LCOV - code coverage report
Current view: top level - libs/http_proto/src/rfc/upgrade_rule.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 93.3 % 15 14
Test Date: 2024-09-18 08:42:22 Functions: 100.0 % 1 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.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/cppalliance/http_proto
       8              : //
       9              : 
      10              : #include <boost/http_proto/rfc/upgrade_rule.hpp>
      11              : #include <boost/http_proto/rfc/token_rule.hpp>
      12              : #include <boost/url/grammar/error.hpp>
      13              : #include <boost/url/grammar/parse.hpp>
      14              : 
      15              : namespace boost {
      16              : namespace http_proto {
      17              : 
      18              : auto
      19           41 : upgrade_protocol_rule_t::
      20              : parse(
      21              :     char const*& it,
      22              :     char const* end) const noexcept ->
      23              :         system::result<value_type>
      24              : {
      25           41 :     value_type t;
      26              :     // token
      27              :     {
      28           41 :         auto rv = grammar::parse(
      29              :             it, end, token_rule);
      30           41 :         if(! rv)
      31            3 :             return rv.error();
      32           38 :         t.name = *rv;
      33              :     }
      34              :     // [ "/" token ]
      35           38 :     if( it == end ||
      36            8 :         *it != '/')
      37           31 :         return t;
      38            7 :     ++it;
      39            7 :     auto rv = grammar::parse(
      40              :         it, end, token_rule);
      41            7 :     if(! rv)
      42            0 :         return rv.error();
      43            7 :     t.version = *rv;
      44            7 :     return t;
      45              : }
      46              : 
      47              : } // http_proto
      48              : } // boost
        

Generated by: LCOV version 2.1