Ada 2.9.2
Fast spec-compliant URL parser
|
URL Component representations using offsets. More...
#include <url_components.h>
Public Member Functions | |
url_components ()=default | |
url_components (const url_components &u)=default | |
url_components (url_components &&u) noexcept=default | |
url_components & | operator= (url_components &&u) noexcept=default |
url_components & | operator= (const url_components &u)=default |
~url_components ()=default | |
constexpr bool | check_offset_consistency () const noexcept |
std::string | to_string () const |
Public Attributes | |
uint32_t | protocol_end {0} |
uint32_t | username_end {0} |
uint32_t | host_start {0} |
uint32_t | host_end {0} |
uint32_t | port {omitted} |
uint32_t | pathname_start {0} |
uint32_t | search_start {omitted} |
uint32_t | hash_start {omitted} |
Static Public Attributes | |
static constexpr uint32_t | omitted = uint32_t(-1) |
URL Component representations using offsets.
We design the url_components struct so that it is as small and simple as possible. This version uses 32 bytes.
This struct is used to extract components from a single 'href'.
Definition at line 23 of file url_components.h.
|
default |
|
default |
|
defaultnoexcept |
|
default |
|
nodiscardconstexprnoexcept |
Check the following conditions: protocol_end < username_end < ... < hash_start, expect when a value is omitted. It also computes a lower bound on the possible string length that may match these offsets.
https://user:[email protected]:1234/foo/bar?baz#quux | | | | ^^^^| | | | | | | | | | ----- hash_start | | | | | |
------— search_start | | | | | ----------------- pathname_start | | | |
------------------— port | | | ----------------------- host_end | |
-------------------------------— host_start | --------------------------------------- username_end
------------------------------------------— protocol_end
Definition at line 12 of file url_components-inl.h.
References hash_start, host_start, omitted, pathname_start, port, protocol_end, search_start, and username_end.
Referenced by ada::url_aggregator::validate().
|
default |
|
defaultnoexcept |
|
nodiscard |
Converts a url_components to JSON stringified version.
Definition at line 10 of file url_components.cpp.
References hash_start, host_end, host_start, pathname_start, port, protocol_end, search_start, and username_end.
Referenced by ada::url_aggregator::clear_hash(), and ada::url_aggregator::clear_search().
uint32_t ada::url_components::hash_start {omitted} |
Definition at line 59 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::clear_hash(), ada::url_aggregator::clear_port(), ada::url_aggregator::clear_search(), ada::url_aggregator::get_hash(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_search(), ada::url_aggregator::has_hash(), ada::url_aggregator::set_hash(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().
uint32_t ada::url_components::host_end {0} |
Definition at line 55 of file url_components.h.
Referenced by ada::url_aggregator::clear_port(), ada::url_aggregator::get_host(), ada::url_aggregator::get_hostname(), ada::url_aggregator::get_port(), ada::url_aggregator::has_empty_hostname(), ada::url_aggregator::has_port(), ada::url_aggregator::has_valid_domain(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().
uint32_t ada::url_components::host_start {0} |
Definition at line 54 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::get_host(), ada::url_aggregator::get_hostname(), ada::url_aggregator::get_password(), ada::url_aggregator::has_empty_hostname(), ada::url_aggregator::has_non_empty_password(), ada::url_aggregator::has_password(), ada::url_aggregator::has_valid_domain(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().
|
staticconstexpr |
Definition at line 24 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::clear_hash(), ada::url_aggregator::clear_port(), ada::url_aggregator::clear_search(), ada::url_aggregator::get_hash(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_port(), ada::url_aggregator::get_search(), ada::url_aggregator::has_hash(), ada::url_aggregator::has_search(), ada::url_aggregator::set_hash(), ada::url_aggregator::to_diagram(), ada::url_aggregator::to_string(), and ada::url_aggregator::validate().
uint32_t ada::url_components::pathname_start {0} |
Definition at line 57 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::clear_port(), ada::url_aggregator::get_host(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_port(), ada::url_aggregator::has_port(), ada::url_aggregator::set_pathname(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().
uint32_t ada::url_components::port {omitted} |
Definition at line 56 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::clear_port(), ada::url_aggregator::get_port(), ada::url_aggregator::set_port(), and to_string().
uint32_t ada::url_components::protocol_end {0} |
Definition at line 48 of file url_components.h.
Referenced by check_offset_consistency(), ada::url::get_components(), ada::url_aggregator::get_protocol(), ada::url_aggregator::get_username(), ada::url_aggregator::has_non_empty_username(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().
uint32_t ada::url_components::search_start {omitted} |
Definition at line 58 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::clear_port(), ada::url_aggregator::clear_search(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_search(), ada::url_aggregator::has_search(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().
uint32_t ada::url_components::username_end {0} |
Username end is not omitted
by default to make username and password getters less costly to implement.
Definition at line 53 of file url_components.h.
Referenced by check_offset_consistency(), ada::url_aggregator::get_password(), ada::url_aggregator::get_username(), ada::url_aggregator::has_empty_hostname(), ada::url_aggregator::has_non_empty_password(), ada::url_aggregator::has_non_empty_username(), ada::url_aggregator::has_password(), ada::url_aggregator::to_diagram(), to_string(), and ada::url_aggregator::validate().