jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=09cf28274166bdf8cccc945cbc3b4083af1f9c6c

commit 09cf28274166bdf8cccc945cbc3b4083af1f9c6c
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Tue Nov 28 16:21:40 2017 +0900

    cxx: Use per-function guards in efl object
    
    This prevents generation of del().
    I also removed constructor, finalize and destructor as I believe this
    requires special work with eo_inherit (where did this work go??).
---
 src/Makefile_Cxx.am                                |  3 +-
 src/bindings/cxx/eo_cxx/Eo.hh                      |  5 ++++
 src/bindings/cxx/eo_cxx/efl_object_impl.hh         | 23 +++++++++++++++
 src/lib/efl/Efl.hh                                 | 11 ++------
 src/lib/efl/cxx/efl_part_impl.hh                   | 33 ++++++++--------------
 src/lib/eolian_cxx/grammar/class_definition.hpp    |  3 +-
 .../eolian_cxx/grammar/function_declaration.hpp    | 11 ++++++--
 7 files changed, 54 insertions(+), 35 deletions(-)

diff --git a/src/Makefile_Cxx.am b/src/Makefile_Cxx.am
index 74ac8f7183..bc9f3749f7 100644
--- a/src/Makefile_Cxx.am
+++ b/src/Makefile_Cxx.am
@@ -16,7 +16,8 @@ bindings/cxx/eo_cxx/eo_wref.hh \
 bindings/cxx/eo_cxx/eo_future.hh \
 bindings/cxx/eo_cxx/eo_promise.hh \
 bindings/cxx/eo_cxx/eo_promise_meta.hh \
-bindings/cxx/eo_cxx/eo_private.hh
+bindings/cxx/eo_cxx/eo_private.hh \
+bindings/cxx/eo_cxx/efl_object_impl.hh
 
 ### Elementary C++
 installed_elementarycxxmainheadersdir = $(includedir)/elementary-cxx-@VMAJ@/
diff --git a/src/bindings/cxx/eo_cxx/Eo.hh b/src/bindings/cxx/eo_cxx/Eo.hh
index 771ee12da9..bd60f69701 100644
--- a/src/bindings/cxx/eo_cxx/Eo.hh
+++ b/src/bindings/cxx/eo_cxx/Eo.hh
@@ -1,6 +1,8 @@
 #ifndef EFL_CXX_EO_HH
 #define EFL_CXX_EO_HH
 
+#include "efl_object_impl.hh"
+
 #include <eo_concrete.hh>
 #include <eo_init.hh>
 #include <eo_wref.hh>
@@ -10,4 +12,7 @@
 #include <eo_cxx_interop.hh>
 #include <eo_event.hh>
 
+#include "efl_object.eo.hh"
+#include "efl_object.eo.impl.hh"
+
 #endif // EFL_CXX_EO_HH
diff --git a/src/bindings/cxx/eo_cxx/efl_object_impl.hh 
b/src/bindings/cxx/eo_cxx/efl_object_impl.hh
new file mode 100644
index 0000000000..ce61ed6200
--- /dev/null
+++ b/src/bindings/cxx/eo_cxx/efl_object_impl.hh
@@ -0,0 +1,23 @@
+#ifndef EFL_OBJECT_MANUAL_IMPL_HH
+#define EFL_OBJECT_MANUAL_IMPL_HH
+
+#define EFL_OBJECT_BETA
+#define EFL_OBJECT_PROTECTED
+
+// Skip del. Must be implemented in eo::concrete.
+#define EOLIAN_CXX_EFL_DEL_DECLARATION
+#define EOLIAN_CXX_EFL_DEL_IMPLEMENTATION
+
+// Skip constructor, destructor and finalize.
+#define EOLIAN_CXX_EFL_CONSTRUCTOR_DECLARATION
+#define EOLIAN_CXX_EFL_CONSTRUCTOR_IMPLEMENTATION
+#define EOLIAN_CXX_EFL_DESTRUCTOR_DECLARATION
+#define EOLIAN_CXX_EFL_DESTRUCTOR_IMPLEMENTATION
+#define EOLIAN_CXX_EFL_FINALIZE_DECLARATION
+#define EOLIAN_CXX_EFL_FINALIZE_IMPLEMENTATION
+
+// Skip auto_unref
+#define EOLIAN_CXX_EFL_AUTO_UNREF_SET_DECLARATION
+#define EOLIAN_CXX_EFL_AUTO_UNREF_SET_IMPLEMENTATION
+
+#endif
diff --git a/src/lib/efl/Efl.hh b/src/lib/efl/Efl.hh
index a7efc5f8f6..e6473eafce 100644
--- a/src/lib/efl/Efl.hh
+++ b/src/lib/efl/Efl.hh
@@ -1,16 +1,9 @@
 #ifndef EFL_EFL_HH
 #define EFL_EFL_HH
 
-#ifdef EFL_BETA_API_SUPPORT
-
-#define EFL_PART_IMPL_HH
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
+#include "cxx/efl_part_impl.hh"
 
+#include <Eo.hh>
 #include <Efl.eo.hh>
