summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/class_implementation.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eolian_cxx/grammar/class_implementation.hpp')
-rw-r--r--src/lib/eolian_cxx/grammar/class_implementation.hpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_implementation.hpp b/src/lib/eolian_cxx/grammar/class_implementation.hpp
index b2578b5bf2..373f04efef 100644
--- a/src/lib/eolian_cxx/grammar/class_implementation.hpp
+++ b/src/lib/eolian_cxx/grammar/class_implementation.hpp
@@ -25,16 +25,28 @@ struct class_implementation_generator
25 std::vector<std::string> cpp_namespaces = attributes::cpp_namespaces(cls.namespaces); 25 std::vector<std::string> cpp_namespaces = attributes::cpp_namespaces(cls.namespaces);
26 auto base_class_name = *(lower_case[string] << "::") << string; 26 auto base_class_name = *(lower_case[string] << "::") << string;
27 auto class_name = *(lit("::") << lower_case[string]) << "::" << string; 27 auto class_name = *(lit("::") << lower_case[string]) << "::" << string;
28 return as_generator 28 std::string guard_symbol;
29 ( 29
30 if(!as_generator(*(string << "_") << string << "_IMPL_HH")
31 .generate(std::back_inserter(guard_symbol)
32 , std::make_tuple(cpp_namespaces, cls.cxx_name), add_upper_case_context(ctx)))
33 return false;
34
35 if(!as_generator( "#ifndef " << guard_symbol << "\n"
36 << "#define " << guard_symbol << "\n")
37 .generate(sink, std::make_tuple(), ctx))
38 return false;
39
30#ifndef USE_EOCXX_INHERIT_ONLY 40#ifndef USE_EOCXX_INHERIT_ONLY
41 if(!as_generator(
31 (namespaces 42 (namespaces
32 [*function_definition(get_klass_name(cls))] 43 [*function_definition(get_klass_name(cls))]
33 << "\n" 44 << "\n"
34 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx) 45 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx))
35 && as_generator 46 return false;
36 (
37#endif 47#endif
48
49 if(!as_generator(
38 attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3> 50 attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3>
39 ( 51 (
40 "namespace eo_cxx {\n" 52 "namespace eo_cxx {\n"
@@ -48,8 +60,14 @@ struct class_implementation_generator
48 << "inline " << base_class_name << "::operator " << class_name << " const&() const { return *static_cast< " 60 << "inline " << base_class_name << "::operator " << class_name << " const&() const { return *static_cast< "
49 << class_name << " const*>(static_cast<void const*>(this)); }\n" 61 << class_name << " const*>(static_cast<void const*>(this)); }\n"
50 ] 62 ]
51 << "}\n\n" 63 << "}\n"
52 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions, cpp_namespaces, cls.cxx_name), ctx); 64 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions, cpp_namespaces, cls.cxx_name), ctx))
65 return false;
66
67 if(!as_generator("#endif\n").generate(sink, std::make_tuple(), ctx))
68 return false;
69
70 return true;
53 } 71 }
54}; 72};
55 73