LCOV - code coverage report
Current view: top level - /jenkins/workspace/boost-root/libs/url/src - scheme.cpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 23 23
Test Date: 2026-02-13 15:53:22 Functions: 100.0 % 2 2

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
       3              : // Copyright (c) 2023 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              : 
      12              : #include <boost/url/detail/config.hpp>
      13              : #include <boost/url/scheme.hpp>
      14              : #include <boost/url/grammar/ci_string.hpp>
      15              : 
      16              : namespace boost {
      17              : namespace urls {
      18              : 
      19              : core::string_view
      20           53 : to_string(scheme s) noexcept
      21              : {
      22           53 :     switch(s)
      23              :     {
      24            4 :     case scheme::ftp:   return "ftp";
      25            3 :     case scheme::file:  return "file";
      26            3 :     case scheme::http:  return "http";
      27            5 :     case scheme::https: return "https";
      28           11 :     case scheme::ws:    return "ws";
      29            5 :     case scheme::wss:   return "wss";
      30            1 :     case scheme::none:  return {};
      31           21 :     default:
      32           21 :         break;
      33              :     }
      34           21 :     return "<unknown>";
      35              : }
      36              : 
      37              : std::uint16_t
      38            8 : default_port(scheme s) noexcept
      39              : {
      40            8 :     switch(s)
      41              :     {
      42            1 :     case scheme::ftp:
      43            1 :         return 21;
      44            2 :     case scheme::http:
      45              :     case scheme::ws:
      46            2 :         return 80;
      47            2 :     case scheme::https:
      48              :     case scheme::wss:
      49            2 :         return 443;
      50            3 :     default:
      51            3 :         break;
      52              :     }
      53            3 :     return 0;
      54              : }
      55              : 
      56              : } // urls
      57              : } // boost
      58              : 
        

Generated by: LCOV version 2.3