Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:38

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_search.hpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Provides regex_search implementation.
0017   */
0018 
0019 #ifndef BOOST_REGEX_V5_REGEX_SEARCH_HPP
0020 #define BOOST_REGEX_V5_REGEX_SEARCH_HPP
0021 
0022 
0023 namespace boost{
0024 
0025 template <class BidiIterator, class Allocator, class charT, class traits>
0026 bool regex_search(BidiIterator first, BidiIterator last, 
0027                   match_results<BidiIterator, Allocator>& m, 
0028                   const basic_regex<charT, traits>& e, 
0029                   match_flag_type flags = match_default)
0030 {
0031    return regex_search(first, last, m, e, flags, first);
0032 }
0033 
0034 template <class BidiIterator, class Allocator, class charT, class traits>
0035 bool regex_search(BidiIterator first, BidiIterator last, 
0036                   match_results<BidiIterator, Allocator>& m, 
0037                   const basic_regex<charT, traits>& e, 
0038                   match_flag_type flags,
0039                   BidiIterator base)
0040 {
0041    if(e.flags() & regex_constants::failbit)
0042       return false;
0043 
0044    BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
0045    return matcher.find();
0046 }
0047 
0048 //
0049 // regex_search convenience interfaces:
0050 //
0051 template <class charT, class Allocator, class traits>
0052 inline bool regex_search(const charT* str, 
0053                         match_results<const charT*, Allocator>& m, 
0054                         const basic_regex<charT, traits>& e, 
0055                         match_flag_type flags = match_default)
0056 {
0057    return regex_search(str, str + traits::length(str), m, e, flags);
0058 }
0059 
0060 template <class ST, class SA, class Allocator, class charT, class traits>
0061 inline bool regex_search(const std::basic_string<charT, ST, SA>& s, 
0062                  match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
0063                  const basic_regex<charT, traits>& e, 
0064                  match_flag_type flags = match_default)
0065 {
0066    return regex_search(s.begin(), s.end(), m, e, flags);
0067 }
0068 
0069 template <class BidiIterator, class charT, class traits>
0070 bool regex_search(BidiIterator first, BidiIterator last, 
0071                   const basic_regex<charT, traits>& e, 
0072                   match_flag_type flags = match_default)
0073 {
0074    if(e.flags() & regex_constants::failbit)
0075       return false;
0076 
0077    match_results<BidiIterator> m;
0078    typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
0079    BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
0080    return matcher.find();
0081 }
0082 
0083 template <class charT, class traits>
0084 inline bool regex_search(const charT* str, 
0085                         const basic_regex<charT, traits>& e, 
0086                         match_flag_type flags = match_default)
0087 {
0088    return regex_search(str, str + traits::length(str), e, flags);
0089 }
0090 
0091 template <class ST, class SA, class charT, class traits>
0092 inline bool regex_search(const std::basic_string<charT, ST, SA>& s, 
0093                  const basic_regex<charT, traits>& e, 
0094                  match_flag_type flags = match_default)
0095 {
0096    return regex_search(s.begin(), s.end(), e, flags);
0097 }
0098 
0099 } // namespace boost
0100 
0101 #endif  // BOOST_REGEX_V5_REGEX_SEARCH_HPP
0102 
0103