Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64033 - in sandbox/SOC/2010/stringalgos: boost/algorithm/string boost/algorithm/string/detail libs/algorithm/string libs/algorithm/string/doc libs/algorithm/string/test
From: mstefanro_at_[hidden]
Date: 2010-07-14 21:48:47


Author: mstefanro
Date: 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
New Revision: 64033
URL: http://svn.boost.org/trac/boost/changeset/64033

Log:
[GSoC2010][StringAlgo] Merge from trunk
Added:
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/find_format_test.cpp
      - copied unchanged from r64032, /trunk/libs/algorithm/string/test/find_format_test.cpp
Properties modified:
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/ (props changed)
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/ (props changed)
Text files modified:
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/case_conv.hpp | 12 ++++----
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/classification.hpp | 24 ++++++++--------
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format.hpp | 52 ++++++++++++++++++++++---------------
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_all.hpp | 56 +++++++++++++++++++++++----------------
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_store.hpp | 13 ++++++++
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/erase.hpp | 4 +-
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/find.hpp | 2
   sandbox/SOC/2010/stringalgos/boost/algorithm/string/find_iterator.hpp | 2
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/Jamfile.v2 | 1
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/external_concepts.html | 10 ++++--
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/string_algo.xml | 2
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/usage.xml | 4 +-
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/Jamfile.v2 | 6 ++++
   sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/split_test.cpp | 1
   14 files changed, 115 insertions(+), 74 deletions(-)

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/case_conv.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/case_conv.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/case_conv.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -31,7 +31,7 @@
             struct to_lowerF : public std::unary_function<CharT, CharT>
             {
                 // Constructor
- to_lowerF( const std::locale& Loc ) : m_Loc( Loc ) {}
+ to_lowerF( const std::locale& Loc ) : m_Loc( &Loc ) {}
 
                 // Operation
                 CharT operator ()( CharT Ch ) const
@@ -39,11 +39,11 @@
                     #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
                         return std::tolower( Ch);
                     #else
- return std::tolower<CharT>( Ch, m_Loc );
+ return std::tolower<CharT>( Ch, *m_Loc );
                     #endif
                 }
             private:
- const std::locale& m_Loc;
+ const std::locale* m_Loc;
             };
 
             // a toupper functor
@@ -51,7 +51,7 @@
             struct to_upperF : public std::unary_function<CharT, CharT>
             {
                 // Constructor
- to_upperF( const std::locale& Loc ) : m_Loc( Loc ) {}
+ to_upperF( const std::locale& Loc ) : m_Loc( &Loc ) {}
 
                 // Operation
                 CharT operator ()( CharT Ch ) const
@@ -59,11 +59,11 @@
                     #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
                         return std::toupper( Ch);
                     #else
- return std::toupper<CharT>( Ch, m_Loc );
+ return std::toupper<CharT>( Ch, *m_Loc );
                     #endif
                 }
             private:
