summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar
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 /src/lib/eolian_cxx/grammar
parent753304c69d27a5303e742dffaaff6f6230c3211b (diff)
cxx: No instantiate ctors for non-regular classes
Only regular classes can be instantiated, this should be reflected in the C++ binding as well.
Diffstat (limited to 'src/lib/eolian_cxx/grammar')
-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
42 if(!as_generator("\n{\n").generate(sink, attributes::unused, context)) return false; 42 if(!as_generator("\n{\n").generate(sink, attributes::unused, context)) return false;
43 43
44 // constructors 44 // constructors
45 if(!as_generator 45 if(!as_generator(
46 (
47 scope_tab << "explicit " << string << "( ::Eo* eo)\n" 46 scope_tab << "explicit " << string << "( ::Eo* eo)\n"
48 << scope_tab << scope_tab << ": ::efl::eo::concrete(eo) {}\n" 47 << scope_tab << scope_tab << ": ::efl::eo::concrete(eo) {}\n"
49 << scope_tab << string << "(std::nullptr_t)\n" 48 << scope_tab << string << "(std::nullptr_t)\n"
@@ -57,10 +56,13 @@ struct class_definition_generator
57 << scope_tab << string << "(Derived&& derived\n" 56 << scope_tab << string << "(Derived&& derived\n"
58 << scope_tab << scope_tab << ", typename std::enable_if<\n" 57 << scope_tab << scope_tab << ", typename std::enable_if<\n"
59 << scope_tab << scope_tab << scope_tab << "::efl::eo::is_eolian_object<Derived>::value\n" 58 << scope_tab << scope_tab << scope_tab << "::efl::eo::is_eolian_object<Derived>::value\n"
60 << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << string << ", Derived>::value" 59 << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << string << ", Derived>::value>::type* = 0)\n"
61 << scope_tab << scope_tab << scope_tab << ">::type* = 0) : ::efl::eo::concrete(derived._eo_ptr())\n" 60 << scope_tab << scope_tab << scope_tab << ": ::efl::eo::concrete(derived._eo_ptr()) {}\n\n"
62 << scope_tab << "{}\n" 61 ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context))
63 << scope_tab << string << "( ::efl::eo::instantiate_t)\n" 62 return false;
63
64 if((cls.type == attributes::class_type::regular) && !as_generator(
65 scope_tab << string << "( ::efl::eo::instantiate_t)\n"
64 << scope_tab << "{\n" 66 << scope_tab << "{\n"
65 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class());\n" 67 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class());\n"
66 << scope_tab << "}\n" 68 << scope_tab << "}\n"
@@ -76,7 +78,7 @@ struct class_definition_generator
76 << 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" 78 << 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"
77 << scope_tab << "{\n" 79 << scope_tab << "{\n"
78 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class(), *this, std::forward<F>(f));\n" 80 << scope_tab << scope_tab << "::efl::eolian::do_eo_add( ::efl::eo::concrete::_eo_raw, parent, _eo_class(), *this, std::forward<F>(f));\n"
79 << scope_tab << "}\n" 81 << scope_tab << "}\n\n"
80 // << scope_tab << "explicit " << string << "( ::efl::eo::concrete const& parent)\n" 82 // << scope_tab << "explicit " << string << "( ::efl::eo::concrete const& parent)\n"
81 // << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add(parent)) {}\n" 83 // << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add(parent)) {}\n"
82 // << scope_tab << "template <typename F>\n" 84 // << scope_tab << "template <typename F>\n"