1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
// file : libbutl/url.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason.
{
// url_traits
//
template <typename H, typename S, typename P>
inline typename url_traits<H, S, P>::path_type url_traits<H, S, P>::
translate_path (string_type&& path)
{
return path_type (basic_url<string_type>::decode (path));
}
template <typename H, typename S, typename P>
inline typename url_traits<H, S, P>::string_type url_traits<H, S, P>::
translate_path (const path_type& path)
{
using url = basic_url<string_type>;
return url::encode (
string_type (path),
[] (typename url::char_type& c) {return !url::path_char (c);});
}
// basic_url
//
template <typename S, typename T>
inline basic_url<S, T>::
basic_url (scheme_type s,
optional<authority_type> a,
optional<path_type> p,
optional<string_type> q,
optional<string_type> f)
: scheme (std::move (s)),
authority (std::move (a)),
path (std::move (p)),
query (std::move (q)),
fragment (std::move (f))
{
}
template <typename S, typename T>
inline basic_url<S, T>::
basic_url (scheme_type s,
host_type h,
optional<path_type> p,
optional<string_type> q,
optional<string_type> f)
: basic_url (std::move (s),
authority_type {string_type (), std::move (h), 0},
std::move (p),
std::move (q),
std::move (f))
{
}
template <typename S, typename T>
inline basic_url<S, T>::
basic_url (scheme_type s,
host_type h,
std::uint16_t o,
optional<path_type> p,
optional<string_type> q,
optional<string_type> f)
: basic_url (std::move (s),
authority_type {string_type (), std::move (h), o},
std::move (p),
std::move (q),
std::move (f))
{
}
template <typename S, typename T>
inline basic_url<S, T>::
basic_url (scheme_type s,
string_type h,
optional<path_type> p,
optional<string_type> q,
optional<string_type> f)
: basic_url (std::move (s),
host_type (std::move (h)),
std::move (p),
std::move (q),
std::move (f))
{
}
template <typename S, typename T>
inline basic_url<S, T>::
basic_url (scheme_type s,
string_type h,
std::uint16_t o,
optional<path_type> p,
optional<string_type> q,
optional<string_type> f)
: basic_url (std::move (s),
host_type (std::move (h)),
o,
std::move (p),
std::move (q),
std::move (f))
{
}
template <typename S, typename T>
inline basic_url<S, T>::
basic_url (scheme_type s,
optional<path_type> p,
optional<string_type> q,
optional<string_type> f)
: scheme (std::move (s)),
path (std::move (p)),
query (std::move (q)),
fragment (std::move (f)),
rootless (true)
{
}
}
|