eolian-cxx: Workaround for multiple callbacks without corresponding void*data

Added workaround for generating classes with methods that have more
than one callback but doesn't have a corresponding void* data
parameter. E.g., elm_box.eo.
This commit is contained in:
Felipe Magno de Almeida 2014-07-17 14:09:26 -03:00
parent d21e400425
commit 401cc81355
3 changed files with 18 additions and 10 deletions

View File

@ -234,8 +234,9 @@ inline unsigned int
parameters_count_callbacks(parameters_container_type const& parameters)
{
unsigned int r = 0u;
for (eo_parameter const& param : parameters)
if(type_is_callback(param.type))
for (auto first = parameters.begin(), last = parameters.end()
; first != last ; ++first)
if(type_is_callback(first->type) && first + 1 != last)
++r;
return r;
}

View File

@ -250,7 +250,7 @@ operator<<(std::ostream& out, inheritance_call_constructor_arguments const& x)
for (i=0; i<n; i++)
{
if(i!=0) out << ", ";
out << "args.get<" << i << ">()";
out << "::efl::eolian::to_c(args.get<" << i << ">())";
}
return out;
}

View File

@ -28,11 +28,11 @@ operator<<(std::ostream& out, parameters_declaration const& x)
{
if (it != first)
out << ", ";
if (type_is_callback((*it).type))
if (type_is_callback((*it).type) && it+1 != last)
{
out << "F && " << (*it).name;
assert(it+1 != last);
++it; // skip next.
out << "F && " << (*it).name;
assert(it+1 != last);
++it; // skip next.
}
else
out << reinterpret_type((*it).type) << " " << (*it).name;
@ -80,12 +80,19 @@ operator<<(std::ostream& out, parameters_list const& x)
{
if (it != first)
out << ", ";
out << to_c((*it).type, (*it).name);
if (type_is_callback((*it).type))
{
out << ", _tmp_f";
++it; // skip next
if(it + 1 != last)
{
out << to_c((*it).type, (*it).name)
<< ", _tmp_f";
++it; // skip next
}
else
out << it->name;
}
else
out << to_c((*it).type, (*it).name);
}
return out;
}