Loading...
Searching...
No Matches
url_components-inl.h
Go to the documentation of this file.
#ifndef ADA_URL_COMPONENTS_INL_H
#define ADA_URL_COMPONENTS_INL_H
#include "ada/url_components.h"
namespace ada {
[[nodiscard]] constexpr bool url_components::check_offset_consistency()
const noexcept {
// These conditions can be made more strict.
if (protocol_end == url_components::omitted) {
return false;
}
uint32_t index = protocol_end;
if (username_end == url_components::omitted) {
return false;
}
if (username_end < index) {
return false;
}
index = username_end;
if (host_start == url_components::omitted) {
return false;
}
if (host_start < index) {
return false;
}
index = host_start;
if (port != url_components::omitted) {
if (port > 0xffff) {
return false;
}
uint32_t port_length = helpers::fast_digit_count(port) + 1;
if (index + port_length < index) {
return false;
}
index += port_length;
}
if (pathname_start == url_components::omitted) {
return false;
}
if (pathname_start < index) {
return false;
}
index = pathname_start;
if (search_start != url_components::omitted) {
if (search_start < index) {
return false;
}
index = search_start;
}
if (hash_start != url_components::omitted) {
if (hash_start < index) {
return false;
}
}
return true;
}
} // namespace ada
#endif
ada
Definition ada_idna.h:13
ada::url_components::pathname_start
uint32_t pathname_start
Definition url_components.h:69
ada::url_components::hash_start
uint32_t hash_start
Definition url_components.h:75
ada::url_components::port
uint32_t port
Definition url_components.h:66
ada::url_components::omitted
static constexpr uint32_t omitted
Definition url_components.h:41
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:51
ada::url_components::search_start
uint32_t search_start
Definition url_components.h:72
ada::url_components::username_end
uint32_t username_end
Definition url_components.h:57
ada::url_components::host_start
uint32_t host_start
Definition url_components.h:60
url_components.h
Declaration for the URL Components.