diff --git a/src/Makefile_Ecore_Audio_Cxx.am b/src/Makefile_Ecore_Audio_Cxx.am index d31d3ec90f..e8833ba373 100644 --- a/src/Makefile_Ecore_Audio_Cxx.am +++ b/src/Makefile_Ecore_Audio_Cxx.am @@ -35,12 +35,13 @@ tests_ecore_audio_cxx_cxx_compile_test_CPPFLAGS = \ -I$(top_srcdir)/src/lib/efl \ -I$(builddir)/src/lib/efl \ -I$(srcdir)/src/lib/efl \ +-I$(top_builddir)/src/lib/evas/canvas/ \ -DTESTS_WD=\"`pwd`\" \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore_audio_cxx\" \ -DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)/src/tests/ecore_audio_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore_audio_cxx\" \ -@CHECK_CFLAGS@ @ECORE_CFLAGS@ @EINA_CFLAGS@ @EO_CFLAGS@ @ECORE_AUDIO_CFLAGS@ \ -@ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EO_CXX_CFLAGS@ @ECORE_AUDIO_CXX_CFLAGS@ +@CHECK_CFLAGS@ @ECORE_CFLAGS@ @EINA_CFLAGS@ @EVAS_CFLAGS@ @EO_CFLAGS@ @ECORE_AUDIO_CFLAGS@ \ +@ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EVAS_CXX_CFLAGS@ @EO_CXX_CFLAGS@ @ECORE_AUDIO_CXX_CFLAGS@ tests_ecore_audio_cxx_cxx_compile_test_LDADD = @CHECK_LIBS@ @USE_ECORE_LIBS@ tests_ecore_audio_cxx_cxx_compile_test_DEPENDENCIES = @USE_ECORE_INTERNAL_LIBS@ diff --git a/src/Makefile_Ecore_Cxx.am b/src/Makefile_Ecore_Cxx.am index 35919e55bb..c0ec604d7d 100644 --- a/src/Makefile_Ecore_Cxx.am +++ b/src/Makefile_Ecore_Cxx.am @@ -42,8 +42,8 @@ tests_ecore_cxx_ecore_cxx_suite_CPPFLAGS = \ -I$(top_builddir)/src/lib/ecore \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore_cxx\" \ -@CHECK_CFLAGS@ @ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EINA_CFLAGS@ \ -@ECORE_CFLAGS@ @EO_CFLAGS@ @EO_CXX_CFLAGS@ +@CHECK_CFLAGS@ @ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EVAS_CXX_CFLAGS@ @EINA_CFLAGS@ \ +@ECORE_CFLAGS@ @EVAS_CFLAGS@ @EO_CFLAGS@ @EO_CXX_CFLAGS@ tests_ecore_cxx_ecore_cxx_suite_LDADD = @CHECK_LIBS@ @USE_ECORE_LIBS@ tests_ecore_cxx_ecore_cxx_suite_DEPENDENCIES = @USE_ECORE_INTERNAL_LIBS@ @@ -52,6 +52,7 @@ tests_ecore_cxx_cxx_compile_test_SOURCES = tests/ecore_cxx/cxx_compile_test.cc tests_ecore_cxx_cxx_compile_test_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_builddir)/src/lib/ecore \ -I$(top_builddir)/src/lib/efl/interfaces/ \ +-I$(top_builddir)/src/lib/evas/canvas/ \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore_cxx\" \ @CHECK_CFLAGS@ @ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EINA_CFLAGS@ \ diff --git a/src/Makefile_Edje_Cxx.am b/src/Makefile_Edje_Cxx.am index c7f7a7759e..93ae9abcef 100644 --- a/src/Makefile_Edje_Cxx.am +++ b/src/Makefile_Edje_Cxx.am @@ -34,7 +34,7 @@ tests_edje_cxx_cxx_compile_test_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_builddir)/src/lib/efl/interfaces/ \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/edje_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/edje_cxx\" \ -@CHECK_CFLAGS@ @ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EDJE_CXX_CFLAGS@ @EO_CXX_CFLAGS@ \ +@CHECK_CFLAGS@ @ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EVAS_CXX_CFLAGS@ @EDJE_CXX_CFLAGS@ @EO_CXX_CFLAGS@ \ @ECORE_CFLAGS@ @EINA_CFLAGS@ @EVAS_CFLAGS@ @EDJE_CFLAGS@ @EO_CFLAGS@ tests_edje_cxx_cxx_compile_test_LDADD = @CHECK_LIBS@ @USE_EDJE_LIBS@ tests_edje_cxx_cxx_compile_test_DEPENDENCIES = @USE_EDJE_INTERNAL_LIBS@ diff --git a/src/Makefile_Evas_Cxx.am b/src/Makefile_Evas_Cxx.am index 8f7a4d2c1c..40ec40fe5d 100644 --- a/src/Makefile_Evas_Cxx.am +++ b/src/Makefile_Evas_Cxx.am @@ -35,6 +35,7 @@ TESTS += tests/evas_cxx/cxx_compile_test tests_evas_cxx_cxx_compile_test_SOURCES = tests/evas_cxx/cxx_compile_test.cc tests_evas_cxx_cxx_compile_test_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_builddir)/src/lib/efl/interfaces/ \ + -I$(top_builddir)/src/lib/evas/canvas/ \ -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas_cxx\" \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas_cxx\" \ @CHECK_CFLAGS@ @ECORE_CXX_CFLAGS@ @EINA_CXX_CFLAGS@ @EVAS_CXX_CFLAGS@ @EO_CXX_CFLAGS@ \ diff --git a/src/bin/eolian_cxx/convert.cc b/src/bin/eolian_cxx/convert.cc index 051c6e3e80..1b42e66799 100644 --- a/src/bin/eolian_cxx/convert.cc +++ b/src/bin/eolian_cxx/convert.cc @@ -302,7 +302,7 @@ convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const& klass) Eolian_Function const& func = *(::eolian_constructor_function_get(&ctor)); efl::eolian::eo_function f; - if (::eolian_function_type_get(&func) != EOLIAN_PROPERTY) + if (function_op_type(func) == EOLIAN_METHOD) f = _convert_function(klass, func); else f = _convert_property_set_to_function(klass, func); diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh b/src/bin/eolian_cxx/eolian_wrappers.hh index 65f218d6e4..9ea4f4cf15 100644 --- a/src/bin/eolian_cxx/eolian_wrappers.hh +++ b/src/bin/eolian_cxx/eolian_wrappers.hh @@ -97,19 +97,6 @@ class_eo_name(Eolian_Class const& klass) (find_replace(class_full_name(klass) + "_" + suffix, ".", "_")); } -inline std::string -class_format_cxx(std::string const& fullname) -{ - std::string s = fullname; - auto found = s.find("."); - while (found != std::string::npos) - { - s.replace(found, 1, "::"); - found = s.find("."); - } - return s; -} - inline efl::eolian::eo_class::eo_class_type class_type(Eolian_Class const& klass) { diff --git a/src/bin/eolian_cxx/type_lookup.hh b/src/bin/eolian_cxx/type_lookup.hh index f7be16e857..38b683d468 100644 --- a/src/bin/eolian_cxx/type_lookup.hh +++ b/src/bin/eolian_cxx/type_lookup.hh @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -23,6 +24,19 @@ namespace eolian_cxx { typedef std::vector lookup_table_type; extern const lookup_table_type type_lookup_table; +inline std::string +class_format_cxx(std::string const& fullname) +{ + std::string s = fullname; + auto found = s.find("."); + while (found != std::string::npos) + { + s.replace(found, 1, "::"); + found = s.find("."); + } + return s; +} + inline bool type_is_complex(Eolian_Type const& type) { @@ -33,6 +47,28 @@ inline efl::eolian::eolian_type type_from_eolian(Eolian_Type const& type) { efl::eolian::eolian_type x; + + Eolian_Type_Type tpt = ::eolian_type_type_get(&type); + if (tpt == EOLIAN_TYPE_POINTER || tpt == EOLIAN_TYPE_ALIAS || tpt == EOLIAN_TYPE_REGULAR) + { + Eolian_Type const* base_type = ::eolian_type_base_type_get(&type); + if (base_type && ::eolian_type_type_get(base_type) == EOLIAN_TYPE_CLASS) + { + Eolian_Class const* klass = ::eolian_type_class_get(base_type); + if (klass) + { + x.category = efl::eolian::eolian_type::simple_; + x.is_class = true; + x.binding_requires_optional = false; + x.binding = "::" + class_format_cxx(safe_lower(safe_str(::eolian_class_full_name_get(klass)))); + + Eina_Stringshare* klass_file = ::eolian_class_file_get(klass); + if (klass_file) + x.includes = {safe_str(klass_file) + ".hh"}; + } + } + } + x.native = normalize_spaces(safe_str(::eolian_type_c_type_get(&type))); x.is_own = ::eolian_type_is_own(&type); x.is_const = ::eolian_type_is_const(&type); diff --git a/src/bin/eolian_cxx/type_lookup_table.cc b/src/bin/eolian_cxx/type_lookup_table.cc index dd005518fb..de6529969e 100644 --- a/src/bin/eolian_cxx/type_lookup_table.cc +++ b/src/bin/eolian_cxx/type_lookup_table.cc @@ -23,12 +23,10 @@ type_lookup_table {"Eina_List *", eolian_type::complex_, false, true, true, true, "::efl::eina::list", {"eina-cxx/eina_list.hh"}}, {"const Eina_List *", eolian_type::complex_, true, false, true, true, "::efl::eina::crange_list", {"eina-cxx/eina_list.hh"}}, {"Eio_Filter_Direct_Cb", eolian_type::callback_, {"Eio.h"}}, - {"Emodel *", eolian_type::simple_, false, false, true, false, "::emodel", {"Emodel.hh"}}, {"Eo *", eolian_type::simple_, false, true, true, false, "::efl::eo::concrete", {"eo_concrete.hh"}}, {"Eo *", eolian_type::simple_, false, false, true, false, "::efl::eo::concrete", {"eo_concrete.hh"}}, //{"Evas_Object_Box_Layout", eolian_type::callback_, {"Evas.h"}}, - {"Evas_Object *", eolian_type::simple_, false, false, true, false, "::evas::object", {"canvas/evas_object.eo.hh"}}, - {"char *", eolian_type::simple_, false, true, true, false, "std::unique_ptr", {"memory"}}, + //{"char *", eolian_type::simple_, false, true, true, false, "std::unique_ptr", {"memory"}}, {"const Eina_Inlist *", eolian_type::complex_, false, false, true, true, "::efl::eina::range_inlist", {"eina-cxx/eina_inlist.hh"}}, {"const Eina_List *", eolian_type::complex_, false, false, true, true, "::efl::eina::range_list", {"eina-cxx/eina_ptrlist.hh"}}, {"const char *", eolian_type::simple_, false, false, true, true, "::efl::eina::string_view", {"string"}}, diff --git a/src/bindings/eo_cxx/eo_cxx_interop.hh b/src/bindings/eo_cxx/eo_cxx_interop.hh index ef3e9c73f5..e0fd2ed355 100644 --- a/src/bindings/eo_cxx/eo_cxx_interop.hh +++ b/src/bindings/eo_cxx/eo_cxx_interop.hh @@ -100,14 +100,14 @@ Eo** to_c(T* v, typename std::enable_if -R to_native(T const& v) +R to_native(T& v) { static_assert(sizeof(T) == sizeof(R), ""); return v.native_handle(); } template -R to_native(eina::optional const& v) +R to_native(eina::optional& v) { static_assert(sizeof(T) == sizeof(R), ""); if (!v) diff --git a/src/examples/evas/Makefile.am b/src/examples/evas/Makefile.am index ed9b8cb744..5c39cbd724 100644 --- a/src/examples/evas/Makefile.am +++ b/src/examples/evas/Makefile.am @@ -314,6 +314,7 @@ EXTRA_PROGRAMS += evas_cxx_rectangle evas_cxx_rectangle_SOURCES = evas_cxx_rectangle.cc evas_cxx_rectangle_LDADD = $(ECORE_EVAS_COMMON_LDADD) evas_cxx_rectangle_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) @EINA_CXX_CFLAGS@ @EO_CXX_CFLAGS@ @EVAS_CXX_CFLAGS@ \ +-I$(top_builddir)/src/lib/evas/canvas/ \ $(AM_CPPFLAGS) @EVAS_CFLAGS@ endif diff --git a/src/lib/eolian_cxx/grammar/eo_header_generator.hh b/src/lib/eolian_cxx/grammar/eo_header_generator.hh index 9ec4a3b480..0b0fc55a36 100644 --- a/src/lib/eolian_cxx/grammar/eo_header_generator.hh +++ b/src/lib/eolian_cxx/grammar/eo_header_generator.hh @@ -41,8 +41,10 @@ namespace efl { namespace eolian { namespace grammar { struct include_dependencies { eo_class const& _cls; - include_dependencies(eo_class const& cls) + eo_generator_options const& _opts; + include_dependencies(eo_class const& cls, eo_generator_options const& opts) : _cls(cls) + , _opts(opts) {} }; @@ -58,7 +60,8 @@ operator<<(std::ostream& out, include_dependencies const& x) it_p != last_p; ++it_p) for (eolian_type const& subtype : (*it_p).type.parts) for (std::string header : subtype.includes) - headers.insert(header); + if (header != x._opts.header_decl_file_name) + headers.insert(header); for (auto it = cls.functions.begin(), last = cls.functions.end(); it != last; ++it) @@ -66,7 +69,8 @@ operator<<(std::ostream& out, include_dependencies const& x) it_p != last_p; ++it_p) for (eolian_type const& subtype : (*it_p).type.parts) for (std::string header : subtype.includes) - headers.insert(header); + if (header != x._opts.header_decl_file_name) + headers.insert(header); for (std::string header : headers) out << "#include <" << header << ">" << endl; @@ -111,7 +115,7 @@ include_headers(std::ostream& out, { out << "#include \"" << cxx_header << "\"" << endl; } - out << include_dependencies(cls) << endl; + out << include_dependencies(cls, opts) << endl; } inline void