efl_mono: Add namespace on helpers.
Make it easier on finding where those functions are coming from.
This commit is contained in:
parent
65f868786a
commit
87c58a460a
|
@ -165,7 +165,7 @@ struct function_definition_generator
|
|||
<< ") {\n "
|
||||
<< eolian_mono::function_definition_preamble() << string << "("
|
||||
<< (do_super ? "efl.eo.Globals.efl_super(" : "")
|
||||
<< (f.is_static ? klass_get_name(f.klass) + "()": "this.raw_handle")
|
||||
<< (f.is_static ? helpers::klass_get_name(f.klass) + "()": "this.raw_handle")
|
||||
<< (do_super ? ", this.raw_klass)" : "")
|
||||
<< *(", " << argument_invocation ) << ");\n"
|
||||
<< eolian_mono::function_definition_epilogue()
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace eolian_mono {
|
||||
|
||||
namespace helpers {
|
||||
|
||||
namespace attributes = efl::eolian::grammar::attributes;
|
||||
|
||||
inline std::string type_full_name(attributes::regular_type_def const& type)
|
||||
|
@ -140,6 +142,8 @@ inline std::string klass_get_name(attributes::klass_name const &clsname)
|
|||
return output.str();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace helpers
|
||||
|
||||
} // namespace eolian_mono
|
||||
|
||||
#endif
|
||||
|
|
|
@ -241,7 +241,9 @@ struct klass
|
|||
}
|
||||
|
||||
for (auto &&p : cls.parts)
|
||||
if (!as_generator( klass_name_to_csharp(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n").generate(sink, attributes::unused, iface_cxt))
|
||||
if (!as_generator(
|
||||
helpers::klass_name_to_csharp(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n"
|
||||
).generate(sink, attributes::unused, iface_cxt))
|
||||
return false;
|
||||
|
||||
// End of interface declaration
|
||||
|
|
|
@ -155,7 +155,7 @@ struct marshall_type_visitor_generate
|
|||
}}
|
||||
};
|
||||
|
||||
if (regular.is_struct() && !is_struct_blacklisted(regular) && !(bool)(regular.base_qualifier & qualifier_info::is_own))
|
||||
if (regular.is_struct() && !helpers::is_struct_blacklisted(regular) && !(bool)(regular.base_qualifier & qualifier_info::is_own))
|
||||
{
|
||||
if ((is_out || is_return) && is_ptr)
|
||||
return as_generator(" System.IntPtr").generate(sink, attributes::unused, *context);
|
||||
|
@ -177,7 +177,7 @@ struct marshall_type_visitor_generate
|
|||
{
|
||||
return *b;
|
||||
}
|
||||
else if (is_ptr && need_pointer_conversion(®ular))
|
||||
else if (is_ptr && helpers::need_pointer_conversion(®ular))
|
||||
{
|
||||
regular_type_def r = regular;
|
||||
r.base_type = " System.IntPtr";
|
||||
|
|
|
@ -288,10 +288,10 @@ inline bool param_should_use_out_var(attributes::parameter_def const& param, boo
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (need_struct_conversion(regular))
|
||||
if (helpers::need_struct_conversion(regular))
|
||||
return true;
|
||||
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -336,10 +336,10 @@ inline bool param_should_use_in_var(attributes::parameter_def const& param, bool
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (need_struct_conversion(regular))
|
||||
if (helpers::need_struct_conversion(regular))
|
||||
return true;
|
||||
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -371,7 +371,7 @@ inline std::string direction_modifier(attributes::parameter_def const& param)
|
|||
else if (param.direction == attributes::parameter_direction::in && param.type.is_ptr)
|
||||
{
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (need_struct_conversion(regular))
|
||||
if (helpers::need_struct_conversion(regular))
|
||||
return " ref "; // Don't add ref on Marshal if it is ptr
|
||||
}
|
||||
return " ";
|
||||
|
@ -382,7 +382,7 @@ std::string marshall_direction_modifier(attributes::parameter_def const& param)
|
|||
if (param.direction == attributes::parameter_direction::in && param.type.is_ptr)
|
||||
{
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (need_struct_conversion(regular) && param.type.has_own)
|
||||
if (helpers::need_struct_conversion(regular) && param.type.has_own)
|
||||
return " "; // Don't add ref on Marshal if it is ptr
|
||||
}
|
||||
return direction_modifier(param);
|
||||
|
@ -545,13 +545,13 @@ struct native_convert_in_variable_generator
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion(param, regular))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(param, regular))
|
||||
{
|
||||
return as_generator(
|
||||
"var " << string << " = eina.PrimitiveConversion.PointerToManaged<" << type << ">(" << escape_keyword(param.param_name) << ");\n"
|
||||
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.type), context);
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
"var " << string << " = " << type << "_StructConversion.ToExternal(" << escape_keyword(param.param_name) << ");\n"
|
||||
|
@ -613,13 +613,13 @@ struct convert_in_variable_generator
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion(param, regular))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(param, regular))
|
||||
{
|
||||
return as_generator(
|
||||
"var " << string << " = eina.PrimitiveConversion.ManagedToPointerAlloc(" << escape_keyword(param.param_name) << ");\n"
|
||||
).generate(sink, in_variable_name(param.param_name), context);
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
"var " << string << " = " << type << "_StructConversion.ToInternal(" << escape_keyword(param.param_name) << ");\n"
|
||||
|
@ -708,13 +708,13 @@ struct convert_out_variable_generator
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion(regular))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
"System.IntPtr " << string << " = System.IntPtr.Zero;\n"
|
||||
).generate(sink, out_variable_name(param.param_name), context);
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
"var " << string << " = new " << marshall_type << "();\n"
|
||||
|
@ -781,13 +781,13 @@ struct native_convert_out_variable_generator
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion(regular))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
type << " " << string << " = default(" << type << ");\n"
|
||||
).generate(sink, std::make_tuple(param, out_variable_name(param.param_name), param), context);
|
||||
}
|
||||
else if (need_struct_conversion(regular)
|
||||
else if (helpers::need_struct_conversion(regular)
|
||||
|| param_is_acceptable(param, "const char *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Stringshare *", !WANT_OWN, WANT_OUT))
|
||||
{
|
||||
|
@ -868,7 +868,7 @@ struct convert_out_assign_generator
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion_in_return(param.type, param.direction))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion_in_return(param.type, param.direction))
|
||||
{
|
||||
bool ret = as_generator(
|
||||
string << " = eina.PrimitiveConversion.PointerToManaged<" << type << ">(" << out_variable_name(param.param_name) << ");\n"
|
||||
|
@ -880,7 +880,7 @@ struct convert_out_assign_generator
|
|||
|
||||
return ret;
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
string << " = " << type << "_StructConversion.ToExternal(" << out_variable_name(param.param_name) << ");\n"
|
||||
|
@ -963,7 +963,7 @@ struct native_convert_in_ptr_assign_generator
|
|||
bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const
|
||||
{
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param_should_use_in_var(param, true) && param.type.is_ptr && !param.type.has_own && need_struct_conversion(regular))
|
||||
if (param_should_use_in_var(param, true) && param.type.is_ptr && !param.type.has_own && helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
string << " = " << type << "_StructConversion.ToInternal(" << in_variable_name(param.param_name) << ");\n"
|
||||
|
@ -980,7 +980,7 @@ struct convert_in_ptr_assign_generator
|
|||
bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const
|
||||
{
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param_should_use_in_var(param, true) && param.type.is_ptr && !param.type.has_own && need_struct_conversion(regular))
|
||||
if (param_should_use_in_var(param, true) && param.type.is_ptr && !param.type.has_own && helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
string << " = " << type << "_StructConversion.ToExternal(" << in_variable_name(param.param_name) << ");\n"
|
||||
|
@ -1010,7 +1010,7 @@ struct convert_return_generator
|
|||
bool generate(OutputIterator sink, attributes::type_def const& ret_type, Context const& context) const
|
||||
{
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(&ret_type.original_type);
|
||||
if (ret_type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion_in_return(ret_type, attributes::parameter_direction::unknown))
|
||||
if (ret_type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion_in_return(ret_type, attributes::parameter_direction::unknown))
|
||||
{
|
||||
return as_generator(
|
||||
"var __ret_tmp = eina.PrimitiveConversion.PointerToManaged<" << type << ">(_ret_var);\n"
|
||||
|
@ -1018,7 +1018,7 @@ struct convert_return_generator
|
|||
<< scope_tab << scope_tab << "return __ret_tmp;\n"
|
||||
).generate(sink, ret_type, context);
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
"return " << type << "_StructConversion.ToExternal(_ret_var);\n"
|
||||
|
@ -1080,13 +1080,13 @@ struct native_convert_out_assign_generator
|
|||
return true;
|
||||
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(¶m.type.original_type);
|
||||
if (param.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion_in_return(param.type, param.direction))
|
||||
if (param.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion_in_return(param.type, param.direction))
|
||||
{
|
||||
return as_generator(
|
||||
string << " = eina.PrimitiveConversion.ManagedToPointerAlloc(" << string << ");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), out_variable_name(param.param_name)), context);
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
string << " = " << type << "_StructConversion.ToInternal(" << string << ");\n"
|
||||
|
@ -1213,13 +1213,13 @@ struct native_convert_return_generator
|
|||
bool generate(OutputIterator sink, attributes::type_def const& ret_type, Context const& context) const
|
||||
{
|
||||
auto regular = efl::eina::get<attributes::regular_type_def>(&ret_type.original_type);
|
||||
if (ret_type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion_in_return(ret_type, attributes::parameter_direction::unknown) )
|
||||
if (ret_type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion_in_return(ret_type, attributes::parameter_direction::unknown) )
|
||||
{
|
||||
return as_generator(
|
||||
"return eina.PrimitiveConversion.ManagedToPointerAlloc(_ret_var);\n"
|
||||
).generate(sink, attributes::unused, context);
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
return as_generator(
|
||||
"return " << type << "_StructConversion.ToInternal(_ret_var);\n"
|
||||
|
|
|
@ -17,7 +17,7 @@ struct part_definition_generator
|
|||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::part_def const& part, Context const& context) const
|
||||
{
|
||||
std::string part_klass_name = klass_name_to_csharp(part.klass);
|
||||
std::string part_klass_name = helpers::klass_name_to_csharp(part.klass);
|
||||
return as_generator(scope_tab << documentation
|
||||
<< scope_tab << "public " << part_klass_name << " " << utils::capitalize(part.name) << "\n"
|
||||
<< scope_tab << "{\n"
|
||||
|
|
|
@ -51,7 +51,7 @@ struct struct_definition_generator
|
|||
documentation(1)
|
||||
<< scope_tab(1) << "public " << type << " " << string << ";\n"
|
||||
)
|
||||
.generate(sink, std::make_tuple(field, field.type, to_field_name(field.name)), context))
|
||||
.generate(sink, std::make_tuple(field, field.type, helpers::to_field_name(field.name)), context))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ struct struct_internal_definition_generator
|
|||
// iterate struct fields
|
||||
for (auto const& field : struct_.fields)
|
||||
{
|
||||
auto field_name = to_field_name(field.name);
|
||||
auto field_name = helpers::to_field_name(field.name);
|
||||
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);
|
||||
|
||||
|
@ -165,7 +165,7 @@ struct to_internal_field_convert_generator
|
|||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||
{
|
||||
auto field_name = to_field_name(field.name);
|
||||
auto field_name = helpers::to_field_name(field.name);
|
||||
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 complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
|
||||
|
@ -191,14 +191,14 @@ struct to_internal_field_convert_generator
|
|||
.generate(sink, std::make_tuple(field_name, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (field.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion(regular))
|
||||
else if (field.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(regular))
|
||||
{
|
||||
if (!as_generator(
|
||||
scope_tab << scope_tab << "_internal_struct." << string << " = eina.PrimitiveConversion.ManagedToPointerAlloc(_external_struct." << string << ");\n")
|
||||
.generate(sink, std::make_tuple(field_name, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
if (!as_generator(
|
||||
scope_tab << scope_tab << "_internal_struct." << string << " = " << type << "_StructConversion.ToInternal(_external_struct." << string << ");\n")
|
||||
|
@ -259,7 +259,7 @@ struct to_external_field_convert_generator
|
|||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||
{
|
||||
auto field_name = to_field_name(field.name);
|
||||
auto field_name = helpers::to_field_name(field.name);
|
||||
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 complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
|
||||
|
@ -301,14 +301,14 @@ struct to_external_field_convert_generator
|
|||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (field.type.is_ptr && need_pointer_conversion(regular) && !need_struct_conversion(regular))
|
||||
else if (field.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(regular))
|
||||
{
|
||||
if (!as_generator(
|
||||
scope_tab << scope_tab << "_external_struct." << string << " = eina.PrimitiveConversion.PointerToManaged<" << type << ">(_internal_struct." << string << ");\n")
|
||||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (need_struct_conversion(regular))
|
||||
else if (helpers::need_struct_conversion(regular))
|
||||
{
|
||||
if (!as_generator(
|
||||
scope_tab << scope_tab << "_external_struct." << string << " = " << type << "_StructConversion.ToExternal(_internal_struct." << string << ");\n")
|
||||
|
@ -439,7 +439,7 @@ struct struct_entities_generator
|
|||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
|
||||
{
|
||||
if (is_struct_blacklisted(struct_))
|
||||
if (helpers::is_struct_blacklisted(struct_))
|
||||
return true;
|
||||
|
||||
std::vector<std::string> cpp_namespaces = escape_namespace(attributes::cpp_namespaces(struct_.namespaces));
|
||||
|
|
|
@ -20,7 +20,7 @@ struct field_argument_default_generator
|
|||
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
||||
{
|
||||
if (!as_generator(type << " " << string << "=default(" << type << ")")
|
||||
.generate(sink, std::make_tuple(field.type, to_field_name(field.name), field.type), context))
|
||||
.generate(sink, std::make_tuple(field.type, helpers::to_field_name(field.name), field.type), context))
|
||||
return false;
|
||||
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
|
||||
{
|
||||
if (!as_generator("this." << string << " = " << string)
|
||||
.generate(sink, std::make_tuple(to_field_name(field.name), to_field_name(field.name)), context))
|
||||
.generate(sink, std::make_tuple(helpers::to_field_name(field.name), helpers::to_field_name(field.name)), context))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue