summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-28 15:32:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 10:17:46 +0900
commitcb7f2d0dd5da40be7ae0bcaf89ceebe3c0d32b6d (patch)
treeabd8ea0fac0c76cb420dbf7d3d2ce96eb3b5400c /src/lib/eolian_cxx
parent9d14b4cfe8e7c073952067cd2258b9e09fea4f93 (diff)
cxx: Add header guards for manual definitions
This will be used for things like efl_del efl_part was a lucky case where the entire class was to be implemented manually, thus the global header guard was sufficient.
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/function_declaration.hpp13
-rw-r--r--src/lib/eolian_cxx/grammar/function_definition.hpp11
2 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/eolian_cxx/grammar/function_declaration.hpp b/src/lib/eolian_cxx/grammar/function_declaration.hpp
index fe3ad732f1..634642eabc 100644
--- a/src/lib/eolian_cxx/grammar/function_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/function_declaration.hpp
@@ -44,6 +44,11 @@ struct function_declaration_generator
44 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name, suffix), add_upper_case_context(ctx))) 44 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name, suffix), add_upper_case_context(ctx)))
45 return false; 45 return false;
46 46
47 if(!as_generator
48 ("#ifndef EOLIAN_CXX_" << string << "_DECLARATION\n")
49 .generate(sink, f.c_name, add_upper_case_context(ctx)))
50 return false;
51
47 std::string template_statement(f.template_statement()); 52 std::string template_statement(f.template_statement());
48 if (!template_statement.empty() && 53 if (!template_statement.empty() &&
49 !as_generator(template_statement << " ") 54 !as_generator(template_statement << " ")
@@ -58,9 +63,17 @@ struct function_declaration_generator
58 << string << "(" << (parameter % ", ") << ")" << const_flag << ";\n") 63 << string << "(" << (parameter % ", ") << ")" << const_flag << ";\n")
59 .generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), ctx)) 64 .generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), ctx))
60 return false; 65 return false;
66
67 if(!as_generator
68 ("#else\n" << scope_tab << "EOLIAN_CXX_" << string << "_DECLARATION\n"
69 "#endif\n")
70 .generate(sink, f.c_name, add_upper_case_context(ctx)))
71 return false;
72
61 if(f.is_beta && 73 if(f.is_beta &&
62 !as_generator("#endif\n").generate(sink, attributes::unused, ctx)) 74 !as_generator("#endif\n").generate(sink, attributes::unused, ctx))
63 return false; 75 return false;
76
64 return true; 77 return true;
65 } 78 }
66 79
diff --git a/src/lib/eolian_cxx/grammar/function_definition.hpp b/src/lib/eolian_cxx/grammar/function_definition.hpp
index 1ffbed4bb3..46df876b33 100644
--- a/src/lib/eolian_cxx/grammar/function_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/function_definition.hpp
@@ -54,6 +54,11 @@ struct function_definition_generator
54 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx))) 54 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx)))
55 return false; 55 return false;
56 56
57 if(!as_generator
58 ("#ifndef EOLIAN_CXX_" << string << "_IMPLEMENTATION\n")
59 .generate(sink, f.c_name, add_upper_case_context(ctx)))
60 return false;
61
57 std::string template_statement(f.template_statement()); 62 std::string template_statement(f.template_statement());
58 if (!template_statement.empty() && 63 if (!template_statement.empty() &&
59 !as_generator(template_statement << "\n") 64 !as_generator(template_statement << "\n")
@@ -161,6 +166,12 @@ struct function_definition_generator
161 if(!as_generator("}\n").generate(sink, attributes::unused, ctx)) 166 if(!as_generator("}\n").generate(sink, attributes::unused, ctx))
162 return false; 167 return false;
163 168
169 if(!as_generator
170 ("#else\n" << scope_tab << "EOLIAN_CXX_" << string << "_IMPLEMENTATION\n"
171 "#endif\n")
172 .generate(sink, f.c_name, add_upper_case_context(ctx)))
173 return false;
174
164 if(f.is_beta && 175 if(f.is_beta &&
165 !as_generator("#endif\n").generate(sink, attributes::unused, ctx)) 176 !as_generator("#endif\n").generate(sink, attributes::unused, ctx))
166 return false; 177 return false;