File indexing completed on 2025-02-22 09:55:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_STRING_COMPARE_HPP
0012 #define BOOST_STRING_COMPARE_HPP
0013
0014 #include <boost/algorithm/string/config.hpp>
0015 #include <locale>
0016
0017
0018
0019
0020
0021
0022
0023
0024 namespace boost {
0025 namespace algorithm {
0026
0027
0028
0029
0030
0031
0032
0033
0034 struct is_equal
0035 {
0036
0037
0038
0039
0040 template< typename T1, typename T2 >
0041 bool operator()( const T1& Arg1, const T2& Arg2 ) const
0042 {
0043 return Arg1==Arg2;
0044 }
0045 };
0046
0047
0048
0049
0050
0051
0052 struct is_iequal
0053 {
0054
0055
0056
0057
0058 is_iequal( const std::locale& Loc=std::locale() ) :
0059 m_Loc( Loc ) {}
0060
0061
0062
0063
0064
0065 template< typename T1, typename T2 >
0066 bool operator()( const T1& Arg1, const T2& Arg2 ) const
0067 {
0068 #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
0069 return std::toupper(Arg1)==std::toupper(Arg2);
0070 #else
0071 return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc);
0072 #endif
0073 }
0074
0075 private:
0076 std::locale m_Loc;
0077 };
0078
0079
0080
0081
0082
0083
0084
0085
0086 struct is_less
0087 {
0088
0089
0090
0091
0092 template< typename T1, typename T2 >
0093 bool operator()( const T1& Arg1, const T2& Arg2 ) const
0094 {
0095 return Arg1<Arg2;
0096 }
0097 };
0098
0099
0100
0101
0102
0103
0104
0105 struct is_iless
0106 {
0107
0108
0109
0110
0111 is_iless( const std::locale& Loc=std::locale() ) :
0112 m_Loc( Loc ) {}
0113
0114
0115
0116
0117
0118 template< typename T1, typename T2 >
0119 bool operator()( const T1& Arg1, const T2& Arg2 ) const
0120 {
0121 #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
0122 return std::toupper(Arg1)<std::toupper(Arg2);
0123 #else
0124 return std::toupper<T1>(Arg1,m_Loc)<std::toupper<T2>(Arg2,m_Loc);
0125 #endif
0126 }
0127
0128 private:
0129 std::locale m_Loc;
0130 };
0131
0132
0133
0134
0135
0136
0137
0138
0139 struct is_not_greater
0140 {
0141
0142
0143
0144
0145 template< typename T1, typename T2 >
0146 bool operator()( const T1& Arg1, const T2& Arg2 ) const
0147 {
0148 return Arg1<=Arg2;
0149 }
0150 };
0151
0152
0153
0154
0155
0156
0157
0158 struct is_not_igreater
0159 {
0160
0161
0162
0163
0164 is_not_igreater( const std::locale& Loc=std::locale() ) :
0165 m_Loc( Loc ) {}
0166
0167
0168
0169
0170
0171 template< typename T1, typename T2 >
0172 bool operator()( const T1& Arg1, const T2& Arg2 ) const
0173 {
0174 #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
0175 return std::toupper(Arg1)<=std::toupper(Arg2);
0176 #else
0177 return std::toupper<T1>(Arg1,m_Loc)<=std::toupper<T2>(Arg2,m_Loc);
0178 #endif
0179 }
0180
0181 private:
0182 std::locale m_Loc;
0183 };
0184
0185
0186 }
0187
0188
0189 using algorithm::is_equal;
0190 using algorithm::is_iequal;
0191 using algorithm::is_less;
0192 using algorithm::is_iless;
0193 using algorithm::is_not_greater;
0194 using algorithm::is_not_igreater;
0195
0196 }
0197
0198
0199 #endif