summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-22 20:16:21 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 10:14:03 +0900
commita787c3cc07b8ddcc3288091a9d1b9e0eb06582bc (patch)
tree9f4ccf771a601d1c8bdb6cbb33287e3ac89f7bb1 /src/lib/eolian_cxx
parent12d50cbe1938a096e8c06674d7b8ee8c33d5c335 (diff)
cxx: Only use eo_cxx:: for methods
Add an experimental (disabled) macro to only generate functions inside the eo_cxx equivalent of a class, instead of inside both the eo_cxx and the normal class definition. I guess the duplicated definition had something to do with doxygen, but I'm not sure this is quite necessary as doc will be generated with custom scripts.
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp18
-rw-r--r--src/lib/eolian_cxx/grammar/class_implementation.hpp2
-rw-r--r--src/lib/eolian_cxx/grammar/generator.hpp3
3 files changed, 18 insertions, 5 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index a60e18dedf..e326c9d0e3 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -27,15 +27,21 @@ struct class_definition_generator
27 auto open_namespace = *("namespace " << string << " { ") << "\n"; 27 auto open_namespace = *("namespace " << string << " { ") << "\n";
28 if(!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context))) return false; 28 if(!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context))) return false;
29 29
30 if(!as_generator 30#ifdef USE_EOCXX_INHERIT_ONLY
31 ( 31 if(!as_generator("struct " << string << " : private ::efl::eo::concrete\n"
32 "struct " << string << " : private ::efl::eo::concrete" 32 << scope_tab << ", ::eo_cxx"
33 ) 33 << *("::" << lower_case[string]) << "::" << string)
34 .generate(sink, std::make_tuple(cls.cxx_name, attributes::cpp_namespaces(cls.namespaces), cls.cxx_name), context))
35 return false;
36#else
37 if(!as_generator("struct " << string << " : private ::efl::eo::concrete")
34 .generate(sink, cls.cxx_name, context)) 38 .generate(sink, cls.cxx_name, context))
35 return false; 39 return false;
40#endif
41
36 for(auto&& i : cls.inherits) 42 for(auto&& i : cls.inherits)
37 { 43 {
38 if(!as_generator("\n" << scope_tab << ", EO_CXX_INHERIT(" << *(" ::" << lower_case[string]) << "::" << string << ")") 44 if(!as_generator("\n" << scope_tab << ", EO_CXX_INHERIT(" << *("::" << lower_case[string]) << "::" << string << ")")
39 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context)) 45 .generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context))
40 return false; 46 return false;
41 } 47 }
@@ -89,8 +95,10 @@ struct class_definition_generator
89 // << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add( ::efl::eo::concrete{nullptr}, f)) {}\n" 95 // << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add( ::efl::eo::concrete{nullptr}, f)) {}\n"
90 ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) return false; 96 ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) return false;
91 97
98#ifndef USE_EOCXX_INHERIT_ONLY
92 if(!as_generator(*(scope_tab << function_declaration(get_klass_name(cls)))) 99 if(!as_generator(*(scope_tab << function_declaration(get_klass_name(cls))))
93 .generate(sink, cls.functions, context)) return false; 100 .generate(sink, cls.functions, context)) return false;
101#endif
94 102
95 // static Efl_Class const* _eo_class(); 103 // static Efl_Class const* _eo_class();
96 std::string suffix; 104 std::string suffix;
diff --git a/src/lib/eolian_cxx/grammar/class_implementation.hpp b/src/lib/eolian_cxx/grammar/class_implementation.hpp
index 0731e3d591..b2578b5bf2 100644
--- a/src/lib/eolian_cxx/grammar/class_implementation.hpp
+++ b/src/lib/eolian_cxx/grammar/class_implementation.hpp
@@ -27,12 +27,14 @@ struct class_implementation_generator
27 auto class_name = *(lit("::") << lower_case[string]) << "::" << string; 27 auto class_name = *(lit("::") << lower_case[string]) << "::" << string;
28 return as_generator 28 return as_generator
29 ( 29 (
30#ifndef USE_EOCXX_INHERIT_ONLY
30 (namespaces 31 (namespaces
31 [*function_definition(get_klass_name(cls))] 32 [*function_definition(get_klass_name(cls))]
32 << "\n" 33 << "\n"
33 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx) 34 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx)
34 && as_generator 35 && as_generator
35 ( 36 (
37#endif
36 attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3> 38 attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3>
37 ( 39 (
38 "namespace eo_cxx {\n" 40 "namespace eo_cxx {\n"
diff --git a/src/lib/eolian_cxx/grammar/generator.hpp b/src/lib/eolian_cxx/grammar/generator.hpp
index 130ee6859c..10e96c7c13 100644
--- a/src/lib/eolian_cxx/grammar/generator.hpp
+++ b/src/lib/eolian_cxx/grammar/generator.hpp
@@ -3,6 +3,9 @@
3 3
4#include <type_traits> 4#include <type_traits>
5 5
6// EXPERIMENTAL
7//#define USE_EOCXX_INHERIT_ONLY
8
6namespace efl { namespace eolian { namespace grammar { 9namespace efl { namespace eolian { namespace grammar {
7 10
8template <typename T, typename Enable = void> 11template <typename T, typename Enable = void>