eolian-cxx: WIP: Remove .Base requirement

This commit is contained in:
Felipe Magno de Almeida 2016-03-18 17:48:47 -03:00
parent 2b249423e7
commit c42254a24e
6 changed files with 43 additions and 9 deletions

View File

@ -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_wrapper.cc \
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/eolian_cxx_test_inheritance.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-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 += \
tests/eolian_cxx/callback.eo.hh \
tests/eolian_cxx/callback.eo.c \

View File

@ -59,7 +59,7 @@ class_base_file(Eolian_Class const& klass)
inline std::string
class_name(Eolian_Class const& klass)
{
return safe_lower(::eolian_class_name_get(&klass));
return ::eolian_class_name_get(&klass);
}
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.name = normalize_spaces(name_);
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 */
event.comment = safe_str("");
}

View File

@ -27,14 +27,26 @@ 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)
auto current = fullname.begin(), last = fullname.end();
auto found = std::find(current, last, '.');
std::string new_string;
while (current != last)
{
s.replace(found, 1, "::");
found = s.find(".");
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 += "::";
current = std::next(found);
found = std::find(current, last, '.');
}
}
return s;
return new_string;
}
inline bool
@ -60,7 +72,7 @@ type_from_eolian(Eolian_Type const& type)
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))));
x.binding = "::" + class_format_cxx(safe_str(::eolian_class_full_name_get(klass)));
Eina_Stringshare* klass_file = ::eolian_class_file_get(klass);
if (klass_file)

View File

@ -0,0 +1,7 @@
#include <Eo.h>
struct Name_Name_Data {};
#include "name_name.eo.h"
#include "name_name.eo.c"

View File

@ -0,0 +1,4 @@
class Name.Name {
legacy_prefix: null;
}

View File

@ -0,0 +1,6 @@
#include <Eo.h>
#include "name_name.eo.h"
#include "name_name.eo.hh"