summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-08-01 21:12:10 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-08-01 21:12:36 +0200
commit44e00273387ddef127bb98358c729d343ef59f05 (patch)
tree18b51a1c9c6384dbf7619540670c8deb54fee23c /src/bin
parentcf818a84be26cd5e2f57cca4b4a8ae9d5b3715f4 (diff)
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.hh6
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_fields.hh20
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
411 if (!as_generator 411 if (!as_generator
412 ( 412 (
413 documentation(indent.n + 1) 413 documentation(indent.n + 1)
414 << indent << scope_tab << "/// <value>" << string << "</value>\n"
414 << indent << scope_tab << "public " << type << " " << string << ";\n" 415 << indent << scope_tab << "public " << type << " " << string << ";\n"
415 ) 416 )
416 .generate(sink, std::make_tuple(field, field.type, name_helpers::to_field_name(field.name)), context)) 417 .generate(sink, std::make_tuple(field, field.type.doc_summary, field.type, name_helpers::to_field_name(field.name)), context))
417 return false; 418 return false;
418 } 419 }
419 420
@@ -434,13 +435,14 @@ struct struct_definition_generator
434 // Constructor with default parameters for easy struct initialization 435 // Constructor with default parameters for easy struct initialization
435 if(!as_generator( 436 if(!as_generator(
436 indent << scope_tab << "/// <summary>Constructor for " << string << ".</summary>\n" 437 indent << scope_tab << "/// <summary>Constructor for " << string << ".</summary>\n"
438 << *(indent << scope_tab << field_argument_docs << ";\n")
437 << indent << scope_tab << "public " << string << "(\n" 439 << indent << scope_tab << "public " << string << "(\n"
438 << ((indent << scope_tab << scope_tab << field_argument_default) % ",\n") 440 << ((indent << scope_tab << scope_tab << field_argument_default) % ",\n")
439 << indent << scope_tab << ")\n" 441 << indent << scope_tab << ")\n"
440 << indent << scope_tab << "{\n" 442 << indent << scope_tab << "{\n"
441 << *(indent << scope_tab << scope_tab << field_argument_assignment << ";\n") 443 << *(indent << scope_tab << scope_tab << field_argument_assignment << ";\n")
442 << indent << scope_tab << "}\n\n") 444 << indent << scope_tab << "}\n\n")
443 .generate(sink, std::make_tuple(struct_name, struct_name, struct_.fields, struct_.fields), context)) 445 .generate(sink, std::make_tuple(struct_name, struct_.fields, struct_name, struct_.fields, struct_.fields), context))
444 return false; 446 return false;
445 } 447 }
446 448
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
37 } 37 }
38} const field_argument_assignment {}; 38} const field_argument_assignment {};
39 39
40struct field_argument_docs_generator
41{
42 template<typename OutputIterator, typename Context>
43 bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
44 {
45 if (!as_generator("/// <param name=\"" << string << "\">" << string << "</param>")
46 .generate(sink, std::make_tuple(name_helpers::to_field_name(field.name), field.documentation.summary), context))
47 return false;
48 return true;
49 }
50} const field_argument_docs {};
51
40} 52}
41 53
42namespace efl { namespace eolian { namespace grammar { 54namespace efl { namespace eolian { namespace grammar {
@@ -51,6 +63,11 @@ struct is_eager_generator< ::eolian_mono::field_argument_assignment_generator> :
51template<> 63template<>
52struct is_generator< ::eolian_mono::field_argument_assignment_generator> : std::true_type {}; 64struct is_generator< ::eolian_mono::field_argument_assignment_generator> : std::true_type {};
53 65
66template<>
67struct is_eager_generator< ::eolian_mono::field_argument_docs_generator> : std::true_type {};
68template<>
69struct is_generator< ::eolian_mono::field_argument_docs_generator> : std::true_type {};
70
54namespace type_traits { 71namespace type_traits {
55 72
56template <> 73template <>
@@ -59,6 +76,9 @@ struct attributes_needed< ::eolian_mono::field_argument_default_generator> : std
59template <> 76template <>
60struct attributes_needed< ::eolian_mono::field_argument_assignment_generator> : std::integral_constant<int, 1> {}; 77struct attributes_needed< ::eolian_mono::field_argument_assignment_generator> : std::integral_constant<int, 1> {};
61 78
79template <>
80struct attributes_needed< ::eolian_mono::field_argument_docs_generator> : std::integral_constant<int, 1> {};
81
62} 82}
63 83
64} } } 84} } }