LCOV - code coverage report
Current view: top level - boost/url/grammar/impl - not_empty_rule.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 10 10 100.0 %
Date: 2024-03-05 20:06:56 Functions: 2 2 100.0 %

          Line data    Source code
       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             : #ifndef BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
      11             : #define BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
      12             : 
      13             : #include <boost/url/grammar/error.hpp>
      14             : #include <boost/url/grammar/parse.hpp>
      15             : 
      16             : namespace boost {
      17             : namespace urls {
      18             : namespace grammar {
      19             : 
      20             : template<class R>
      21             : auto
      22           8 : not_empty_rule_t<R>::
      23             : parse(
      24             :     char const*& it,
      25             :     char const* end) const ->
      26             :         system::result<value_type>
      27             : {
      28           8 :     if(it == end)
      29             :     {
      30             :         // empty
      31           1 :         BOOST_URL_RETURN_EC(
      32             :             error::mismatch);
      33             :     }
      34           7 :     auto const it0 = it;
      35           7 :     auto rv = r_.parse(it, end);
      36           7 :     if(  !rv )
      37             :     {
      38             :         // error
      39           3 :         return rv;
      40             :     }
      41           4 :     if(it == it0)
      42             :     {
      43             :         // empty
      44           1 :         BOOST_URL_RETURN_EC(
      45             :             error::mismatch);
      46             :     }
      47             :     // value
      48           3 :     return rv;
      49             : }
      50             : 
      51             : } // grammar
      52             : } // urls
      53             : } // boost
      54             : 
      55             : #endif

Generated by: LCOV version 1.15