Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65010 - trunk/tools/quickbook/detail
From: dnljms_at_[hidden]
Date: 2010-08-26 04:01:45


Author: danieljames
Date: 2010-08-26 04:01:40 EDT (Thu, 26 Aug 2010)
New Revision: 65010
URL: http://svn.boost.org/trac/boost/changeset/65010

Log:
And inline the 'xml_' classes.
Text files modified:
   trunk/tools/quickbook/detail/actions.cpp | 114 ++++++++++++---------------------------
   1 files changed, 36 insertions(+), 78 deletions(-)

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-08-26 04:01:40 EDT (Thu, 26 Aug 2010)
@@ -1572,76 +1572,6 @@
         return (qbk_version_n < version) ? raw : encoded;
     }
 
- struct xml_author
- {
- // Handles xml author
-
- xml_author(collector& out)
- : out(out) {}
-
- void operator()(std::pair<docinfo_string, docinfo_string> const& author) const;
-
- collector& out;
- };
-
- struct xml_year
- {
- // Handles xml year
-
- xml_year(collector& out)
- : out(out) {}
-
- void operator()(std::string const &year) const;
-
- collector& out;
- };
-
- struct xml_copyright
- {
- // Handles xml copyright
-
- xml_copyright(collector& out)
- : out(out) {}
-
- void operator()(std::pair<std::vector<std::string>, docinfo_string> const &copyright) const;
-
- collector& out;
- };
-
- void xml_author::operator()(actions::author const& name) const
- {
- out << " <author>\n"
- << " <firstname>"
- << name.first.get(103)
- << "</firstname>\n"
- << " <surname>"
- << name.second.get(103)
- << "</surname>\n"
- << " </author>\n";
- }
-
- void xml_copyright::operator()(actions::copyright_item const& copyright) const
- {
- out << "\n" << " <copyright>\n";
-
- for_each(
- copyright.first.begin()
- , copyright.first.end()
- , xml_year(out));
-
- out << " <holder>"
- << copyright.second.get(103)
- << "</holder>\n"
- << " </copyright>\n"
- << "\n"
- ;
- }
-
- void xml_year::operator()(std::string const &year) const
- {
- out << " <year>" << year << "</year>\n";
- }
-
     static void write_document_title(collector& out, quickbook::actions& actions);
     static void write_document_info(collector& out, quickbook::actions& actions);
 
@@ -1794,19 +1724,47 @@
         if(!actions.doc_authors.empty())
         {
             out << " <authorgroup>\n";
- for_each(
- actions.doc_authors.begin()
- , actions.doc_authors.end()
- , xml_author(out));
+ for(actions::author_list::const_iterator
+ it = actions.doc_authors.begin(),
+ end = actions.doc_authors.end();
+ it != end; ++it)
+ {
+ out << " <author>\n"
+ << " <firstname>"
+ << it->first.get(103)
+ << "</firstname>\n"
+ << " <surname>"
+ << it->second.get(103)
+ << "</surname>\n"
+ << " </author>\n";
+ }
             out << " </authorgroup>\n";
         }
 
         if (!actions.doc_copyrights.empty())
         {
- for_each(
- actions.doc_copyrights.begin()
- , actions.doc_copyrights.end()
- , xml_copyright(out));
+ for(actions::copyright_list::const_iterator
+ it = actions.doc_copyrights.begin(),
+ end = actions.doc_copyrights.end();
+ it != end; ++it)
+ {
+ out << "\n" << " <copyright>\n";
+
+ for(actions::string_list::const_iterator
+ it2 = it->first.begin(),
+ end = it->first.end();
+ it2 != end; ++it2)
+ {
+ out << " <year>" << *it2 << "</year>\n";
+ }
+
+ out << " <holder>"
+ << it->second.get(103)
+ << "</holder>\n"
+ << " </copyright>\n"
+ << "\n"
+ ;
+ }
         }
 
         if (!actions.doc_license.empty())


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