- const std::locale& m_Loc;
+ const std::locale* m_Loc;
             };
 
 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/classification.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/classification.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/classification.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -32,8 +32,8 @@
             struct is_classifiedF :
                 public predicate_facade<is_classifiedF>
             {
- // Boost.Lambda support
- template <class Args> struct sig { typedef bool type; };
+ // Boost.ResultOf support
+ typedef bool result_type;
 
                 // Constructor from a locale
                 is_classifiedF(std::ctype_base::mask Type, std::locale const & Loc = std::locale()) :
@@ -72,8 +72,8 @@
                 typedef typename ::boost::remove_const<CharT>::type set_value_type;
 
             public:
- // Boost.Lambda support
- template <class Args> struct sig { typedef bool type; };
+ // Boost.ResultOf support
+ typedef bool result_type;
 
                 // Constructor
                 template<typename RangeT>
@@ -253,8 +253,8 @@
             struct is_from_rangeF :
                 public predicate_facade< is_from_rangeF<CharT> >
             {
- // Boost.Lambda support
- template <class Args> struct sig { typedef bool type; };
+ // Boost.ResultOf support
+ typedef bool result_type;
 
                 // Constructor
                 is_from_rangeF( CharT From, CharT To ) : m_From(From), m_To(To) {}
@@ -278,8 +278,8 @@
             {
             public:
 
- // Boost.Lambda support
- template <class Args> struct sig { typedef bool type; };
+ // Boost.ResultOf support
+ typedef bool result_type;
 
                 // Constructor
                 pred_andF( Pred1T Pred1, Pred2T Pred2 ) :
@@ -303,8 +303,8 @@
                 public predicate_facade< pred_orF<Pred1T,Pred2T> >
             {
             public:
- // Boost.Lambda support
- template <class Args> struct sig { typedef bool type; };
+ // Boost.ResultOf support
+ typedef bool result_type;
 
                 // Constructor
                 pred_orF( Pred1T Pred1, Pred2T Pred2 ) :
@@ -328,8 +328,8 @@
                 public predicate_facade< pred_notF<PredT> >
             {
             public:
- // Boost.Lambda support
- template <class Args> struct sig { typedef bool type; };
+ // Boost.ResultOf support
+ typedef bool result_type;
 
                 // Constructor
                 pred_notF( PredT Pred ) : m_Pred(Pred) {}

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -49,17 +49,17 @@
                 if ( !M )
                 {
                     // Match not found - return original sequence
- std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
+ Output = std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
                     return Output;
                 }
 
                 // Copy the beginning of the sequence
- std::copy( ::boost::begin(Input), ::boost::begin(M), Output );
+ Output = std::copy( ::boost::begin(Input), ::boost::begin(M), Output );
                 // Format find result
                 // Copy formated result
- std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
+ Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
                 // Copy the rest of the sequence
- std::copy( M.end(), ::boost::end(Input), Output );
+ Output = std::copy( M.end(), ::boost::end(Input), Output );
 
                 return Output;
             }
@@ -74,13 +74,17 @@
                 const InputT& Input,
                 FormatterT Formatter,
                 const FindResultT& FindResult )
- {
- return ::boost::algorithm::detail::find_format_copy_impl2(
- Output,
- Input,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ {
+ if( ::boost::algorithm::detail::check_find_result(Input, 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 );
+ }
             }
 
  
@@ -132,11 +136,15 @@
                 FormatterT Formatter,
                 const FindResultT& FindResult)
             {
- return ::boost::algorithm::detail::find_format_copy_impl2(
- Input,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
+ return ::boost::algorithm::detail::find_format_copy_impl2(
+ Input,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
+ } else {
+ return Input;
+ }
             }
 
  // replace implementation ----------------------------------------------------//
@@ -180,11 +188,13 @@
                 FormatterT Formatter,
                 const FindResultT& FindResult)
             {
- ::boost::algorithm::detail::find_format_impl2(
- Input,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
+ ::boost::algorithm::detail::find_format_impl2(
+ Input,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
+ }
             }
 
         } // namespace detail

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_all.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_all.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_all.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -57,9 +57,9 @@
                 while( M )
                 {
                     // Copy the beginning of the sequence
- std::copy( LastMatch, M.begin(), Output );
+ Output = std::copy( LastMatch, M.begin(), Output );
                     // Copy formated result
- std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
+ Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
 
                     // Proceed to the next match
                     LastMatch=M.end();
@@ -67,7 +67,7 @@
                 }
 
                 // Copy the rest of the sequence
- std::copy( LastMatch, ::boost::end(Input), Output );
+ Output = std::copy( LastMatch, ::boost::end(Input), Output );
 
                 return Output;
             }
@@ -84,14 +84,18 @@
                 FinderT Finder,
                 FormatterT Formatter,
                 const FindResultT& FindResult )
- {
- return ::boost::algorithm::detail::find_format_all_copy_impl2(
- Output,
- Input,
- Finder,
- Formatter,
- FindResult,
- Formatter(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) );
+ } else {
+ return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
+ }
             }
 
  // find_format_all_copy implementation ----------------------------------------------//
@@ -156,12 +160,16 @@
                 FormatterT Formatter,
                 const FindResultT& FindResult)
             {
- return ::boost::algorithm::detail::find_format_all_copy_impl2(
- Input,
- Finder,
- Formatter,
- FindResult,
- Formatter(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) );
+ } else {
+ return Input;
+ }
             }
 
  // find_format_all implementation ------------------------------------------------//
@@ -248,12 +256,14 @@
                 FormatterT Formatter,
                 FindResultT FindResult)
             {
- ::boost::algorithm::detail::find_format_all_impl2(
- Input,
- Finder,
- Formatter,
- FindResult,
- Formatter(FindResult) );
+ if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
+ ::boost::algorithm::detail::find_format_all_impl2(
+ Input,
+ Finder,
+ Formatter,
+ FindResult,
+ Formatter(FindResult) );
+ }
             }
 
         } // namespace detail

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_store.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_store.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/detail/find_format_store.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -52,7 +52,9 @@
                 find_format_store& operator=( FindResultT FindResult )
                 {
                     iterator_range<ForwardIteratorT>::operator=(FindResult);
- m_FormatResult=m_Formatter(FindResult);
+ if( !this->empty() ) {
+ m_FormatResult=m_Formatter(FindResult);
+ }
                     
                     return *this;
                 }
@@ -68,6 +70,15 @@
                 const formatter_type& m_Formatter;
             };
 
+ template<typename InputT, typename FindResultT>
+ bool check_find_result(InputT& Input, FindResultT& FindResult)
+ {
+ typedef BOOST_STRING_TYPENAME
+ range_const_iterator<InputT>::type input_iterator_type;
+ iterator_range<input_iterator_type> ResultRange(FindResult);
+ return !ResultRange.empty();
+ }
+
 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
 #pragma warning(pop)
 #endif

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/erase.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/erase.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/erase.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -752,7 +752,7 @@
 
             \param Output An output iterator to which the result will be copied
             \param Input An input string
- \param N Length of the head.
+ \param N Length of the tail.
                 For N>=0, at most N characters are extracted.
                 For N<0, size(Input)-|N| characters are extracted.
             \return An output iterator pointing just after the last inserted character or
