diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-24 20:33:19 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-24 20:35:17 (GMT) |
commit | 332d60c56dfaa11fdd135088279d15cd5983b3d4 (patch) | |
tree | dd77717a4e1732da929d5ff8a0471fa3f005e201 /3rdParty/Boost/src/boost/algorithm/string | |
parent | 90c44a10fec26d2a0935b2d62e82b6a5be028373 (diff) | |
download | swift-contrib-332d60c56dfaa11fdd135088279d15cd5983b3d4.zip swift-contrib-332d60c56dfaa11fdd135088279d15cd5983b3d4.tar.bz2 |
Upgraded Boost to 1.45.0.
Diffstat (limited to '3rdParty/Boost/src/boost/algorithm/string')
5 files changed, 46 insertions, 15 deletions
diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp index 3440c27..5b0064f 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp @@ -31,7 +31,7 @@ namespace boost { 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 @@ namespace boost { #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 @@ namespace boost { 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 @@ namespace boost { #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) diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/find_format.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/find_format.hpp index 0d8b104..7f5f780 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/find_format.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/find_format.hpp @@ -49,17 +49,17 @@ namespace boost { 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 @@ namespace boost { 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 @@ namespace boost { 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 @@ namespace boost { 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 diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_all.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_all.hpp index 36edf56..0f184a3 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_all.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_all.hpp @@ -57,9 +57,9 @@ namespace boost { 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 @@ namespace boost { } // 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 @@ namespace boost { 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 @@ namespace boost { Formatter, FindResult, Formatter(FindResult) ); + } else { + return std::copy( ::boost::begin(Input), ::boost::end(Input), Output ); + } } // find_format_all_copy implementation ----------------------------------------------// @@ -156,12 +160,16 @@ namespace boost { 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 @@ namespace boost { 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 @@ namespace boost { FindResult, Formatter(FindResult) ); } + } } // namespace detail } // namespace algorithm diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_store.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_store.hpp index 2260fc2e..4872c5a 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_store.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/find_format_store.hpp @@ -52,7 +52,9 @@ namespace boost { 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 @@ namespace boost { const formatter_type& m_Formatter; }; + template<typename InputT, typename FindResultT> + bool check_find_result(InputT&, 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 diff --git a/3rdParty/Boost/src/boost/algorithm/string/erase.hpp b/3rdParty/Boost/src/boost/algorithm/string/erase.hpp index 0951b8a..e738b86 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/erase.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/erase.hpp @@ -752,7 +752,7 @@ namespace boost { \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 @@ namespace boost { 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. */ |