summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bindings/cxx/eo_cxx/eo_wref.hh12
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp7
2 files changed, 19 insertions, 0 deletions
diff --git a/src/bindings/cxx/eo_cxx/eo_wref.hh b/src/bindings/cxx/eo_cxx/eo_wref.hh
index e0f9c7bf82..124b1da3b7 100644
--- a/src/bindings/cxx/eo_cxx/eo_wref.hh
+++ b/src/bindings/cxx/eo_cxx/eo_wref.hh
@@ -123,6 +123,18 @@ struct wref
123 return *this; 123 return *this;
124 } 124 }
125 125
126#ifdef EFL_CXX_WREF_EASY
127 T operator->() const {
128 if (!_eo_wref) return T(nullptr);
129 return T(detail::ref(_eo_wref));
130 }
131
132 T operator*() const {
133 if (!_eo_wref) return T(nullptr);
134 return T(detail::ref(_eo_wref));
135 }
136#endif
137
126private: 138private:
127 void _add() 139 void _add()
128 { 140 {
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;