forked from enlightenment/efl
cxx: Place beta API declarations behind ifdef
NOTE: protected APIs are placed behind ifdef as well in the implementation file. This makes sense since the define is required for the C code to compile, but this isn't what @protected means.
This commit is contained in:
parent
2dd1e59a4c
commit
3f64dcc521
|
@ -33,7 +33,7 @@ struct base_class_definition_generator
|
||||||
"struct " << string << " {\n"
|
"struct " << string << " {\n"
|
||||||
).generate(sink, cls.cxx_name, context)) return false;
|
).generate(sink, cls.cxx_name, context)) return false;
|
||||||
|
|
||||||
if(!as_generator(*(scope_tab << function_declaration))
|
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;
|
||||||
|
|
||||||
// static Efl_Class const* _eo_class();
|
// static Efl_Class const* _eo_class();
|
||||||
|
|
|
@ -87,7 +87,7 @@ 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;
|
||||||
|
|
||||||
if(!as_generator(*(scope_tab << function_declaration))
|
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;
|
||||||
|
|
||||||
// static Efl_Class const* _eo_class();
|
// static Efl_Class const* _eo_class();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "grammar/generator.hpp"
|
#include "grammar/generator.hpp"
|
||||||
#include "grammar/klass_def.hpp"
|
#include "grammar/klass_def.hpp"
|
||||||
|
|
||||||
|
#include "grammar/string.hpp"
|
||||||
#include "grammar/indentation.hpp"
|
#include "grammar/indentation.hpp"
|
||||||
#include "grammar/list.hpp"
|
#include "grammar/list.hpp"
|
||||||
#include "grammar/alternative.hpp"
|
#include "grammar/alternative.hpp"
|
||||||
|
@ -15,13 +16,43 @@ namespace efl { namespace eolian { namespace grammar {
|
||||||
|
|
||||||
struct function_declaration_generator
|
struct function_declaration_generator
|
||||||
{
|
{
|
||||||
|
function_declaration_generator(attributes::klass_name const& name)
|
||||||
|
: _klass_name(name)
|
||||||
|
{}
|
||||||
|
|
||||||
template <typename OutputIterator, typename Context>
|
template <typename OutputIterator, typename Context>
|
||||||
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
|
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& ctx) const
|
||||||
{
|
{
|
||||||
return as_generator
|
std::string suffix;
|
||||||
("::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "(" << (parameter % ", ") << ") const;\n")
|
switch(_klass_name.type)
|
||||||
.generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), context);
|
{
|
||||||
|
case attributes::class_type::regular:
|
||||||
|
case attributes::class_type::abstract_:
|
||||||
|
suffix = "CLASS";
|
||||||
|
break;
|
||||||
|
case attributes::class_type::mixin:
|
||||||
|
suffix = "MIXIN";
|
||||||
|
break;
|
||||||
|
case attributes::class_type::interface_:
|
||||||
|
suffix = "INTERFACE";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)))
|
||||||
|
return false;
|
||||||
|
if(!as_generator
|
||||||
|
("::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "(" << (parameter % ", ") << ") const;\n")
|
||||||
|
.generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), ctx))
|
||||||
|
return false;
|
||||||
|
if(f.is_beta &&
|
||||||
|
!as_generator("#endif\n").generate(sink, attributes::unused, ctx))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes::klass_name _klass_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -32,7 +63,13 @@ template <>
|
||||||
struct attributes_needed<function_declaration_generator> : std::integral_constant<int, 1> {};
|
struct attributes_needed<function_declaration_generator> : std::integral_constant<int, 1> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
function_declaration_generator const function_declaration = {};
|
struct function_declaration_terminal
|
||||||
|
{
|
||||||
|
function_declaration_generator operator()(attributes::klass_name name) const
|
||||||
|
{
|
||||||
|
return function_declaration_generator{name};
|
||||||
|
}
|
||||||
|
} const function_declaration = {};
|
||||||
|
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue