include/boost/url/grammar/detail/range_rule.hpp

100.0% Lines (21/21) 100.0% List of functions (9/9)
range_rule.hpp
f(x) Functions (9)
Function Calls Lines Blocks
boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::core::basic_string_view<char> >, false>::range_base_storage() :31 1x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::core::basic_string_view<char> >, false>::range_base_storage(boost::urls::grammar::any_rule<boost::core::basic_string_view<char> > const&) :34 4x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::urls::detail::segment_template>, false>::range_base_storage(boost::urls::grammar::any_rule<boost::urls::detail::segment_template> const&) :34 225x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::core::basic_string_view<char> >, false>::range_base_storage(boost::urls::grammar::any_rule<boost::core::basic_string_view<char> >&&) :40 95x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::urls::detail::segment_template>, false>::range_base_storage(boost::urls::grammar::any_rule<boost::urls::detail::segment_template>&&) :40 564x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::core::basic_string_view<char> >, false>::rule() :46 68x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::urls::detail::segment_template>, false>::rule() :46 451x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::core::basic_string_view<char> >, false>::rule() const :52 45x 100.0% 100.0% boost::urls::grammar::detail::range_base_storage<boost::urls::grammar::any_rule<boost::urls::detail::segment_template>, false>::rule() const :52 663x 100.0% 100.0%
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2025 Alan de Freitas (vinnie dot falco at gmail dot 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_GRAMMAR_DETAIL_RANGE_RULE_HPP
11 #define BOOST_URL_GRAMMAR_DETAIL_RANGE_RULE_HPP
12
13 #include <boost/url/detail/config.hpp>
14 #include <type_traits>
15 #include <utility>
16
17 namespace boost {
18 namespace urls {
19 namespace grammar {
20 namespace detail {
21
22 template<class RangeRule, bool = std::is_empty<RangeRule>::value>
23 class range_base_storage;
24
25 template<class RangeRule>
26 class range_base_storage<RangeRule, false>
27 {
28 RangeRule rule_;
29
30 protected:
31 1x range_base_storage() = default;
32
33 explicit
34 229x range_base_storage(RangeRule const& rule)
35 229x : rule_(rule)
36 {
37 229x }
38
39 explicit
40 659x range_base_storage(RangeRule&& rule)
41 659x : rule_(std::move(rule))
42 {
43 659x }
44
45 RangeRule&
46 519x rule() noexcept
47 {
48 519x return rule_;
49 }
50
51 RangeRule const&
52 708x rule() const noexcept
53 {
54 708x return rule_;
55 }
56 };
57
58 template<class RangeRule>
59 class range_base_storage<RangeRule, true>
60 : private RangeRule
61 {
62 protected:
63 range_base_storage() = default;
64
65 explicit
66 range_base_storage(RangeRule const& rule)
67 : RangeRule(rule)
68 {
69 }
70
71 explicit
72 range_base_storage(RangeRule&& rule)
73 : RangeRule(std::move(rule))
74 {
75 }
76
77 RangeRule&
78 rule() noexcept
79 {
80 return *this;
81 }
82
83 RangeRule const&
84 rule() const noexcept
85 {
86 return *this;
87 }
88 };
89
90 } // detail
91 } // grammar
92 } // urls
93 } // boost
94
95 #endif
96