summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-22 17:17:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 10:14:03 +0900
commit753304c69d27a5303e742dffaaff6f6230c3211b (patch)
tree89817211f34ec95915863f24857da916db02fb45 /src/lib/eolian_cxx
parent425d8db90f9b67ab9645216a71bbba651cc54732 (diff)
downloadefl-753304c69d27a5303e742dffaaff6f6230c3211b.tar.gz
cxx: Add define EFL_CXXPERIMENTAL for testing
I'll hide some controversial features behind this, until we come to an agreement with @felipealmeida and people who actually know C++ (iow: not just me^^). Features protected: - easy wref (using -> without locking) - xxx_event_cb_add() functions in object classes - instantiate(obj) to create a new object - add as a synonym for instantiate (both in efl::eo)
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index 295662f94d..d5810da033 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -156,6 +156,10 @@ struct class_definition_generator
<< scope_tab << "} const " << string_replace(',', '_') << "_event;\n"
))).generate(sink, std::vector<attributes::event_def>{e}, context))
return false;
+
+ /* EXPERIMENTAL: event_cb_add */
+ if (!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context))
+ return false;
if (!as_generator(
scope_tab << "template <typename F>\n"
<< scope_tab << "typename std::enable_if<std::is_bind_expression<F>::value, ::efl::eolian::signal_connection>::type\n"
@@ -174,6 +178,9 @@ struct class_definition_generator
<< scope_tab << "}\n")
.generate(sink, std::make_tuple(e.name, e.name), context))
return false;
+ if (!as_generator("#endif\n").generate(sink, attributes::unused, context))
+ return false;
+
if (e.beta && !as_generator("#endif\n").generate(sink, attributes::unused, context))
return false;
if (e.protect && !as_generator("#endif\n").generate(sink, attributes::unused, context))
@@ -192,12 +199,13 @@ struct class_definition_generator
"return ::efl::eo::wref<" << string << ">(*this); }\n"
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
- if(!as_generator("#ifdef EFL_CXX_WREF_EASY\n").generate(sink, attributes::unused, context)) return false;
+ // EXPERIMENTAL
+ if(!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context)) return false;
if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n"
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
if(!as_generator( scope_tab << string << "* operator->() { return this; }\n"
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
- if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
+ if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n"
<< scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n"