From e00fd7f15933366b7d530c2910e132bd6d857227 Mon Sep 17 00:00:00 2001 From: Pavol Droba Date: Wed, 11 May 2005 09:17:14 +0000 Subject: [PATCH] bcc32 patch from Russell Hind applied [SVN r28811] --- include/boost/algorithm/string/compare.hpp | 16 +++--- include/boost/algorithm/string/config.hpp | 4 -- .../algorithm/string/detail/case_conv.hpp | 16 ++++-- .../string/detail/classification.hpp | 52 +++++++++++-------- .../algorithm/string/sequence_traits.hpp | 38 +++++++------- .../algorithm/string/std/list_traits.hpp | 12 ++--- .../algorithm/string/std/slist_traits.hpp | 8 +-- .../algorithm/string/std/string_traits.hpp | 2 +- 8 files changed, 82 insertions(+), 66 deletions(-) diff --git a/include/boost/algorithm/string/compare.hpp b/include/boost/algorithm/string/compare.hpp index dc4d521..6961792 100644 --- a/include/boost/algorithm/string/compare.hpp +++ b/include/boost/algorithm/string/compare.hpp @@ -14,7 +14,7 @@ #include /*! \file - Defines element comparison predicates. Many algorithms in this library can + Defines element comparison predicates. Many algorithms in this library can take an additional argument with a predicate used to compare elements. This makes it possible, for instance, to have case insensitive versions of the algorithms. @@ -22,7 +22,7 @@ namespace boost { namespace algorithm { - + // is_equal functor -----------------------------------------------// //! is_equal functor @@ -54,24 +54,28 @@ namespace boost { /*! \param Loc locales used for comparison */ - is_iequal( const std::locale& Loc=std::locale() ) : + is_iequal( const std::locale& Loc=std::locale() ) : m_Loc( Loc ) {} - //! Function operator + //! Function operator /*! Compare two operands. Case is ignored. */ template< typename T1, typename T2 > bool operator ()( const T1& Arg1, const T2& Arg2 ) const { - return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc); + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::toupper(Arg1)==std::toupper(Arg2); + #else + return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc); + #endif } private: std::locale m_Loc; }; - } // namespace algorithm + } // namespace algorithm // pull names to the boost namespace using algorithm::is_equal; diff --git a/include/boost/algorithm/string/config.hpp b/include/boost/algorithm/string/config.hpp index e97b1a6..da28643 100644 --- a/include/boost/algorithm/string/config.hpp +++ b/include/boost/algorithm/string/config.hpp @@ -17,11 +17,7 @@ # error "macro already defined!" #endif -#ifdef __BORLANDC__ -#define BOOST_STRING_TYPENAME -#else #define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME -#endif // Metrowerks workaround #if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x diff --git a/include/boost/algorithm/string/detail/case_conv.hpp b/include/boost/algorithm/string/detail/case_conv.hpp index a6f24d7..95f9d85 100644 --- a/include/boost/algorithm/string/detail/case_conv.hpp +++ b/include/boost/algorithm/string/detail/case_conv.hpp @@ -20,7 +20,7 @@ namespace boost { // case conversion functors -----------------------------------------------// - // a tolower functor + // a tolower functor template struct to_lowerF : public std::unary_function { @@ -30,13 +30,17 @@ namespace boost { // Operation CharT operator ()( CharT Ch ) const { - return std::tolower( Ch, m_Loc ); + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::tolower( Ch); + #else + return std::tolower( Ch, m_Loc ); + #endif } private: const std::locale& m_Loc; }; - // a toupper functor + // a toupper functor template struct to_upperF : public std::unary_function { @@ -46,7 +50,11 @@ namespace boost { // Operation CharT operator ()( CharT Ch ) const { - return std::toupper( Ch, m_Loc ); + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::toupper( Ch); + #else + return std::toupper( Ch, m_Loc ); + #endif } private: const std::locale& m_Loc; diff --git a/include/boost/algorithm/string/detail/classification.hpp b/include/boost/algorithm/string/detail/classification.hpp index 06c85a9..3e305c3 100644 --- a/include/boost/algorithm/string/detail/classification.hpp +++ b/include/boost/algorithm/string/detail/classification.hpp @@ -25,9 +25,9 @@ namespace boost { namespace algorithm { namespace detail { - + // classification functors -----------------------------------------------// - + // is_classified functor struct is_classifiedF : public predicate_facade @@ -35,7 +35,7 @@ namespace boost { // Boost.Lambda support template struct sig { typedef bool type; }; - // Constructor from a locale + // Constructor from a locale is_classifiedF(std::ctype_base::mask Type, std::locale const & Loc = std::locale()) : m_Type(Type), m_Locale(Loc) {} @@ -46,13 +46,21 @@ namespace boost { return std::use_facet< std::ctype >(m_Locale).is( m_Type, Ch ); } + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + template<> + bool operator()( char const Ch ) const + { + return std::use_facet< std::ctype >(m_Locale).is( m_Type, Ch ); + } + #endif + private: const std::ctype_base::mask m_Type; const std::locale m_Locale; }; - // is_any_of functor - /* + // is_any_of functor + /* returns true if the value is from the specified set */ template @@ -62,26 +70,26 @@ namespace boost { // Boost.Lambda support template struct sig { typedef bool type; }; - // Constructor + // Constructor template - is_any_ofF( const RangeT& Range ) : + is_any_ofF( const RangeT& Range ) : m_Set( begin(Range), end(Range) ) {} - + // Operation template bool operator()( Char2T Ch ) const { return m_Set.find(Ch)!=m_Set.end(); } - + private: // set cannot operate on const value-type typedef typename remove_const::type set_value_type; - std::set m_Set; + std::set m_Set; }; - // is_from_range functor - /* + // is_from_range functor + /* returns true if the value is from the specified range. (i.e. x>=From && x>=To) */ @@ -92,16 +100,16 @@ namespace boost { // Boost.Lambda support template struct sig { typedef bool type; }; - // Constructor + // Constructor is_from_rangeF( CharT From, CharT To ) : m_From(From), m_To(To) {} - + // Operation template bool operator()( Char2T Ch ) const { - return ( m_From <= Ch ) && ( Ch <= m_To ); + return ( m_From <= Ch ) && ( Ch <= m_To ); } - + private: CharT m_From; CharT m_To; @@ -123,11 +131,11 @@ namespace boost { // Operation template - bool operator()( CharT Ch ) const + bool operator()( CharT Ch ) const { return m_Pred1(Ch) && m_Pred2(Ch); } - + private: Pred1T m_Pred1; Pred2T m_Pred2; @@ -148,11 +156,11 @@ namespace boost { // Operation template - bool operator()( CharT Ch ) const + bool operator()( CharT Ch ) const { return m_Pred1(Ch) || m_Pred2(Ch); } - + private: Pred1T m_Pred1; Pred2T m_Pred2; @@ -172,11 +180,11 @@ namespace boost { // Operation template - bool operator()( CharT Ch ) const + bool operator()( CharT Ch ) const { return !m_Pred(Ch); } - + private: PredT m_Pred; }; diff --git a/include/boost/algorithm/string/sequence_traits.hpp b/include/boost/algorithm/string/sequence_traits.hpp index a9ba473..e53f656 100644 --- a/include/boost/algorithm/string/sequence_traits.hpp +++ b/include/boost/algorithm/string/sequence_traits.hpp @@ -24,7 +24,7 @@ Due to a language restriction, it is not currently possible to define specializations for stl containers without including the corresponding header. To decrease the overhead - needed by this inclusion, user can selectively include a specialization + needed by this inclusion, user can selectively include a specialization header for a specific container. They are located in boost/algorithm/string/stl directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp header which contains specializations for all stl containers. @@ -39,7 +39,7 @@ namespace boost { //! Native replace tester /*! - Declare an override of this tester function with return + Declare an override of this tester function with return type boost::string_algo::yes_type for a sequence with this property. \return yes_type if the container has basic_string like native replace @@ -49,31 +49,31 @@ namespace boost { //! Stable iterators tester /*! - Declare an override of this tester function with return + Declare an override of this tester function with return type boost::string_algo::yes_type for a sequence with this property. \return yes_type if the sequence's insert/replace/erase methods do not invalidate existing iterators. */ - no_type has_stable_iterators_tester(...); + no_type has_stable_iterators_tester(...); //! const time insert tester /*! - Declare an override of this tester function with return + Declare an override of this tester function with return type boost::string_algo::yes_type for a sequence with this property. \return yes_type if the sequence's insert method is working in constant time */ - no_type has_const_time_insert_tester(...); + no_type has_const_time_insert_tester(...); //! const time erase tester /*! - Declare an override of this tester function with return + Declare an override of this tester function with return type boost::string_algo::yes_type for a sequence with this property. \return yes_type if the sequence's erase method is working in constant time */ - no_type has_const_time_erase_tester(...); + no_type has_const_time_erase_tester(...); #endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -89,7 +89,7 @@ namespace boost { private: static T* t; public: - BOOST_STATIC_CONSTANT(bool, value=( + BOOST_STATIC_CONSTANT(bool, value=( sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) ); #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION public: @@ -99,9 +99,9 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, value=false); # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - typedef mpl::bool_ type; + + typedef mpl::bool_::value> type; }; @@ -117,7 +117,7 @@ namespace boost { private: static T* t; public: - BOOST_STATIC_CONSTANT(bool, value=( + BOOST_STATIC_CONSTANT(bool, value=( sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) ); #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION public: @@ -128,13 +128,13 @@ namespace boost { # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; //! Const time insert trait /*! - This trait specifies that the sequence's insert method has + This trait specifies that the sequence's insert method has constant time complexity. */ template< typename T > @@ -144,7 +144,7 @@ namespace boost { private: static T* t; public: - BOOST_STATIC_CONSTANT(bool, value=( + BOOST_STATIC_CONSTANT(bool, value=( sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) ); #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION public: @@ -155,13 +155,13 @@ namespace boost { # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; //! Const time erase trait /*! - This trait specifies that the sequence's erase method has + This trait specifies that the sequence's erase method has constant time complexity. */ template< typename T > @@ -171,7 +171,7 @@ namespace boost { private: static T* t; public: - BOOST_STATIC_CONSTANT(bool, value=( + BOOST_STATIC_CONSTANT(bool, value=( sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) ); #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION public: @@ -182,7 +182,7 @@ namespace boost { # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; } // namespace algorithm diff --git a/include/boost/algorithm/string/std/list_traits.hpp b/include/boost/algorithm/string/std/list_traits.hpp index 92e4b5c..e58a66a 100644 --- a/include/boost/algorithm/string/std/list_traits.hpp +++ b/include/boost/algorithm/string/std/list_traits.hpp @@ -33,9 +33,9 @@ namespace boost { template yes_type has_const_time_erase_tester( const ::std::list* ); - + #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - + // stable iterators trait template class has_stable_iterators< ::std::list > @@ -46,7 +46,7 @@ namespace boost { #else BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; // const time insert trait @@ -59,7 +59,7 @@ namespace boost { #else BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; // const time erase trait @@ -72,11 +72,11 @@ namespace boost { #else BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; #endif - + } // namespace algorithm } // namespace boost diff --git a/include/boost/algorithm/string/std/slist_traits.hpp b/include/boost/algorithm/string/std/slist_traits.hpp index ceddbc7..f33f446 100644 --- a/include/boost/algorithm/string/std/slist_traits.hpp +++ b/include/boost/algorithm/string/std/slist_traits.hpp @@ -35,7 +35,7 @@ namespace boost { yes_type has_const_time_erase_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist* ); #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - + // stable iterators trait template class has_stable_iterators< BOOST_STD_EXTENSION_NAMESPACE::slist > @@ -46,7 +46,7 @@ namespace boost { #else BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; // const time insert trait @@ -59,7 +59,7 @@ namespace boost { #else BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; // const time erase trait @@ -72,7 +72,7 @@ namespace boost { #else BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; }; #endif diff --git a/include/boost/algorithm/string/std/string_traits.hpp b/include/boost/algorithm/string/std/string_traits.hpp index 89b7543..d603a4a 100644 --- a/include/boost/algorithm/string/std/string_traits.hpp +++ b/include/boost/algorithm/string/std/string_traits.hpp @@ -38,7 +38,7 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, value=true); #endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) - typedef mpl::bool_ type; + typedef mpl::bool_::value> type; };