summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-28 16:21:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 15:01:45 +0900
commit09cf28274166bdf8cccc945cbc3b4083af1f9c6c (patch)
tree4ef83774aefac8be324ed07da188f9dc87c768ca /src
parent5d6a5343b7949daf2bdb5c24af8f7dac66519386 (diff)
cxx: Use per-function guards in efl object
This prevents generation of del(). I also removed constructor, finalize and destructor as I believe this requires special work with eo_inherit (where did this work go??).
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Cxx.am3
-rw-r--r--src/bindings/cxx/eo_cxx/Eo.hh5
-rw-r--r--src/bindings/cxx/eo_cxx/efl_object_impl.hh23
-rw-r--r--src/lib/efl/Efl.hh11
-rw-r--r--src/lib/efl/cxx/efl_part_impl.hh33
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp3
-rw-r--r--src/lib/eolian_cxx/grammar/function_declaration.hpp11
7 files changed, 54 insertions, 35 deletions
diff --git a/src/Makefile_Cxx.am b/src/Makefile_Cxx.am
index 74ac8f7183..bc9f3749f7 100644
--- a/src/Makefile_Cxx.am
+++ b/src/Makefile_Cxx.am
@@ -16,7 +16,8 @@ bindings/cxx/eo_cxx/eo_wref.hh \
16bindings/cxx/eo_cxx/eo_future.hh \ 16bindings/cxx/eo_cxx/eo_future.hh \
17bindings/cxx/eo_cxx/eo_promise.hh \ 17bindings/cxx/eo_cxx/eo_promise.hh \
18bindings/cxx/eo_cxx/eo_promise_meta.hh \ 18bindings/cxx/eo_cxx/eo_promise_meta.hh \
19bindings/cxx/eo_cxx/eo_private.hh 19bindings/cxx/eo_cxx/eo_private.hh \
20bindings/cxx/eo_cxx/efl_object_impl.hh
20 21
21### Elementary C++ 22### Elementary C++
22installed_elementarycxxmainheadersdir = $(includedir)/elementary-cxx-@VMAJ@/ 23installed_elementarycxxmainheadersdir = $(includedir)/elementary-cxx-@VMAJ@/
diff --git a/src/bindings/cxx/eo_cxx/Eo.hh b/src/bindings/cxx/eo_cxx/Eo.hh
index 771ee12da9..bd60f69701 100644
--- a/src/bindings/cxx/eo_cxx/Eo.hh
+++ b/src/bindings/cxx/eo_cxx/Eo.hh
@@ -1,6 +1,8 @@
1#ifndef EFL_CXX_EO_HH 1#ifndef EFL_CXX_EO_HH
2#define EFL_CXX_EO_HH 2#define EFL_CXX_EO_HH
3 3
4#include "efl_object_impl.hh"
5
4#include <eo_concrete.hh> 6#include <eo_concrete.hh>
5#include <eo_init.hh> 7#include <eo_init.hh>
6#include <eo_wref.hh> 8#include <eo_wref.hh>
@@ -10,4 +12,7 @@
10#include <eo_cxx_interop.hh> 12#include <eo_cxx_interop.hh>
11#include <eo_event.hh> 13#include <eo_event.hh>
12 14
15#include "efl_object.eo.hh"
16#include "efl_object.eo.impl.hh"
17
13#endif // EFL_CXX_EO_HH 18#endif // EFL_CXX_EO_HH
diff --git a/src/bindings/cxx/eo_cxx/efl_object_impl.hh b/src/bindings/cxx/eo_cxx/efl_object_impl.hh
new file mode 100644
index 0000000000..ce61ed6200
--- /dev/null
+++ b/src/bindings/cxx/eo_cxx/efl_object_impl.hh
@@ -0,0 +1,23 @@
1#ifndef EFL_OBJECT_MANUAL_IMPL_HH
2#define EFL_OBJECT_MANUAL_IMPL_HH
3
4#define EFL_OBJECT_BETA
5#define EFL_OBJECT_PROTECTED
6
7// Skip del. Must be implemented in eo::concrete.
8#define EOLIAN_CXX_EFL_DEL_DECLARATION
9#define EOLIAN_CXX_EFL_DEL_IMPLEMENTATION
10
11// Skip constructor, destructor and finalize.
12#define EOLIAN_CXX_EFL_CONSTRUCTOR_DECLARATION
13#define EOLIAN_CXX_EFL_CONSTRUCTOR_IMPLEMENTATION
14#define EOLIAN_CXX_EFL_DESTRUCTOR_DECLARATION
15#define EOLIAN_CXX_EFL_DESTRUCTOR_IMPLEMENTATION
16#define EOLIAN_CXX_EFL_FINALIZE_DECLARATION
17#define EOLIAN_CXX_EFL_FINALIZE_IMPLEMENTATION
18
19// Skip auto_unref
20#define EOLIAN_CXX_EFL_AUTO_UNREF_SET_DECLARATION
21#define EOLIAN_CXX_EFL_AUTO_UNREF_SET_IMPLEMENTATION
22
23#endif
diff --git a/src/lib/efl/Efl.hh b/src/lib/efl/Efl.hh
index a7efc5f8f6..e6473eafce 100644
--- a/src/lib/efl/Efl.hh
+++ b/src/lib/efl/Efl.hh
@@ -1,16 +1,9 @@
1#ifndef EFL_EFL_HH 1#ifndef EFL_EFL_HH
2#define EFL_EFL_HH 2#define EFL_EFL_HH
3 3
4#ifdef EFL_BETA_API_SUPPORT 4#include "cxx/efl_part_impl.hh"
5
6#define EFL_PART_IMPL_HH
7#define EFL_OBJECT_BETA
8#define EFL_OBJECT_PROTECTED
9 5
6#include <Eo.hh>
10#include <Efl.eo.hh> 7#include <Efl.eo.hh>
11#include "cxx/efl_part_impl.hh"
12 8
13#endif 9#endif
14#endif
15
16
diff --git a/src/lib/efl/cxx/efl_part_impl.hh b/src/lib/efl/cxx/efl_part_impl.hh
index c1c99e785a..f40292c6e0 100644
--- a/src/lib/efl/cxx/efl_part_impl.hh
+++ b/src/lib/efl/cxx/efl_part_impl.hh
@@ -1,26 +1,15 @@
1//#ifndef EFL_PART_IMPL_HH 1#ifndef EFL_PART_MANUAL_IMPL_HH
2//#define EFL_PART_IMPL_HH 2#define EFL_PART_MANUAL_IMPL_HH
3 3
4namespace efl { 4#define EOLIAN_CXX_EFL_PART_DECLARATION \
5inline ::efl::eolian::return_traits< ::efl::Object>::type Part::part( ::efl::eolian::in_traits< ::efl::eina::string_view>::type name) const 5 ::efl::Object part(::efl::eina::string_view const& name) const;
6{
7 Eo *handle = ::efl_part(this->_eo_ptr(), name.c_str());
8 ::efl_auto_unref_set(handle, false);
9 return ::efl::Object{handle};
10}
11}
12 6
13namespace eo_cxx { 7#define EOLIAN_CXX_EFL_PART_IMPLEMENTATION \
14namespace efl { 8inline ::efl::Object Part::part(::efl::eina::string_view const& name) const \
15inline ::efl::eolian::return_traits< ::efl::Object>::type Part::part( ::efl::eolian::in_traits< ::efl::eina::string_view>::type name) const 9{ \
16{ 10 ::Eo *handle = ::efl_part(_eo_ptr(), name.c_str()); \
17 Eo *handle = ::efl_part(this->_eo_ptr(), name.c_str()); 11 ::efl_auto_unref_set(handle, false); \
18 ::efl_auto_unref_set(handle, false); 12 return ::efl::Object{handle}; \
19 return ::efl::Object{handle};
20} 13}
21inline efl::Part::operator ::efl::Part() const { return *static_cast< ::efl::Part const*>(static_cast<void const*>(this)); }
22inline efl::Part::operator ::efl::Part&() { return *static_cast< ::efl::Part*>(static_cast<void*>(this)); }
23inline efl::Part::operator ::efl::Part const&() const { return *static_cast< ::efl::Part const*>(static_cast<void const*>(this)); }
24} }
25 14
26//#endif 15#endif
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index e7bfaba54d..771121d8ee 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -134,7 +134,7 @@ struct class_definition_generator
134 << "(const_cast<" << string << " *>(this))); }\n" 134 << "(const_cast<" << string << " *>(this))); }\n"
135 ).generate(sink, cls.cxx_name, context)) 135 ).generate(sink, cls.cxx_name, context))
136 return false; 136 return false;
137 137
138 for (auto&& e : cls.events) 138 for (auto&& e : cls.events)
139 { 139 {
140 if (e.beta) 140 if (e.beta)
@@ -237,6 +237,7 @@ struct class_definition_generator
237 if(!as_generator( scope_tab << "using ::efl::eo::concrete::_eo_ptr;\n" 237 if(!as_generator( scope_tab << "using ::efl::eo::concrete::_eo_ptr;\n"
238 << scope_tab << "using ::efl::eo::concrete::_release;\n" 238 << scope_tab << "using ::efl::eo::concrete::_release;\n"
239 << scope_tab << "using ::efl::eo::concrete::_reset;\n" 239 << scope_tab << "using ::efl::eo::concrete::_reset;\n"
240 << scope_tab << "using ::efl::eo::concrete::_delete;\n"
240 << scope_tab << "using ::efl::eo::concrete::operator bool;\n" 241 << scope_tab << "using ::efl::eo::concrete::operator bool;\n"
241 ).generate(sink, attributes::unused, context)) return false; 242 ).generate(sink, attributes::unused, context)) return false;
242 243
diff --git a/src/lib/eolian_cxx/grammar/function_declaration.hpp b/src/lib/eolian_cxx/grammar/function_declaration.hpp
index 634642eabc..a2770abf18 100644
--- a/src/lib/eolian_cxx/grammar/function_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/function_declaration.hpp
@@ -40,8 +40,12 @@ struct function_declaration_generator
40 } 40 }
41 41
42 if(f.is_beta && 42 if(f.is_beta &&
43 !as_generator("#ifdef " << *(string << "_") << string << "_" << string << "_BETA\n") 43 !as_generator("#ifdef " << *(string << "_") << string << "_BETA\n")
44 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name, suffix), add_upper_case_context(ctx))) 44 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx)))
45 return false;
46 if(f.is_protected &&
47 !as_generator("#ifdef " << *(string << "_") << string << "_PROTECTED\n")
48 .generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx)))
45 return false; 49 return false;
46 50
47 if(!as_generator 51 if(!as_generator
@@ -70,6 +74,9 @@ struct function_declaration_generator
70 .generate(sink, f.c_name, add_upper_case_context(ctx))) 74 .generate(sink, f.c_name, add_upper_case_context(ctx)))
71 return false; 75 return false;
72 76
77 if(f.is_protected &&
78 !as_generator("#endif\n").generate(sink, attributes::unused, ctx))
79 return false;
73 if(f.is_beta && 80 if(f.is_beta &&
74 !as_generator("#endif\n").generate(sink, attributes::unused, ctx)) 81 !as_generator("#endif\n").generate(sink, attributes::unused, ctx))
75 return false; 82 return false;