summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-02 18:39:47 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 09:57:24 +0900
commite7009b77a235ece2bbcba24c4fc6e2b719a2ab8d (patch)
treec3c56f591ba9769c45078f74125e93722d330b46 /src/lib
parent73ec85aeffc2eddfe81673344ed22bb21461aaa7 (diff)
cxx: Add experimental "easy" way to use wref
I hid it behind ifdef for now as I'm very much unsure of what I'm doing. This whole modern C++ thing is still weird to me :) Prerequisite: #define EFL_CXX_WREF_EASY This allows constructs such as: auto wobj = obj._get_wref(); std::cout << wobj->text_get() << std::endl;
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index 320d806398..54df3301a6 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -174,6 +174,13 @@ struct class_definition_generator
174 "return ::efl::eo::wref<" << string << ">(*this); }\n" 174 "return ::efl::eo::wref<" << string << ">(*this); }\n"
175 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; 175 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
176 176
177 if(!as_generator("#ifdef EFL_CXX_WREF_EASY\n").generate(sink, attributes::unused, context)) return false;
178 if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n"
179 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
180 if(!as_generator( scope_tab << string << "* operator->() { return this; }\n"
181 ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
182 if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
183
177 if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n" 184 if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n"
178 << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n" 185 << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n"
179 ).generate(sink, attributes::unused, context)) return false; 186 ).generate(sink, attributes::unused, context)) return false;