## include/boost/regex/v5/regex_replace.hpp

96.0% Lines (24/25) 100.0% List of functions (12/12)
regex_replace.hpp
f(x) Functions (12)
Function Calls Lines Blocks
boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > boost::regex_replace<boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::c_regex_traits<char>, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::basic_regex<char, boost::c_regex_traits<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :32 1836x 100.0% 100.0% boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > boost::regex_replace<boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::cpp_regex_traits<char>, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::basic_regex<char, boost::cpp_regex_traits<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :32 1836x 100.0% 100.0% boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > boost::regex_replace<boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> >, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :32 14x 84.2% 73.0% boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > boost::regex_replace<boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::c_regex_traits<wchar_t>, wchar_t, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t> > const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, boost::regex_constants::_match_flags) :32 1836x 100.0% 100.0% boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > boost::regex_replace<boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::cpp_regex_traits<wchar_t>, wchar_t, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(boost::re_detail_600::string_out_iterator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::basic_regex<wchar_t, boost::cpp_regex_traits<wchar_t> > const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, boost::regex_constants::_match_flags) :32 1836x 100.0% 100.0% std::ostream_iterator<char, char, std::char_traits<char> > boost::regex_replace<std::ostream_iterator<char, char, std::char_traits<char> >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> >, char, char const*>(std::ostream_iterator<char, char, std::char_traits<char> >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, char const*, boost::regex_constants::_match_flags) :32 4x 84.2% 66.0% std::ostream_iterator<char, char, std::char_traits<char> > boost::regex_replace<std::ostream_iterator<char, char, std::char_traits<char> >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> >, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::ostream_iterator<char, char, std::char_traits<char> >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :32 1x 84.2% 64.0% std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > boost::regex_replace<boost::c_regex_traits<char>, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_regex<char, boost::c_regex_traits<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :66 1683x 83.3% 69.0% std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > boost::regex_replace<boost::cpp_regex_traits<char>, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_regex<char, boost::cpp_regex_traits<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :66 1683x 83.3% 69.0% std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > boost::regex_replace<boost::regex_traits<char, boost::cpp_regex_traits<char> >, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::regex_constants::_match_flags) :66 14x 83.3% 69.0% std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > boost::regex_replace<boost::c_regex_traits<wchar_t>, wchar_t, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t> > const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, boost::regex_constants::_match_flags) :66 1683x 83.3% 69.0% std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > boost::regex_replace<boost::cpp_regex_traits<wchar_t>, wchar_t, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, boost::basic_regex<wchar_t, boost::cpp_regex_traits<wchar_t> > const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, boost::regex_constants::_match_flags) :66 1683x 83.3% 69.0%

Line | TLA | Hits | Source Code
--- | --- | --- | ---
1 |  |  | /*
2 |  |  | *
3 |  |  | * Copyright (c) 1998-2009
4 |  |  | * John Maddock
5 |  |  | *
6 |  |  | * Use, modification and distribution are subject to the
7 |  |  | * Boost Software License, Version 1.0. (See accompanying file
8 |  |  | * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 |  |  | *
10 |  |  | */
11 |  |  |
12 |  |  | /*
13 |  |  | * LOCATION: see http://www.boost.org for most recent version.
14 |  |  | * FILE regex_format.hpp
15 |  |  | * VERSION see <boost/version.hpp>
16 |  |  | * DESCRIPTION: Provides formatting output routines for search and replace
17 |  |  | * operations. Note this is an internal header file included
18 |  |  | * by regex.hpp, do not include on its own.
19 |  |  | */
20 |  |  |
21 |  |  | #ifndef BOOST_REGEX_V5_REGEX_REPLACE_HPP
22 |  |  | #define BOOST_REGEX_V5_REGEX_REPLACE_HPP
23 |  |  |
24 |  |  |
25 |  |  | #include <boost/regex/v5/basic_regex.hpp>
26 |  |  | #include <boost/regex/v5/match_flags.hpp>
27 |  |  | #include <boost/regex/v5/regex_iterator.hpp>
28 |  |  |
29 |  |  | namespace boost{
30 |  |  |
31 |  |  | BOOST_REGEX_MODULE_EXPORT template <class OutputIterator, class BidirectionalIterator, class traits, class charT, class Formatter>
32 |  | 7363x | OutputIterator regex_replace(OutputIterator out,
33 |  |  | BidirectionalIterator first,
34 |  |  | BidirectionalIterator last,
35 |  |  | const basic_regex<charT, traits>& e,
36 |  |  | Formatter fmt,
37 |  |  | match_flag_type flags = match_default)
38 |  |  | {
39 |  | 7363x | regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
40 |  | 7363x | regex_iterator<BidirectionalIterator, charT, traits> j;
41 |  | 7363x | if(i == j)
42 |  |  | {
43 |  | 96x | if(!(flags & regex_constants::format_no_copy))
44 |  | 48x | out = BOOST_REGEX_DETAIL_NS::copy(first, last, out);
45 |  |  | }
46 |  |  | else
47 |  |  | {
48 |  | 7267x | BidirectionalIterator last_m(first);
49 |  | 20576x | while(i != j)
50 |  |  | {
51 |  | 13501x | if(!(flags & regex_constants::format_no_copy))
52 |  | 8461x | out = BOOST_REGEX_DETAIL_NS::copy(i->prefix().first, i->prefix().second, out);
53 |  | 13501x | out = i->format(out, fmt, flags, e);
54 |  | 13501x | last_m = (*i)[0].second;
55 |  | 13501x | if(flags & regex_constants::format_first_only)
56 |  | 192x | break;
57 |  | 13309x | ++i;
58 |  |  | }
59 |  | 7267x | if(!(flags & regex_constants::format_no_copy))
60 |  | 2563x | out = BOOST_REGEX_DETAIL_NS::copy(last_m, last, out);
61 |  |  | }
62 |  | 7980x | return out;
63 |  | 7363x | }
64 |  |  |
65 |  |  | BOOST_REGEX_MODULE_EXPORT template <class traits, class charT, class Formatter>
66 |  | 7358x | std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
67 |  |  | const basic_regex<charT, traits>& e,
68 |  |  | Formatter fmt,
69 |  |  | match_flag_type flags = match_default)
70 |  |  | {
71 |  | 7358x | std::basic_string<charT> result;
72 |  | 7358x | BOOST_REGEX_DETAIL_NS::string_out_iterator<std::basic_string<charT> > i(result);
73 |  | 7358x | regex_replace(i, s.begin(), s.end(), e, fmt, flags);
74 |  | 14104x | return result;
75 |  | ✗ | }
76 |  |  |
77 |  |  | } // namespace boost
78 |  |  |
79 |  |  | #endif // BOOST_REGEX_V5_REGEX_REPLACE_HPP
80 |  |  |
81 |  |  |
82 |  |  |