Ada 2.9.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
url_components.h
Go to the documentation of this file.
1
5#ifndef ADA_URL_COMPONENTS_H
6#define ADA_URL_COMPONENTS_H
7
8#include "ada/common_defs.h"
9
10#include <optional>
11#include <string_view>
12
13namespace ada {
14
24 constexpr static uint32_t omitted = uint32_t(-1);
25
26 url_components() = default;
27 url_components(const url_components &u) = default;
28 url_components(url_components &&u) noexcept = default;
29 url_components &operator=(url_components &&u) noexcept = default;
31 ~url_components() = default;
32
33 /*
34 * By using 32-bit integers, we implicitly assume that the URL string
35 * cannot exceed 4 GB.
36 *
37 * https://user:[email protected]:1234/foo/bar?baz#quux
38 * | | | | ^^^^| | |
39 * | | | | | | | `----- hash_start
40 * | | | | | | `--------- search_start
41 * | | | | | `----------------- pathname_start
42 * | | | | `--------------------- port
43 * | | | `----------------------- host_end
44 * | | `---------------------------------- host_start
45 * | `--------------------------------------- username_end
46 * `--------------------------------------------- protocol_end
47 */
48 uint32_t protocol_end{0};
53 uint32_t username_end{0};
54 uint32_t host_start{0};
55 uint32_t host_end{0};
56 uint32_t port{omitted};
57 uint32_t pathname_start{0};
60
70 [[nodiscard]] bool check_offset_consistency() const noexcept;
71
75 [[nodiscard]] std::string to_string() const;
76
77}; // struct url_components
78
79} // namespace ada
80#endif
Common definitions for cross-platform compiler support.
Definition ada_idna.h:13
URL Component representations using offsets.
bool check_offset_consistency() const noexcept
std::string to_string() const
static constexpr uint32_t omitted
url_components & operator=(url_components &&u) noexcept=default
~url_components()=default
url_components()=default
url_components(url_components &&u) noexcept=default
url_components(const url_components &u)=default
url_components & operator=(const url_components &u)=default