Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-01-07 14:46:28


Author: danieljames
Date: 2008-01-07 14:46:27 EST (Mon, 07 Jan 2008)
New Revision: 42576
URL: http://svn.boost.org/trac/boost/changeset/42576

Log:
Add support for multiple copyrights in the library info.
Text files modified:
   trunk/tools/quickbook/detail/actions.cpp | 30 +++++++++++++++++++-----------
   trunk/tools/quickbook/detail/actions.hpp | 12 ++++++++++++
   trunk/tools/quickbook/detail/actions_class.cpp | 3 +--
   trunk/tools/quickbook/detail/actions_class.hpp | 4 ++--
   trunk/tools/quickbook/doc_info.hpp | 9 +++++----
   5 files changed, 39 insertions(+), 19 deletions(-)

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2008-01-07 14:46:27 EST (Mon, 07 Jan 2008)
@@ -1096,6 +1096,21 @@
             << " </author>\n";
     }
 
+ void xml_copyright::operator()(std::pair<std::vector<std::string>, std::string> const& copyright) const
+ {
+ out << "\n" << " <copyright>\n";
+
+ for_each(
+ copyright.first.begin()
+ , copyright.first.end()
+ , xml_year(out));
+
+ out << " <holder>" << copyright.second << "</holder>\n"
+ << " </copyright>\n"
+ << "\n"
+ ;
+ }
+
     void xml_year::operator()(std::string const &year) const
     {
         out << " <year>" << year << "</year>\n";
@@ -1170,19 +1185,12 @@
             out << " </authorgroup>\n";
         }
 
- if (!actions.doc_copyright_holder.empty())
+ if (!actions.doc_copyrights.empty())
         {
- out << "\n" << " <copyright>\n";
-
             for_each(
- actions.doc_copyright_years.begin()
- , actions.doc_copyright_years.end()
- , xml_year(out));
-
- out << " <holder>" << actions.doc_copyright_holder << "</holder>\n"
- << " </copyright>\n"
- << "\n"
- ;
+ actions.doc_copyrights.begin()
+ , actions.doc_copyrights.end()
+ , xml_copyright(out));
         }
 
         if (qbk_version_n < 103)

Modified: trunk/tools/quickbook/detail/actions.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.hpp (original)
+++ trunk/tools/quickbook/detail/actions.hpp 2008-01-07 14:46:27 EST (Mon, 07 Jan 2008)
@@ -743,6 +743,18 @@
         collector& out;
     };
 
+ struct xml_copyright
+ {
+ // Handles xml copyright
+
+ xml_copyright(collector& out)
+ : out(out) {}
+
+ void operator()(std::pair<std::vector<std::string>, std::string> const &copyright) const;
+
+ collector& out;
+ };
+
     void pre(collector& out, quickbook::actions& actions, bool ignore_docinfo = false);
     void post(collector& out, quickbook::actions& actions, bool ignore_docinfo = false);
 

Modified: trunk/tools/quickbook/detail/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions_class.cpp (original)
+++ trunk/tools/quickbook/detail/actions_class.cpp 2008-01-07 14:46:27 EST (Mon, 07 Jan 2008)
@@ -24,8 +24,7 @@
         , doc_version()
         , doc_id()
         , doc_dirname()
- , doc_copyright_years()
- , doc_copyright_holder()
+ , doc_copyrights()
         , doc_purpose()
         , doc_category()
         , doc_authors()

Modified: trunk/tools/quickbook/detail/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions_class.hpp (original)
+++ trunk/tools/quickbook/detail/actions_class.hpp 2008-01-07 14:46:27 EST (Mon, 07 Jan 2008)
@@ -28,6 +28,7 @@
 
         typedef std::vector<std::string> string_list;
         typedef std::vector<std::pair<std::string, std::string> > author_list;
+ typedef std::vector<std::pair<string_list, std::string> > copyright_list;
         typedef std::pair<char, int> mark_type;
         static int const max_template_depth = 100;
 
@@ -37,8 +38,7 @@
         std::string doc_version;
         std::string doc_id;
         std::string doc_dirname;
- string_list doc_copyright_years;
- std::string doc_copyright_holder;
+ copyright_list doc_copyrights;
         std::string doc_purpose;
         std::string doc_category;
         author_list doc_authors;

Modified: trunk/tools/quickbook/doc_info.hpp
==============================================================================
--- trunk/tools/quickbook/doc_info.hpp (original)
+++ trunk/tools/quickbook/doc_info.hpp 2008-01-07 14:46:27 EST (Mon, 07 Jan 2008)
@@ -66,7 +66,7 @@
                               doc_version
                             | doc_id
                             | doc_dirname
- | doc_copyright
+ | doc_copyright [push_back_a(actions.doc_copyrights, copyright)]
                             | doc_purpose [actions.extract_doc_purpose]
                             | doc_category
                             | doc_authors
@@ -103,12 +103,12 @@
                     ;
 
                 doc_copyright =
- "copyright" >> hard_space
- >> +( repeat_p(4)[digit_p] [push_back_a(actions.doc_copyright_years)]
+ "copyright" >> hard_space [clear_a(copyright.first)]
+ >> +( repeat_p(4)[digit_p] [push_back_a(copyright.first)]
>> space
                         )
>> space
- >> (*(anychar_p - ']')) [assign_a(actions.doc_copyright_holder)]
+ >> (*(anychar_p - ']')) [assign_a(copyright.second)]
                     ;
 
                 doc_purpose =
@@ -178,6 +178,7 @@
 
             bool unused;
             std::pair<std::string, std::string> name;
+ std::pair<std::vector<std::string>, std::string> copyright;
             rule<Scanner> doc_info, doc_title, doc_version, doc_id, doc_dirname,
                             doc_copyright, doc_purpose,doc_category, doc_authors,
                             doc_author, comment, space, hard_space, doc_license,


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