GCC Code Coverage Report


Directory: libs/url/
File: libs/url/src/static_url.cpp
Date: 2024-02-29 20:02:56
Exec Total Coverage
Lines: 17 24 70.8%
Functions: 3 5 60.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 //
2 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@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_IMPL_STATIC_URL_IPP
11 #define BOOST_URL_IMPL_STATIC_URL_IPP
12
13 #include <boost/url/detail/config.hpp>
14 #include <boost/url/parse.hpp>
15 #include <boost/url/static_url.hpp>
16 #include <boost/url/url_view.hpp>
17 #include <boost/url/detail/except.hpp>
18 #include <boost/assert.hpp>
19
20 namespace boost {
21 namespace urls {
22
23 29 static_url_base::
24 static_url_base(
25 char* buf,
26 29 std::size_t cap) noexcept
27 {
28 29 s_ = buf;
29 29 cap_ = cap;
30 29 s_[0] = '\0';
31 29 impl_.cs_ = s_;
32 29 }
33
34 15 static_url_base::
35 static_url_base(
36 char* buf,
37 std::size_t cap,
38 15 core::string_view s)
39 17 : static_url_base(buf, cap)
40 {
41
3/4
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 1 times.
31 copy(parse_uri_reference(s
42
2/2
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 1 times.
16 ).value(BOOST_URL_POS));
43 13 }
44
45 void
46 static_url_base::
47 clear_impl() noexcept
48 {
49 impl_ = {from::url};
50 s_[0] = '\0';
51 impl_.cs_ = s_;
52 }
53
54 void
55 36 static_url_base::
56 reserve_impl(
57 std::size_t n,
58 op_t&)
59 {
60
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 4 times.
36 if(n <= cap_)
61 32 return;
62 4 detail::throw_length_error();
63 }
64
65 //----------------------------------------------------------
66
67 void
68 static_url_base::
69 cleanup(op_t&)
70 {
71 }
72
73 } // urls
74 } // boost
75
76 #endif
77