summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-22 19:45:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 10:14:03 +0900
commit12d50cbe1938a096e8c06674d7b8ee8c33d5c335 (patch)
tree982f49c811a8bbd6462f5e171b33b299c24b213e
parent753304c69d27a5303e742dffaaff6f6230c3211b (diff)
downloadefl-12d50cbe1938a096e8c06674d7b8ee8c33d5c335.tar.gz
cxx: No instantiate ctors for non-regular classes
Only regular classes can be instantiated, this should be reflected in the C++ binding as well.
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index d5810da033..a60e18dedf 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -42,8 +42,7 @@ struct class_definition_generator
if(!as_generator("\n{\n").generate(sink, attributes::unused, context)) return false;
// constructors
- if(!as_generator
- (
+ if(!as_generator(
scope_tab << "explicit " << string << "( ::Eo* eo)\n"
<< scope_tab << scope_tab << ": ::efl::eo::concrete(eo) {}\n"
<< scope_tab << string << "(std::nullptr_t)\n"
@@ -57,10 +56,13 @@ struct class_definition_generator
<< scope_tab << string << "(Derived&& derived\n"
<< scope_tab << scope_tab << ", typename std::enable_if<\n"
<< scope_tab << scope_tab << scope_tab << "::efl::eo::is_eolian_object<Derived>::value\n"
- << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << string << ", Derived>::value"
- << scope_tab << scope_tab << scope_tab << ">::type* = 0) : ::efl::eo::concrete(derived._eo_ptr())\n"
- << scope_tab << "{}\n"
- << scope_tab << string << "( ::efl::eo::instantiate_t)\n"
+ << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << string << ", Derived>::value>::type* = 0)\n"
+ << scope_tab << scope_tab << scope_tab << ": ::efl::eo::concrete(derived._eo_ptr()) {}\n\n"
+ ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context))
+ return false;
+
+ if((cls.type == attributes::class_type::regular) && !as_generator(
+ scope_tab << string << "( ::efl::eo::instantiate_t)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class());\n"
<< scope_tab << "}\n"
@@ -76,7 +78,7 @@ struct class_definition_generator
<< scope_tab << "template <typename T, typename F> " << string << "( ::efl::eo::instantiate_t, T&& parent, F&& f, typename ::std::enable_if< ::efl::eolian::is_constructor_lambda<F, " << string << " >::value && ::efl::eo::is_eolian_object<T>::value>::type* = 0)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class(), *this, std::forward<F>(f));\n"
- << scope_tab << "}\n"
+ << scope_tab << "}\n\n"
// << scope_tab << "explicit " << string << "( ::efl::eo::concrete const& parent)\n"
// << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add(parent)) {}\n"
// << scope_tab << "template <typename F>\n"