Ada
3.1.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
url_components-inl.h
Go to the documentation of this file.
1
5
#ifndef ADA_URL_COMPONENTS_INL_H
6
#define ADA_URL_COMPONENTS_INL_H
7
8
#include "
ada/url_components.h
"
9
10
namespace
ada
{
11
12
[[nodiscard]]
constexpr
bool
url_components::check_offset_consistency
()
13
const noexcept {
26
// These conditions can be made more strict.
27
if
(
protocol_end
==
url_components::omitted
) {
28
return
false
;
29
}
30
uint32_t index =
protocol_end
;
31
32
if
(
username_end
==
url_components::omitted
) {
33
return
false
;
34
}
35
if
(
username_end
< index) {
36
return
false
;
37
}
38
index =
username_end
;
39
40
if
(
host_start
==
url_components::omitted
) {
41
return
false
;
42
}
43
if
(
host_start
< index) {
44
return
false
;
45
}
46
index =
host_start
;
47
48
if
(
port
!=
url_components::omitted
) {
49
if
(
port
> 0xffff) {
50
return
false
;
51
}
52
uint32_t port_length = helpers::fast_digit_count(
port
) + 1;
53
if
(index + port_length < index) {
54
return
false
;
55
}
56
index += port_length;
57
}
58
59
if
(
pathname_start
==
url_components::omitted
) {
60
return
false
;
61
}
62
if
(
pathname_start
< index) {
63
return
false
;
64
}
65
index =
pathname_start
;
66
67
if
(
search_start
!=
url_components::omitted
) {
68
if
(
search_start
< index) {
69
return
false
;
70
}
71
index =
search_start
;
72
}
73
74
if
(
hash_start
!=
url_components::omitted
) {
75
if
(
hash_start
< index) {
76
return
false
;
77
}
78
}
79
80
return
true
;
81
}
82
83
}
// namespace ada
84
#endif
ada
Definition
ada_idna.h:13
ada::url_components::pathname_start
uint32_t pathname_start
Definition
url_components.h:52
ada::url_components::hash_start
uint32_t hash_start
Definition
url_components.h:54
ada::url_components::port
uint32_t port
Definition
url_components.h:51
ada::url_components::omitted
static constexpr uint32_t omitted
Definition
url_components.h:19
ada::url_components::check_offset_consistency
constexpr bool check_offset_consistency() const noexcept
Definition
url_components-inl.h:12
ada::url_components::protocol_end
uint32_t protocol_end
Definition
url_components.h:43
ada::url_components::search_start
uint32_t search_start
Definition
url_components.h:53
ada::url_components::username_end
uint32_t username_end
Definition
url_components.h:48
ada::url_components::host_start
uint32_t host_start
Definition
url_components.h:49
url_components.h
Declaration for the URL Components.