annotate DEPENDENCIES/generic/include/boost/regex/v4/regex_search.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 *
Chris@16 3 * Copyright (c) 1998-2002
Chris@16 4 * John Maddock
Chris@16 5 *
Chris@16 6 * Use, modification and distribution are subject to the
Chris@16 7 * Boost Software License, Version 1.0. (See accompanying file
Chris@16 8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 *
Chris@16 10 */
Chris@16 11
Chris@16 12 /*
Chris@16 13 * LOCATION: see http://www.boost.org for most recent version.
Chris@16 14 * FILE regex_search.hpp
Chris@16 15 * VERSION see <boost/version.hpp>
Chris@16 16 * DESCRIPTION: Provides regex_search implementation.
Chris@16 17 */
Chris@16 18
Chris@16 19 #ifndef BOOST_REGEX_V4_REGEX_SEARCH_HPP
Chris@16 20 #define BOOST_REGEX_V4_REGEX_SEARCH_HPP
Chris@16 21
Chris@16 22
Chris@16 23 namespace boost{
Chris@16 24
Chris@16 25 #ifdef BOOST_MSVC
Chris@16 26 #pragma warning(push)
Chris@16 27 #pragma warning(disable: 4103)
Chris@16 28 #endif
Chris@16 29 #ifdef BOOST_HAS_ABI_HEADERS
Chris@16 30 # include BOOST_ABI_PREFIX
Chris@16 31 #endif
Chris@16 32 #ifdef BOOST_MSVC
Chris@16 33 #pragma warning(pop)
Chris@16 34 #endif
Chris@16 35
Chris@16 36 template <class BidiIterator, class Allocator, class charT, class traits>
Chris@16 37 bool regex_search(BidiIterator first, BidiIterator last,
Chris@16 38 match_results<BidiIterator, Allocator>& m,
Chris@16 39 const basic_regex<charT, traits>& e,
Chris@16 40 match_flag_type flags = match_default)
Chris@16 41 {
Chris@16 42 return regex_search(first, last, m, e, flags, first);
Chris@16 43 }
Chris@16 44
Chris@16 45 template <class BidiIterator, class Allocator, class charT, class traits>
Chris@16 46 bool regex_search(BidiIterator first, BidiIterator last,
Chris@16 47 match_results<BidiIterator, Allocator>& m,
Chris@16 48 const basic_regex<charT, traits>& e,
Chris@16 49 match_flag_type flags,
Chris@16 50 BidiIterator base)
Chris@16 51 {
Chris@16 52 if(e.flags() & regex_constants::failbit)
Chris@16 53 return false;
Chris@16 54
Chris@16 55 re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
Chris@16 56 return matcher.find();
Chris@16 57 }
Chris@16 58
Chris@16 59 //
Chris@16 60 // regex_search convenience interfaces:
Chris@16 61 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
Chris@16 62 //
Chris@16 63 // this isn't really a partial specialisation, but template function
Chris@16 64 // overloading - if the compiler doesn't support partial specialisation
Chris@16 65 // then it really won't support this either:
Chris@16 66 template <class charT, class Allocator, class traits>
Chris@16 67 inline bool regex_search(const charT* str,
Chris@16 68 match_results<const charT*, Allocator>& m,
Chris@16 69 const basic_regex<charT, traits>& e,
Chris@16 70 match_flag_type flags = match_default)
Chris@16 71 {
Chris@16 72 return regex_search(str, str + traits::length(str), m, e, flags);
Chris@16 73 }
Chris@16 74
Chris@16 75 template <class ST, class SA, class Allocator, class charT, class traits>
Chris@16 76 inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
Chris@16 77 match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
Chris@16 78 const basic_regex<charT, traits>& e,
Chris@16 79 match_flag_type flags = match_default)
Chris@16 80 {
Chris@16 81 return regex_search(s.begin(), s.end(), m, e, flags);
Chris@16 82 }
Chris@16 83 #else // partial overloads:
Chris@16 84 inline bool regex_search(const char* str,
Chris@16 85 cmatch& m,
Chris@16 86 const regex& e,
Chris@16 87 match_flag_type flags = match_default)
Chris@16 88 {
Chris@16 89 return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
Chris@16 90 }
Chris@16 91 inline bool regex_search(const char* first, const char* last,
Chris@16 92 const regex& e,
Chris@16 93 match_flag_type flags = match_default)
Chris@16 94 {
Chris@16 95 cmatch m;
Chris@16 96 return regex_search(first, last, m, e, flags | regex_constants::match_any);
Chris@16 97 }
Chris@16 98
Chris@16 99 #ifndef BOOST_NO_WREGEX
Chris@16 100 inline bool regex_search(const wchar_t* str,
Chris@16 101 wcmatch& m,
Chris@16 102 const wregex& e,
Chris@16 103 match_flag_type flags = match_default)
Chris@16 104 {
Chris@16 105 return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
Chris@16 106 }
Chris@16 107 inline bool regex_search(const wchar_t* first, const wchar_t* last,
Chris@16 108 const wregex& e,
Chris@16 109 match_flag_type flags = match_default)
Chris@16 110 {
Chris@16 111 wcmatch m;
Chris@16 112 return regex_search(first, last, m, e, flags | regex_constants::match_any);
Chris@16 113 }
Chris@16 114 #endif
Chris@16 115 inline bool regex_search(const std::string& s,
Chris@16 116 smatch& m,
Chris@16 117 const regex& e,
Chris@16 118 match_flag_type flags = match_default)
Chris@16 119 {
Chris@16 120 return regex_search(s.begin(), s.end(), m, e, flags);
Chris@16 121 }
Chris@16 122 #if !defined(BOOST_NO_WREGEX)
Chris@16 123 inline bool regex_search(const std::basic_string<wchar_t>& s,
Chris@16 124 wsmatch& m,
Chris@16 125 const wregex& e,
Chris@16 126 match_flag_type flags = match_default)
Chris@16 127 {
Chris@16 128 return regex_search(s.begin(), s.end(), m, e, flags);
Chris@16 129 }
Chris@16 130 #endif
Chris@16 131
Chris@16 132 #endif
Chris@16 133
Chris@16 134 template <class BidiIterator, class charT, class traits>
Chris@16 135 bool regex_search(BidiIterator first, BidiIterator last,
Chris@16 136 const basic_regex<charT, traits>& e,
Chris@16 137 match_flag_type flags = match_default)
Chris@16 138 {
Chris@16 139 if(e.flags() & regex_constants::failbit)
Chris@16 140 return false;
Chris@16 141
Chris@16 142 match_results<BidiIterator> m;
Chris@16 143 typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
Chris@16 144 re_detail::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
Chris@16 145 return matcher.find();
Chris@16 146 }
Chris@16 147
Chris@16 148 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
Chris@16 149
Chris@16 150 template <class charT, class traits>
Chris@16 151 inline bool regex_search(const charT* str,
Chris@16 152 const basic_regex<charT, traits>& e,
Chris@16 153 match_flag_type flags = match_default)
Chris@16 154 {
Chris@16 155 return regex_search(str, str + traits::length(str), e, flags);
Chris@16 156 }
Chris@16 157
Chris@16 158 template <class ST, class SA, class charT, class traits>
Chris@16 159 inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
Chris@16 160 const basic_regex<charT, traits>& e,
Chris@16 161 match_flag_type flags = match_default)
Chris@16 162 {
Chris@16 163 return regex_search(s.begin(), s.end(), e, flags);
Chris@16 164 }
Chris@16 165 #else // non-template function overloads
Chris@16 166 inline bool regex_search(const char* str,
Chris@16 167 const regex& e,
Chris@16 168 match_flag_type flags = match_default)
Chris@16 169 {
Chris@16 170 cmatch m;
Chris@16 171 return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
Chris@16 172 }
Chris@16 173 #ifndef BOOST_NO_WREGEX
Chris@16 174 inline bool regex_search(const wchar_t* str,
Chris@16 175 const wregex& e,
Chris@16 176 match_flag_type flags = match_default)
Chris@16 177 {
Chris@16 178 wcmatch m;
Chris@16 179 return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
Chris@16 180 }
Chris@16 181 #endif
Chris@16 182 inline bool regex_search(const std::string& s,
Chris@16 183 const regex& e,
Chris@16 184 match_flag_type flags = match_default)
Chris@16 185 {
Chris@16 186 smatch m;
Chris@16 187 return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
Chris@16 188 }
Chris@16 189 #if !defined(BOOST_NO_WREGEX)
Chris@16 190 inline bool regex_search(const std::basic_string<wchar_t>& s,
Chris@16 191 const wregex& e,
Chris@16 192 match_flag_type flags = match_default)
Chris@16 193 {
Chris@16 194 wsmatch m;
Chris@16 195 return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
Chris@16 196 }
Chris@16 197
Chris@16 198 #endif // BOOST_NO_WREGEX
Chris@16 199
Chris@16 200 #endif // partial overload
Chris@16 201
Chris@16 202 #ifdef BOOST_MSVC
Chris@16 203 #pragma warning(push)
Chris@16 204 #pragma warning(disable: 4103)
Chris@16 205 #endif
Chris@16 206 #ifdef BOOST_HAS_ABI_HEADERS
Chris@16 207 # include BOOST_ABI_SUFFIX
Chris@16 208 #endif
Chris@16 209 #ifdef BOOST_MSVC
Chris@16 210 #pragma warning(pop)
Chris@16 211 #endif
Chris@16 212
Chris@16 213 } // namespace boost
Chris@16 214
Chris@16 215 #endif // BOOST_REGEX_V4_REGEX_SEARCH_HPP
Chris@16 216
Chris@16 217