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_V4_REGEX_SEARCH_HPP
0020 #define BOOST_REGEX_V4_REGEX_SEARCH_HPP
0021
0022
0023 namespace boost{
0024
0025 #ifdef BOOST_MSVC
0026 #pragma warning(push)
0027 #pragma warning(disable: 4103)
0028 #endif
0029 #ifdef BOOST_HAS_ABI_HEADERS
0030 # include BOOST_ABI_PREFIX
0031 #endif
0032 #ifdef BOOST_MSVC
0033 #pragma warning(pop)
0034 #endif
0035
0036 template <class BidiIterator, class Allocator, class charT, class traits>
0037 bool regex_search(BidiIterator first, BidiIterator last,
0038 match_results<BidiIterator, Allocator>& m,
0039 const basic_regex<charT, traits>& e,
0040 match_flag_type flags = match_default)
0041 {
0042 return regex_search(first, last, m, e, flags, first);
0043 }
0044
0045 template <class BidiIterator, class Allocator, class charT, class traits>
0046 bool regex_search(BidiIterator first, BidiIterator last,
0047 match_results<BidiIterator, Allocator>& m,
0048 const basic_regex<charT, traits>& e,
0049 match_flag_type flags,
0050 BidiIterator base)
0051 {
0052 if(e.flags() & regex_constants::failbit)
0053 return false;
0054
0055 BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
0056 return matcher.find();
0057 }
0058
0059
0060
0061 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
0062
0063
0064
0065
0066 template <class charT, class Allocator, class traits>
0067 inline bool regex_search(const charT* str,
0068 match_results<const charT*, Allocator>& m,
0069 const basic_regex<charT, traits>& e,
0070 match_flag_type flags = match_default)
0071 {
0072 return regex_search(str, str + traits::length(str), m, e, flags);
0073 }
0074
0075 template <class ST, class SA, class Allocator, class charT, class traits>
0076 inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
0077 match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
0078 const basic_regex<charT, traits>& e,
0079 match_flag_type flags = match_default)
0080 {
0081 return regex_search(s.begin(), s.end(), m, e, flags);
0082 }
0083 #else
0084 inline bool regex_search(const char* str,
0085 cmatch& m,
0086 const regex& e,
0087 match_flag_type flags = match_default)
0088 {
0089 return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
0090 }
0091 inline bool regex_search(const char* first, const char* last,
0092 const regex& e,
0093 match_flag_type flags = match_default)
0094 {
0095 cmatch m;
0096 return regex_search(first, last, m, e, flags | regex_constants::match_any);
0097 }
0098
0099 #ifndef BOOST_NO_WREGEX
0100 inline bool regex_search(const wchar_t* str,
0101 wcmatch& m,
0102 const wregex& e,
0103 match_flag_type flags = match_default)
0104 {
0105 return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
0106 }
0107 inline bool regex_search(const wchar_t* first, const wchar_t* last,
0108 const wregex& e,
0109 match_flag_type flags = match_default)
0110 {
0111 wcmatch m;
0112 return regex_search(first, last, m, e, flags | regex_constants::match_any);
0113 }
0114 #endif
0115 inline bool regex_search(const std::string& s,
0116 smatch& m,
0117 const regex& e,
0118 match_flag_type flags = match_default)
0119 {
0120 return regex_search(s.begin(), s.end(), m, e, flags);
0121 }
0122 #if !defined(BOOST_NO_WREGEX)
0123 inline bool regex_search(const std::basic_string<wchar_t>& s,
0124 wsmatch& m,
0125 const wregex& e,
0126 match_flag_type flags = match_default)
0127 {
0128 return regex_search(s.begin(), s.end(), m, e, flags);
0129 }
0130 #endif
0131
0132 #endif
0133
0134 template <class BidiIterator, class charT, class traits>
0135 bool regex_search(BidiIterator first, BidiIterator last,
0136 const basic_regex<charT, traits>& e,
0137 match_flag_type flags = match_default)
0138 {
0139 if(e.flags() & regex_constants::failbit)
0140 return false;
0141
0142 match_results<BidiIterator> m;
0143 typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
0144 BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
0145 return matcher.find();
0146 }
0147
0148 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
0149
0150 template <class charT, class traits>
0151 inline bool regex_search(const charT* str,
0152 const basic_regex<charT, traits>& e,
0153 match_flag_type flags = match_default)
0154 {
0155 return regex_search(str, str + traits::length(str), e, flags);
0156 }
0157
0158 template <class ST, class SA, class charT, class traits>
0159 inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
0160 const basic_regex<charT, traits>& e,
0161 match_flag_type flags = match_default)
0162 {
0163 return regex_search(s.begin(), s.end(), e, flags);
0164 }
0165 #else
0166 inline bool regex_search(const char* str,
0167 const regex& e,
0168 match_flag_type flags = match_default)
0169 {
0170 cmatch m;
0171 return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0172 }
0173 #ifndef BOOST_NO_WREGEX
0174 inline bool regex_search(const wchar_t* str,
0175 const wregex& e,
0176 match_flag_type flags = match_default)
0177 {
0178 wcmatch m;
0179 return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0180 }
0181 #endif
0182 inline bool regex_search(const std::string& s,
0183 const regex& e,
0184 match_flag_type flags = match_default)
0185 {
0186 smatch m;
0187 return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0188 }
0189 #if !defined(BOOST_NO_WREGEX)
0190 inline bool regex_search(const std::basic_string<wchar_t>& s,
0191 const wregex& e,
0192 match_flag_type flags = match_default)
0193 {
0194 wsmatch m;
0195 return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0196 }
0197
0198 #endif
0199
0200 #endif
0201
0202 #ifdef BOOST_MSVC
0203 #pragma warning(push)
0204 #pragma warning(disable: 4103)
0205 #endif
0206 #ifdef BOOST_HAS_ABI_HEADERS
0207 # include BOOST_ABI_SUFFIX
0208 #endif
0209 #ifdef BOOST_MSVC
0210 #pragma warning(pop)
0211 #endif
0212
0213 }
0214
0215 #endif
0216
0217