-#include "cxx/efl_part_impl.hh"
 
 #endif
-#endif
-
-
diff --git a/src/lib/efl/cxx/efl_part_impl.hh b/src/lib/efl/cxx/efl_part_impl.hh
index c1c99e785a..f40292c6e0 100644
--- a/src/lib/efl/cxx/efl_part_impl.hh
+++ b/src/lib/efl/cxx/efl_part_impl.hh
@@ -1,26 +1,15 @@
-//#ifndef EFL_PART_IMPL_HH
-//#define EFL_PART_IMPL_HH
+#ifndef EFL_PART_MANUAL_IMPL_HH
+#define EFL_PART_MANUAL_IMPL_HH
 
-namespace efl {
-inline ::efl::eolian::return_traits< ::efl::Object>::type Part::part( 
::efl::eolian::in_traits< ::efl::eina::string_view>::type name) const
-{
-   Eo *handle = ::efl_part(this->_eo_ptr(), name.c_str());
-   ::efl_auto_unref_set(handle, false);
-   return ::efl::Object{handle};
-}
-}
+#define EOLIAN_CXX_EFL_PART_DECLARATION \
+   ::efl::Object part(::efl::eina::string_view const& name) const;
 
-namespace eo_cxx {
-namespace efl { 
-inline ::efl::eolian::return_traits< ::efl::Object>::type Part::part( 
::efl::eolian::in_traits< ::efl::eina::string_view>::type name) const
-{
-   Eo *handle = ::efl_part(this->_eo_ptr(), name.c_str());
-   ::efl_auto_unref_set(handle, false);
-   return ::efl::Object{handle};
+#define EOLIAN_CXX_EFL_PART_IMPLEMENTATION \
+inline ::efl::Object Part::part(::efl::eina::string_view const& name) const \
+{ \
+   ::Eo *handle = ::efl_part(_eo_ptr(), name.c_str()); \
+   ::efl_auto_unref_set(handle, false); \
+   return ::efl::Object{handle}; \
 }
-inline efl::Part::operator ::efl::Part() const { return *static_cast< 
::efl::Part const*>(static_cast<void const*>(this)); }
-inline efl::Part::operator ::efl::Part&() { return *static_cast< 
::efl::Part*>(static_cast<void*>(this)); }
-inline efl::Part::operator ::efl::Part const&() const { return *static_cast< 
::efl::Part const*>(static_cast<void const*>(this)); }
-} }
 
-//#endif
+#endif
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp 
b/src/lib/eolian_cxx/grammar/class_definition.hpp
index e7bfaba54d..771121d8ee 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -134,7 +134,7 @@ struct class_definition_generator
               << "(const_cast<" << string << " *>(this))); }\n"
         ).generate(sink, cls.cxx_name, context))
        return false;
-     
+
      for (auto&& e : cls.events)
        {
           if (e.beta)
@@ -237,6 +237,7 @@ struct class_definition_generator
      if(!as_generator(   scope_tab << "using ::efl::eo::concrete::_eo_ptr;\n"
                       << scope_tab << "using ::efl::eo::concrete::_release;\n"
                       << scope_tab << "using ::efl::eo::concrete::_reset;\n"
+                      << scope_tab << "using ::efl::eo::concrete::_delete;\n"
                       << scope_tab << "using ::efl::eo::concrete::operator 
bool;\n"
                       ).generate(sink, attributes::unused, context)) return 
false;
 
diff --git a/src/lib/eolian_cxx/grammar/function_declaration.hpp 
b/src/lib/eolian_cxx/grammar/function_declaration.hpp
index 634642eabc..a2770abf18 100644
--- a/src/lib/eolian_cxx/grammar/function_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/function_declaration.hpp
@@ -40,8 +40,12 @@ struct function_declaration_generator
         }
 
       if(f.is_beta &&
-            !as_generator("#ifdef " << *(string << "_") << string << "_" << 
string << "_BETA\n")
-            .generate(sink, std::make_tuple(_klass_name.namespaces, 
_klass_name.eolian_name, suffix), add_upper_case_context(ctx)))
+            !as_generator("#ifdef " << *(string << "_") << string << "_BETA\n")
+            .generate(sink, std::make_tuple(_klass_name.namespaces, 
_klass_name.eolian_name), add_upper_case_context(ctx)))
+        return false;
+      if(f.is_protected &&
+            !as_generator("#ifdef " << *(string << "_") << string << 
"_PROTECTED\n")
+            .generate(sink, std::make_tuple(_klass_name.namespaces, 
_klass_name.eolian_name), add_upper_case_context(ctx)))
         return false;
 
       if(!as_generator
@@ -70,6 +74,9 @@ struct function_declaration_generator
             .generate(sink, f.c_name, add_upper_case_context(ctx)))
         return false;
 
+      if(f.is_protected &&
+            !as_generator("#endif\n").generate(sink, attributes::unused, ctx))
+        return false;
       if(f.is_beta &&
             !as_generator("#endif\n").generate(sink, attributes::unused, ctx))
         return false;

-- 


Reply via email to