Ada 2.7.8
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:pass@example.com: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 */
60
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
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
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