File indexing completed on 2025-01-18 09:51:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_REGEX_WORKAROUND_HPP
0020 #define BOOST_REGEX_WORKAROUND_HPP
0021
0022 #include <boost/config.hpp>
0023 #include <new>
0024 #include <cstring>
0025 #include <cstdlib>
0026 #include <cstddef>
0027 #include <cassert>
0028 #include <cstdio>
0029 #include <climits>
0030 #include <string>
0031 #include <stdexcept>
0032 #include <iterator>
0033 #include <algorithm>
0034 #include <iosfwd>
0035 #include <vector>
0036 #include <set>
0037 #include <map>
0038 #include <boost/limits.hpp>
0039 #include <boost/assert.hpp>
0040 #include <boost/cstdint.hpp>
0041 #include <boost/throw_exception.hpp>
0042 #include <boost/scoped_ptr.hpp>
0043 #include <boost/scoped_array.hpp>
0044 #include <boost/shared_ptr.hpp>
0045 #include <boost/mpl/bool_fwd.hpp>
0046 #include <boost/regex/config.hpp>
0047 #ifndef BOOST_NO_STD_LOCALE
0048 # include <locale>
0049 #endif
0050
0051 #if defined(BOOST_NO_STDC_NAMESPACE)
0052 namespace std{
0053 using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
0054 }
0055 #endif
0056
0057 namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
0058 #ifdef BOOST_NO_STD_DISTANCE
0059 template <class T>
0060 std::ptrdiff_t distance(const T& x, const T& y)
0061 { return y - x; }
0062 #else
0063 using std::distance;
0064 #endif
0065 }}
0066
0067
0068 #ifdef BOOST_REGEX_NO_BOOL
0069 # define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>((x) ? true : false)
0070 #else
0071 # define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>(x)
0072 #endif
0073
0074
0075
0076
0077
0078
0079
0080 #if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
0081
0082 namespace std{
0083 using ::ptrdiff_t;
0084 using ::size_t;
0085 using ::abs;
0086 using ::memset;
0087 using ::memcpy;
0088 }
0089
0090 #endif
0091
0092
0093
0094
0095
0096
0097
0098 #ifdef __cplusplus
0099 namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
0100
0101 #ifdef BOOST_MSVC
0102 #pragma warning (push)
0103 #pragma warning (disable : 4100)
0104 #endif
0105
0106 template <class T>
0107 inline void pointer_destroy(T* p)
0108 { p->~T(); (void)p; }
0109
0110 #ifdef BOOST_MSVC
0111 #pragma warning (pop)
0112 #endif
0113
0114 template <class T>
0115 inline void pointer_construct(T* p, const T& t)
0116 { new (p) T(t); }
0117
0118 }}
0119 #endif
0120
0121
0122
0123
0124
0125
0126
0127 #ifdef __cplusplus
0128 namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
0129 #if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && BOOST_WORKAROUND(BOOST_MSVC, <1600) && defined(_CPPLIB_VER) && defined(BOOST_DINKUMWARE_STDLIB) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
0130
0131
0132
0133
0134
0135
0136 template<class InputIterator, class OutputIterator>
0137 inline OutputIterator copy(
0138 InputIterator first,
0139 InputIterator last,
0140 OutputIterator dest
0141 )
0142 {
0143 return stdext::unchecked_copy(first, last, dest);
0144 }
0145 template<class InputIterator1, class InputIterator2>
0146 inline bool equal(
0147 InputIterator1 first,
0148 InputIterator1 last,
0149 InputIterator2 with
0150 )
0151 {
0152 return stdext::unchecked_equal(first, last, with);
0153 }
0154 #elif BOOST_WORKAROUND(BOOST_MSVC, > 1500)
0155
0156
0157
0158
0159
0160
0161
0162
0163 template<class InputIterator, class OutputIterator>
0164 inline OutputIterator copy(
0165 InputIterator first,
0166 InputIterator last,
0167 OutputIterator dest
0168 )
0169 {
0170 while(first != last)
0171 *dest++ = *first++;
0172 return dest;
0173 }
0174 template<class InputIterator1, class InputIterator2>
0175 inline bool equal(
0176 InputIterator1 first,
0177 InputIterator1 last,
0178 InputIterator2 with
0179 )
0180 {
0181 while(first != last)
0182 if(*first++ != *with++) return false;
0183 return true;
0184 }
0185 #else
0186 using std::copy;
0187 using std::equal;
0188 #endif
0189 #if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
0190
0191
0192 using ::strcpy_s;
0193 using ::strcat_s;
0194 #else
0195 inline std::size_t strcpy_s(
0196 char *strDestination,
0197 std::size_t sizeInBytes,
0198 const char *strSource
0199 )
0200 {
0201 std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
0202 if (lenSourceWithNull > sizeInBytes)
0203 return 1;
0204 std::memcpy(strDestination, strSource, lenSourceWithNull);
0205 return 0;
0206 }
0207 inline std::size_t strcat_s(
0208 char *strDestination,
0209 std::size_t sizeInBytes,
0210 const char *strSource
0211 )
0212 {
0213 std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
0214 std::size_t lenDestination = std::strlen(strDestination);
0215 if (lenSourceWithNull + lenDestination > sizeInBytes)
0216 return 1;
0217 std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
0218 return 0;
0219 }
0220
0221 #endif
0222
0223 inline void overflow_error_if_not_zero(std::size_t i)
0224 {
0225 if(i)
0226 {
0227 std::overflow_error e("String buffer too small");
0228 boost::throw_exception(e);
0229 }
0230 }
0231
0232 }}
0233
0234 #endif
0235
0236 #endif
0237