|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63824 - in branches/release: boost/algorithm/string boost/algorithm/string/detail libs/algorithm/string libs/algorithm/string/doc libs/algorithm/string/test
From: droba_at_[hidden]
Date: 2010-07-10 16:29:19
Author: pavol_droba
Date: 2010-07-10 16:29:03 EDT (Sat, 10 Jul 2010)
New Revision: 63824
URL: http://svn.boost.org/trac/boost/changeset/63824
Log:
Merging changes from trunk
Added:
branches/release/libs/algorithm/string/test/find_format_test.cpp
- copied unchanged from r63823, /trunk/libs/algorithm/string/test/find_format_test.cpp
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/case_conv.hpp | 12 ++++++------
branches/release/boost/algorithm/string/detail/classification.hpp | 24 ++++++++++++------------
branches/release/boost/algorithm/string/detail/find_format.hpp | 18 ++++++++++++++----
branches/release/boost/algorithm/string/detail/find_format_all.hpp | 16 +++++++++++++---
branches/release/boost/algorithm/string/detail/find_format_store.hpp | 11 +++++++++++
branches/release/boost/algorithm/string/erase.hpp | 4 ++--
branches/release/boost/algorithm/string/find.hpp | 2 +-
branches/release/boost/algorithm/string/find_iterator.hpp | 2 +-
branches/release/libs/algorithm/string/doc/external_concepts.html | 10 ++++++----
branches/release/libs/algorithm/string/doc/string_algo.xml | 2 +-
branches/release/libs/algorithm/string/doc/usage.xml | 4 ++--
branches/release/libs/algorithm/string/test/Jamfile.v2 | 6 ++++++
branches/release/libs/algorithm/string/test/split_test.cpp | 1 +
13 files changed, 76 insertions(+), 36 deletions(-)
Modified: branches/release/boost/algorithm/string/detail/case_conv.hpp
==============================================================================
--- branches/release/boost/algorithm/string/detail/case_conv.hpp (original)
+++ branches/release/boost/algorithm/string/detail/case_conv.hpp 2010-07-10 16:29:03 EDT (Sat, 10 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: branches/release/boost/algorithm/string/detail/classification.hpp
==============================================================================
--- branches/release/boost/algorithm/string/detail/classification.hpp (original)
+++ branches/release/boost/algorithm/string/detail/classification.hpp 2010-07-10 16:29:03 EDT (Sat, 10 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: 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 2010-07-10 16:29:03 EDT (Sat, 10 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;
}
@@ -75,12 +75,16 @@
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) );
+ } else {
+ return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
+ }
}
@@ -132,11 +136,15 @@
FormatterT Formatter,
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) );
+ } else {
+ return Input;
+ }
}
// replace implementation ----------------------------------------------------//
@@ -180,12 +188,14 @@
FormatterT Formatter,
const FindResultT& FindResult)
{
+ if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
::boost::algorithm::detail::find_format_impl2(
Input,
Formatter,
FindResult,
Formatter(FindResult) );
}
+ }
} // namespace detail
} // namespace algorithm
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 2010-07-10 16:29:03 EDT (Sat, 10 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;
}
@@ -85,6 +85,7 @@
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,
@@ -92,6 +93,9 @@
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)
{
+ 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,6 +256,7 @@
FormatterT Formatter,
FindResultT FindResult)
{
+ if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
::boost::algorithm::detail::find_format_all_impl2(
Input,
Finder,
@@ -255,6 +264,7 @@
FindResult,
Formatter(FindResult) );
}
+ }
} // namespace detail
} // namespace algorithm
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 2010-07-10 16:29:03 EDT (Sat, 10 Jul 2010)
@@ -52,7 +52,9 @@
find_format_store& operator=( FindResultT FindResult )
{
iterator_range<ForwardIteratorT>::operator=(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: branches/release/boost/algorithm/string/erase.hpp
==============================================================================
--- branches/release/boost/algorithm/string/erase.hpp (original)
+++ branches/release/boost/algorithm/string/erase.hpp 2010-07-10 16:29:03 EDT (Sat, 10 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: branches/release/boost/algorithm/string/find.hpp
==============================================================================
--- branches/release/boost/algorithm/string/find.hpp (original)
+++ branches/release/boost/algorithm/string/find.hpp 2010-07-10 16:29:03 EDT (Sat, 10 Jul 2010)
@@ -257,7 +257,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: 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 2010-07-10 16:29:03 EDT (Sat, 10 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: branches/release/libs/algorithm/string/doc/external_concepts.html
==============================================================================
--- branches/release/libs/algorithm/string/doc/external_concepts.html (original)
+++ branches/release/libs/algorithm/string/doc/external_concepts.html 2010-07-10 16:29:03 EDT (Sat, 10 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 >© 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: branches/release/libs/algorithm/string/doc/string_algo.xml
==============================================================================
--- branches/release/libs/algorithm/string/doc/string_algo.xml (original)
+++ branches/release/libs/algorithm/string/doc/string_algo.xml 2010-07-10 16:29:03 EDT (Sat, 10 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: branches/release/libs/algorithm/string/doc/usage.xml
==============================================================================
--- branches/release/libs/algorithm/string/doc/usage.xml (original)
+++ branches/release/libs/algorithm/string/doc/usage.xml 2010-07-10 16:29:03 EDT (Sat, 10 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< string > 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: branches/release/libs/algorithm/string/test/Jamfile.v2
==============================================================================
--- branches/release/libs/algorithm/string/test/Jamfile.v2 (original)
+++ branches/release/libs/algorithm/string/test/Jamfile.v2 2010-07-10 16:29:03 EDT (Sat, 10 Jul 2010)
@@ -59,5 +59,11 @@
:
: regex
]
+ [ run
+ find_format_test.cpp
+ : :
+ :
+ : find_format
+ ]
;
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 2010-07-10 16:29:03 EDT (Sat, 10 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