|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68641 - trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk
From: barend.gehrels_at_[hidden]
Date: 2011-02-04 17:31:05
Author: barendgehrels
Date: 2011-02-04 17:31:04 EST (Fri, 04 Feb 2011)
New Revision: 68641
URL: http://svn.boost.org/trac/boost/changeset/68641
Log:
Made parameters skippable (e.g. dummy parameters)
Text files modified:
trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp | 3 +
trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp | 24 +++++++----
trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp | 84 +++++++++++++++++++++++----------------
3 files changed, 68 insertions(+), 43 deletions(-)
Modified: trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp
==============================================================================
--- trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp (original)
+++ trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_elements.hpp 2011-02-04 17:31:04 EST (Fri, 04 Feb 2011)
@@ -32,8 +32,11 @@
std::string name;
std::string brief_description;
+ bool skip;
+
base_element(std::string const& n = "")
: name(n)
+ , skip(false)
{}
};
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 2011-02-04 17:31:04 EST (Fri, 04 Feb 2011)
@@ -61,7 +61,7 @@
So we have to list explicitly either where to recurse, or where not to...
*/
-static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool first = true)
+static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& skip, bool first = true)
{
if (node != NULL)
{
@@ -69,7 +69,12 @@
{
//std::cout << "ELEMENT: " << node->name() << "=" << node->value() << std::endl;
std::string name = node->name();
- if (! (
+ if (boost::equals(name, "qbk.skip"))
+ {
+ skip = true;
+ return;
+ }
+ else if (! (
(boost::equals(name, "para") && first)
|| boost::equals(name, "ref")
|| boost::equals(name, "defval")
@@ -91,8 +96,8 @@
{
//std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl;
}
- parse_para(node->first_node(), contents, false);
- parse_para(node->next_sibling(), contents, false);
+ parse_para(node->first_node(), contents, skip, false);
+ parse_para(node->next_sibling(), contents, skip, false);
}
}
@@ -120,11 +125,11 @@
else if (name == "defname") p.name = node->value();
else if (name == "defval")
{
- parse_para(node, p.default_value);
+ parse_para(node, p.default_value, p.skip);
}
else if (name == "para")
{
- parse_para(node, p.brief_description);
+ parse_para(node, p.brief_description, p.skip);
}
parse_parameter(node->first_node(), p);
@@ -146,7 +151,7 @@
else if (node_name == "para")
{
// Parses both brief AND detailed into this description
- parse_para(node, value.brief_description);
+ parse_para(node, value.brief_description, value.skip);
}
else if (node_name == "initializer")
{
@@ -232,12 +237,12 @@
if (full == ".briefdescription.para")
{
- parse_para(node, el.brief_description);
+ parse_para(node, el.brief_description, el.skip);
}
else if (full == ".detaileddescription.para")
{
std::string para;
- parse_para(node, para);
+ parse_para(node, para, el.skip);
if (!para.empty() && !el.detailed_description.empty())
{
el.detailed_description += "\n\n";
@@ -457,6 +462,7 @@
f.type = function_define;
parse_element(node->first_node(), config, "", f);
parse_function(node->first_node(), config, "", f);
+ doc.functions.push_back(f);
}
else if (kind == "enum")
{
Modified: trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp
==============================================================================
--- trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp (original)
+++ trunk/libs/geometry/doc/src/docutils/tools/doxygen_xml2qbk/quickbook_output.hpp 2011-02-04 17:31:04 EST (Fri, 04 Feb 2011)
@@ -51,28 +51,36 @@
out << f.definition;
break;
case function_define :
- {
- out << "#define " << f.name;
- bool first = true;
- BOOST_FOREACH(parameter const& p, f.parameters)
- {
- out << (first ? "(" : ", ") << p.name;
- first = false;
- }
- if (! first)
- {
- out << ")";
- }
- }
+ out << "#define " << f.name;
break;
case function_unknown :
// do nothing
break;
}
- if (! f.argsstring.empty())
+
+ // Output the parameters
+ // Because we want to be able to skip, we cannot use the argstring
{
- out << " " << f.argsstring;
+ bool first = true;
+ BOOST_FOREACH(parameter const& p, f.parameters)
+ {
+ if (! p.skip)
+ {
+ out
+ << (first ? "(" : ", ")
+ << p.fulltype << (p.fulltype.empty() ? "" : " ")
+ << p.name
+ << (p.default_value.empty() ? "" : " = ")
+ << p.default_value;
+ first = false;
+ }
+ }
+ if (! first)
+ {
+ out << ")";
+ }
}
+
out << "``"
<< std::endl
<< std::endl;
@@ -204,7 +212,10 @@
{
BOOST_FOREACH(parameter const& p, f.parameters)
{
- out << "[* " << p.fulltype << "]: ['" << p.name << "]: " << p.brief_description << std::endl << std::endl;
+ if (! p.skip)
+ {
+ out << "[* " << p.fulltype << "]: ['" << p.name << "]: " << p.brief_description << std::endl << std::endl;
+ }
}
out << std::endl;
out << std::endl;
@@ -290,31 +301,36 @@
// First: output any template parameter which is NOT used in the normal parameter list
BOOST_FOREACH(parameter const& tp, f.template_parameters)
{
- std::vector<parameter>::const_iterator it = std::find_if(f.parameters.begin(), f.parameters.end(), par_by_type(tp.name));
-
- if (it == f.parameters.end())
+ if (! tp.skip)
{
- out << "[[" << tp.name << "] [" << tp.brief_description << "] [ - ] [Must be specified]]" << std::endl;
- }
+ std::vector<parameter>::const_iterator it = std::find_if(f.parameters.begin(), f.parameters.end(), par_by_type(tp.name));
+ if (it == f.parameters.end())
+ {
+ out << "[[" << tp.name << "] [" << tp.brief_description << "] [ - ] [Must be specified]]" << std::endl;
+ }
+ }
}
BOOST_FOREACH(parameter const& p, f.parameters)
{
- out << "[";
- std::vector<parameter>::const_iterator it = std::find_if(f.template_parameters.begin(),
- f.template_parameters.end(), par_by_name(p.type));
-
- if (f.type != function_define)
- {
- out << "[" << p.fulltype
- << "] [" << (it == f.template_parameters.end() ? "" : it->brief_description)
- << "] ";
+ if (! p.skip)
+ {
+ out << "[";
+ std::vector<parameter>::const_iterator it = std::find_if(f.template_parameters.begin(),
+ f.template_parameters.end(), par_by_name(p.type));
+
+ if (f.type != function_define)
+ {
+ out << "[" << p.fulltype
+ << "] [" << (it == f.template_parameters.end() ? "" : it->brief_description)
+ << "] ";
+ }
+ out << "[" << p.name
+ << "] [" << p.brief_description
+ << "]]"
+ << std::endl;
}
- out << "[" << p.name
- << "] [" << p.brief_description
- << "]]"
- << std::endl;
}
out << "]" << std::endl
<< std::endl
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