Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:26

0001 /*
0002  *
0003  * Copyright (c) 1998-2002
0004  * John Maddock
0005  *
0006  * Use, modification and distribution are subject to the 
0007  * Boost Software License, Version 1.0. (See accompanying file 
0008  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009  *
0010  */
0011 
0012  /*
0013   *   LOCATION:    see http://www.boost.org for most recent version.
0014   *   FILE         regex_match.hpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Regular expression matching algorithms.
0017   *                Note this is an internal header file included
0018   *                by regex.hpp, do not include on its own.
0019   */
0020 
0021 
0022 #ifndef BOOST_REGEX_MATCH_HPP
0023 #define BOOST_REGEX_MATCH_HPP
0024 
0025 namespace boost{
0026 
0027 #ifdef BOOST_MSVC
0028 #pragma warning(push)
0029 #pragma warning(disable: 4103)
0030 #endif
0031 #ifdef BOOST_HAS_ABI_HEADERS
0032 #  include BOOST_ABI_PREFIX
0033 #endif
0034 #ifdef BOOST_MSVC
0035 #pragma warning(pop)
0036 #endif
0037 
0038 //
0039 // proc regex_match
0040 // returns true if the specified regular expression matches
0041 // the whole of the input.  Fills in what matched in m.
0042 //
0043 template <class BidiIterator, class Allocator, class charT, class traits>
0044 bool regex_match(BidiIterator first, BidiIterator last, 
0045                  match_results<BidiIterator, Allocator>& m, 
0046                  const basic_regex<charT, traits>& e, 
0047                  match_flag_type flags = match_default)
0048 {
0049    BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, first);
0050    return matcher.match();
0051 }
0052 template <class iterator, class charT, class traits>
0053 bool regex_match(iterator first, iterator last, 
0054                  const basic_regex<charT, traits>& e, 
0055                  match_flag_type flags = match_default)
0056 {
0057    match_results<iterator> m;
0058    return regex_match(first, last, m, e, flags | regex_constants::match_any);
0059 }
0060 //
0061 // query_match convenience interfaces:
0062 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
0063 //
0064 // this isn't really a partial specialisation, but template function
0065 // overloading - if the compiler doesn't support partial specialisation
0066 // then it really won't support this either:
0067 template <class charT, class Allocator, class traits>
0068 inline bool regex_match(const charT* str, 
0069                         match_results<const charT*, Allocator>& m, 
0070                         const basic_regex<charT, traits>& e, 
0071                         match_flag_type flags = match_default)
0072 {
0073    return regex_match(str, str + traits::length(str), m, e, flags);
0074 }
0075 
0076 template <class ST, class SA, class Allocator, class charT, class traits>
0077 inline bool regex_match(const std::basic_string<charT, ST, SA>& s, 
0078                  match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
0079                  const basic_regex<charT, traits>& e, 
0080                  match_flag_type flags = match_default)
0081 {
0082    return regex_match(s.begin(), s.end(), m, e, flags);
0083 }
0084 template <class charT, class traits>
0085 inline bool regex_match(const charT* str, 
0086                         const basic_regex<charT, traits>& e, 
0087                         match_flag_type flags = match_default)
0088 {
0089    match_results<const charT*> m;
0090    return regex_match(str, str + traits::length(str), m, e, flags | regex_constants::match_any);
0091 }
0092 
0093 template <class ST, class SA, class charT, class traits>
0094 inline bool regex_match(const std::basic_string<charT, ST, SA>& s, 
0095                  const basic_regex<charT, traits>& e, 
0096                  match_flag_type flags = match_default)
0097 {
0098    typedef typename std::basic_string<charT, ST, SA>::const_iterator iterator;
0099    match_results<iterator> m;
0100    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0101 }
0102 #else  // partial ordering
0103 inline bool regex_match(const char* str, 
0104                         cmatch& m, 
0105                         const regex& e, 
0106                         match_flag_type flags = match_default)
0107 {
0108    return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
0109 }
0110 inline bool regex_match(const char* str, 
0111                         const regex& e, 
0112                         match_flag_type flags = match_default)
0113 {
0114    match_results<const char*> m;
0115    return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0116 }
0117 #ifndef BOOST_NO_STD_LOCALE
0118 inline bool regex_match(const char* str, 
0119                         cmatch& m, 
0120                         const basic_regex<char, cpp_regex_traits<char> >& e, 
0121                         match_flag_type flags = match_default)
0122 {
0123    return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
0124 }
0125 inline bool regex_match(const char* str, 
0126                         const basic_regex<char, cpp_regex_traits<char> >& e, 
0127                         match_flag_type flags = match_default)
0128 {
0129    match_results<const char*> m;
0130    return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0131 }
0132 #endif
0133 inline bool regex_match(const char* str, 
0134                         cmatch& m, 
0135                         const basic_regex<char, c_regex_traits<char> >& e, 
0136                         match_flag_type flags = match_default)
0137 {
0138    return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
0139 }
0140 inline bool regex_match(const char* str, 
0141                         const basic_regex<char, c_regex_traits<char> >& e, 
0142                         match_flag_type flags = match_default)
0143 {
0144    match_results<const char*> m;
0145    return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0146 }
0147 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
0148 inline bool regex_match(const char* str, 
0149                         cmatch& m, 
0150                         const basic_regex<char, w32_regex_traits<char> >& e, 
0151                         match_flag_type flags = match_default)
0152 {
0153    return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
0154 }
0155 inline bool regex_match(const char* str, 
0156                         const basic_regex<char, w32_regex_traits<char> >& e, 
0157                         match_flag_type flags = match_default)
0158 {
0159    match_results<const char*> m;
0160    return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0161 }
0162 #endif
0163 #ifndef BOOST_NO_WREGEX
0164 inline bool regex_match(const wchar_t* str, 
0165                         wcmatch& m, 
0166                         const wregex& e, 
0167                         match_flag_type flags = match_default)
0168 {
0169    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
0170 }
0171 inline bool regex_match(const wchar_t* str, 
0172                         const wregex& e, 
0173                         match_flag_type flags = match_default)
0174 {
0175    match_results<const wchar_t*> m;
0176    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0177 }
0178 #ifndef BOOST_NO_STD_LOCALE
0179 inline bool regex_match(const wchar_t* str, 
0180                         wcmatch& m, 
0181                         const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e, 
0182                         match_flag_type flags = match_default)
0183 {
0184    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
0185 }
0186 inline bool regex_match(const wchar_t* str, 
0187                         const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e, 
0188                         match_flag_type flags = match_default)
0189 {
0190    match_results<const wchar_t*> m;
0191    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0192 }
0193 #endif
0194 inline bool regex_match(const wchar_t* str, 
0195                         wcmatch& m, 
0196                         const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e, 
0197                         match_flag_type flags = match_default)
0198 {
0199    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
0200 }
0201 inline bool regex_match(const wchar_t* str, 
0202                         const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e, 
0203                         match_flag_type flags = match_default)
0204 {
0205    match_results<const wchar_t*> m;
0206    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0207 }
0208 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
0209 inline bool regex_match(const wchar_t* str, 
0210                         wcmatch& m, 
0211                         const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e, 
0212                         match_flag_type flags = match_default)
0213 {
0214    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
0215 }
0216 inline bool regex_match(const wchar_t* str, 
0217                         const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e, 
0218                         match_flag_type flags = match_default)
0219 {
0220    match_results<const wchar_t*> m;
0221    return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
0222 }
0223 #endif
0224 #endif
0225 inline bool regex_match(const std::string& s, 
0226                         smatch& m,
0227                         const regex& e, 
0228                         match_flag_type flags = match_default)
0229 {
0230    return regex_match(s.begin(), s.end(), m, e, flags);
0231 }
0232 inline bool regex_match(const std::string& s, 
0233                         const regex& e, 
0234                         match_flag_type flags = match_default)
0235 {
0236    match_results<std::string::const_iterator> m;
0237    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0238 }
0239 #ifndef BOOST_NO_STD_LOCALE
0240 inline bool regex_match(const std::string& s, 
0241                         smatch& m,
0242                         const basic_regex<char, cpp_regex_traits<char> >& e, 
0243                         match_flag_type flags = match_default)
0244 {
0245    return regex_match(s.begin(), s.end(), m, e, flags);
0246 }
0247 inline bool regex_match(const std::string& s, 
0248                         const basic_regex<char, cpp_regex_traits<char> >& e, 
0249                         match_flag_type flags = match_default)
0250 {
0251    match_results<std::string::const_iterator> m;
0252    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0253 }
0254 #endif
0255 inline bool regex_match(const std::string& s, 
0256                         smatch& m,
0257                         const basic_regex<char, c_regex_traits<char> >& e, 
0258                         match_flag_type flags = match_default)
0259 {
0260    return regex_match(s.begin(), s.end(), m, e, flags);
0261 }
0262 inline bool regex_match(const std::string& s, 
0263                         const basic_regex<char, c_regex_traits<char> >& e, 
0264                         match_flag_type flags = match_default)
0265 {
0266    match_results<std::string::const_iterator> m;
0267    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0268 }
0269 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
0270 inline bool regex_match(const std::string& s, 
0271                         smatch& m,
0272                         const basic_regex<char, w32_regex_traits<char> >& e, 
0273                         match_flag_type flags = match_default)
0274 {
0275    return regex_match(s.begin(), s.end(), m, e, flags);
0276 }
0277 inline bool regex_match(const std::string& s, 
0278                         const basic_regex<char, w32_regex_traits<char> >& e, 
0279                         match_flag_type flags = match_default)
0280 {
0281    match_results<std::string::const_iterator> m;
0282    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0283 }
0284 #endif
0285 #if !defined(BOOST_NO_WREGEX)
0286 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0287                         match_results<std::basic_string<wchar_t>::const_iterator>& m,
0288                         const wregex& e, 
0289                         match_flag_type flags = match_default)
0290 {
0291    return regex_match(s.begin(), s.end(), m, e, flags);
0292 }
0293 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0294                         const wregex& e, 
0295                         match_flag_type flags = match_default)
0296 {
0297    match_results<std::basic_string<wchar_t>::const_iterator> m;
0298    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0299 }
0300 #ifndef BOOST_NO_STD_LOCALE
0301 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0302                         match_results<std::basic_string<wchar_t>::const_iterator>& m,
0303                         const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e, 
0304                         match_flag_type flags = match_default)
0305 {
0306    return regex_match(s.begin(), s.end(), m, e, flags);
0307 }
0308 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0309                         const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e, 
0310                         match_flag_type flags = match_default)
0311 {
0312    match_results<std::basic_string<wchar_t>::const_iterator> m;
0313    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0314 }
0315 #endif
0316 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0317                         match_results<std::basic_string<wchar_t>::const_iterator>& m,
0318                         const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e, 
0319                         match_flag_type flags = match_default)
0320 {
0321    return regex_match(s.begin(), s.end(), m, e, flags);
0322 }
0323 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0324                         const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e, 
0325                         match_flag_type flags = match_default)
0326 {
0327    match_results<std::basic_string<wchar_t>::const_iterator> m;
0328    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0329 }
0330 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
0331 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0332                         match_results<std::basic_string<wchar_t>::const_iterator>& m,
0333                         const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e, 
0334                         match_flag_type flags = match_default)
0335 {
0336    return regex_match(s.begin(), s.end(), m, e, flags);
0337 }
0338 inline bool regex_match(const std::basic_string<wchar_t>& s, 
0339                         const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e, 
0340                         match_flag_type flags = match_default)
0341 {
0342    match_results<std::basic_string<wchar_t>::const_iterator> m;
0343    return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
0344 }
0345 #endif
0346 #endif
0347 
0348 #endif
0349 
0350 
0351 #ifdef BOOST_MSVC
0352 #pragma warning(push)
0353 #pragma warning(disable: 4103)
0354 #endif
0355 #ifdef BOOST_HAS_ABI_HEADERS
0356 #  include BOOST_ABI_SUFFIX
0357 #endif
0358 #ifdef BOOST_MSVC
0359 #pragma warning(pop)
0360 #endif
0361 
0362 } // namespace boost
0363 
0364 #endif   // BOOST_REGEX_MATCH_HPP
0365 
0366 
0367 
0368 
0369 
0370 
0371 
0372 
0373 
0374 
0375 
0376 
0377 
0378 
0379 
0380 
0381 
0382