GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 13 / 0 / 13
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 4 / 0 / 4

libs/url/src/rfc/detail/scheme_rule.cpp
Line Branch Exec Source
1 //
2 // Copyright (c) 2016-2019 Vinnie Falco (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
11 #include <boost/url/detail/config.hpp>
12 #include "scheme_rule.hpp"
13 #include <boost/url/grammar/alpha_chars.hpp>
14 #include <boost/url/grammar/delim_rule.hpp>
15 #include <boost/url/grammar/lut_chars.hpp>
16 #include <boost/url/grammar/parse.hpp>
17 #include <boost/url/grammar/tuple_rule.hpp>
18
19 namespace boost {
20 namespace urls {
21 namespace detail {
22
23 auto
24 3588 scheme_rule::
25 parse(
26 char const*& it,
27 char const* end) const noexcept ->
28 system::result<value_type>
29 {
30 3588 auto const start = it;
31
2/2
✓ Branch 0 taken 124 times.
✓ Branch 1 taken 3464 times.
3588 if(it == end)
32 {
33 // end
34 124 BOOST_URL_RETURN_EC(
35 grammar::error::mismatch);
36 }
37
2/2
✓ Branch 1 taken 850 times.
✓ Branch 2 taken 2614 times.
3464 if(! grammar::alpha_chars(*it))
38 {
39 // expected alpha
40 850 BOOST_URL_RETURN_EC(
41 grammar::error::mismatch);
42 }
43
44 static
45 constexpr
46 grammar::lut_chars scheme_chars(
47 "0123456789" "+-."
48 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
49 "abcdefghijklmnopqrstuvwxyz");
50 5228 it = grammar::find_if_not(
51 2614 it + 1, end, scheme_chars);
52 2614 value_type t;
53 5228 t.scheme = core::string_view(
54 2614 start, it - start);
55 2614 t.scheme_id = string_to_scheme(
56 t.scheme);
57 2614 return t;
58 }
59
60 } // detail
61 } // urls
62 } // boost
63
64