LCOV - code coverage report
Current view: top level - url/grammar/impl - parse.hpp (source / functions) Coverage Total Hit Missed
Test: coverage_remapped.info Lines: 100.0 % 11 11
Test Date: 2026-02-25 21:00:01 Functions: 99.2 % 131 130 1

           TLA  Line data    Source code
       1                 : //
       2                 : // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
       3                 : // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
       4                 : //
       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)
       7                 : //
       8                 : // Official repository: https://github.com/boostorg/url
       9                 : //
      10                 : 
      11                 : #ifndef BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
      12                 : #define BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
      13                 : 
      14                 : #include <boost/url/grammar/error.hpp>
      15                 : #include <boost/url/grammar/type_traits.hpp>
      16                 : 
      17                 : namespace boost {
      18                 : namespace urls {
      19                 : namespace grammar {
      20                 : 
      21                 : template<BOOST_URL_CONSTRAINT(Rule) R>
      22                 : BOOST_URL_CXX14_CONSTEXPR
      23                 : auto
      24 HIT       68941 : parse(
      25                 :     char const*& it,
      26                 :     char const* end,
      27                 :     R const& r) ->
      28                 :         system::result<typename R::value_type>
      29                 : {
      30                 :     // If this goes off, it means the rule
      31                 :     // passed in did not meet the requirements.
      32                 :     // Please check the documentation.
      33                 :     static_assert(
      34                 :         is_rule<R>::value,
      35                 :         "Rule requirements not met");
      36                 : 
      37           68941 :     return r.parse(it, end);
      38                 : }
      39                 : 
      40                 : template<BOOST_URL_CONSTRAINT(Rule) R>
      41                 : BOOST_URL_CXX14_CONSTEXPR
      42                 : auto
      43            6103 : parse(
      44                 :     core::string_view s,
      45                 :     R const& r) ->
      46                 :         system::result<typename R::value_type>
      47                 : {
      48                 :     // If this goes off, it means the rule
      49                 :     // passed in did not meet the requirements.
      50                 :     // Please check the documentation.
      51                 :     static_assert(
      52                 :         is_rule<R>::value,
      53                 :         "Rule requirements not met");
      54                 : 
      55            6103 :     auto it = s.data();
      56            6103 :     auto const end = it + s.size();
      57            6103 :     auto rv = r.parse(it, end);
      58           11387 :     if( rv &&
      59            5284 :         it != end)
      60             243 :         return error::leftover;
      61            5860 :     return rv;
      62             325 : }
      63                 : 
      64                 : } // grammar
      65                 : } // urls
      66                 : } // boost
      67                 : 
      68                 : #endif
        

Generated by: LCOV version 2.3