forked from enlightenment/efl
eolian_mono: fix documentation warning by using "<" and ">"
Summary: If type A: list<B>; is written in eo, then documentation warning occurs because list<B> is written in the documentation without string conversion. To fix the warning, "<" and ">" are converted into "<" and ">". Reviewers: lauromoura Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9891
This commit is contained in:
parent
5d5128b226
commit
993b337e67
|
@ -37,6 +37,10 @@ struct alias_definition_generator
|
||||||
if (!as_generator(eolian_mono::type).generate(std::back_inserter(alias_type), alias.base_type, context))
|
if (!as_generator(eolian_mono::type).generate(std::back_inserter(alias_type), alias.base_type, context))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string alias_type_doc;
|
||||||
|
alias_type_doc = utils::replace_all(alias_type, "<", "<");
|
||||||
|
alias_type_doc = utils::replace_all(alias_type_doc, ">", ">");
|
||||||
|
|
||||||
std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
|
std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
|
||||||
if (!as_generator(
|
if (!as_generator(
|
||||||
documentation
|
documentation
|
||||||
|
@ -44,7 +48,7 @@ struct alias_definition_generator
|
||||||
<< "{\n"
|
<< "{\n"
|
||||||
<< scope_tab << "private " << alias_type << " payload;\n\n"
|
<< scope_tab << "private " << alias_type << " payload;\n\n"
|
||||||
|
|
||||||
<< scope_tab << "/// <summary>Converts an instance of " << alias_type << " to this struct.</summary>\n"
|
<< scope_tab << "/// <summary>Converts an instance of " << alias_type_doc << " to this struct.</summary>\n"
|
||||||
<< scope_tab << "/// <param name=\"value\">The value to be converted.</param>\n"
|
<< scope_tab << "/// <param name=\"value\">The value to be converted.</param>\n"
|
||||||
<< scope_tab << "/// <returns>A struct with the given value.</returns>\n"
|
<< scope_tab << "/// <returns>A struct with the given value.</returns>\n"
|
||||||
<< scope_tab << "public static implicit operator " << alias_name << "(" << alias_type << " value)\n"
|
<< scope_tab << "public static implicit operator " << alias_name << "(" << alias_type << " value)\n"
|
||||||
|
@ -52,7 +56,7 @@ struct alias_definition_generator
|
||||||
<< scope_tab << scope_tab << "return new " << alias_name << "{payload=value};\n"
|
<< scope_tab << scope_tab << "return new " << alias_name << "{payload=value};\n"
|
||||||
<< scope_tab << "}\n\n"
|
<< scope_tab << "}\n\n"
|
||||||
|
|
||||||
<< scope_tab << "/// <summary>Converts an instance of this struct to " << alias_type << ".</summary>\n"
|
<< scope_tab << "/// <summary>Converts an instance of this struct to " << alias_type_doc << ".</summary>\n"
|
||||||
<< scope_tab << "/// <param name=\"value\">The value to be converted packed in this struct.</param>\n"
|
<< scope_tab << "/// <param name=\"value\">The value to be converted packed in this struct.</param>\n"
|
||||||
<< scope_tab << "/// <returns>The actual value the alias is wrapping.</returns>\n"
|
<< scope_tab << "/// <returns>The actual value the alias is wrapping.</returns>\n"
|
||||||
<< scope_tab << "public static implicit operator " << alias_type << "(" << alias_name << " value)\n"
|
<< scope_tab << "public static implicit operator " << alias_type << "(" << alias_name << " value)\n"
|
||||||
|
|
|
@ -88,6 +88,20 @@ namespace eolian_mono { namespace utils {
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::string replace_all(std::string s, std::string target, std::string replace)
|
||||||
|
{
|
||||||
|
size_t pos = s.find(target);
|
||||||
|
|
||||||
|
while (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
s.replace(pos, target.length(), replace);
|
||||||
|
pos += replace.length();
|
||||||
|
pos = s.find(target, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
} }
|
} }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue