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)
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
156 << scope_tab << "} const " << string_replace(',', '_') << "_event;\n" 156 << scope_tab << "} const " << string_replace(',', '_') << "_event;\n"
157 ))).generate(sink, std::vector<attributes::event_def>{e}, context)) 157 ))).generate(sink, std::vector<attributes::event_def>{e}, context))
158 return false; 158 return false;
159
160 /* EXPERIMENTAL: event_cb_add */
161 if (!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context))
162 return false;
159 if (!as_generator( 163 if (!as_generator(
160 scope_tab << "template <typename F>\n" 164 scope_tab << "template <typename F>\n"
161 << scope_tab << "typename std::enable_if<std::is_bind_expression<F>::value, ::efl::eolian::signal_connection>::type\n" 165 << 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
174 << scope_tab << "}\n") 178 << scope_tab << "}\n")
175 .generate(sink, std::make_tuple(e.name, e.name), context)) 179 .generate(sink, std::make_tuple(e.name, e.name), context))
176 return false; 180 return false;
181 if (!as_generator("#endif\n").generate(sink, attributes::unused, context))
182 return false;
183
177 if (e.beta && !as_generator("#endif\n").generate(sink, attributes::unused, context)) 184 if (e.beta && !as_generator("#endif\n").generate(sink, attributes::unused, context))
178 return false; 185 return false;
179 if (e.protect && !as_generator("#endif\n").generate(sink, attributes::unused, context)) 186 if (e.protect && !as_generator("#endif\n").generate(sink, attributes::unused, context))
@@ -192,12 +199,13 @@ struct class_definition_generator
192 "return ::efl::eo::wref<" << string << ">(*this); }\n" 199 "return ::efl::eo::wref<" << string << ">(*this); }\n"
193 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 200 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
194 201
195 if(!as_generator("#ifdef EFL_CXX_WREF_EASY\n").generate(sink, attributes::unused, context)) return false; 202 // EXPERIMENTAL
203 if(!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context)) return false;
196 if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n" 204 if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n"
197 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 205 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
198 if(!as_generator( scope_tab << string << "* operator->() { return this; }\n" 206 if(!as_generator( scope_tab << string << "* operator->() { return this; }\n"
199 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 207 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
200 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false; 208 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
201 209
202 if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n" 210 if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n"
203 << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n" 211 << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n"