xartigas pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=767631e304b7142669d4f44f13cb97010348de11
commit 767631e304b7142669d4f44f13cb97010348de11 Author: Lauro Moura <[email protected]> Date: Fri May 3 16:21:58 2019 +0200 csharp: Add docs for aliases Summary: Fixes T7689 Reviewers: vitor.sousa, segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7689 Differential Revision: https://phab.enlightenment.org/D8808 --- .../eolian_mono/eolian/mono/alias_definition.hh | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/alias_definition.hh b/src/bin/eolian_mono/eolian/mono/alias_definition.hh index f9c7f435ca..a6cfadbca5 100644 --- a/src/bin/eolian_mono/eolian/mono/alias_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/alias_definition.hh @@ -33,21 +33,34 @@ struct alias_definition_generator if (!name_helpers::open_namespaces(sink, alias.namespaces, context)) return false; + std::string alias_type; + if (!as_generator(eolian_mono::type).generate(std::back_inserter(alias_type), alias.base_type, context)) + return false; + std::string const alias_name = utils::remove_all(alias.eolian_name, '_'); if (!as_generator( - "public struct " << alias_name << "\n" + documentation + << "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 << "private " << alias_type << " payload;\n\n" + + << scope_tab << "/// <summary>Converts an instance of " << alias_type << " to this struct.</summary>\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 << "public static implicit operator " << alias_name << "(" << alias_type << " value)\n" << scope_tab << "{\n" - << scope_tab << scope_tab << "return new " << alias_name << "{payload=x};\n" + << scope_tab << scope_tab << "return new " << alias_name << "{payload=value};\n" << scope_tab << "}\n\n" - << scope_tab << "public static implicit operator " << type << "(" << alias_name << " x)\n" + + << scope_tab << "/// <summary>Converts an instance of this struct to " << alias_type << ".</summary>\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 << "public static implicit operator " << alias_type << "(" << alias_name << " value)\n" << scope_tab << "{\n" - << scope_tab << scope_tab << "return x.payload;\n" + << scope_tab << scope_tab << "return value.payload;\n" << scope_tab << "}\n\n" << "}\n\n" - ).generate(sink, std::make_tuple(alias.base_type, alias.base_type, alias.base_type), context)) + ).generate(sink, alias, context)) return false; if (!name_helpers::close_namespaces(sink, alias.namespaces, context)) --
