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
0020
0021 #ifndef BOOST_REGEX_V4_REGEX_REPLACE_HPP
0022 #define BOOST_REGEX_V4_REGEX_REPLACE_HPP
0023
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 template <class OutputIterator, class BidirectionalIterator, class traits, class charT, class Formatter>
0039 OutputIterator regex_replace(OutputIterator out,
0040 BidirectionalIterator first,
0041 BidirectionalIterator last,
0042 const basic_regex<charT, traits>& e,
0043 Formatter fmt,
0044 match_flag_type flags = match_default)
0045 {
0046 regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
0047 regex_iterator<BidirectionalIterator, charT, traits> j;
0048 if(i == j)
0049 {
0050 if(!(flags & regex_constants::format_no_copy))
0051 out = BOOST_REGEX_DETAIL_NS::copy(first, last, out);
0052 }
0053 else
0054 {
0055 BidirectionalIterator last_m(first);
0056 while(i != j)
0057 {
0058 if(!(flags & regex_constants::format_no_copy))
0059 out = BOOST_REGEX_DETAIL_NS::copy(i->prefix().first, i->prefix().second, out);
0060 out = i->format(out, fmt, flags, e);
0061 last_m = (*i)[0].second;
0062 if(flags & regex_constants::format_first_only)
0063 break;
0064 ++i;
0065 }
0066 if(!(flags & regex_constants::format_no_copy))
0067 out = BOOST_REGEX_DETAIL_NS::copy(last_m, last, out);
0068 }
0069 return out;
0070 }
0071
0072 template <class traits, class charT, class Formatter>
0073 std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
0074 const basic_regex<charT, traits>& e,
0075 Formatter fmt,
0076 match_flag_type flags = match_default)
0077 {
0078 std::basic_string<charT> result;
0079 BOOST_REGEX_DETAIL_NS::string_out_iterator<std::basic_string<charT> > i(result);
0080 regex_replace(i, s.begin(), s.end(), e, fmt, flags);
0081 return result;
0082 }
0083
0084 #ifdef BOOST_MSVC
0085 #pragma warning(push)
0086 #pragma warning(disable: 4103)
0087 #endif
0088 #ifdef BOOST_HAS_ABI_HEADERS
0089 # include BOOST_ABI_SUFFIX
0090 #endif
0091 #ifdef BOOST_MSVC
0092 #pragma warning(pop)
0093 #endif
0094
0095 }
0096
0097 #endif
0098
0099