100.00% Lines (14/14)
100.00% Functions (1/1)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) | |||||
| 3 | // Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) | 3 | // Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com) | |||||
| 4 | // | 4 | // | |||||
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||||
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 7 | // | 7 | // | |||||
| 8 | // Official repository: https://github.com/boostorg/url | 8 | // Official repository: https://github.com/boostorg/url | |||||
| 9 | // | 9 | // | |||||
| 10 | 10 | |||||||
| 11 | #ifndef BOOST_URL_RFC_DETAIL_IMPL_SCHEME_RULE_HPP | 11 | #ifndef BOOST_URL_RFC_DETAIL_IMPL_SCHEME_RULE_HPP | |||||
| 12 | #define BOOST_URL_RFC_DETAIL_IMPL_SCHEME_RULE_HPP | 12 | #define BOOST_URL_RFC_DETAIL_IMPL_SCHEME_RULE_HPP | |||||
| 13 | 13 | |||||||
| 14 | #include <boost/url/detail/config.hpp> | 14 | #include <boost/url/detail/config.hpp> | |||||
| 15 | #include <boost/url/grammar/alpha_chars.hpp> | 15 | #include <boost/url/grammar/alpha_chars.hpp> | |||||
| 16 | #include <boost/url/grammar/charset.hpp> | 16 | #include <boost/url/grammar/charset.hpp> | |||||
| 17 | #include <boost/url/grammar/error.hpp> | 17 | #include <boost/url/grammar/error.hpp> | |||||
| 18 | #include <boost/url/grammar/lut_chars.hpp> | 18 | #include <boost/url/grammar/lut_chars.hpp> | |||||
| 19 | #include <boost/url/grammar/parse.hpp> | 19 | #include <boost/url/grammar/parse.hpp> | |||||
| 20 | 20 | |||||||
| 21 | namespace boost { | 21 | namespace boost { | |||||
| 22 | namespace urls { | 22 | namespace urls { | |||||
| 23 | namespace detail { | 23 | namespace detail { | |||||
| 24 | 24 | |||||||
| 25 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | 25 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | |||||
| 26 | auto | 26 | auto | |||||
| HITCBC | 27 | 20689 | scheme_rule:: | 27 | 20693 | scheme_rule:: | ||
| 28 | parse( | 28 | parse( | |||||
| 29 | char const*& it, | 29 | char const*& it, | |||||
| 30 | char const* end) const noexcept -> | 30 | char const* end) const noexcept -> | |||||
| 31 | system::result<value_type> | 31 | system::result<value_type> | |||||
| 32 | { | 32 | { | |||||
| HITCBC | 33 | 20689 | auto const start = it; | 33 | 20693 | auto const start = it; | ||
| HITCBC | 34 | 20689 | if(it == end) | 34 | 20693 | if(it == end) | ||
| 35 | { | 35 | { | |||||
| 36 | // end | 36 | // end | |||||
| HITCBC | 37 | 152 | BOOST_URL_CONSTEXPR_RETURN_EC( | 37 | 152 | BOOST_URL_CONSTEXPR_RETURN_EC( | ||
| 38 | grammar::error::mismatch); | 38 | grammar::error::mismatch); | |||||
| 39 | } | 39 | } | |||||
| HITCBC | 40 | 20537 | if(! grammar::alpha_chars(*it)) | 40 | 20541 | if(! grammar::alpha_chars(*it)) | ||
| 41 | { | 41 | { | |||||
| 42 | // expected alpha | 42 | // expected alpha | |||||
| HITCBC | 43 | 6443 | BOOST_URL_CONSTEXPR_RETURN_EC( | 43 | 6447 | BOOST_URL_CONSTEXPR_RETURN_EC( | ||
| 44 | grammar::error::mismatch); | 44 | grammar::error::mismatch); | |||||
| 45 | } | 45 | } | |||||
| 46 | 46 | |||||||
| 47 | constexpr | 47 | constexpr | |||||
| HITCBC | 48 | 14094 | grammar::lut_chars scheme_chars( | 48 | 14094 | grammar::lut_chars scheme_chars( | ||
| 49 | "0123456789" "+-." | 49 | "0123456789" "+-." | |||||
| 50 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 50 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |||||
| 51 | "abcdefghijklmnopqrstuvwxyz"); | 51 | "abcdefghijklmnopqrstuvwxyz"); | |||||
| HITCBC | 52 | 28188 | it = grammar::find_if_not( | 52 | 28188 | it = grammar::find_if_not( | ||
| HITCBC | 53 | 14094 | it + 1, end, scheme_chars); | 53 | 14094 | it + 1, end, scheme_chars); | ||
| HITCBC | 54 | 14094 | value_type t; | 54 | 14094 | value_type t; | ||
| HITCBC | 55 | 28188 | t.scheme = core::string_view( | 55 | 28188 | t.scheme = core::string_view( | ||
| HITCBC | 56 | 14094 | start, it - start); | 56 | 14094 | start, it - start); | ||
| HITCBC | 57 | 14094 | t.scheme_id = string_to_scheme( | 57 | 14094 | t.scheme_id = string_to_scheme( | ||
| 58 | t.scheme); | 58 | t.scheme); | |||||
| HITCBC | 59 | 14094 | return t; | 59 | 14094 | return t; | ||
| 60 | } | 60 | } | |||||
| 61 | 61 | |||||||
| 62 | } // detail | 62 | } // detail | |||||
| 63 | } // urls | 63 | } // urls | |||||
| 64 | } // boost | 64 | } // boost | |||||
| 65 | 65 | |||||||
| 66 | 66 | |||||||
| 67 | #endif | 67 | #endif | |||||