Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69166 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-02-22 15:28:49


Author: danieljames
Date: 2011-02-22 15:28:48 EST (Tue, 22 Feb 2011)
New Revision: 69166
URL: http://svn.boost.org/trac/boost/changeset/69166

Log:
Use ranges in make_identifier.
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 21 ++++++++-------------
   branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp | 3 +--
   branches/quickbook-filenames/tools/quickbook/src/utils.hpp | 13 +++++++++----
   3 files changed, 18 insertions(+), 19 deletions(-)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.cpp 2011-02-22 15:28:48 EST (Tue, 22 Feb 2011)
@@ -191,22 +191,19 @@
 
         if (!generic && qbk_version_n < 103) // version 1.2 and below
         {
- std::string id_base = content.get_boostbook();
-
             anchor = section_id + '.' +
- detail::make_identifier(id_base.begin(), id_base.end());
+ detail::make_identifier(content.get_boostbook());
         }
         else
         {
- std::string id_base =
- qbk_version_n >= 106 ?
- content.get_quickbook() :
- content.get_boostbook();
-
             std::string id =
                 !element_id.is_empty() ?
                     element_id.get_quickbook() :
- detail::make_identifier(id_base.begin(), id_base.end());
+ detail::make_identifier(
+ qbk_version_n >= 106 ?
+ content.get_quickbook() :
+ content.get_boostbook()
+ );
 
             linkend = anchor =
                 fully_qualified_id(library_id, qualified_section_id, id);
@@ -1222,7 +1219,7 @@
             else if(has_title) {
                 table_id = fully_qualified_id(actions.doc_id,
                     actions.qualified_section_id,
- detail::make_identifier(title.begin(), title.end()));
+ detail::make_identifier(title));
             }
         }
 
@@ -1302,11 +1299,9 @@
         value content = values.consume();
         assert(!values.is());
 
- std::string qbk_src = content.get_quickbook();
-
         section_id = !element_id.is_empty() ?
             element_id.get_quickbook() :
- detail::make_identifier(qbk_src.begin(), qbk_src.end());
+ detail::make_identifier(content.get_quickbook());
 
         if (section_level != 0)
             qualified_section_id += '.';

Modified: branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp 2011-02-22 15:28:48 EST (Tue, 22 Feb 2011)
@@ -98,8 +98,7 @@
             actions.doc_id = id.get_quickbook();
 
         if (actions.doc_id.empty())
- actions.doc_id = detail::make_identifier(
- actions.doc_title_qbk.begin(),actions.doc_title_qbk.end());
+ actions.doc_id = detail::make_identifier(actions.doc_title_qbk);
         
         if (dirname.is_empty() && actions.doc_type == "library") {
             if (!id.is_empty()) {

Modified: branches/quickbook-filenames/tools/quickbook/src/utils.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/utils.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/utils.hpp 2011-02-22 15:28:48 EST (Tue, 22 Feb 2011)
@@ -15,6 +15,9 @@
 #include <boost/ref.hpp>
 #include <boost/assert.hpp>
 #include <boost/filesystem/v3/path.hpp>
+#include <boost/range/algorithm_ext/push_back.hpp>
+#include <boost/range/adaptor/transformed.hpp>
+
 
 namespace quickbook {
 
@@ -27,13 +30,15 @@
     void print_space(char ch, std::ostream& out);
     char filter_identifier_char(char ch);
 
- template <typename Iterator>
+ template <typename Range>
     inline std::string
- make_identifier(Iterator const& first, Iterator const& last)
+ make_identifier(Range const& range)
     {
         std::string out_name;
- for (Iterator i = first; i != last; ++i)
- out_name += filter_identifier_char(*i);
+
+ boost::push_back(out_name,
+ range | boost::adaptors::transformed(filter_identifier_char));
+
         return out_name;
     }
 


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