aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eolian_cxx/grammar/function_definition.hpp
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/grammar/function_definition.hpp
parentcxx: Give ref to returned objects (diff)
downloadefl-cb7f2d0dd5da40be7ae0bcaf89ceebe3c0d32b6d.tar.gz
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/grammar/function_definition.hpp')
-rw-r--r--src/lib/eolian_cxx/grammar/function_definition.hpp11
1 files changed, 11 insertions, 0 deletions
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
.generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx)))
return false;
+ if(!as_generator
+ ("#ifndef EOLIAN_CXX_" << string << "_IMPLEMENTATION\n")
+ .generate(sink, f.c_name, add_upper_case_context(ctx)))
+ return false;
+
std::string template_statement(f.template_statement());
if (!template_statement.empty() &&
!as_generator(template_statement << "\n")
@@ -161,6 +166,12 @@ struct function_definition_generator
if(!as_generator("}\n").generate(sink, attributes::unused, ctx))
return false;
+ if(!as_generator
+ ("#else\n" << scope_tab << "EOLIAN_CXX_" << string << "_IMPLEMENTATION\n"
+ "#endif\n")
+ .generate(sink, f.c_name, add_upper_case_context(ctx)))
+ return false;
+
if(f.is_beta &&
!as_generator("#endif\n").generate(sink, attributes::unused, ctx))
return false;