summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-05-03 16:21:58 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-05-03 16:22:09 +0200
commit767631e304b7142669d4f44f13cb97010348de11 (patch)
tree0bfd9e89eb9680725cd2da641c6f1bf0e02b7a8f /src/bin
parentce2e2c7ce0c7379cb16653bd0785494889f15173 (diff)
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
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian_mono/eolian/mono/alias_definition.hh27
1 files 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
33 if (!name_helpers::open_namespaces(sink, alias.namespaces, context)) 33 if (!name_helpers::open_namespaces(sink, alias.namespaces, context))
34 return false; 34 return false;
35 35
36 std::string alias_type;
37 if (!as_generator(eolian_mono::type).generate(std::back_inserter(alias_type), alias.base_type, context))
38 return false;
39
36 std::string const alias_name = utils::remove_all(alias.eolian_name, '_'); 40 std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
37 if (!as_generator( 41 if (!as_generator(
38 "public struct " << alias_name << "\n" 42 documentation
43 << "public struct " << alias_name << "\n"
39 << "{\n" 44 << "{\n"
40 << scope_tab << "private " << type << " payload;\n" 45 << scope_tab << "private " << alias_type << " payload;\n\n"
41 << scope_tab << "public static implicit operator " << alias_name << "(" << type << " x)\n" 46
47 << scope_tab << "/// <summary>Converts an instance of " << alias_type << " to this struct.</summary>\n"
48 << scope_tab << "/// <param name=\"value\">The value to be converted.</param>\n"
49 << scope_tab << "/// <returns>A struct with the given value.</returns>\n"
50 << scope_tab << "public static implicit operator " << alias_name << "(" << alias_type << " value)\n"
42 << scope_tab << "{\n" 51 << scope_tab << "{\n"
43 << scope_tab << scope_tab << "return new " << alias_name << "{payload=x};\n" 52 << scope_tab << scope_tab << "return new " << alias_name << "{payload=value};\n"
44 << scope_tab << "}\n\n" 53 << scope_tab << "}\n\n"
45 << scope_tab << "public static implicit operator " << type << "(" << alias_name << " x)\n" 54
55 << scope_tab << "/// <summary>Converts an instance of this struct to " << alias_type << ".</summary>\n"
56 << scope_tab << "/// <param name=\"value\">The value to be converted packed in this struct.</param>\n"
57 << scope_tab << "/// <returns>The actual value the alias is wrapping.</returns>\n"
58 << scope_tab << "public static implicit operator " << alias_type << "(" << alias_name << " value)\n"
46 << scope_tab << "{\n" 59 << scope_tab << "{\n"
47 << scope_tab << scope_tab << "return x.payload;\n" 60 << scope_tab << scope_tab << "return value.payload;\n"
48 << scope_tab << "}\n\n" 61 << scope_tab << "}\n\n"
49 << "}\n\n" 62 << "}\n\n"
50 ).generate(sink, std::make_tuple(alias.base_type, alias.base_type, alias.base_type), context)) 63 ).generate(sink, alias, context))
51 return false; 64 return false;
52 65
53 if (!name_helpers::close_namespaces(sink, alias.namespaces, context)) 66 if (!name_helpers::close_namespaces(sink, alias.namespaces, context))