GCC Code Coverage Report


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