100.00% Lines (13/13)
100.00% Functions (1/1)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2022 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2022 Vinnie Falco (vinnie.falco@gmail.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_IMPL_IPV4_ADDRESS_RULE_HPP | 11 | #ifndef BOOST_URL_RFC_IMPL_IPV4_ADDRESS_RULE_HPP | |||||
| 12 | #define BOOST_URL_RFC_IMPL_IPV4_ADDRESS_RULE_HPP | 12 | #define BOOST_URL_RFC_IMPL_IPV4_ADDRESS_RULE_HPP | |||||
| 13 | 13 | |||||||
| 14 | #include <boost/url/detail/config.hpp> | 14 | #include <boost/url/detail/config.hpp> | |||||
| 15 | #include <boost/url/grammar/delim_rule.hpp> | 15 | #include <boost/url/grammar/delim_rule.hpp> | |||||
| 16 | #include <boost/url/grammar/dec_octet_rule.hpp> | 16 | #include <boost/url/grammar/dec_octet_rule.hpp> | |||||
| 17 | #include <boost/url/grammar/parse.hpp> | 17 | #include <boost/url/grammar/parse.hpp> | |||||
| 18 | #include <boost/url/grammar/tuple_rule.hpp> | 18 | #include <boost/url/grammar/tuple_rule.hpp> | |||||
| 19 | 19 | |||||||
| 20 | namespace boost { | 20 | namespace boost { | |||||
| 21 | namespace urls { | 21 | namespace urls { | |||||
| 22 | 22 | |||||||
| 23 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | 23 | BOOST_URL_CXX20_CONSTEXPR_OR_INLINE | |||||
| 24 | auto | 24 | auto | |||||
| HITCBC | 25 | 6948 | implementation_defined::ipv4_address_rule_t:: | 25 | 6948 | implementation_defined::ipv4_address_rule_t:: | ||
| 26 | parse( | 26 | parse( | |||||
| 27 | char const*& it, | 27 | char const*& it, | |||||
| 28 | char const* end | 28 | char const* end | |||||
| 29 | ) const noexcept -> | 29 | ) const noexcept -> | |||||
| 30 | system::result<value_type> | 30 | system::result<value_type> | |||||
| 31 | { | 31 | { | |||||
| 32 | using namespace grammar; | 32 | using namespace grammar; | |||||
| 33 | auto rv = grammar::parse( | 33 | auto rv = grammar::parse( | |||||
| HITCBC | 34 | 6948 | it, end, tuple_rule( | 34 | 6948 | it, end, tuple_rule( | ||
| HITCBC | 35 | 6948 | dec_octet_rule, squelch(delim_rule('.')), | 35 | 6948 | dec_octet_rule, squelch(delim_rule('.')), | ||
| HITCBC | 36 | 6948 | dec_octet_rule, squelch(delim_rule('.')), | 36 | 6948 | dec_octet_rule, squelch(delim_rule('.')), | ||
| HITCBC | 37 | 6948 | dec_octet_rule, squelch(delim_rule('.')), | 37 | 6948 | dec_octet_rule, squelch(delim_rule('.')), | ||
| HITCBC | 38 | 6948 | dec_octet_rule)); | 38 | 6948 | dec_octet_rule)); | ||
| HITCBC | 39 | 6948 | if(! rv) | 39 | 6948 | if(! rv) | ||
| HITCBC | 40 | 6564 | return rv.error(); | 40 | 6564 | return rv.error(); | ||
| 41 | std::array<unsigned char, 4> v; | 41 | std::array<unsigned char, 4> v; | |||||
| HITCBC | 42 | 384 | v[0] = std::get<0>(*rv); | 42 | 384 | v[0] = std::get<0>(*rv); | ||
| HITCBC | 43 | 384 | v[1] = std::get<1>(*rv); | 43 | 384 | v[1] = std::get<1>(*rv); | ||
| HITCBC | 44 | 384 | v[2] = std::get<2>(*rv); | 44 | 384 | v[2] = std::get<2>(*rv); | ||
| HITCBC | 45 | 384 | v[3] = std::get<3>(*rv); | 45 | 384 | v[3] = std::get<3>(*rv); | ||
| HITCBC | 46 | 384 | return ipv4_address(v); | 46 | 384 | return ipv4_address(v); | ||
| 47 | } | 47 | } | |||||
| 48 | 48 | |||||||
| 49 | } // urls | 49 | } // urls | |||||
| 50 | } // boost | 50 | } // boost | |||||
| 51 | 51 | |||||||
| 52 | 52 | |||||||
| 53 | #endif | 53 | #endif | |||||