Ada
4.1.1
Fast spec-compliant URL parser
Toggle main menu visibility
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
#include <cstdint>
11
12
namespace
ada
{
13
14
[[nodiscard]]
constexpr
bool
url_components::check_offset_consistency
()
15
const noexcept {
28
// These conditions can be made more strict.
29
if
(
protocol_end
==
url_components::omitted
) {
30
return
false
;
31
}
32
uint32_t index =
protocol_end
;
33
34
if
(
username_end
==
url_components::omitted
) {
35
return
false
;
36
}
37
if
(
username_end
< index) {
38
return
false
;
39
}
40
index =
username_end
;
41
42
if
(
host_start
==
url_components::omitted
) {
43
return
false
;
44
}
45
if
(
host_start
< index) {
46
return
false
;
47
}
48
index =
host_start
;
49
50
if
(
port
!=
url_components::omitted
) {
51
if
(
port
> 0xffff) {
52
return
false
;
53
}
54
uint32_t port_length = helpers::fast_digit_count(
port
) + 1;
55
if
(index + port_length < index) {
56
return
false
;
57
}
58
index += port_length;
59
}
60
61
if
(
pathname_start
==
url_components::omitted
) {
62
return
false
;
63
}
64
if
(
pathname_start
< index) {
65
return
false
;
66
}
67
index =
pathname_start
;
68
69
if
(
search_start
!=
url_components::omitted
) {
70
if
(
search_start
< index) {
71
return
false
;
72
}
73
index =
search_start
;
74
}
75
76
if
(
hash_start
!=
url_components::omitted
) {
77
if
(
hash_start
< index) {
78
return
false
;
79
}
80
}
81
82
return
true
;
83
}
84
85
}
// namespace ada
86
#endif
ada
Definition
identifier.h:7
ada::url_components::pathname_start
uint32_t pathname_start
Definition
url_components.h:72
ada::url_components::hash_start
uint32_t hash_start
Definition
url_components.h:78
ada::url_components::port
uint32_t port
Definition
url_components.h:69
ada::url_components::omitted
static constexpr uint32_t omitted
Definition
url_components.h:44
ada::url_components::check_offset_consistency
constexpr bool check_offset_consistency() const noexcept
Definition
url_components-inl.h:14
ada::url_components::protocol_end
uint32_t protocol_end
Definition
url_components.h:54
ada::url_components::search_start
uint32_t search_start
Definition
url_components.h:75
ada::url_components::username_end
uint32_t username_end
Definition
url_components.h:60
ada::url_components::host_start
uint32_t host_start
Definition
url_components.h:63
url_components.h
Declaration for the URL Components.