diff options
author | Xavi Artigas <xavierartigas@yahoo.es> | 2019-08-01 21:12:10 +0200 |
---|---|---|
committer | Xavi Artigas <xavierartigas@yahoo.es> | 2019-08-01 21:12:36 +0200 |
commit | 44e00273387ddef127bb98358c729d343ef59f05 (patch) | |
tree | 18b51a1c9c6384dbf7619540670c8deb54fee23c /src/bin | |
parent | cf818a84be26cd5e2f57cca4b4a8ae9d5b3715f4 (diff) | |
download | efl-44e00273387ddef127bb98358c729d343ef59f05.tar.gz |
mono-docs: Add misc struct docs
Summary:
Structs have a convenience constructor which was missing parameter documentation.
Struct fields need a <value> tag or there is a hole in the generated docs.
The documentation for the type of the field has been used, when available.
Test Plan: Build docs and look at generated pages for structs.
Reviewers: lauromoura, vitor.sousa, felipealmeida
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9478
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/struct_definition.hh | 6 | ||||
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/struct_fields.hh | 20 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh index d358dc78ba..413f59ec53 100644 --- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh @@ -411,9 +411,10 @@ struct struct_definition_generator if (!as_generator ( documentation(indent.n + 1) + << indent << scope_tab << "/// <value>" << string << "</value>\n" << indent << scope_tab << "public " << type << " " << string << ";\n" ) - .generate(sink, std::make_tuple(field, field.type, name_helpers::to_field_name(field.name)), context)) + .generate(sink, std::make_tuple(field, field.type.doc_summary, field.type, name_helpers::to_field_name(field.name)), context)) return false; } @@ -434,13 +435,14 @@ struct struct_definition_generator // Constructor with default parameters for easy struct initialization if(!as_generator( indent << scope_tab << "/// <summary>Constructor for " << string << ".</summary>\n" + << *(indent << scope_tab << field_argument_docs << ";\n") << indent << scope_tab << "public " << string << "(\n" << ((indent << scope_tab << scope_tab << field_argument_default) % ",\n") << indent << scope_tab << ")\n" << indent << scope_tab << "{\n" << *(indent << scope_tab << scope_tab << field_argument_assignment << ";\n") << indent << scope_tab << "}\n\n") - .generate(sink, std::make_tuple(struct_name, struct_name, struct_.fields, struct_.fields), context)) + .generate(sink, std::make_tuple(struct_name, struct_.fields, struct_name, struct_.fields, struct_.fields), context)) return false; } diff --git a/src/bin/eolian_mono/eolian/mono/struct_fields.hh b/src/bin/eolian_mono/eolian/mono/struct_fields.hh index 163d1b94db..5b755a7ffa 100644 --- a/src/bin/eolian_mono/eolian/mono/struct_fields.hh +++ b/src/bin/eolian_mono/eolian/mono/struct_fields.hh @@ -37,6 +37,18 @@ struct field_argument_assignment_generator } } const field_argument_assignment {}; +struct field_argument_docs_generator +{ + template<typename OutputIterator, typename Context> + bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const + { + if (!as_generator("/// <param name=\"" << string << "\">" << string << "</param>") + .generate(sink, std::make_tuple(name_helpers::to_field_name(field.name), field.documentation.summary), context)) + return false; + return true; + } +} const field_argument_docs {}; + } namespace efl { namespace eolian { namespace grammar { @@ -51,6 +63,11 @@ struct is_eager_generator< ::eolian_mono::field_argument_assignment_generator> : template<> struct is_generator< ::eolian_mono::field_argument_assignment_generator> : std::true_type {}; +template<> +struct is_eager_generator< ::eolian_mono::field_argument_docs_generator> : std::true_type {}; +template<> +struct is_generator< ::eolian_mono::field_argument_docs_generator> : std::true_type {}; + namespace type_traits { template <> @@ -59,6 +76,9 @@ struct attributes_needed< ::eolian_mono::field_argument_default_generator> : std template <> struct attributes_needed< ::eolian_mono::field_argument_assignment_generator> : std::integral_constant<int, 1> {}; +template <> +struct attributes_needed< ::eolian_mono::field_argument_docs_generator> : std::integral_constant<int, 1> {}; + } } } } |