include/boost/url/detail/format_args.hpp

100.0% Lines (262/262) 100.0% List of functions (104/104)
format_args.hpp
f(x) Functions (104)
Function Calls Lines Blocks
boost::urls::detail::format_parse_context::format_parse_context(char const*, char const*, unsigned long) :36 752x 100.0% 100.0% boost::urls::detail::format_parse_context::format_parse_context(boost::core::basic_string_view<char>, unsigned long) :46 597x 100.0% 100.0% boost::urls::detail::format_parse_context::begin() const :57 1747x 100.0% 100.0% boost::urls::detail::format_parse_context::end() const :64 1173x 100.0% 100.0% boost::urls::detail::format_parse_context::advance_to(char const*) :71 1150x 100.0% 100.0% boost::urls::detail::format_parse_context::next_arg_id() :77 1027x 100.0% 100.0% boost::urls::detail::named_arg<char [11]>::named_arg(boost::core::basic_string_view<char>, char const (&) [11]) :94 2x 100.0% 100.0% boost::urls::detail::named_arg<char [3]>::named_arg(boost::core::basic_string_view<char>, char const (&) [3]) :94 2x 100.0% 100.0% boost::urls::detail::named_arg<char [4]>::named_arg(boost::core::basic_string_view<char>, char const (&) [4]) :94 3x 100.0% 100.0% boost::urls::detail::named_arg<char [5]>::named_arg(boost::core::basic_string_view<char>, char const (&) [5]) :94 3x 100.0% 100.0% boost::urls::detail::named_arg<char [9]>::named_arg(boost::core::basic_string_view<char>, char const (&) [9]) :94 1x 100.0% 100.0% boost::urls::detail::named_arg<char>::named_arg(boost::core::basic_string_view<char>, char const&) :94 2x 100.0% 100.0% boost::urls::detail::named_arg<int>::named_arg(boost::core::basic_string_view<char>, int const&) :94 8x 100.0% 100.0% boost::urls::detail::format_arg::format_arg() :146 34x 100.0% 100.0% boost::urls::detail::format_arg::measure(boost::urls::detail::format_parse_context&, boost::urls::detail::measure_context&, boost::urls::grammar::lut_chars const&) :157 290x 100.0% 100.0% boost::urls::detail::format_arg::format(boost::urls::detail::format_parse_context&, boost::urls::detail::format_context&, boost::urls::grammar::lut_chars const&) :166 286x 100.0% 100.0% boost::urls::detail::format_arg::name() const :175 224x 100.0% 100.0% boost::urls::detail::format_arg::value() const :181 28x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 0> boost::urls::detail::make_format_args<>() :190 15x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<boost::urls::X>(boost::urls::X&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<boost::urls::detail::named_arg<char [4]> >(boost::urls::detail::named_arg<char [4]>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<boost::urls::detail::named_arg<char [5]> >(boost::urls::detail::named_arg<char [5]>&&) :190 3x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<boost::urls::detail::named_arg<char [9]> >(boost::urls::detail::named_arg<char [9]>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<boost::urls::detail::named_arg<int> >(boost::urls::detail::named_arg<int>&&) :190 3x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [10]>(char const (&) [10]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [15]>(char const (&) [15]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [2]>(char const (&) [2]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [4]>(char const (&) [4]) :190 4x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [5]>(char const (&) [5]) :190 11x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [6]>(char const (&) [6]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [7]>(char const (&) [7]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char const (&) [9]>(char const (&) [9]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<char>(char&&) :190 12x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<int>(int&&) :190 16x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<long long>(long long&&) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<unsigned int>(unsigned int&&) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<unsigned long long>(unsigned long long&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 1> boost::urls::detail::make_format_args<unsigned long>(unsigned long&&) :190 6x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [14], char const (&) [13]>(char const (&) [14], char const (&) [13]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [25]>(char const (&) [5], char const (&) [25]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [4]>(char const (&) [5], char const (&) [4]) :190 8x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [5]>(char const (&) [5], char const (&) [5]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [6]>(char const (&) [5], char const (&) [6]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [8]>(char const (&) [5], char const (&) [8]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [6], char const (&) [14]>(char const (&) [6], char const (&) [14]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [7], char const (&) [11]>(char const (&) [7], char const (&) [11]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [7], char const (&) [20]>(char const (&) [7], char const (&) [20]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [7], char const (&) [4]>(char const (&) [7], char const (&) [4]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [7], char>(char const (&) [7], char&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char const (&) [8], char const (&) [20]>(char const (&) [8], char const (&) [20]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char, boost::urls::detail::named_arg<char> >(char&&, boost::urls::detail::named_arg<char>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char, boost::urls::detail::named_arg<int> >(char&&, boost::urls::detail::named_arg<int>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char, char>(char&&, char&&) :190 5x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<char, int>(char&&, int&&) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<int, boost::urls::detail::named_arg<char> >(int&&, boost::urls::detail::named_arg<char>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<int, boost::urls::detail::named_arg<int> >(int&&, boost::urls::detail::named_arg<int>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<int, int>(int&&, int&&) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<unsigned long, boost::urls::detail::named_arg<int> >(unsigned long&&, boost::urls::detail::named_arg<int>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 2> boost::urls::detail::make_format_args<unsigned long, int>(unsigned long&&, int&&) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [2], char const (&) [2]>(char const (&) [5], char const (&) [2], char const (&) [2]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [4], char const (&) [4]>(char const (&) [5], char const (&) [4], char const (&) [4]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [4], char>(char const (&) [5], char const (&) [4], char&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [4], unsigned short const&>(char const (&) [5], char const (&) [4], unsigned short const&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char const (&) [5], char, char>(char const (&) [5], char&&, char&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char, char, char const (&) [4]>(char&&, char&&, char const (&) [4]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char, char, char>(char&&, char&&, char&&) :190 4x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<char, char, int>(char&&, char&&, int&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<int, char, int>(int&&, char&&, int&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 3> boost::urls::detail::make_format_args<unsigned long, char, int>(unsigned long&&, char&&, int&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 4> boost::urls::detail::make_format_args<boost::urls::detail::named_arg<char [3]>, boost::urls::detail::named_arg<char [11]>, boost::urls::detail::named_arg<int>, boost::urls::detail::named_arg<char [4]> >(boost::urls::detail::named_arg<char [3]>&&, boost::urls::detail::named_arg<char [11]>&&, boost::urls::detail::named_arg<int>&&, boost::urls::detail::named_arg<char [4]>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 4> boost::urls::detail::make_format_args<boost::urls::detail::named_arg<char [4]>, boost::urls::detail::named_arg<int>, boost::urls::detail::named_arg<char [3]>, boost::urls::detail::named_arg<char [11]> >(boost::urls::detail::named_arg<char [4]>&&, boost::urls::detail::named_arg<int>&&, boost::urls::detail::named_arg<char [3]>&&, boost::urls::detail::named_arg<char [11]>&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 4> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [2], char const (&) [2], char const (&) [4]>(char const (&) [5], char const (&) [2], char const (&) [2], char const (&) [4]) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 4> boost::urls::detail::make_format_args<char const (&) [5], char const (&) [4], char, char>(char const (&) [5], char const (&) [4], char&&, char&&) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 4> boost::urls::detail::make_format_args<char const (&) [5], char, char, char const (&) [4]>(char const (&) [5], char&&, char&&, char const (&) [4]) :190 3x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 4> boost::urls::detail::make_format_args<char const (&) [6], char const (&) [13], int, char const (&) [12]>(char const (&) [6], char const (&) [13], int&&, char const (&) [12]) :190 6x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 5> boost::urls::detail::make_format_args<char const (&) [5], char, char, char const (&) [4], int>(char const (&) [5], char&&, char&&, char const (&) [4], int&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 5> boost::urls::detail::make_format_args<char const (&) [6], int, char const (&) [13], char const (&) [5], char const (&) [4]>(char const (&) [6], int&&, char const (&) [13], char const (&) [5], char const (&) [4]) :190 2x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 7> boost::urls::detail::make_format_args<char, char const (&) [4], char const (&) [8], int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, char const (&) [2], boost::urls::X>(char&&, char const (&) [4], char const (&) [8], int&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, char const (&) [2], boost::urls::X&&) :190 1x 100.0% 100.0% std::array<boost::urls::detail::format_arg, 9> boost::urls::detail::make_format_args<char const (&) [5], char, char, char const (&) [4], int, char, char, char, char const (&) [4]>(char const (&) [5], char&&, char&&, char const (&) [4], int&&, char&&, char&&, char&&, char const (&) [4]) :190 1x 100.0% 100.0% boost::urls::detail::format_args::format_args(boost::urls::detail::format_arg const*, boost::urls::detail::format_arg const*) :202 6x 100.0% 100.0% boost::urls::detail::format_args::format_args<0ul>(std::array<boost::urls::detail::format_arg, 0ul> const&) :210 15x 100.0% 100.0% boost::urls::detail::format_args::format_args<1ul>(std::array<boost::urls::detail::format_arg, 1ul> const&) :210 72x 100.0% 100.0% boost::urls::detail::format_args::format_args<2ul>(std::array<boost::urls::detail::format_arg, 2ul> const&) :210 40x 100.0% 100.0% boost::urls::detail::format_args::format_args<3ul>(std::array<boost::urls::detail::format_arg, 3ul> const&) :210 13x 100.0% 100.0% boost::urls::detail::format_args::format_args<4ul>(std::array<boost::urls::detail::format_arg, 4ul> const&) :210 14x 100.0% 100.0% boost::urls::detail::format_args::format_args<5ul>(std::array<boost::urls::detail::format_arg, 5ul> const&) :210 3x 100.0% 100.0% boost::urls::detail::format_args::format_args<7ul>(std::array<boost::urls::detail::format_arg, 7ul> const&) :210 1x 100.0% 100.0% boost::urls::detail::format_args::format_args<9ul>(std::array<boost::urls::detail::format_arg, 9ul> const&) :210 1x 100.0% 100.0% boost::urls::detail::format_args::get(unsigned long) const :216 508x 100.0% 100.0% boost::urls::detail::format_args::get(boost::core::basic_string_view<char>) const :224 96x 100.0% 100.0% boost::urls::detail::format_context::format_context(char*, boost::urls::detail::format_args) :242 155x 100.0% 100.0% boost::urls::detail::format_context::args() const :250 14x 100.0% 100.0% boost::urls::detail::format_context::arg(unsigned long) const :256 243x 100.0% 100.0% boost::urls::detail::format_context::arg(boost::core::basic_string_view<char>) const :262 43x 100.0% 100.0% boost::urls::detail::format_context::out() :268 1131x 100.0% 100.0% boost::urls::detail::format_context::advance_to(char*) :274 1131x 100.0% 100.0% boost::urls::detail::measure_context::measure_context(boost::urls::detail::format_args) :287 158x 100.0% 100.0% boost::urls::detail::measure_context::measure_context(unsigned long, boost::urls::detail::format_args) :292 158x 100.0% 100.0% boost::urls::detail::measure_context::args() const :300 14x 100.0% 100.0% boost::urls::detail::measure_context::arg(unsigned long) const :306 247x 100.0% 100.0% boost::urls::detail::measure_context::arg(boost::core::basic_string_view<char>) const :312 43x 100.0% 100.0% boost::urls::detail::measure_context::out() :318 1145x 100.0% 100.0% boost::urls::detail::measure_context::advance_to(unsigned long) :324 1145x 100.0% 100.0%
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/url
8 //
9
10 #ifndef BOOST_URL_DETAIL_FORMAT_ARGS_HPP
11 #define BOOST_URL_DETAIL_FORMAT_ARGS_HPP
12
13 #include <boost/url/detail/encode.hpp>
14 #include <boost/url/grammar/lut_chars.hpp>
15
16 #include <boost/core/ignore_unused.hpp>
17 #include <array>
18
19 // This file implements functions and classes to
20 // type-erase format arguments.
21
22 namespace boost {
23 namespace urls {
24 namespace detail {
25
26 // state of the format string. It basically keeps
27 // track of where we are in the format string.
28 class format_parse_context
29 {
30 char const* begin_;
31 char const* end_;
32 std::size_t arg_id_ = 0;
33
34 public:
35 constexpr
36 752x format_parse_context(
37 char const* first,
38 char const* last,
39 std::size_t arg_id = 0)
40 752x : begin_( first )
41 752x , end_( last )
42 752x , arg_id_( arg_id )
43 752x {}
44
45 constexpr
46 597x format_parse_context(
47 core::string_view fmt,
48 std::size_t arg_id = 0)
49 597x : format_parse_context(
50 fmt.data(),
51 597x fmt.data() + fmt.size(),
52 597x arg_id )
53 597x {}
54
55 constexpr
56 char const*
57 1747x begin() const noexcept
58 {
59 1747x return begin_;
60 }
61
62 constexpr
63 char const*
64 1173x end() const noexcept
65 {
66 1173x return end_;
67 }
68
69 BOOST_CXX14_CONSTEXPR
70 void
71 1150x advance_to( char const* it )
72 {
73 1150x begin_ = it;
74 1150x }
75
76 std::size_t
77 1027x next_arg_id()
78 {
79 1027x return arg_id_++;
80 }
81 };
82
83 // State of the destination string
84 class format_context;
85 class measure_context;
86 struct ignore_format {};
87
88 template <class T>
89 struct named_arg
90 {
91 core::string_view name;
92 T const& value;
93
94 21x named_arg(core::string_view n, T const& v)
95 21x : name(n)
96 21x , value(v)
97 21x {}
98 };
99
100 // A type erased format argument
101 class format_arg
102 {
103 void const* arg_;
104 void (*measure_)(
105 format_parse_context&,
106 measure_context&,
107 grammar::lut_chars const&,
108 void const* );
109 void (*fmt_)(
110 format_parse_context&,
111 format_context&,
112 grammar::lut_chars const&,
113 void const* );
114 core::string_view name_;
115 std::size_t value_ = 0;
116 bool ignore_ = false;
117
118 template <class A>
119 static
120 void
121 measure_impl(
122 format_parse_context& pctx,
123 measure_context& mctx,
124 grammar::lut_chars const& cs,
125 void const* a );
126
127 template <class A>
128 static
129 void
130 format_impl(
131 format_parse_context& pctx,
132 format_context& fctx,
133 grammar::lut_chars const& cs,
134 void const* a );
135
136 public:
137 template<class A>
138 format_arg( A&& a );
139
140 template<class A>
141 format_arg( named_arg<A>&& a );
142
143 template<class A>
144 format_arg( core::string_view name, A&& a );
145
146 34x format_arg()
147 34x : format_arg(ignore_format{})
148 34x {}
149
150 explicit
151 operator bool() const noexcept
152 {
153 return !ignore_;
154 }
155
156 void
157 290x measure(
158 format_parse_context& pctx,
159 measure_context& mctx,
160 grammar::lut_chars const& cs)
161 {
162 290x measure_( pctx, mctx, cs, arg_ );
163 288x }
164
165 void
166 286x format(
167 format_parse_context& pctx,
168 format_context& fctx,
169 grammar::lut_chars const& cs )
170 {
171 286x fmt_( pctx, fctx, cs, arg_ );
172 286x }
173
174 core::string_view
175 224x name() const
176 {
177 224x return name_;
178 }
179
180 std::size_t
181 28x value() const
182 {
183 28x return value_;
184 }
185 };
186
187 // create temp stack storage for type erased args
188 template< class... Args >
189 std::array<format_arg, sizeof...(Args)>
190 159x make_format_args( Args&&... args )
191 {
192 159x return {{ std::forward<Args>(args)... }};
193 }
194
195 // reference to an array of format_args
196 class format_args
197 {
198 format_arg const* p_{nullptr};
199 std::size_t n_{0};
200
201 public:
202 6x format_args(
203 detail::format_arg const* first,
204 detail::format_arg const* last ) noexcept
205 6x : p_(first)
206 6x , n_(static_cast<std::size_t>(last - first))
207 6x {}
208
209 template < std::size_t N >
210 159x format_args( std::array<format_arg, N> const& store ) noexcept
211 159x : p_(store.data())
212 159x , n_(store.size())
213 159x {}
214
215 format_arg
216 508x get( std::size_t i ) const noexcept
217 {
218 508x if (i < n_)
219 504x return p_[i];
220 4x return {};
221 }
222
223 format_arg
224 96x get( core::string_view name ) const noexcept
225 {
226 226x for (std::size_t i = 0; i < n_; ++i)
227 {
228 224x if (p_[i].name() == name)
229 94x return p_[i];
230 }
231 2x return {};
232 }
233 };
234
235 // define the format_context after format_args
236 class format_context
237 {
238 format_args args_;
239 char* out_;
240
241 public:
242 155x format_context(
243 char* out,
244 format_args args )
245 155x : args_( args )
246 155x , out_( out )
247 155x {}
248
249 format_args
250 14x args() const noexcept
251 {
252 14x return args_;
253 }
254
255 format_arg
256 243x arg( std::size_t id ) const noexcept
257 {
258 243x return args_.get( id );
259 }
260
261 format_arg
262 43x arg( core::string_view name ) const noexcept
263 {
264 43x return args_.get( name );
265 }
266
267 char*
268 1131x out()
269 {
270 1131x return out_;
271 }
272
273 void
274 1131x advance_to( char* it )
275 {
276 1131x out_ = it;
277 1131x }
278 };
279
280 // define the measure_context after format_args
281 class measure_context
282 {
283 format_args args_;
284 std::size_t out_;
285
286 public:
287 158x measure_context(
288 format_args args )
289 158x : measure_context(0, args)
290 158x {}
291
292 158x measure_context(
293 std::size_t out,
294 format_args args )
295 158x : args_( args )
296 158x , out_( out )
297 158x {}
298
299 format_args
300 14x args() const noexcept
301 {
302 14x return args_;
303 }
304
305 format_arg
306 247x arg( std::size_t id ) const noexcept
307 {
308 247x return args_.get( id );
309 }
310
311 format_arg
312 43x arg( core::string_view name ) const noexcept
313 {
314 43x return args_.get( name );
315 }
316
317 std::size_t
318 1145x out()
319 {
320 1145x return out_;
321 }
322
323 void
324 1145x advance_to( std::size_t n )
325 {
326 1145x out_ = n;
327 1145x }
328 };
329
330 // fwd declare the formatter
331 template <class T, class = void>
332 struct formatter;
333
334 } // detail
335 } // url
336 } // boost
337
338 #include <boost/url/detail/impl/format_args.hpp>
339
340 #endif
341