Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67922 - in branches/release: boost/algorithm/string boost/algorithm/string/detail libs/algorithm/string libs/algorithm/string/test
From: droba_at_[hidden]
Date: 2011-01-10 14:36:40


Author: pavol_droba
Date: 2011-01-10 14:36:38 EST (Mon, 10 Jan 2011)
New Revision: 67922
URL: http://svn.boost.org/trac/boost/changeset/67922

Log:
trunk changes merged

Properties modified:
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/libs/algorithm/string/ (props changed)
Text files modified:
   branches/release/boost/algorithm/string/detail/find_format.hpp | 40 +++++++++++++++++-----------------
   branches/release/boost/algorithm/string/detail/find_format_all.hpp | 46 ++++++++++++++++++++--------------------
   branches/release/boost/algorithm/string/detail/find_format_store.hpp | 2
   branches/release/boost/algorithm/string/find_iterator.hpp | 12 ++++++++-
   branches/release/libs/algorithm/string/test/split_test.cpp | 20 +++++++++++++++++
   5 files changed, 74 insertions(+), 46 deletions(-)

Modified: branches/release/boost/algorithm/string/detail/find_format.hpp
==============================================================================
--- branches/release/boost/algorithm/string/detail/find_format.hpp (original)
+++ branches/release/boost/algorithm/string/detail/find_format.hpp 2011-01-10 14:36:38 EST (Mon, 10 Jan 2011)
@@ -74,17 +74,17 @@
                 const InputT& Input,
                 FormatterT Formatter,
                 const FindResultT& FindResult )
- {
+ {
                 if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
- return ::boost::algorithm::detail::find_format_copy_impl2(
- Output,
- Input,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ return ::boost::algorithm::detail::find_format_copy_impl2(
+ Output,
+ Input,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
                 } else {
                     return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
- }
+ }
             }
 
  
@@ -137,14 +137,14 @@
                 const FindResultT& FindResult)
             {
                 if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
- return ::boost::algorithm::detail::find_format_copy_impl2(
- Input,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ return ::boost::algorithm::detail::find_format_copy_impl2(
+ Input,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
                 } else {
                     return Input;
- }
+ }
             }
 
  // replace implementation ----------------------------------------------------//
@@ -189,12 +189,12 @@
                 const FindResultT& FindResult)
             {
                 if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
- ::boost::algorithm::detail::find_format_impl2(
- Input,
- Formatter,
- FindResult,
- Formatter(FindResult) );
- }
+ ::boost::algorithm::detail::find_format_impl2(
+ Input,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
+ }
             }
 
         } // namespace detail

Modified: branches/release/boost/algorithm/string/detail/find_format_all.hpp
==============================================================================
--- branches/release/boost/algorithm/string/detail/find_format_all.hpp (original)
+++ branches/release/boost/algorithm/string/detail/find_format_all.hpp 2011-01-10 14:36:38 EST (Mon, 10 Jan 2011)
@@ -84,18 +84,18 @@
                 FinderT Finder,
                 FormatterT Formatter,
                 const FindResultT& FindResult )
- {
+ {
                 if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
- return ::boost::algorithm::detail::find_format_all_copy_impl2(
- Output,
- Input,
- Finder,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ return ::boost::algorithm::detail::find_format_all_copy_impl2(
+ Output,
+ Input,
+ Finder,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
                 } else {
                     return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
- }
+ }
             }
 
  // find_format_all_copy implementation ----------------------------------------------//
@@ -161,15 +161,15 @@
                 const FindResultT& FindResult)
             {
                 if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
- return ::boost::algorithm::detail::find_format_all_copy_impl2(
- Input,
- Finder,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ return ::boost::algorithm::detail::find_format_all_copy_impl2(
+ Input,
+ Finder,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
                 } else {
                     return Input;
- }
+ }
             }
 
  // find_format_all implementation ------------------------------------------------//
@@ -257,13 +257,13 @@
                 FindResultT FindResult)
             {
                 if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
- ::boost::algorithm::detail::find_format_all_impl2(
- Input,
- Finder,
- Formatter,
- FindResult,
- Formatter(FindResult) );
- }
+ ::boost::algorithm::detail::find_format_all_impl2(
+ Input,
+ Finder,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
+ }
             }
 
         } // namespace detail

Modified: branches/release/boost/algorithm/string/detail/find_format_store.hpp
==============================================================================
--- branches/release/boost/algorithm/string/detail/find_format_store.hpp (original)
+++ branches/release/boost/algorithm/string/detail/find_format_store.hpp 2011-01-10 14:36:38 EST (Mon, 10 Jan 2011)
@@ -53,7 +53,7 @@
                 {
                     iterator_range<ForwardIteratorT>::operator=(FindResult);
                     if( !this->empty() ) {
- m_FormatResult=m_Formatter(FindResult);
+ m_FormatResult=m_Formatter(FindResult);
                     }
                     
                     return *this;

Modified: branches/release/boost/algorithm/string/find_iterator.hpp
==============================================================================
--- branches/release/boost/algorithm/string/find_iterator.hpp (original)
+++ branches/release/boost/algorithm/string/find_iterator.hpp 2011-01-10 14:36:38 EST (Mon, 10 Jan 2011)
@@ -259,7 +259,11 @@
                 m_End(End),
                 m_bEof(false)
             {
- increment();
+ // force the correct behavior for empty sequences and yield at least one token
+ if(Begin!=End)
+ {
+ increment();
+ }
             }
             //! Constructor
             /*!
@@ -278,7 +282,11 @@
                 m_Next=::boost::begin(lit_col);
                 m_End=::boost::end(lit_col);
 
- increment();
+ // force the correct behavior for empty sequences and yield at least one token
+ if(m_Next!=m_End)
+ {
+ increment();
+ }
             }
 
 

Modified: branches/release/libs/algorithm/string/test/split_test.cpp
==============================================================================
--- branches/release/libs/algorithm/string/test/split_test.cpp (original)
+++ branches/release/libs/algorithm/string/test/split_test.cpp 2011-01-10 14:36:38 EST (Mon, 10 Jan 2011)
@@ -40,6 +40,7 @@
     string str1("xx-abc--xx-abb");
     string str2("Xx-abc--xX-abb-xx");
     string str3("xx");
+ string strempty("");
     const char* pch1="xx-abc--xx-abb";
     vector<string> tokens;
     vector< vector<int> > vtokens;
@@ -123,6 +124,25 @@
     BOOST_CHECK( tokens[3]==string("xx") );
     BOOST_CHECK( tokens[4]==string("abb") );
 
+ split(
+ tokens,
+ str3,
+ is_any_of(","),
+ token_compress_off);
+
+ BOOST_REQUIRE( tokens.size()==1 );
+ BOOST_CHECK( tokens[0]==string("xx") );
+
+ split(
+ tokens,
+ strempty,
+ is_punct(),
+ token_compress_off);
+
+ BOOST_REQUIRE( tokens.size()==1 );
+ BOOST_CHECK( tokens[0]==string("") );
+
+
     find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
     BOOST_CHECK(equals(*fiter, "xx"));
     ++fiter;


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