summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/class_implementation.hpp
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-27 19:52:44 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 10:15:40 +0900
commit5901b4601e3a240f6286ab9396d1ea2967ca61bc (patch)
treedcb679ad428348da47fd2c08cab26e292419e197 /src/lib/eolian_cxx/grammar/class_implementation.hpp
parentf47bb54f4f0960b34050be4342f692f33feedf35 (diff)
cxx: Implement support for parts
This generates methods like this: Part_Class part_name() const; Which can then be used like: slider.indicator().format_string_set("%1.1f");
Diffstat (limited to 'src/lib/eolian_cxx/grammar/class_implementation.hpp')
-rw-r--r--src/lib/eolian_cxx/grammar/class_implementation.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_implementation.hpp b/src/lib/eolian_cxx/grammar/class_implementation.hpp
index 373f04efef..60eb075073 100644
--- a/src/lib/eolian_cxx/grammar/class_implementation.hpp
+++ b/src/lib/eolian_cxx/grammar/class_implementation.hpp
@@ -14,6 +14,7 @@
14#include "grammar/namespace.hpp" 14#include "grammar/namespace.hpp"
15#include "grammar/type_impl.hpp" 15#include "grammar/type_impl.hpp"
16#include "grammar/attribute_reorder.hpp" 16#include "grammar/attribute_reorder.hpp"
17#include "grammar/part_implementation.hpp"
17 18
18namespace efl { namespace eolian { namespace grammar { 19namespace efl { namespace eolian { namespace grammar {
19 20
@@ -40,19 +41,21 @@ struct class_implementation_generator
40#ifndef USE_EOCXX_INHERIT_ONLY 41#ifndef USE_EOCXX_INHERIT_ONLY
41 if(!as_generator( 42 if(!as_generator(
42 (namespaces 43 (namespaces
43 [*function_definition(get_klass_name(cls))] 44 [*function_definition(get_klass_name(cls))
45 << *part_implementation(cls.cxx_name)]
44 << "\n" 46 << "\n"
45 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx)) 47 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions, cls.parts), ctx))
46 return false; 48 return false;
47#endif 49#endif
48 50
49 if(!as_generator( 51 if(!as_generator(
50 attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3> 52 attribute_reorder<0, 1, 4, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3>
51 ( 53 (
52 "namespace eo_cxx {\n" 54 "namespace eo_cxx {\n"
53 << namespaces 55 << namespaces
54 [ 56 [
55 *function_definition(get_klass_name(cls)) 57 *function_definition(get_klass_name(cls))
58 << *part_implementation(cls.cxx_name)
56 << "inline " << base_class_name << "::operator " << class_name << "() const { return *static_cast< " 59 << "inline " << base_class_name << "::operator " << class_name << "() const { return *static_cast< "
57 << class_name << " const*>(static_cast<void const*>(this)); }\n" 60 << class_name << " const*>(static_cast<void const*>(this)); }\n"
58 << "inline " << base_class_name << "::operator " << class_name << "&() { return *static_cast< " 61 << "inline " << base_class_name << "::operator " << class_name << "&() { return *static_cast< "
@@ -61,7 +64,7 @@ struct class_implementation_generator
61 << class_name << " const*>(static_cast<void const*>(this)); }\n" 64 << class_name << " const*>(static_cast<void const*>(this)); }\n"
62 ] 65 ]
63 << "}\n" 66 << "}\n"
64 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions, cpp_namespaces, cls.cxx_name), ctx)) 67 )).generate(sink, std::make_tuple(cls.namespaces, cls.functions, cpp_namespaces, cls.cxx_name, cls.parts), ctx))
65 return false; 68 return false;
66 69
67 if(!as_generator("#endif\n").generate(sink, std::make_tuple(), ctx)) 70 if(!as_generator("#endif\n").generate(sink, std::make_tuple(), ctx))