summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-02 18:14:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 09:57:24 +0900
commit73ec85aeffc2eddfe81673344ed22bb21461aaa7 (patch)
treeba849f324c6b7dd413836ab84d4a6cc7bab3f704 /src/lib/eolian_cxx
parent88e10da36b00291b399c2d9bfe5f266a44a40f6f (diff)
cxx: Add _get_wref() convenience to all classes
This allows constructs like: auto w_obj = obj._get_wref(); auto cb = std::bind([w_obj]() { auto o = w_obj.lock(); if (!o) return; o->call(); }); event_add(..., obj, cb); Note: I don't like how those wref work. Close to c++ wref but far from EFL wref.
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index 15ef86d371..320d806398 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -170,6 +170,10 @@ struct class_definition_generator
170 // /// @endcond 170 // /// @endcond
171 if(!as_generator(scope_tab << "/// @endcond\n").generate(sink, attributes::unused, context)) return false; 171 if(!as_generator(scope_tab << "/// @endcond\n").generate(sink, attributes::unused, context)) return false;
172 172
173 if(!as_generator( scope_tab << "::efl::eo::wref<" << string << "> _get_wref() const { "
174 "return ::efl::eo::wref<" << string << ">(*this); }\n"
175 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
176
173 if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n" 177 if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n"
174 << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n" 178 << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n"
175 ).generate(sink, attributes::unused, context)) return false; 179 ).generate(sink, attributes::unused, context)) return false;