LCOV - code coverage report
Current view: top level - libs/http/src/server - router_types.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 53.3 % 15 8
Test Date: 2026-01-20 00:11:34 Functions: 75.0 % 4 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
       8              : //
       9              : 
      10              : #include <boost/http/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 {
      17              : 
      18              : namespace detail {
      19              : 
      20              : const char*
      21            2 : route_cat_type::
      22              : name() const noexcept
      23              : {
      24            2 :     return "boost.http.route";
      25              : }
      26              : 
      27              : std::string
      28           16 : route_cat_type::
      29              : message(int code) const
      30              : {
      31           32 :     return message(code, nullptr, 0);
      32              : }
      33              : 
      34              : char const*
      35           16 : route_cat_type::
      36              : message(
      37              :     int code,
      38              :     char*,
      39              :     std::size_t) const noexcept
      40              : {
      41           16 :     switch(static_cast<route>(code))
      42              :     {
      43           15 :     case route::next:       return "next";
      44            1 :     case route::next_route: return "next_route";
      45            0 :     default:
      46            0 :         return "?";
      47              :     }
      48              : }
      49              : 
      50              : // msvc 14.0 has a bug that warns about inability
      51              : // to use constexpr construction here, even though
      52              : // there's no constexpr construction
      53              : #if defined(_MSC_VER) && _MSC_VER <= 1900
      54              : # pragma warning( push )
      55              : # pragma warning( disable : 4592 )
      56              : #endif
      57              : 
      58              : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
      59              : constinit route_cat_type route_cat;
      60              : #else
      61              : route_cat_type route_cat;
      62              : #endif
      63              : 
      64              : #if defined(_MSC_VER) && _MSC_VER <= 1900
      65              : # pragma warning( pop )
      66              : #endif
      67              : 
      68              : } // detail
      69              : 
      70              : bool
      71            0 : route_params_base::
      72              : is_method(
      73              :     core::string_view s) const noexcept
      74              : {
      75            0 :     auto m = http::string_to_method(s);
      76            0 :     if(m != http::method::unknown)
      77            0 :         return verb_ == m;
      78            0 :     return s == verb_str_;
      79              : }
      80              : 
      81              : } // http
      82              : } // boost
        

Generated by: LCOV version 2.3