From a152ba6d5b7ed1a8d4c111e2b7d7025a733818a9 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 19 Feb 2019 13:29:09 +0100 Subject: [PATCH] mono-docs: Add tags to properties eolian_mono now generates properties (which simply wrap the setter and getter methods when both ara available), but they were missing docs, because properties require a special tag instead of or which we are already implementing. This commit adds tags only if docs can be retrieved from the setter or the getter methods. --- .../eolian_mono/eolian/mono/documentation.hh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh index d2f4669b2c..c00b449365 100644 --- a/src/bin/eolian_mono/eolian/mono/documentation.hh +++ b/src/bin/eolian_mono/eolian/mono/documentation.hh @@ -252,6 +252,12 @@ struct documentation_generator return generate_tag(sink, "returns", text, context); } + template + bool generate_tag_value(OutputIterator sink, std::string const& text, Context const& context) const + { + return generate_tag(sink, "value", text, context); + } + // Actual exported generators template bool generate(OutputIterator sink, Attribute const& attr, Context const& context) const @@ -259,6 +265,23 @@ struct documentation_generator return generate(sink, attr.documentation, context); } + template + bool generate(OutputIterator sink, attributes::property_def const& prop, Context const& context) const + { + if (!generate(sink, prop.documentation, context)) + return false; + + std::string text; + if (prop.setter.is_engaged()) + text = prop.setter->parameters[0].documentation.full_text; + else if (prop.getter.is_engaged()) + text = prop.getter->return_documentation.full_text; + // If there are no docs at all, do not generate tag + else return true; + + return generate_tag_value(sink, text, context); + } + template bool generate(OutputIterator sink, attributes::function_def const& func, Context const& context) const {