LCOV - code coverage report
Current view: top level - libs/http_proto/src/server - router_types.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 66.7 % 21 14
Test Date: 2025-12-21 20:19:40 Functions: 60.0 % 5 3

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 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/cppalliance/http_proto
       8              : //
       9              : 
      10              : #include <boost/http_proto/server/router_types.hpp>
      11              : #include <boost/url/grammar/ci_string.hpp>
      12              : #include <boost/assert.hpp>
      13              : #include <cstring>
      14              : 
      15              : namespace boost {
      16              : namespace http_proto {
      17              : 
      18              : namespace detail {
      19              : 
      20              : const char*
      21            0 : route_cat_type::
      22              : name() const noexcept
      23              : {
      24            0 :     return "boost.http";
      25              : }
      26              : 
      27              : std::string
      28          294 : route_cat_type::
      29              : message(int code) const
      30              : {
      31          588 :     return message(code, nullptr, 0);
      32              : }
      33              : 
      34              : char const*
      35          294 : route_cat_type::
      36              : message(
      37              :     int code,
      38              :     char*,
      39              :     std::size_t) const noexcept
      40              : {
      41          294 :     switch(static_cast<route>(code))
      42              :     {
      43            2 :     case route::close:      return "route::close";
      44            2 :     case route::complete:   return "route::complete";
      45            4 :     case route::suspend:     return "route::suspend";
      46           98 :     case route::next:       return "route::next";
      47            0 :     case route::next_route: return "route::next_route";
      48          188 :     case route::send:       return "route::send";
      49            0 :     default:
      50            0 :         return "?";
      51              :     }
      52              : }
      53              : 
      54              : // msvc 14.0 has a bug that warns about inability
      55              : // to use constexpr construction here, even though
      56              : // there's no constexpr construction
      57              : #if defined(_MSC_VER) && _MSC_VER <= 1900
      58              : # pragma warning( push )
      59              : # pragma warning( disable : 4592 )
      60              : #endif
      61              : 
      62              : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
      63              : constinit route_cat_type route_cat;
      64              : #else
      65              : route_cat_type route_cat;
      66              : #endif
      67              : 
      68              : #if defined(_MSC_VER) && _MSC_VER <= 1900
      69              : # pragma warning( pop )
      70              : #endif
      71              : 
      72              : } // detail
      73              : 
      74              : resumer
      75            0 : suspender::
      76              : owner::
      77              : do_suspend()
      78              : {
      79            0 :     detail::throw_logic_error();
      80              : }
      81              : 
      82              : bool
      83            3 : route_params_base::
      84              : is_method(
      85              :     core::string_view s) const noexcept
      86              : {
      87            3 :     auto m = http_proto::string_to_method(s);
      88            3 :     if(m != http_proto::method::unknown)
      89            2 :         return verb_ == m;
      90            1 :     return s == verb_str_;
      91              : }
      92              : 
      93              : } // http_proto
      94              : } // boost
        

Generated by: LCOV version 2.1