Line |
Branch |
Exec |
Source |
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_DETAIL_ROUTER_HPP |
11 |
|
|
#define BOOST_URL_DETAIL_ROUTER_HPP |
12 |
|
|
|
13 |
|
|
#include <boost/url/pct_string_view.hpp> |
14 |
|
|
#include <boost/url/segments_encoded_view.hpp> |
15 |
|
|
#include <boost/url/grammar/delim_rule.hpp> |
16 |
|
|
#include <boost/url/grammar/optional_rule.hpp> |
17 |
|
|
#include <boost/url/grammar/range_rule.hpp> |
18 |
|
|
#include <boost/url/grammar/tuple_rule.hpp> |
19 |
|
|
#include <string> |
20 |
|
|
|
21 |
|
|
namespace boost { |
22 |
|
|
namespace urls { |
23 |
|
|
namespace detail { |
24 |
|
|
|
25 |
|
|
class router_base |
26 |
|
|
{ |
27 |
|
|
void* impl_{nullptr}; |
28 |
|
|
|
29 |
|
|
public: |
30 |
|
|
// A type-erased router resource |
31 |
|
|
struct any_resource |
32 |
|
|
{ |
33 |
|
226 |
virtual ~any_resource() = default; |
34 |
|
|
virtual void const* get() const noexcept = 0; |
35 |
|
|
}; |
36 |
|
|
|
37 |
|
|
protected: |
38 |
|
|
router_base(); |
39 |
|
|
|
40 |
|
|
virtual ~router_base(); |
41 |
|
|
|
42 |
|
|
void |
43 |
|
|
insert_impl( |
44 |
|
|
core::string_view s, |
45 |
|
|
any_resource const* v); |
46 |
|
|
|
47 |
|
|
any_resource const* |
48 |
|
|
find_impl( |
49 |
|
|
segments_encoded_view path, |
50 |
|
|
core::string_view*& matches, |
51 |
|
|
core::string_view*& names) const noexcept; |
52 |
|
|
}; |
53 |
|
|
|
54 |
|
|
} // detail |
55 |
|
|
} // urls |
56 |
|
|
} // boost |
57 |
|
|
|
58 |
|
|
#endif |
59 |
|
|
|