LCOV - code coverage report
Current view: top level - libs/url/example/router/router.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 1 1
Test Date: 2024-08-20 16:05:53 Functions: 100.0 % 1 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2022 Alan de Freitas (alandefreitas@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/boostorg/url
       8              : //
       9              : 
      10              : #ifndef BOOST_URL_ROUTER_HPP
      11              : #define BOOST_URL_ROUTER_HPP
      12              : 
      13              : #include <boost/url/detail/config.hpp>
      14              : #include <boost/url/parse_path.hpp>
      15              : #include "detail/router.hpp"
      16              : #include "matches.hpp"
      17              : 
      18              : namespace boost {
      19              : namespace urls {
      20              : 
      21              : /** A URL router.
      22              : 
      23              :     This container matches static and dynamic
      24              :     URL requests to an object which represents
      25              :     how the it should be handled. These
      26              :     values are usually callback functions.
      27              : 
      28              :     @tparam T type of resource associated with
      29              :     each path template
      30              : 
      31              :     @tparam N maximum number of replacement fields
      32              :     in a path template
      33              : 
      34              :     @par Exception Safety
      35              : 
      36              :     @li Functions marked `noexcept` provide the
      37              :     no-throw guarantee, otherwise:
      38              : 
      39              :     @li Functions which throw offer the strong
      40              :     exception safety guarantee.
      41              : 
      42              :     @see
      43              :         @ref parse_absolute_uri,
      44              :         @ref parse_relative_ref,
      45              :         @ref parse_uri,
      46              :         @ref parse_uri_reference,
      47              :         @ref resolve.
      48              : */
      49              : template <class T>
      50              : class router
      51              :     : private detail::router_base
      52              : {
      53              : public:
      54              :     /// Constructor
      55           95 :     router() = default;
      56              : 
      57              :     /** Route the specified URL path to a resource
      58              : 
      59              :         @param path A url path with dynamic segments
      60              :         @param resource A resource the path corresponds to
      61              : 
      62              :         @see
      63              :             https://fmt.dev/latest/syntax.html
      64              :      */
      65              :     template <class U>
      66              :     void
      67              :     insert(core::string_view pattern, U&& v);
      68              : 
      69              :     /** Match URL path to corresponding resource
      70              : 
      71              :         @param request Request path
      72              :         @return The match results
      73              :      */
      74              :     T const*
      75              :     find(segments_encoded_view path, matches_base& m) const noexcept;
      76              : 
      77              : #ifdef BOOST_URL_DOCS
      78              :     /// @copydoc find
      79              :     T const*
      80              :     find(segments_encoded_view path, matches& m) const noexcept;
      81              : #endif
      82              : };
      83              : 
      84              : } // urls
      85              : } // boost
      86              : 
      87              : #include "impl/router.hpp"
      88              : 
      89              : #endif
      90              : 
        

Generated by: LCOV version 2.1