efl_mono: Reorganize utility functions.
Summary: Blacklist functions are all in the header/namespace blacklist. Helper functions returning strings (names) are in the name_helpers header. They act somewhat like "mini-generators". Helpers.hh was left with other kind of helper functions (checks, etc) that do not return strings. Depends on D5992 Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5993
This commit is contained in:
parent
628e5ab950
commit
429d7510b0
|
@ -1,8 +1,15 @@
|
||||||
#ifndef EOLIAN_MONO_FUNCTION_BLACKLIST_HH
|
#ifndef EOLIAN_MONO_BLACKLIST_HH
|
||||||
#define EOLIAN_MONO_FUNCTION_BLACKLIST_HH
|
#define EOLIAN_MONO_BLACKLIST_HH
|
||||||
|
|
||||||
|
#include "grammar/klass_def.hpp"
|
||||||
|
#include "name_helpers.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
|
namespace blacklist {
|
||||||
|
|
||||||
|
namespace attributes = efl::eolian::grammar::attributes;
|
||||||
|
|
||||||
inline bool is_function_blacklisted(std::string const& c_name)
|
inline bool is_function_blacklisted(std::string const& c_name)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
@ -46,6 +53,28 @@ inline bool is_function_blacklisted(std::string const& c_name)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Blacklist structs that require some kind of manual binding.
|
||||||
|
inline bool is_struct_blacklisted(std::string const& full_name)
|
||||||
|
{
|
||||||
|
return full_name == "Efl.Event.Description"
|
||||||
|
|| full_name == "Eina.Binbuf"
|
||||||
|
|| full_name == "Eina.Strbuf"
|
||||||
|
|| full_name == "Eina.Slice"
|
||||||
|
|| full_name == "Eina.Rw_Slice";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool is_struct_blacklisted(attributes::struct_def const& struct_)
|
||||||
|
{
|
||||||
|
return is_struct_blacklisted(name_helpers::struct_full_name(struct_));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool is_struct_blacklisted(attributes::regular_type_def const& struct_)
|
||||||
|
{
|
||||||
|
return is_struct_blacklisted(name_helpers::type_full_name(struct_));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -11,6 +11,7 @@
|
||||||
#include "parameter.hh"
|
#include "parameter.hh"
|
||||||
#include "keyword.hh"
|
#include "keyword.hh"
|
||||||
#include "using_decl.hh"
|
#include "using_decl.hh"
|
||||||
|
#include "blacklist.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ struct function_declaration_generator
|
||||||
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& context) const
|
||||||
{
|
{
|
||||||
if(is_function_blacklisted(f.c_name) || f.is_static)
|
if(blacklist::is_function_blacklisted(f.c_name) || f.is_static)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(!as_generator(documentation).generate(sink, f, context))
|
if(!as_generator(documentation).generate(sink, f, context))
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "grammar/alternative.hpp"
|
#include "grammar/alternative.hpp"
|
||||||
#include "grammar/attribute_reorder.hpp"
|
#include "grammar/attribute_reorder.hpp"
|
||||||
#include "type.hh"
|
#include "type.hh"
|
||||||
|
#include "name_helpers.hh"
|
||||||
#include "helpers.hh"
|
#include "helpers.hh"
|
||||||
#include "function_helpers.hh"
|
#include "function_helpers.hh"
|
||||||
#include "marshall_type.hh"
|
#include "marshall_type.hh"
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
#include "documentation.hh"
|
#include "documentation.hh"
|
||||||
#include "using_decl.hh"
|
#include "using_decl.hh"
|
||||||
#include "generation_contexts.hh"
|
#include "generation_contexts.hh"
|
||||||
|
#include "blacklist.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ struct native_function_definition_generator
|
||||||
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& context) const
|
||||||
{
|
{
|
||||||
if(is_function_blacklisted(f.c_name) || f.is_static) // Only Concrete classes implement static methods.
|
if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) // Only Concrete classes implement static methods.
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -134,7 +136,7 @@ struct function_definition_generator
|
||||||
{
|
{
|
||||||
if(do_super && f.is_static) // Static methods goes only on Concrete classes.
|
if(do_super && f.is_static) // Static methods goes only on Concrete classes.
|
||||||
return true;
|
return true;
|
||||||
if(is_function_blacklisted(f.c_name))
|
if(blacklist::is_function_blacklisted(f.c_name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(!as_generator
|
if(!as_generator
|
||||||
|
@ -165,7 +167,7 @@ struct function_definition_generator
|
||||||
<< ") {\n "
|
<< ") {\n "
|
||||||
<< eolian_mono::function_definition_preamble() << string << "("
|
<< eolian_mono::function_definition_preamble() << string << "("
|
||||||
<< (do_super ? "efl.eo.Globals.efl_super(" : "")
|
<< (do_super ? "efl.eo.Globals.efl_super(" : "")
|
||||||
<< (f.is_static ? helpers::klass_get_name(f.klass) + "()": "this.raw_handle")
|
<< (f.is_static ? name_helpers::klass_get_name(f.klass) + "()": "this.raw_handle")
|
||||||
<< (do_super ? ", this.raw_klass)" : "")
|
<< (do_super ? ", this.raw_klass)" : "")
|
||||||
<< *(", " << argument_invocation ) << ");\n"
|
<< *(", " << argument_invocation ) << ");\n"
|
||||||
<< eolian_mono::function_definition_epilogue()
|
<< eolian_mono::function_definition_epilogue()
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "keyword.hh"
|
#include "keyword.hh"
|
||||||
#include "using_decl.hh"
|
#include "using_decl.hh"
|
||||||
#include "generation_contexts.hh"
|
#include "generation_contexts.hh"
|
||||||
|
#include "blacklist.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ struct function_registration_generator
|
||||||
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& context) const
|
||||||
{
|
{
|
||||||
if(is_function_blacklisted(f.c_name) || f.is_static) // Static methods aren't overrideable
|
if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) // Static methods aren't overrideable
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,65 +2,20 @@
|
||||||
#define EOLIAN_MONO_HELPERS_HH
|
#define EOLIAN_MONO_HELPERS_HH
|
||||||
|
|
||||||
#include "grammar/klass_def.hpp"
|
#include "grammar/klass_def.hpp"
|
||||||
#include "utils.hh"
|
#include "blacklist.hh"
|
||||||
|
#include "name_helpers.hh"
|
||||||
/* General helper functions for the main generators.
|
|
||||||
*
|
|
||||||
* These range from blacklisting structures to 'nano-generators' (functions that receive
|
|
||||||
* a binding-specifict structure and returns a string).
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
namespace helpers {
|
namespace helpers {
|
||||||
|
|
||||||
|
/* General helpers, not related directly with generating strings (those go in the name_helpers.hh). */
|
||||||
|
|
||||||
namespace attributes = efl::eolian::grammar::attributes;
|
namespace attributes = efl::eolian::grammar::attributes;
|
||||||
|
|
||||||
inline std::string type_full_name(attributes::regular_type_def const& type)
|
|
||||||
{
|
|
||||||
std::string full_name;
|
|
||||||
for (auto& name : type.namespaces)
|
|
||||||
{
|
|
||||||
full_name += name + ".";
|
|
||||||
}
|
|
||||||
full_name += type.base_type;
|
|
||||||
return full_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string struct_full_name(attributes::struct_def const& struct_)
|
|
||||||
{
|
|
||||||
std::string full_name;
|
|
||||||
for (auto& name : struct_.namespaces)
|
|
||||||
{
|
|
||||||
full_name += name + ".";
|
|
||||||
}
|
|
||||||
full_name += struct_.cxx_name;
|
|
||||||
return full_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Blacklist structs that require some kind of manual binding.
|
|
||||||
inline bool is_struct_blacklisted(std::string const& full_name)
|
|
||||||
{
|
|
||||||
return full_name == "Efl.Event.Description"
|
|
||||||
|| full_name == "Eina.Binbuf"
|
|
||||||
|| full_name == "Eina.Strbuf"
|
|
||||||
|| full_name == "Eina.Slice"
|
|
||||||
|| full_name == "Eina.Rw_Slice";
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool is_struct_blacklisted(attributes::struct_def const& struct_)
|
|
||||||
{
|
|
||||||
return is_struct_blacklisted(struct_full_name(struct_));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool is_struct_blacklisted(attributes::regular_type_def const& struct_)
|
|
||||||
{
|
|
||||||
return is_struct_blacklisted(type_full_name(struct_));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool need_struct_conversion(attributes::regular_type_def const* regular)
|
inline bool need_struct_conversion(attributes::regular_type_def const* regular)
|
||||||
{
|
{
|
||||||
return regular && regular->is_struct() && !is_struct_blacklisted(*regular);
|
return regular && regular->is_struct() && !blacklist::is_struct_blacklisted(*regular);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool need_struct_conversion(attributes::parameter_def const& param, attributes::regular_type_def const* regular)
|
inline bool need_struct_conversion(attributes::parameter_def const& param, attributes::regular_type_def const* regular)
|
||||||
|
@ -93,7 +48,7 @@ inline bool need_pointer_conversion(attributes::regular_type_def const* regular)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (regular->is_enum()
|
if (regular->is_enum()
|
||||||
|| (regular->is_struct() && type_full_name(*regular) != "Eina.Binbuf")
|
|| (regular->is_struct() && name_helpers::type_full_name(*regular) != "Eina.Binbuf")
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -110,38 +65,6 @@ inline bool need_pointer_conversion(attributes::regular_type_def const* regular)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string to_field_name(std::string const& in)
|
|
||||||
{
|
|
||||||
return utils::capitalize(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string klass_name_to_csharp(attributes::klass_name const& clsname)
|
|
||||||
{
|
|
||||||
std::ostringstream output;
|
|
||||||
|
|
||||||
for (auto namesp : clsname.namespaces)
|
|
||||||
output << utils::to_lowercase(namesp) << ".";
|
|
||||||
|
|
||||||
output << clsname.eolian_name;
|
|
||||||
|
|
||||||
return output.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string klass_get_name(attributes::klass_name const &clsname)
|
|
||||||
{
|
|
||||||
std::ostringstream output;
|
|
||||||
|
|
||||||
output << klass_name_to_csharp(clsname);
|
|
||||||
output << "Concrete.";
|
|
||||||
|
|
||||||
for (auto namesp : clsname.namespaces)
|
|
||||||
output << utils::to_lowercase(namesp) << "_";
|
|
||||||
output << utils::to_lowercase(clsname.eolian_name);
|
|
||||||
output << "_class_get";
|
|
||||||
|
|
||||||
return output.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace helpers
|
} // namespace helpers
|
||||||
|
|
||||||
} // namespace eolian_mono
|
} // namespace eolian_mono
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "grammar/integral.hpp"
|
#include "grammar/integral.hpp"
|
||||||
#include "grammar/generator.hpp"
|
#include "grammar/generator.hpp"
|
||||||
#include "grammar/klass_def.hpp"
|
#include "grammar/klass_def.hpp"
|
||||||
#include "function_blacklist.hh"
|
#include "blacklist.hh"
|
||||||
|
|
||||||
#include "grammar/indentation.hpp"
|
#include "grammar/indentation.hpp"
|
||||||
#include "grammar/list.hpp"
|
#include "grammar/list.hpp"
|
||||||
|
@ -74,7 +74,7 @@ get_inheritable_function_count(grammar::attributes::klass_def const& cls)
|
||||||
auto methods = cls.get_all_methods();
|
auto methods = cls.get_all_methods();
|
||||||
return std::count_if(methods.cbegin(), methods.cend(), [](grammar::attributes::function_def const& func)
|
return std::count_if(methods.cbegin(), methods.cend(), [](grammar::attributes::function_def const& func)
|
||||||
{
|
{
|
||||||
return !is_function_blacklisted(func.c_name) && !func.is_static;
|
return !blacklist::is_function_blacklisted(func.c_name) && !func.is_static;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ struct klass
|
||||||
|
|
||||||
for (auto &&p : cls.parts)
|
for (auto &&p : cls.parts)
|
||||||
if (!as_generator(
|
if (!as_generator(
|
||||||
helpers::klass_name_to_csharp(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n"
|
name_helpers::klass_name_to_csharp(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n"
|
||||||
).generate(sink, attributes::unused, iface_cxt))
|
).generate(sink, attributes::unused, iface_cxt))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "namespace.hh"
|
#include "namespace.hh"
|
||||||
#include "type_impl.hh"
|
#include "type_impl.hh"
|
||||||
#include "generation_contexts.hh"
|
#include "generation_contexts.hh"
|
||||||
|
#include "blacklist.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
|
@ -155,7 +156,7 @@ struct marshall_type_visitor_generate
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (regular.is_struct() && !helpers::is_struct_blacklisted(regular) && !(bool)(regular.base_qualifier & qualifier_info::is_own))
|
if (regular.is_struct() && !blacklist::is_struct_blacklisted(regular) && !(bool)(regular.base_qualifier & qualifier_info::is_own))
|
||||||
{
|
{
|
||||||
if ((is_out || is_return) && is_ptr)
|
if ((is_out || is_return) && is_ptr)
|
||||||
return as_generator(" System.IntPtr").generate(sink, attributes::unused, *context);
|
return as_generator(" System.IntPtr").generate(sink, attributes::unused, *context);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "utils.hh"
|
#include "utils.hh"
|
||||||
|
|
||||||
|
#include "grammar/klass_def.hpp"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
/* Utility functions for naming things. Compared to the utils.hh, this header has higher level
|
/* Utility functions for naming things. Compared to the utils.hh, this header has higher level
|
||||||
|
@ -17,6 +19,8 @@ namespace eolian_mono {
|
||||||
*/
|
*/
|
||||||
namespace name_helpers {
|
namespace name_helpers {
|
||||||
|
|
||||||
|
namespace attributes = efl::eolian::grammar::attributes;
|
||||||
|
|
||||||
static const std::vector<std::string> verbs =
|
static const std::vector<std::string> verbs =
|
||||||
{
|
{
|
||||||
"add",
|
"add",
|
||||||
|
@ -108,11 +112,65 @@ void reorder_verb(std::vector<std::string> &names)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string managed_event_name(std::string const& name)
|
inline std::string managed_event_name(std::string const& name)
|
||||||
{
|
{
|
||||||
return utils::to_pascal_case(utils::split(name, ','), "") + "Evt";
|
return utils::to_pascal_case(utils::split(name, ','), "") + "Evt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::string type_full_name(attributes::regular_type_def const& type)
|
||||||
|
{
|
||||||
|
std::string full_name;
|
||||||
|
for (auto& name : type.namespaces)
|
||||||
|
{
|
||||||
|
full_name += name + ".";
|
||||||
|
}
|
||||||
|
full_name += type.base_type;
|
||||||
|
return full_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string struct_full_name(attributes::struct_def const& struct_)
|
||||||
|
{
|
||||||
|
std::string full_name;
|
||||||
|
for (auto& name : struct_.namespaces)
|
||||||
|
{
|
||||||
|
full_name += name + ".";
|
||||||
|
}
|
||||||
|
full_name += struct_.cxx_name;
|
||||||
|
return full_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_field_name(std::string const& in)
|
||||||
|
{
|
||||||
|
return utils::capitalize(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string klass_name_to_csharp(attributes::klass_name const& clsname)
|
||||||
|
{
|
||||||
|
std::ostringstream output;
|
||||||
|
|
||||||
|
for (auto namesp : clsname.namespaces)
|
||||||
|
output << utils::to_lowercase(namesp) << ".";
|
||||||
|
|
||||||
|
output << clsname.eolian_name;
|
||||||
|
|
||||||
|
return output.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string klass_get_name(attributes::klass_name const &clsname)
|
||||||
|
{
|
||||||
|
std::ostringstream output;
|
||||||
|
|
||||||
|
output << klass_name_to_csharp(clsname);
|
||||||
|
output << "Concrete.";
|
||||||
|
|
||||||
|
for (auto namesp : clsname.namespaces)
|
||||||
|
output << utils::to_lowercase(namesp) << "_";
|
||||||
|
output << utils::to_lowercase(clsname.eolian_name);
|
||||||
|
output << "_class_get";
|
||||||
|
|
||||||
|
return output.str();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace name_helpers
|
} // namespace name_helpers
|
||||||
|
|
||||||
} // namespace eolian_mono
|
} // namespace eolian_mono
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "grammar/indentation.hpp"
|
#include "grammar/indentation.hpp"
|
||||||
|
|
||||||
#include "utils.hh"
|
#include "utils.hh"
|
||||||
|
#include "name_helpers.hh"
|
||||||
#include "documentation.hh"
|
#include "documentation.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
@ -17,7 +18,7 @@ struct part_definition_generator
|
||||||
template <typename OutputIterator, typename Context>
|
template <typename OutputIterator, typename Context>
|
||||||
bool generate(OutputIterator sink, attributes::part_def const& part, Context const& context) const
|
bool generate(OutputIterator sink, attributes::part_def const& part, Context const& context) const
|
||||||
{
|
{
|
||||||
std::string part_klass_name = helpers::klass_name_to_csharp(part.klass);
|
std::string part_klass_name = name_helpers::klass_name_to_csharp(part.klass);
|
||||||
return as_generator(scope_tab << documentation
|
return as_generator(scope_tab << documentation
|
||||||
<< scope_tab << "public " << part_klass_name << " " << utils::capitalize(part.name) << "\n"
|
<< scope_tab << "public " << part_klass_name << " " << utils::capitalize(part.name) << "\n"
|
||||||
<< scope_tab << "{\n"
|
<< scope_tab << "{\n"
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
#include "grammar/indentation.hpp"
|
#include "grammar/indentation.hpp"
|
||||||
#include "grammar/list.hpp"
|
#include "grammar/list.hpp"
|
||||||
#include "grammar/alternative.hpp"
|
#include "grammar/alternative.hpp"
|
||||||
|
#include "name_helpers.hh"
|
||||||
#include "helpers.hh"
|
#include "helpers.hh"
|
||||||
#include "type.hh"
|
#include "type.hh"
|
||||||
#include "keyword.hh"
|
#include "keyword.hh"
|
||||||
#include "using_decl.hh"
|
#include "using_decl.hh"
|
||||||
#include "documentation.hh"
|
#include "documentation.hh"
|
||||||
#include "struct_fields.hh"
|
#include "struct_fields.hh"
|
||||||
|
#include "blacklist.hh"
|
||||||
|
|
||||||
namespace eolian_mono {
|
namespace eolian_mono {
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ struct struct_definition_generator
|
||||||
documentation(1)
|
documentation(1)
|
||||||
<< scope_tab(1) << "public " << type << " " << string << ";\n"
|
<< scope_tab(1) << "public " << type << " " << string << ";\n"
|
||||||
)
|
)
|
||||||
.generate(sink, std::make_tuple(field, field.type, helpers::to_field_name(field.name)), context))
|
.generate(sink, std::make_tuple(field, field.type, name_helpers::to_field_name(field.name)), context))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +106,7 @@ struct struct_internal_definition_generator
|
||||||
// iterate struct fields
|
// iterate struct fields
|
||||||
for (auto const& field : struct_.fields)
|
for (auto const& field : struct_.fields)
|
||||||
{
|
{
|
||||||
auto field_name = helpers::to_field_name(field.name);
|
auto field_name = name_helpers::to_field_name(field.name);
|
||||||
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
|
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
|
||||||
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
|
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
|
||||||
|
|
||||||
|
@ -165,7 +167,7 @@ struct to_internal_field_convert_generator
|
||||||
template <typename OutputIterator, typename Context>
|
template <typename OutputIterator, typename Context>
|
||||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||||
{
|
{
|
||||||
auto field_name = helpers::to_field_name(field.name);
|
auto field_name = name_helpers::to_field_name(field.name);
|
||||||
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
|
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
|
||||||
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
|
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
|
||||||
auto complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
|
auto complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
|
||||||
|
@ -259,7 +261,7 @@ struct to_external_field_convert_generator
|
||||||
template <typename OutputIterator, typename Context>
|
template <typename OutputIterator, typename Context>
|
||||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||||
{
|
{
|
||||||
auto field_name = helpers::to_field_name(field.name);
|
auto field_name = name_helpers::to_field_name(field.name);
|
||||||
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
|
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
|
||||||
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
|
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
|
||||||
auto complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
|
auto complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
|
||||||
|
@ -439,7 +441,7 @@ struct struct_entities_generator
|
||||||
template <typename OutputIterator, typename Context>
|
template <typename OutputIterator, typename Context>
|
||||||
bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
|
bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
|
||||||
{
|
{
|
||||||
if (helpers::is_struct_blacklisted(struct_))
|
if (blacklist::is_struct_blacklisted(struct_))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
std::vector<std::string> cpp_namespaces = escape_namespace(attributes::cpp_namespaces(struct_.namespaces));
|
std::vector<std::string> cpp_namespaces = escape_namespace(attributes::cpp_namespaces(struct_.namespaces));
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "grammar/indentation.hpp"
|
#include "grammar/indentation.hpp"
|
||||||
#include "grammar/list.hpp"
|
#include "grammar/list.hpp"
|
||||||
#include "grammar/alternative.hpp"
|
#include "grammar/alternative.hpp"
|
||||||
#include "helpers.hh"
|
#include "name_helpers.hh"
|
||||||
#include "type.hh"
|
#include "type.hh"
|
||||||
#include "keyword.hh"
|
#include "keyword.hh"
|
||||||
#include "using_decl.hh"
|
#include "using_decl.hh"
|
||||||
|
@ -20,7 +20,7 @@ struct field_argument_default_generator
|
||||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||||
{
|
{
|
||||||
if (!as_generator(type << " " << string << "=default(" << type << ")")
|
if (!as_generator(type << " " << string << "=default(" << type << ")")
|
||||||
.generate(sink, std::make_tuple(field.type, helpers::to_field_name(field.name), field.type), context))
|
.generate(sink, std::make_tuple(field.type, name_helpers::to_field_name(field.name), field.type), context))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ struct field_argument_assignment_generator
|
||||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||||
{
|
{
|
||||||
if (!as_generator("this." << string << " = " << string)
|
if (!as_generator("this." << string << " = " << string)
|
||||||
.generate(sink, std::make_tuple(helpers::to_field_name(field.name), helpers::to_field_name(field.name)), context))
|
.generate(sink, std::make_tuple(name_helpers::to_field_name(field.name), name_helpers::to_field_name(field.name)), context))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue