csharp: Simple spacing rules changes

Summary: Also do not generated empty tag if doc would be empty.

Reviewers: vitor.sousa, segfaultxavi

Reviewed By: vitor.sousa, segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8612
This commit is contained in:
Lauro Moura 2019-04-22 17:53:30 -03:00 committed by Vitor Sousa
parent 1291af37ad
commit 7681d187da
6 changed files with 15 additions and 11 deletions

View File

@ -35,17 +35,18 @@ struct alias_definition_generator
std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
if (!as_generator(
"public struct " << alias_name << " {\n"
"public struct " << alias_name << "\n"
<< "{\n"
<< scope_tab << "private " << type << " payload;\n"
<< scope_tab << "public static implicit operator " << alias_name << "(" << type << " x)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return new " << alias_name << "{payload=x};\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
<< scope_tab << "public static implicit operator " << type << "(" << alias_name << " x)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return x.payload;\n"
<< scope_tab << "}\n"
<< "}\n"
<< scope_tab << "}\n\n"
<< "}\n\n"
).generate(sink, std::make_tuple(alias.base_type, alias.base_type, alias.base_type), context))
return false;

View File

@ -285,6 +285,9 @@ struct documentation_generator
template<typename OutputIterator, typename Context>
bool generate_tag(OutputIterator sink, std::string const& tag, std::string const &text, Context const& context, std::string tag_params = "") const
{
if (text == "")
return true;
if (!as_generator(scope_tab(scope_size) << "/// ").generate(sink, attributes::unused, context)) return false;
if (!generate_opening_tag(sink, tag, context, tag_params)) return false;
if (!generate_escaped_content(sink, text, context)) return false;

View File

@ -44,7 +44,7 @@ struct enum_definition_generator
return false;
}
if(!as_generator("}\n").generate(sink, attributes::unused, context)) return false;
if(!as_generator("}\n\n").generate(sink, attributes::unused, context)) return false;
if(!name_helpers::close_namespaces(sink, enum_.namespaces, context))
return false;

View File

@ -465,14 +465,14 @@ bool open_namespaces(OutputIterator sink, std::vector<std::string> namespaces, C
{
std::transform(namespaces.begin(), namespaces.end(), namespaces.begin(), managed_namespace);
auto open_namespace = *("namespace " << string << " { ") << "\n";
auto open_namespace = *("namespace " << string << " {\n\n");
return as_generator(open_namespace).generate(sink, namespaces, context);
}
template<typename OutputIterator, typename Context>
bool close_namespaces(OutputIterator sink, std::vector<std::string> const& namespaces, Context const& context)
{
auto close_namespace = *(lit("} ")) << "\n";
auto close_namespace = (lit("}") % "\n\n" ) << "\n\n";
return as_generator(close_namespace).generate(sink, namespaces, context);
}

View File

@ -34,7 +34,7 @@ struct constant_definition_generator
if (!name_helpers::open_namespaces(sink, constant.namespaces, context))
return false;
if (!as_generator("public partial class Constants {\n").generate(sink, attributes::unused, context))
if (!as_generator("public partial class Constants\n{\n").generate(sink, attributes::unused, context))
return false;
std::string literal;