summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-04-10 17:19:18 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-04-10 17:19:18 -0300
commit3c2ef0cd8e39594828a1a1448e0336a05921e7b9 (patch)
treeddf0cb1ecdae66dda9cdeeade5c5419961f02d48
parent5351070a4d8d4e114823296bed190f079e865d82 (diff)
efl-cxx: Convert class names to lower-case (WIP)devs/felipealmeida/cxx-lower-case
-rw-r--r--src/lib/eolian_cxx/grammar/address_of.hpp9
-rw-r--r--src/lib/eolian_cxx/grammar/base_class_definition.hpp7
-rw-r--r--src/lib/eolian_cxx/grammar/c_type.hpp1
-rw-r--r--src/lib/eolian_cxx/grammar/class_declaration.hpp10
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp53
-rw-r--r--src/lib/eolian_cxx/grammar/class_implementation.hpp4
-rw-r--r--src/lib/eolian_cxx/grammar/cxx_class_name.hpp37
-rw-r--r--src/lib/eolian_cxx/grammar/function_definition.hpp3
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp3
9 files changed, 85 insertions, 42 deletions
diff --git a/src/lib/eolian_cxx/grammar/address_of.hpp b/src/lib/eolian_cxx/grammar/address_of.hpp
index 6c6b977ca3..cdedf8a3f5 100644
--- a/src/lib/eolian_cxx/grammar/address_of.hpp
+++ b/src/lib/eolian_cxx/grammar/address_of.hpp
@@ -11,6 +11,7 @@
11#include "grammar/parameter.hpp" 11#include "grammar/parameter.hpp"
12#include "grammar/function_declaration.hpp" 12#include "grammar/function_declaration.hpp"
13#include "grammar/case.hpp" 13#include "grammar/case.hpp"
14#include "grammar/cxx_class_name.hpp"
14 15
15namespace efl { namespace eolian { namespace grammar { 16namespace efl { namespace eolian { namespace grammar {
16 17
@@ -23,12 +24,12 @@ struct address_of_generator
23 24
24 if(!as_generator 25 if(!as_generator
25 ( 26 (
26 scope_tab << " ::efl::eolian::address_of_operator<" << string 27 scope_tab << " ::efl::eolian::address_of_operator<" << cxx_class_name
27 ).generate(sink, cls.cxx_name, context)) return false; 28 ).generate(sink, cls.cxx_name, context)) return false;
28 29
29 for(auto&& i : cls.inherits) 30 for(auto&& i : cls.inherits)
30 { 31 {
31 if(!as_generator(", " << *("::" << lower_case[string]) << "::" << string) 32 if(!as_generator(", " << *("::" << lower_case[string]) << "::" << cxx_class_name)
32 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context)) 33 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context))
33 return false; 34 return false;
34 } 35 }
@@ -40,12 +41,12 @@ struct address_of_generator
40 41
41 if(!as_generator 42 if(!as_generator
42 ( 43 (
43 scope_tab << " ::efl::eolian::address_of_operator<" << string << " const " 44 scope_tab << " ::efl::eolian::address_of_operator<" << cxx_class_name << " const "
44 ).generate(sink, cls.cxx_name, context)) return false; 45 ).generate(sink, cls.cxx_name, context)) return false;
45 46
46 for(auto&& i : cls.inherits) 47 for(auto&& i : cls.inherits)
47 { 48 {
48 if(!as_generator(", " << *("::" << lower_case[string]) << "::" << string << " const ") 49 if(!as_generator(", " << *("::" << lower_case[string]) << "::" << cxx_class_name << " const ")
49 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context)) 50 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context))
50 return false; 51 return false;
51 } 52 }
diff --git a/src/lib/eolian_cxx/grammar/base_class_definition.hpp b/src/lib/eolian_cxx/grammar/base_class_definition.hpp
index f8a704d4fd..233cc03a5d 100644
--- a/src/lib/eolian_cxx/grammar/base_class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/base_class_definition.hpp
@@ -15,6 +15,7 @@
15#include "grammar/address_of.hpp" 15#include "grammar/address_of.hpp"
16#include "grammar/attribute_reorder.hpp" 16#include "grammar/attribute_reorder.hpp"
17#include "grammar/part_declaration.hpp" 17#include "grammar/part_declaration.hpp"
18#include "grammar/cxx_class_name.hpp"
18 19
19namespace efl { namespace eolian { namespace grammar { 20namespace efl { namespace eolian { namespace grammar {
20 21
@@ -31,7 +32,7 @@ struct base_class_definition_generator
31 32
32 if(!as_generator 33 if(!as_generator
33 ( 34 (
34 "struct " << string << " {\n" 35 "struct " << cxx_class_name << " {\n"
35 ).generate(sink, cls.cxx_name, context)) return false; 36 ).generate(sink, cls.cxx_name, context)) return false;
36 37
37 if(!as_generator(*(function_declaration(get_klass_name(cls)))) 38 if(!as_generator(*(function_declaration(get_klass_name(cls))))
@@ -70,14 +71,14 @@ struct base_class_definition_generator
70 71
71 if(!as_generator( 72 if(!as_generator(
72 scope_tab << "Eo* _eo_ptr() const { return *(reinterpret_cast<Eo **>" 73 scope_tab << "Eo* _eo_ptr() const { return *(reinterpret_cast<Eo **>"
73 << "(const_cast<" << string << " *>(this))); }\n" 74 << "(const_cast<" << cxx_class_name << " *>(this))); }\n"
74 ).generate(sink, cls.cxx_name, context)) 75 ).generate(sink, cls.cxx_name, context))
75 return false; 76 return false;
76 77
77 // operator ::ns::Class_Name() const; 78 // operator ::ns::Class_Name() const;
78 // operator ::ns::Class_Name&(); 79 // operator ::ns::Class_Name&();
79 // operator ::ns::Class_Name const&() const; 80 // operator ::ns::Class_Name const&() const;
80 auto class_name = *(lit("::") << lower_case[string]) << "::" << string; 81 auto class_name = *(lit("::") << lower_case[string]) << "::" << cxx_class_name;
81 if(!as_generator 82 if(!as_generator
82 ( 83 (
83 attribute_reorder<0, 1, 0, 1, 0, 1, 0, 1> 84 attribute_reorder<0, 1, 0, 1, 0, 1, 0, 1>
diff --git a/src/lib/eolian_cxx/grammar/c_type.hpp b/src/lib/eolian_cxx/grammar/c_type.hpp
index e680b38835..8ff3779f18 100644
--- a/src/lib/eolian_cxx/grammar/c_type.hpp
+++ b/src/lib/eolian_cxx/grammar/c_type.hpp
@@ -4,6 +4,7 @@
4#include "grammar/generator.hpp" 4#include "grammar/generator.hpp"
5#include "grammar/klass_def.hpp" 5#include "grammar/klass_def.hpp"
6#include "grammar/string.hpp" 6#include "grammar/string.hpp"
7#include "grammar/cxx_class_name.hpp"
7 8
8namespace efl { namespace eolian { namespace grammar { namespace attributes { 9namespace efl { namespace eolian { namespace grammar { namespace attributes {
9 10
diff --git a/src/lib/eolian_cxx/grammar/class_declaration.hpp b/src/lib/eolian_cxx/grammar/class_declaration.hpp
index de9c4a69d6..172c07b787 100644
--- a/src/lib/eolian_cxx/grammar/class_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/class_declaration.hpp
@@ -39,7 +39,7 @@ struct class_declaration_generator
39 39
40 if(!as_generator 40 if(!as_generator
41 ( 41 (
42 "struct " << string << ";\n" 42 "struct " << cxx_class_name << ";\n"
43 ).generate(sink, cls.cxx_name, context)) return false; 43 ).generate(sink, cls.cxx_name, context)) return false;
44 44
45 auto close_namespace = *(lit("} ")) << "\n"; 45 auto close_namespace = *(lit("} ")) << "\n";
@@ -49,13 +49,13 @@ struct class_declaration_generator
49 if(!as_generator 49 if(!as_generator
50 ( 50 (
51 "namespace efl { namespace eo { template<> struct is_eolian_object< " 51 "namespace efl { namespace eo { template<> struct is_eolian_object< "
52 "::" << *(lower_case[string] << "::") << string << "> : ::std::true_type {}; } }\n" 52 "::" << *(lower_case[string] << "::") << cxx_class_name << "> : ::std::true_type {}; } }\n"
53 "namespace efl { namespace eo { template<> struct is_eolian_object< " 53 "namespace efl { namespace eo { template<> struct is_eolian_object< "
54 "::" << *(lower_case[string] << "::") << string << "&> : ::std::true_type {}; } }\n" 54 "::" << *(lower_case[string] << "::") << cxx_class_name << "&> : ::std::true_type {}; } }\n"
55 "namespace efl { namespace eo { template<> struct is_eolian_object< " 55 "namespace efl { namespace eo { template<> struct is_eolian_object< "
56 "::" << *(lower_case[string] << "::") << string << " const> : ::std::true_type {}; } }\n" 56 "::" << *(lower_case[string] << "::") << cxx_class_name << " const> : ::std::true_type {}; } }\n"
57 "namespace efl { namespace eo { template<> struct is_eolian_object< " 57 "namespace efl { namespace eo { template<> struct is_eolian_object< "
58 "::" << *(lower_case[string] << "::") << string << " const&> : ::std::true_type {}; } }\n" 58 "::" << *(lower_case[string] << "::") << cxx_class_name << " const&> : ::std::true_type {}; } }\n"
59 ).generate(sink, std::make_tuple 59 ).generate(sink, std::make_tuple
60 ( 60 (
61 cpp_namespaces, cls.cxx_name, cpp_namespaces, cls.cxx_name 61 cpp_namespaces, cls.cxx_name, cpp_namespaces, cls.cxx_name
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index 89455eda16..75ea06e8cb 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -16,6 +16,7 @@
16#include "grammar/attribute_conditional.hpp" 16#include "grammar/attribute_conditional.hpp"
17#include "grammar/attribute_replace.hpp" 17#include "grammar/attribute_replace.hpp"
18#include "grammar/part_declaration.hpp" 18#include "grammar/part_declaration.hpp"
19#include "grammar/cxx_class_name.hpp"
19 20
20namespace efl { namespace eolian { namespace grammar { 21namespace efl { namespace eolian { namespace grammar {
21 22
@@ -29,20 +30,20 @@ struct class_definition_generator
29 if(!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context))) return false; 30 if(!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context))) return false;
30 31
31#ifdef USE_EOCXX_INHERIT_ONLY 32#ifdef USE_EOCXX_INHERIT_ONLY
32 if(!as_generator("struct " << string << " : private ::efl::eo::concrete\n" 33 if(!as_generator("struct " << cxx_class_name << " : private ::efl::eo::concrete\n"
33 << scope_tab << ", ::eo_cxx" 34 << scope_tab << ", ::eo_cxx"
34 << *("::" << lower_case[string]) << "::" << string) 35 << *("::" << lower_case[string]) << "::" << cxx_class_name)
35 .generate(sink, std::make_tuple(cls.cxx_name, attributes::cpp_namespaces(cls.namespaces), cls.cxx_name), context)) 36 .generate(sink, std::make_tuple(cls.cxx_name, attributes::cpp_namespaces(cls.namespaces), cls.cxx_name), context))
36 return false; 37 return false;
37#else 38#else
38 if(!as_generator("struct " << string << " : private ::efl::eo::concrete") 39 if(!as_generator("struct " << cxx_class_name << " : private ::efl::eo::concrete")
39 .generate(sink, cls.cxx_name, context)) 40 .generate(sink, cls.cxx_name, context))
40 return false; 41 return false;
41#endif 42#endif
42 43
43 for(auto&& i : cls.inherits) 44 for(auto&& i : cls.inherits)
44 { 45 {
45 if(!as_generator("\n" << scope_tab << ", EO_CXX_INHERIT(" << *("::" << lower_case[string]) << "::" << string << ")") 46 if(!as_generator("\n" << scope_tab << ", EO_CXX_INHERIT(" << *("::" << lower_case[string]) << "::" << cxx_class_name << ")")
46 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context)) 47 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context))
47 return false; 48 return false;
48 } 49 }
@@ -50,39 +51,39 @@ struct class_definition_generator
50 51
51 // constructors 52 // constructors
52 if(!as_generator( 53 if(!as_generator(
53 scope_tab << "explicit " << string << "( ::Eo* eo)\n" 54 scope_tab << "explicit " << cxx_class_name << "( ::Eo* eo)\n"
54 << scope_tab << scope_tab << ": ::efl::eo::concrete(eo) {}\n" 55 << scope_tab << scope_tab << ": ::efl::eo::concrete(eo) {}\n"
55 << scope_tab << string << "(std::nullptr_t)\n" 56 << scope_tab << cxx_class_name << "(std::nullptr_t)\n"
56 << scope_tab << scope_tab << ": ::efl::eo::concrete(nullptr) {}\n" 57 << scope_tab << scope_tab << ": ::efl::eo::concrete(nullptr) {}\n"
57 << scope_tab << "explicit " << string << "() = default;\n" 58 << scope_tab << "explicit " << cxx_class_name << "() = default;\n"
58 << scope_tab << string << "(" << string << " const&) = default;\n" 59 << scope_tab << cxx_class_name << "(" << cxx_class_name << " const&) = default;\n"
59 << scope_tab << string << "(" << string << "&&) = default;\n" 60 << scope_tab << cxx_class_name << "(" << cxx_class_name << "&&) = default;\n"
60 << scope_tab << string << "& operator=(" << string << " const&) = default;\n" 61 << scope_tab << cxx_class_name << "& operator=(" << cxx_class_name << " const&) = default;\n"
61 << scope_tab << string << "& operator=(" << string << "&&) = default;\n" 62 << scope_tab << cxx_class_name << "& operator=(" << cxx_class_name << "&&) = default;\n"
62 << scope_tab << "template <typename Derived>\n" 63 << scope_tab << "template <typename Derived>\n"
63 << scope_tab << string << "(Derived&& derived\n" 64 << scope_tab << cxx_class_name << "(Derived&& derived\n"
64 << scope_tab << scope_tab << ", typename std::enable_if<\n" 65 << scope_tab << scope_tab << ", typename std::enable_if<\n"
65 << scope_tab << scope_tab << scope_tab << "::efl::eo::is_eolian_object<Derived>::value\n" 66 << scope_tab << scope_tab << scope_tab << "::efl::eo::is_eolian_object<Derived>::value\n"
66 << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << string << ", Derived>::value>::type* = 0)\n" 67 << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << cxx_class_name << ", Derived>::value>::type* = 0)\n"
67 << scope_tab << scope_tab << scope_tab << ": ::efl::eo::concrete(derived._eo_ptr()) {}\n\n" 68 << scope_tab << scope_tab << scope_tab << ": ::efl::eo::concrete(derived._eo_ptr()) {}\n\n"
68 ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) 69 ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context))
69 return false; 70 return false;
70 71
71 if((cls.type == attributes::class_type::regular) && !as_generator( 72 if((cls.type == attributes::class_type::regular) && !as_generator(
72 scope_tab << string << "( ::efl::eo::instantiate_t)\n" 73 scope_tab << cxx_class_name << "( ::efl::eo::instantiate_t)\n"
73 << scope_tab << "{\n" 74 << scope_tab << "{\n"
74 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class());\n" 75 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class());\n"
75 << scope_tab << "}\n" 76 << scope_tab << "}\n"
76 << scope_tab << "template <typename T>\n" 77 << scope_tab << "template <typename T>\n"
77 << scope_tab << "explicit " << string << "( ::efl::eo::instantiate_t, T&& parent, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value>::type* = 0)\n" 78 << scope_tab << "explicit " << cxx_class_name << "( ::efl::eo::instantiate_t, T&& parent, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value>::type* = 0)\n"
78 << scope_tab << "{\n" 79 << scope_tab << "{\n"
79 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class());\n" 80 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class());\n"
80 << scope_tab << "}\n" 81 << scope_tab << "}\n"
81 << scope_tab << "template <typename F> " << string << "( ::efl::eo::instantiate_t, F&& f, typename ::std::enable_if< ::efl::eolian::is_constructor_lambda<F, " << string << " >::value>::type* = 0)\n" 82 << scope_tab << "template <typename F> " << cxx_class_name << "( ::efl::eo::instantiate_t, F&& f, typename ::std::enable_if< ::efl::eolian::is_constructor_lambda<F, " << cxx_class_name << " >::value>::type* = 0)\n"
82 << scope_tab << "{\n" 83 << scope_tab << "{\n"
83 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class(), *this, std::forward<F>(f));\n" 84 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class(), *this, std::forward<F>(f));\n"
84 << scope_tab << "}\n" 85 << scope_tab << "}\n"
85 << scope_tab << "template <typename T, typename F> " << string << "( ::efl::eo::instantiate_t, T&& parent, F&& f, typename ::std::enable_if< ::efl::eolian::is_constructor_lambda<F, " << string << " >::value && ::efl::eo::is_eolian_object<T>::value>::type* = 0)\n" 86 << scope_tab << "template <typename T, typename F> " << cxx_class_name << "( ::efl::eo::instantiate_t, T&& parent, F&& f, typename ::std::enable_if< ::efl::eolian::is_constructor_lambda<F, " << cxx_class_name << " >::value && ::efl::eo::is_eolian_object<T>::value>::type* = 0)\n"
86 << scope_tab << "{\n" 87 << scope_tab << "{\n"
87 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class(), *this, std::forward<F>(f));\n" 88 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class(), *this, std::forward<F>(f));\n"
88 << scope_tab << "}\n\n" 89 << scope_tab << "}\n\n"
@@ -131,7 +132,7 @@ struct class_definition_generator
131 132
132 if(!as_generator( 133 if(!as_generator(
133 scope_tab << "Eo* _eo_ptr() const { return *(reinterpret_cast<Eo **>" 134 scope_tab << "Eo* _eo_ptr() const { return *(reinterpret_cast<Eo **>"
134 << "(const_cast<" << string << " *>(this))); }\n" 135 << "(const_cast<" << cxx_class_name << " *>(this))); }\n"
135 ).generate(sink, cls.cxx_name, context)) 136 ).generate(sink, cls.cxx_name, context))
136 return false; 137 return false;
137 138
@@ -216,8 +217,8 @@ struct class_definition_generator
216 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false; 217 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
217 } 218 }
218 219
219 if(!as_generator( scope_tab << "::efl::eo::wref<" << string << "> _get_wref() const { " 220 if(!as_generator( scope_tab << "::efl::eo::wref<" << cxx_class_name << "> _get_wref() const { "
220 "return ::efl::eo::wref<" << string << ">(*this); }\n" 221 "return ::efl::eo::wref<" << cxx_class_name << ">(*this); }\n"
221 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 222 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
222 223
223 // eo_concrete 224 // eo_concrete
@@ -235,25 +236,25 @@ struct class_definition_generator
235 // EXPERIMENTAL: wref and implicit conversion to Eo* 236 // EXPERIMENTAL: wref and implicit conversion to Eo*
236 if(!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context)) return false; 237 if(!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context)) return false;
237 // For easy wref, operator-> in wref needs to also return a pointer type 238 // For easy wref, operator-> in wref needs to also return a pointer type
238 if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n" 239 if(!as_generator( scope_tab << "const " << cxx_class_name << "* operator->() const { return this; }\n"
239 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 240 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
240 if(!as_generator( scope_tab << string << "* operator->() { return this; }\n" 241 if(!as_generator( scope_tab << cxx_class_name << "* operator->() { return this; }\n"
241 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 242 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
242 // For easy interfacing with C: no need to use _eo_ptr() 243 // For easy interfacing with C: no need to use _eo_ptr()
243 if(!as_generator( scope_tab << "operator Eo*() const { return _eo_ptr(); }\n" 244 if(!as_generator( scope_tab << "operator Eo*() const { return _eo_ptr(); }\n"
244 ).generate(sink, attributes::unused, context)) return false; 245 ).generate(sink, attributes::unused, context)) return false;
245 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false; 246 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
246 247
247 if(!as_generator( scope_tab << "friend bool operator==(" << string << " const& lhs, " << string << " const& rhs)\n" 248 if(!as_generator( scope_tab << "friend bool operator==(" << cxx_class_name << " const& lhs, " << cxx_class_name << " const& rhs)\n"
248 << scope_tab << "{ return lhs._get_concrete() == rhs._get_concrete(); }\n" 249 << scope_tab << "{ return lhs._get_concrete() == rhs._get_concrete(); }\n"
249 << scope_tab << "friend bool operator!=(" << string << " const& lhs, " << string << " const& rhs)\n" 250 << scope_tab << "friend bool operator!=(" << cxx_class_name << " const& lhs, " << cxx_class_name << " const& rhs)\n"
250 << scope_tab << "{ return !(lhs == rhs); }\n" 251 << scope_tab << "{ return !(lhs == rhs); }\n"
251 << "};\n").generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) return false; 252 << "};\n").generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) return false;
252 253
253 // static asserts 254 // static asserts
254 if(!as_generator("static_assert(sizeof(" << string << ") == sizeof(Eo*), \"\");\n") 255 if(!as_generator("static_assert(sizeof(" << cxx_class_name << ") == sizeof(Eo*), \"\");\n")
255 .generate(sink, cls.cxx_name, context)) return false; 256 .generate(sink, cls.cxx_name, context)) return false;
256 if(!as_generator("static_assert(std::is_standard_layout<" << string << ">::value, \"\");\n") 257 if(!as_generator("static_assert(std::is_standard_layout<" << cxx_class_name << ">::value, \"\");\n")
257 .generate(sink, cls.cxx_name, context)) return false; 258 .generate(sink, cls.cxx_name, context)) return false;
258 259
259 auto close_namespace = *(lit("} ")) << "\n"; 260 auto close_namespace = *(lit("} ")) << "\n";
diff --git a/src/lib/eolian_cxx/grammar/class_implementation.hpp b/src/lib/eolian_cxx/grammar/class_implementation.hpp
index 615ee6022e..f5f2f31ffb 100644
--- a/src/lib/eolian_cxx/grammar/class_implementation.hpp
+++ b/src/lib/eolian_cxx/grammar/class_implementation.hpp
@@ -24,8 +24,8 @@ struct class_implementation_generator
24 bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& ctx) const 24 bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& ctx) const
25 { 25 {
26 std::vector<std::string> cpp_namespaces = attributes::cpp_namespaces(cls.namespaces); 26 std::vector<std::string> cpp_namespaces = attributes::cpp_namespaces(cls.namespaces);
27 auto base_class_name = *(lower_case[string] << "::") << string; 27 auto base_class_name = *(lower_case[string] << "::") << lower_case[string];
28 auto class_name = *(lit("::") << lower_case[string]) << "::" << string; 28 auto class_name = *(lit("::") << lower_case[string]) << "::" << lower_case[string];
29 std::string guard_symbol; 29 std::string guard_symbol;
30 30
31 if(!as_generator(*(string << "_") << string << "_IMPL_HH") 31 if(!as_generator(*(string << "_") << string << "_IMPL_HH")
diff --git a/src/lib/eolian_cxx/grammar/cxx_class_name.hpp b/src/lib/eolian_cxx/grammar/cxx_class_name.hpp
new file mode 100644
index 0000000000..ab7a81281c
--- /dev/null
+++ b/src/lib/eolian_cxx/grammar/cxx_class_name.hpp
@@ -0,0 +1,37 @@
1#ifndef EOLIAN_CXX_CLASS_NAME_HH
2#define EOLIAN_CXX_CLASS_NAME_HH
3
4#include "grammar/case.hpp"
5#include "grammar/string.hpp"
6
7namespace efl { namespace eolian { namespace grammar {
8
9struct cxx_class_name_generator
10{
11 template <typename OutputIterator, typename Context>
12 bool generate(OutputIterator sink, std::string name, Context const& context) const
13 {
14 if(name == "Class")
15 {
16 name = "efl_class";
17 }
18
19 return as_generator(lower_case[string]).generate(sink, name, context);
20 }
21};
22
23cxx_class_name_generator const cxx_class_name{};
24
25template <>
26struct is_eager_generator<cxx_class_name_generator> : std::true_type {};
27template <>
28struct is_generator<cxx_class_name_generator> : std::true_type {};
29
30namespace type_traits {
31template <>
32struct attributes_needed<cxx_class_name_generator> : std::integral_constant<int, 1> {};
33}
34
35} } }
36
37#endif
diff --git a/src/lib/eolian_cxx/grammar/function_definition.hpp b/src/lib/eolian_cxx/grammar/function_definition.hpp
index 9b646efc9c..14413d1631 100644
--- a/src/lib/eolian_cxx/grammar/function_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/function_definition.hpp
@@ -18,6 +18,7 @@
18#include "grammar/attribute_reorder.hpp" 18#include "grammar/attribute_reorder.hpp"
19#include "grammar/type_impl.hpp" 19#include "grammar/type_impl.hpp"
20#include "grammar/eps.hpp" 20#include "grammar/eps.hpp"
21#include "grammar/cxx_class_name.hpp"
21 22
22namespace efl { namespace eolian { namespace grammar { 23namespace efl { namespace eolian { namespace grammar {
23 24
@@ -71,7 +72,7 @@ struct function_definition_generator
71 if (!f.is_static) const_flag = " const"; 72 if (!f.is_static) const_flag = " const";
72 73
73 if(!as_generator 74 if(!as_generator
74 ("inline ::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "::" 75 ("inline ::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << cxx_class_name << "::"
75 << string << "(" << (parameter % ", ") << ")" << string << "\n{\n") 76 << string << "(" << (parameter % ", ") << ")" << string << "\n{\n")
76 .generate(sink, std::make_tuple(f.return_type, _klass_name.eolian_name, 77 .generate(sink, std::make_tuple(f.return_type, _klass_name.eolian_name,
77 escape_keyword(f.name), f.parameters, const_flag), ctx)) 78 escape_keyword(f.name), f.parameters, const_flag), ctx))
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index ebe738abed..f9a158fc4c 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -6,6 +6,7 @@
6#include "grammar/case.hpp" 6#include "grammar/case.hpp"
7#include "grammar/container.hpp" 7#include "grammar/container.hpp"
8#include "grammar/type.hpp" 8#include "grammar/type.hpp"
9#include "grammar/cxx_class_name.hpp"
9 10
10namespace efl { namespace eolian { namespace grammar { 11namespace efl { namespace eolian { namespace grammar {
11 12
@@ -263,7 +264,7 @@ struct visitor_generate
263 bool operator()(attributes::klass_name klass) const 264 bool operator()(attributes::klass_name klass) const
264 { 265 {
265 return 266 return
266 as_generator(" " << *("::" << lower_case[string]) << "::" << string) 267 as_generator(" " << *("::" << lower_case[string]) << "::" << cxx_class_name)
267 .generate(sink, std::make_tuple(attributes::cpp_namespaces(klass.namespaces), klass.eolian_name), *context) 268 .generate(sink, std::make_tuple(attributes::cpp_namespaces(klass.namespaces), klass.eolian_name), *context)
268 && (!(klass.base_qualifier & qualifier_info::is_ref) 269 && (!(klass.base_qualifier & qualifier_info::is_ref)
269 || as_generator("&").generate(sink, attributes::unused, *context)); 270 || as_generator("&").generate(sink, attributes::unused, *context));