forked from enlightenment/efl
cxx: Only use eo_cxx:: for methods
Add an experimental (disabled) macro to only generate functions inside the eo_cxx equivalent of a class, instead of inside both the eo_cxx and the normal class definition. I guess the duplicated definition had something to do with doxygen, but I'm not sure this is quite necessary as doc will be generated with custom scripts.
This commit is contained in:
parent
12d50cbe19
commit
a787c3cc07
|
@ -27,15 +27,21 @@ struct class_definition_generator
|
||||||
auto open_namespace = *("namespace " << string << " { ") << "\n";
|
auto open_namespace = *("namespace " << string << " { ") << "\n";
|
||||||
if(!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context))) return false;
|
if(!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context))) return false;
|
||||||
|
|
||||||
if(!as_generator
|
#ifdef USE_EOCXX_INHERIT_ONLY
|
||||||
(
|
if(!as_generator("struct " << string << " : private ::efl::eo::concrete\n"
|
||||||
"struct " << string << " : private ::efl::eo::concrete"
|
<< scope_tab << ", ::eo_cxx"
|
||||||
)
|
<< *("::" << lower_case[string]) << "::" << string)
|
||||||
|
.generate(sink, std::make_tuple(cls.cxx_name, attributes::cpp_namespaces(cls.namespaces), cls.cxx_name), context))
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if(!as_generator("struct " << string << " : private ::efl::eo::concrete")
|
||||||
.generate(sink, cls.cxx_name, context))
|
.generate(sink, cls.cxx_name, context))
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
for(auto&& i : cls.inherits)
|
for(auto&& i : cls.inherits)
|
||||||
{
|
{
|
||||||
if(!as_generator("\n" << scope_tab << ", EO_CXX_INHERIT(" << *(" ::" << lower_case[string]) << "::" << string << ")")
|
if(!as_generator("\n" << scope_tab << ", EO_CXX_INHERIT(" << *("::" << lower_case[string]) << "::" << string << ")")
|
||||||
.generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context))
|
.generate(sink, std::make_tuple(attributes::cpp_namespaces(i.namespaces), i.eolian_name), context))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +95,10 @@ struct class_definition_generator
|
||||||
// << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add( ::efl::eo::concrete{nullptr}, f)) {}\n"
|
// << scope_tab << scope_tab << ": ::efl::eo::concrete( ::efl::eo::do_eo_add( ::efl::eo::concrete{nullptr}, f)) {}\n"
|
||||||
).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) return false;
|
).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), context)) return false;
|
||||||
|
|
||||||
|
#ifndef USE_EOCXX_INHERIT_ONLY
|
||||||
if(!as_generator(*(scope_tab << function_declaration(get_klass_name(cls))))
|
if(!as_generator(*(scope_tab << function_declaration(get_klass_name(cls))))
|
||||||
.generate(sink, cls.functions, context)) return false;
|
.generate(sink, cls.functions, context)) return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// static Efl_Class const* _eo_class();
|
// static Efl_Class const* _eo_class();
|
||||||
std::string suffix;
|
std::string suffix;
|
||||||
|
|
|
@ -27,12 +27,14 @@ struct class_implementation_generator
|
||||||
auto class_name = *(lit("::") << lower_case[string]) << "::" << string;
|
auto class_name = *(lit("::") << lower_case[string]) << "::" << string;
|
||||||
return as_generator
|
return as_generator
|
||||||
(
|
(
|
||||||
|
#ifndef USE_EOCXX_INHERIT_ONLY
|
||||||
(namespaces
|
(namespaces
|
||||||
[*function_definition(get_klass_name(cls))]
|
[*function_definition(get_klass_name(cls))]
|
||||||
<< "\n"
|
<< "\n"
|
||||||
)).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx)
|
)).generate(sink, std::make_tuple(cls.namespaces, cls.functions), ctx)
|
||||||
&& as_generator
|
&& as_generator
|
||||||
(
|
(
|
||||||
|
#endif
|
||||||
attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3>
|
attribute_reorder<0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3>
|
||||||
(
|
(
|
||||||
"namespace eo_cxx {\n"
|
"namespace eo_cxx {\n"
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
// EXPERIMENTAL
|
||||||
|
//#define USE_EOCXX_INHERIT_ONLY
|
||||||
|
|
||||||
namespace efl { namespace eolian { namespace grammar {
|
namespace efl { namespace eolian { namespace grammar {
|
||||||
|
|
||||||
template <typename T, typename Enable = void>
|
template <typename T, typename Enable = void>
|
||||||
|
|
Loading…
Reference in New Issue