@@ -797,7 +797,7 @@
             considered to be the tail. The input sequence is modified in-place.
 
             \param Input An input string
- \param N Length of the head
+ \param N Length of the tail
                 For N>=0, at most N characters are extracted.
                 For N<0, size(Input)-|N| characters are extracted.
         */

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/find.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/find.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/find.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -258,7 +258,7 @@
 
         //! Find tail algorithm
         /*!
- Get the head of the input. Head is a suffix of the string of the
+ Get the tail of the input. Tail is a suffix of the string of the
             given size. If the input is shorter then required, whole input if considered
             to be the tail.
 

Modified: sandbox/SOC/2010/stringalgos/boost/algorithm/string/find_iterator.hpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/boost/algorithm/string/find_iterator.hpp (original)
+++ sandbox/SOC/2010/stringalgos/boost/algorithm/string/find_iterator.hpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -240,7 +240,7 @@
                 m_Match(Other.m_Match),
                 m_Next(Other.m_Next),
                 m_End(Other.m_End),
- m_bEof(false)
+ m_bEof(Other.m_bEof)
             {}
 
             //! Constructor

Modified: sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/Jamfile.v2 (original)
+++ sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/Jamfile.v2 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -12,6 +12,7 @@
 
 boostbook string_algo : string_algo.xml autodoc
         :
+ <xsl:param>boost.root=../../../../..
         <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
         ;
 

Modified: sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/external_concepts.html
==============================================================================
--- sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/external_concepts.html (original)
+++ sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/external_concepts.html 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -32,7 +32,9 @@
             free-standing functions and type-generators exists:</p><code>void foo( const T&, int ); <br>
                 int bar( T& ); <br>
              foo_type_of< T >::type;</code> <br> <br><hr size="1" ><h3 >Literature</h3><ul ><li > Type Generators </li><li > Concepts </li><li > Concepts and SGI STL </li></ul><hr size="1" ><p >&copy; Thorsten Ottosen 2003-2004 (nesotto_AT_cs.auc.dk).
- Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears
- in all copies. This software is provided "as is" without express or implied warranty, and with no
- claim as to its suitability for any purpose.</p><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></body></html>
- <!-- Copyright Dezide Aps 2003-2004 -->
\ No newline at end of file
+<br>Use, modification and distribution is subject to the Boost
+ Software License, Version 1.0. (See accompanying file
+ <code class="filename">LICENSE_1_0.txt</code> or copy at http://www.boost.org/LICENSE_1_0.txt)
+</br>
+</p>
+ <!-- Copyright Dezide Aps 2003-2004 -->

Modified: sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/string_algo.xml
==============================================================================
--- sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/string_algo.xml (original)
+++ sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/string_algo.xml 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -33,7 +33,7 @@
         <librarypurpose>
             A set of generic string-related algorithms and utilities
         </librarypurpose>
- <librarycategory name="category:algoritms"/>
+ <librarycategory name="category:algorithms"/>
         <librarycategory name="category:string-text"/>
     </libraryinfo>
 

Modified: sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/usage.xml
==============================================================================
--- sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/usage.xml (original)
+++ sandbox/SOC/2010/stringalgos/libs/algorithm/string/doc/usage.xml 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -169,7 +169,7 @@
         <programlisting>
     string str1=" hello world! ";
     string str2=trim_left_copy(str1); // str2 == "hello world! "
- string str3=trim_right_copy(str2); // str3 == " hello world!"
+ string str3=trim_right_copy(str1); // str3 == " hello world!"
     trim(str1); // str1 == "hello world!"
 
     string phone="00423333444";
@@ -339,7 +339,7 @@
     typedef vector&lt; string &gt; split_vector_type;
     
     split_vector_type SplitVec; // #2: Search for tokens
- split( SplitVec, str1, is_any_of("-*") ); // SplitVec == { "hello abc","ABC","aBc goodbye" }
+ split( SplitVec, str1, is_any_of("-*"), token_compress_on ); // SplitVec == { "hello abc","ABC","aBc goodbye" }
         </programlisting>
         <para>
             <code>[hello]</code> designates an <code>iterator_range</code> delimiting this substring.

Modified: sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/Jamfile.v2 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -65,5 +65,11 @@
             :
             : regex
         ]
+ [ run
+ find_format_test.cpp
+ : :
+ :
+ : find_format
+ ]
     ;
 

Modified: sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/split_test.cpp
==============================================================================
--- sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/split_test.cpp (original)
+++ sandbox/SOC/2010/stringalgos/libs/algorithm/string/test/split_test.cpp 2010-07-14 21:48:45 EDT (Wed, 14 Jul 2010)
@@ -139,6 +139,7 @@
     ++siter;
     BOOST_CHECK(equals(*siter, "abb"));
     ++siter;
+ BOOST_CHECK(siter==split_iterator<string::iterator>(siter));
     BOOST_CHECK(siter==split_iterator<string::iterator>());
 
 }


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