template <typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& ctx) const
{
- std::string suffix;
+ std::string suffix, static_flag, const_flag;
switch(_klass_name.type)
{
case attributes::class_type::regular:
.generate(sink, attributes::unused, ctx))
return false;
+ if (f.is_static) static_flag = "static ";
+ else const_flag = " const";
+
if(!as_generator
- (scope_tab << "::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "(" << (parameter % ", ") << ") const;\n")
+ (scope_tab << static_flag << "::efl::eolian::return_traits<" << grammar::type(true) << ">::type "
+ << string << "(" << (parameter % ", ") << ")" << const_flag << ";\n")
.generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), ctx))
return false;
if(f.is_beta &&
.generate(sink, attributes::unused, ctx))
return false;
+ std::string const_flag;
+ if (!f.is_static) const_flag = " const";
+
if(!as_generator
- ("inline ::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "::" << string << "(" << (parameter % ", ") << ") const\n{\n")
- .generate(sink, std::make_tuple(f.return_type, _klass_name.eolian_name, escape_keyword(f.name), f.parameters), ctx))
+ ("inline ::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "::"
+ << string << "(" << (parameter % ", ") << ")" << string << "\n{\n")
+ .generate(sink, std::make_tuple(f.return_type, _klass_name.eolian_name,
+ escape_keyword(f.name), f.parameters, const_flag), ctx))
return false;
std::vector<std::string> opening_statements(f.opening_statements());
&& !as_generator(attributes::c_type({attributes::parameter_direction::in, f.return_type, ""})
<< " __return_value = "
).generate(sink, attributes::unused, ctx)) return false;
-
+
+ std::string object_flag;
+ if (f.is_static) object_flag = "_eo_class()";
+ else object_flag = "_eo_ptr()";
+
if(!as_generator
- (" ::" << string << "(this->_eo_ptr()"
- <<
+ (" ::" << string << "(" << string <<
*(
"\n" << scope_tab << scope_tab << ", "
<<
)
)
<< ");\n"
- ).generate(sink, std::make_tuple(f.c_name, f.parameters), ctx))
+ ).generate(sink, std::make_tuple(f.c_name, object_flag, f.parameters), ctx))
return false;
auto out_assignments =
bool is_beta;
bool is_protected;
bool is_function_pointer;
+ bool is_static;
friend inline bool operator==(function_def const& lhs, function_def const& rhs)
{
&& lhs.filename == rhs.filename
&& lhs.is_beta == rhs.is_beta
&& lhs.is_protected == rhs.is_protected
- && lhs.is_function_pointer == rhs.is_function_pointer;
+ && lhs.is_function_pointer == rhs.is_function_pointer
+ && lhs.is_static == rhs.is_static;
}
friend inline bool operator!=(function_def const& lhs, function_def const& rhs)
{
}
is_beta = eolian_function_is_beta(function);
is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED;
- is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED;
+ is_static = eolian_function_is_class(function);
}
std::string template_statement() const