Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79528 - trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk
From: barend.gehrels_at_[hidden]
Date: 2012-07-15 08:08:12


Author: barendgehrels
Date: 2012-07-15 08:08:11 EDT (Sun, 15 Jul 2012)
New Revision: 79528
URL: http://svn.boost.org/trac/boost/changeset/79528

Log:
[geometry] Bugfix in document generator. Details:

The XML generated by Doxygen contains parameters twice: first shortly ("memberdef -> param"), below more in detail ("memberdef -> detaileddescription -> para -> parameterlist -> parameteritem"). However, the second one is not always in the parameter-order, apparently. At least this was the case for simplify.

This change fixes that. We now get it from param, get the details in a separate list and copy the details to the original list such that order is preserved.
Text files modified:
   trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp | 54 +++++++++++++++++++++++++++++++++++++++
   1 files changed, 53 insertions(+), 1 deletions(-)

Modified: trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp
==============================================================================
--- trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp (original)
+++ trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp 2012-07-15 08:08:11 EDT (Sun, 15 Jul 2012)
@@ -228,6 +228,46 @@
     }
 }
 
+static void copy_string_property(std::string const& source, std::string& target)
+{
+ if (target.empty())
+ {
+ target = source;
+ }
+}
+
+
+template <typename Parameters>
+static void copy_parameter_properties(parameter const& source, Parameters& target)
+{
+ BOOST_FOREACH(parameter& t, target)
+ {
+ if (source.name == t.name)
+ {
+ t.skip = source.skip;
+ copy_string_property(source.brief_description, t.brief_description);
+ copy_string_property(source.type, t.type);
+ copy_string_property(source.default_value, t.default_value);
+ copy_string_property(source.fulltype, t.fulltype);
+
+ return;
+ }
+ }
+ // If not found, write a warning
+ std::cerr << "Parameter not found: " << source.name << std::endl;
+}
+
+
+template <typename Parameters>
+static void copy_parameters_properties(Parameters const& source, Parameters& target)
+{
+ BOOST_FOREACH(parameter const& s, source)
+ {
+ copy_parameter_properties(s, target);
+ }
+}
+
+
 
 template <typename Element>
 static void parse_element(rapidxml::xml_node<>* node, configuration const& config, std::string const& parent, Element& el)
@@ -290,13 +330,25 @@
             std::string kind = get_attribute(node, "kind");
             if (kind == "param")
             {
- parse_parameter_list(node->first_node(), el.parameters);
+ // Parse parameters and their descriptions.
+ // NOTE: they are listed here, but the order might not be the order in the function call
+ std::vector<parameter> parameters;
+ parse_parameter_list(node->first_node(), parameters);
+ copy_parameters_properties(parameters, el.parameters);
             }
             else if (kind == "templateparam")
             {
                 parse_parameter_list(node->first_node(), el.template_parameters);
             }
         }
+ else if (full == ".param")
+ {
+ // Parse one parameter, and add it to el.parameters
+ parameter p;
+ parse_parameter(node->first_node(), p);
+ el.parameters.push_back(p);
+ }
+
 
         parse_element(node->first_node(), config, full, el);
         parse_element(node->next_sibling(), config, parent, el);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk