eolian-cxx: Remove .Base requirement
Remove requirement that class can't have the same name as another class's namespace.
This commit is contained in:
parent
5c87f2762f
commit
535a069a23
|
@ -72,6 +72,8 @@ tests/eolian_cxx/eolian_cxx_test_callback.cc \
|
||||||
tests/eolian_cxx/eolian_cxx_test_address_of.cc \
|
tests/eolian_cxx/eolian_cxx_test_address_of.cc \
|
||||||
tests/eolian_cxx/eolian_cxx_test_wrapper.cc \
|
tests/eolian_cxx/eolian_cxx_test_wrapper.cc \
|
||||||
tests/eolian_cxx/simple.c \
|
tests/eolian_cxx/simple.c \
|
||||||
|
tests/eolian_cxx/name_name.c \
|
||||||
|
tests/eolian_cxx/name_name_cxx.cc \
|
||||||
tests/eolian_cxx/generic.c \
|
tests/eolian_cxx/generic.c \
|
||||||
tests/eolian_cxx/eolian_cxx_test_inheritance.cc \
|
tests/eolian_cxx/eolian_cxx_test_inheritance.cc \
|
||||||
tests/eolian_cxx/eolian_cxx_test_generate.cc \
|
tests/eolian_cxx/eolian_cxx_test_generate.cc \
|
||||||
|
@ -91,6 +93,9 @@ tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-b.$(OBJEXT): tests/eolian_cxx
|
||||||
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-c.$(OBJEXT): tests/eolian_cxx/c.eo.c tests/eolian_cxx/c.eo.h
|
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-c.$(OBJEXT): tests/eolian_cxx/c.eo.c tests/eolian_cxx/c.eo.h
|
||||||
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-d.$(OBJEXT): tests/eolian_cxx/d.eo.c tests/eolian_cxx/d.eo.h
|
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-d.$(OBJEXT): tests/eolian_cxx/d.eo.c tests/eolian_cxx/d.eo.h
|
||||||
|
|
||||||
|
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-name_name.$(OBJEXT): tests/eolian_cxx/name_name.eo.c tests/eolian_cxx/name_name.eo.h
|
||||||
|
tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-name_name_cxx.$(OBJEXT): tests/eolian_cxx/name_name.eo.h tests/eolian_cxx/name_name.eo.hh
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
tests/eolian_cxx/callback.eo.hh \
|
tests/eolian_cxx/callback.eo.hh \
|
||||||
tests/eolian_cxx/callback.eo.c \
|
tests/eolian_cxx/callback.eo.c \
|
||||||
|
|
|
@ -38,7 +38,7 @@ add_ancestor_recursive(const char* klass_name, std::set<std::string>& ancestor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ancestor.insert(class_format_cxx(safe_lower(klass_name)));
|
ancestor.insert(class_format_cxx(safe_str(klass_name)));
|
||||||
|
|
||||||
Eina_Iterator* inheritances = ::eolian_class_inherits_get(klass);
|
Eina_Iterator* inheritances = ::eolian_class_inherits_get(klass);
|
||||||
void* curr = 0;
|
void* curr = 0;
|
||||||
|
@ -236,7 +236,7 @@ convert_eolian_inheritances(efl::eolian::eo_class& cls, Eolian_Class const& klas
|
||||||
EINA_ITERATOR_FOREACH(inheritances, curr)
|
EINA_ITERATOR_FOREACH(inheritances, curr)
|
||||||
{
|
{
|
||||||
const char* klass_name = static_cast<const char*>(curr);
|
const char* klass_name = static_cast<const char*>(curr);
|
||||||
cls.parents.push_back(class_format_cxx(safe_lower(klass_name)));
|
cls.parents.push_back(class_format_cxx(safe_str(klass_name)));
|
||||||
add_ancestor_recursive(klass_name, ancestors);
|
add_ancestor_recursive(klass_name, ancestors);
|
||||||
}
|
}
|
||||||
eina_iterator_free(inheritances);
|
eina_iterator_free(inheritances);
|
||||||
|
@ -275,6 +275,8 @@ convert_eolian_class_new(Eolian_Class const& klass)
|
||||||
cls.type = class_type(klass);
|
cls.type = class_type(klass);
|
||||||
cls.name = class_name(klass);
|
cls.name = class_name(klass);
|
||||||
cls.name_space = class_namespace_full(klass);
|
cls.name_space = class_namespace_full(klass);
|
||||||
|
if(cls.name_space.empty())
|
||||||
|
cls.name_space = "nonamespace";
|
||||||
cls.eo_name = class_eo_name(klass);
|
cls.eo_name = class_eo_name(klass);
|
||||||
cls.comment = convert_comments_class(klass);
|
cls.comment = convert_comments_class(klass);
|
||||||
return cls;
|
return cls;
|
||||||
|
|
|
@ -59,7 +59,7 @@ class_base_file(Eolian_Class const& klass)
|
||||||
inline std::string
|
inline std::string
|
||||||
class_name(Eolian_Class const& klass)
|
class_name(Eolian_Class const& klass)
|
||||||
{
|
{
|
||||||
return safe_lower(::eolian_class_name_get(&klass));
|
return ::eolian_class_name_get(&klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string
|
inline std::string
|
||||||
|
@ -347,7 +347,7 @@ event_create(Eolian_Class const& klass, const Eolian_Event *event_)
|
||||||
event.is_beta = (::eolian_event_is_beta(event_) != EINA_FALSE);
|
event.is_beta = (::eolian_event_is_beta(event_) != EINA_FALSE);
|
||||||
event.name = normalize_spaces(name_);
|
event.name = normalize_spaces(name_);
|
||||||
event.eo_name = safe_upper
|
event.eo_name = safe_upper
|
||||||
(find_replace(class_full_name(klass), ".", "_") + "_EVENT_" + event.name);
|
(find_replace(safe_lower(class_full_name(klass)), ".", "_") + "_EVENT_" + event.name);
|
||||||
/* FIXME: use doc api */
|
/* FIXME: use doc api */
|
||||||
event.comment = safe_str("");
|
event.comment = safe_str("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,30 @@ extern const lookup_table_type type_lookup_table;
|
||||||
inline std::string
|
inline std::string
|
||||||
class_format_cxx(std::string const& fullname)
|
class_format_cxx(std::string const& fullname)
|
||||||
{
|
{
|
||||||
std::string s = fullname;
|
auto current = fullname.begin(), last = fullname.end();
|
||||||
auto found = s.find(".");
|
auto found = std::find(current, last, '.');
|
||||||
while (found != std::string::npos)
|
std::string new_string;
|
||||||
{
|
if(found == last)
|
||||||
s.replace(found, 1, "::");
|
new_string = "nonamespace::" + fullname;
|
||||||
found = s.find(".");
|
else
|
||||||
}
|
while (current != last)
|
||||||
return s;
|
{
|
||||||
|
if(found == last)
|
||||||
|
{
|
||||||
|
new_string.insert(new_string.end(), current, found);
|
||||||
|
current = found;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_string += std::tolower(*current);
|
||||||
|
new_string.insert(new_string.end(), std::next(current), found);
|
||||||
|
new_string = safe_lower(new_string);
|
||||||
|
new_string += "::";
|
||||||
|
current = std::next(found);
|
||||||
|
found = std::find(current, last, '.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
@ -60,7 +76,16 @@ type_from_eolian(Eolian_Type const& type)
|
||||||
x.category = efl::eolian::eolian_type::simple_;
|
x.category = efl::eolian::eolian_type::simple_;
|
||||||
x.is_class = true;
|
x.is_class = true;
|
||||||
x.binding_requires_optional = false;
|
x.binding_requires_optional = false;
|
||||||
x.binding = "::" + class_format_cxx(safe_lower(safe_str(::eolian_class_full_name_get(klass))));
|
x.binding = "::" + class_format_cxx(safe_str(::eolian_class_full_name_get(klass)));
|
||||||
|
x.native = "::";
|
||||||
|
x.native += safe_str( ::eolian_class_full_name_get(klass));
|
||||||
|
std::replace(x.native.begin(), x.native.end(), '.', '_');
|
||||||
|
|
||||||
|
if( ::eolian_type_is_const(base_type))
|
||||||
|
x.native += " const";
|
||||||
|
|
||||||
|
x.native += '*';
|
||||||
|
|
||||||
|
|
||||||
Eina_Stringshare* klass_file = ::eolian_class_file_get(klass);
|
Eina_Stringshare* klass_file = ::eolian_class_file_get(klass);
|
||||||
if (klass_file)
|
if (klass_file)
|
||||||
|
@ -69,7 +94,8 @@ type_from_eolian(Eolian_Type const& type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x.native = normalize_spaces(safe_str(::eolian_type_c_type_get(&type)));
|
if(x.native.empty())
|
||||||
|
x.native = normalize_spaces(safe_str(::eolian_type_c_type_get(&type)));
|
||||||
x.is_own = ::eolian_type_is_own(&type);
|
x.is_own = ::eolian_type_is_own(&type);
|
||||||
x.is_const = ::eolian_type_is_const(&type);
|
x.is_const = ::eolian_type_is_const(&type);
|
||||||
return x;
|
return x;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "eo_ops.hh"
|
#include "eo_ops.hh"
|
||||||
|
|
||||||
namespace eo {
|
namespace eo {
|
||||||
struct base;
|
struct Base;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace efl { namespace eo { namespace detail {
|
namespace efl { namespace eo { namespace detail {
|
||||||
|
@ -89,7 +89,7 @@ Eo_Class const* do_eo_class_new(Eo_Class_Description& class_desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> struct operation_description_class_size;
|
template <typename T> struct operation_description_class_size;
|
||||||
template <> struct operation_description_class_size< ::eo::base> : std::integral_constant<std::size_t, 0u> {};
|
template <> struct operation_description_class_size< ::eo::Base> : std::integral_constant<std::size_t, 0u> {};
|
||||||
|
|
||||||
/// @internal
|
/// @internal
|
||||||
///
|
///
|
||||||
|
@ -136,7 +136,7 @@ namespace detail {
|
||||||
template <typename T> struct operations;
|
template <typename T> struct operations;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct operations< ::eo::base> { template <typename T> struct type {}; };
|
struct operations< ::eo::Base> { template <typename T> struct type {}; };
|
||||||
|
|
||||||
/// @internal
|
/// @internal
|
||||||
///
|
///
|
||||||
|
@ -165,7 +165,7 @@ struct Inherit_Private_Data
|
||||||
|
|
||||||
namespace efl { namespace eo { namespace detail {
|
namespace efl { namespace eo { namespace detail {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
int initialize_operation_description(efl::eo::detail::tag< ::eo::base>
|
int initialize_operation_description(efl::eo::detail::tag< ::eo::Base>
|
||||||
, Eo_Op_Description* ops)
|
, Eo_Op_Description* ops)
|
||||||
{
|
{
|
||||||
(void)ops;
|
(void)ops;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Ecore_Audio.h>
|
#include <Ecore_Audio.h>
|
||||||
|
#include <ecore_audio.eo.h>
|
||||||
#include <Ecore_Audio.hh>
|
#include <Ecore_Audio.hh>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
@ -37,22 +37,22 @@ START_TEST(eina_cxx_eo_iterator_equal)
|
||||||
efl::eina::eina_init eina_init;
|
efl::eina::eina_init eina_init;
|
||||||
efl::eo::eo_init eo_init;
|
efl::eo::eo_init eo_init;
|
||||||
|
|
||||||
efl::eina::list<simple> list;
|
efl::eina::list<nonamespace::Simple> list;
|
||||||
|
|
||||||
simple const w1;
|
nonamespace::Simple const w1;
|
||||||
simple const w2;
|
nonamespace::Simple const w2;
|
||||||
simple const w3;
|
nonamespace::Simple const w3;
|
||||||
simple const w4;
|
nonamespace::Simple const w4;
|
||||||
|
|
||||||
list.push_back(w1);
|
list.push_back(w1);
|
||||||
list.push_back(w2);
|
list.push_back(w2);
|
||||||
list.push_back(w3);
|
list.push_back(w3);
|
||||||
list.push_back(w4);
|
list.push_back(w4);
|
||||||
|
|
||||||
efl::eina::iterator<simple> iterator = list.ibegin()
|
efl::eina::iterator<nonamespace::Simple> iterator = list.ibegin()
|
||||||
, last_iterator = list.iend();
|
, last_iterator = list.iend();
|
||||||
|
|
||||||
simple const result[] = {w1, w2, w3, w4};
|
nonamespace::Simple const result[] = {w1, w2, w3, w4};
|
||||||
|
|
||||||
ck_assert(std::equal(iterator, last_iterator, result));
|
ck_assert(std::equal(iterator, last_iterator, result));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Eo.hh>
|
||||||
|
|
||||||
#include <a.eo.hh>
|
#include <a.eo.hh>
|
||||||
#include <b.eo.hh>
|
#include <b.eo.hh>
|
||||||
#include <c.eo.hh>
|
#include <c.eo.hh>
|
||||||
|
@ -13,12 +15,12 @@ START_TEST(eolian_cxx_test_addess_of_conversions)
|
||||||
{
|
{
|
||||||
efl::eo::eo_init init;
|
efl::eo::eo_init init;
|
||||||
|
|
||||||
d d_obj;
|
nonamespace::D d_obj;
|
||||||
|
|
||||||
a* a_ptr = &d_obj;
|
nonamespace::A* a_ptr = &d_obj;
|
||||||
b* b_ptr = &d_obj;
|
nonamespace::B* b_ptr = &d_obj;
|
||||||
c* c_ptr = &d_obj;
|
nonamespace::C* c_ptr = &d_obj;
|
||||||
d* d_ptr = &d_obj;
|
nonamespace::D* d_ptr = &d_obj;
|
||||||
|
|
||||||
fail_unless(a_ptr == (void*) b_ptr);
|
fail_unless(a_ptr == (void*) b_ptr);
|
||||||
fail_unless(a_ptr == (void*) c_ptr);
|
fail_unless(a_ptr == (void*) c_ptr);
|
||||||
|
|
|
@ -12,7 +12,7 @@ START_TEST(eolian_cxx_test_binding_constructor_only_required)
|
||||||
|
|
||||||
bool called1 = false;
|
bool called1 = false;
|
||||||
|
|
||||||
generic g(
|
nonamespace::Generic g(
|
||||||
g.required_ctor_a(1),
|
g.required_ctor_a(1),
|
||||||
g.required_ctor_b(std::bind([&called1] { called1 = true; }))
|
g.required_ctor_b(std::bind([&called1] { called1 = true; }))
|
||||||
);
|
);
|
||||||
|
@ -32,7 +32,7 @@ START_TEST(eolian_cxx_test_binding_constructor_all_optionals)
|
||||||
bool called1 = false;
|
bool called1 = false;
|
||||||
bool called2 = false;
|
bool called2 = false;
|
||||||
|
|
||||||
generic g(
|
nonamespace::Generic g(
|
||||||
g.required_ctor_a(2),
|
g.required_ctor_a(2),
|
||||||
g.required_ctor_b(std::bind([&called1] { called1 = true; })),
|
g.required_ctor_b(std::bind([&called1] { called1 = true; })),
|
||||||
g.optional_ctor_a(3),
|
g.optional_ctor_a(3),
|
||||||
|
|
|
@ -20,7 +20,7 @@ START_TEST(eolian_cxx_test_callback_method)
|
||||||
{
|
{
|
||||||
efl::eo::eo_init i;
|
efl::eo::eo_init i;
|
||||||
|
|
||||||
callback c;
|
nonamespace::Callback c;
|
||||||
|
|
||||||
bool called1 = false, called2 = false;
|
bool called1 = false, called2 = false;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ START_TEST(eolian_cxx_test_callback_event_add)
|
||||||
{
|
{
|
||||||
efl::eo::eo_init i;
|
efl::eo::eo_init i;
|
||||||
|
|
||||||
callback c;
|
nonamespace::Callback c;
|
||||||
|
|
||||||
bool called1 = false, called2 = false;
|
bool called1 = false, called2 = false;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ START_TEST(eolian_cxx_test_callback_event_del)
|
||||||
{
|
{
|
||||||
efl::eo::eo_init i;
|
efl::eo::eo_init i;
|
||||||
|
|
||||||
callback c;
|
nonamespace::Callback c;
|
||||||
|
|
||||||
int called1 = 0, called2 = 0, called3 = 0, called4 = 0;
|
int called1 = 0, called2 = 0, called3 = 0, called4 = 0;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ START_TEST(eolian_cxx_test_global_callback)
|
||||||
|
|
||||||
bool called = false;
|
bool called = false;
|
||||||
|
|
||||||
callback::test_global_callbacks(std::bind([&called] { called = true; }));
|
nonamespace::Callback::test_global_callbacks(std::bind([&called] { called = true; }));
|
||||||
|
|
||||||
fail_if(!called);
|
fail_if(!called);
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ END_TEST
|
||||||
START_TEST(eolian_cxx_test_disconnect_inside_callback)
|
START_TEST(eolian_cxx_test_disconnect_inside_callback)
|
||||||
{
|
{
|
||||||
efl::eo::eo_init i;
|
efl::eo::eo_init i;
|
||||||
callback c;
|
nonamespace::Callback c;
|
||||||
|
|
||||||
std::vector<long> capture_me;
|
std::vector<long> capture_me;
|
||||||
int times_called = 0;
|
int times_called = 0;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "eolian_cxx_suite.h"
|
#include "eolian_cxx_suite.h"
|
||||||
|
|
||||||
struct bar
|
struct bar
|
||||||
: efl::eo::inherit<bar, simple>
|
: efl::eo::inherit<bar, nonamespace::Simple>
|
||||||
{
|
{
|
||||||
bar()
|
bar()
|
||||||
: inherit_base(efl::eo::parent = nullptr)
|
: inherit_base(efl::eo::parent = nullptr)
|
||||||
|
@ -23,7 +23,7 @@ struct bar
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void foo(simple is)
|
void foo(nonamespace::Simple is)
|
||||||
{
|
{
|
||||||
fail_if(is.simple_get());
|
fail_if(is.simple_get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ START_TEST(eolian_cxx_test_wrapper_size)
|
||||||
efl::eo::eo_init init;
|
efl::eo::eo_init init;
|
||||||
|
|
||||||
::efl::eo::concrete b(nullptr);
|
::efl::eo::concrete b(nullptr);
|
||||||
::callback c;
|
::nonamespace::Callback c;
|
||||||
|
|
||||||
fail_if(sizeof(b) != sizeof(Eo*));
|
fail_if(sizeof(b) != sizeof(Eo*));
|
||||||
fail_if(sizeof(b) != sizeof(c));
|
fail_if(sizeof(b) != sizeof(c));
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
#include <Eo.h>
|
||||||
|
|
||||||
|
struct Name_Name_Data {};
|
||||||
|
typedef struct Name_Name_Data Name_Name_Data;
|
||||||
|
|
||||||
|
#include "name_name.eo.h"
|
||||||
|
#include "name_name.eo.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
class Name.Name {
|
||||||
|
legacy_prefix: null;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
#include <Eo.h>
|
||||||
|
|
||||||
|
#include "name_name.eo.h"
|
||||||
|
#include "name_name.eo.hh"
|
||||||
|
|
Loading…
Reference in New Issue