13template <
bool overr
ide_hostname>
14bool url::set_host_or_hostname(
const std::string_view
input) {
26 helpers::remove_ascii_tab_or_newline(
_host);
44 if (!buffer.empty()) {
72 if (
location != std::string_view::npos) {
88 if (host.has_value() && host.value() ==
"localhost") {
104 if (cannot_have_credentials_or_port()) {
107 username = ada::unicode::percent_encode(
113 if (cannot_have_credentials_or_port()) {
116 password = ada::unicode::percent_encode(
122 if (cannot_have_credentials_or_port()) {
126 helpers::remove_ascii_tab_or_newline(
trimmed);
132 if (ada::unicode::is_c0_control_or_space(
trimmed.front())) {
136 if (
input.find_first_of(
"0123456789") == std::string_view::npos) {
154 helpers::strip_trailing_spaces_from_opaque_path(*
this);
160 helpers::remove_ascii_tab_or_newline(
new_value);
161 hash = unicode::percent_encode(
new_value,
168 query = std::nullopt;
169 helpers::strip_trailing_spaces_from_opaque_path(*
this);
175 helpers::remove_ascii_tab_or_newline(
new_value);
181 query = ada::unicode::percent_encode(std::string_view(
new_value),
196 helpers::remove_ascii_tab_or_newline(
view);
208 std::string::iterator
pointer =
209 std::find_if_not(
view.begin(),
view.end(), unicode::is_alnum_plus);
222 username =
out->username;
223 password =
out->password;
230 non_special_scheme =
out->non_special_scheme;
234 return out.has_value();
Includes all definitions for Ada.
Definitions for helper functions used within Ada.
constexpr uint8_t QUERY_PERCENT_ENCODE[32]
constexpr uint8_t SPECIAL_QUERY_PERCENT_ENCODE[32]
constexpr uint8_t USERINFO_PERCENT_ENCODE[32]
constexpr uint8_t FRAGMENT_PERCENT_ENCODE[32]
constexpr bool is_alpha(char x) noexcept
tl::expected< result_type, ada::errors > result
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
ada_really_inline bool is_special() const noexcept
void set_hash(std::string_view input)
bool set_hostname(std::string_view input)
bool set_host(std::string_view input)
ada_really_inline bool has_credentials() const noexcept
bool set_password(std::string_view input)
void set_search(std::string_view input)
bool set_href(std::string_view input)
bool set_username(std::string_view input)
bool set_pathname(std::string_view input)
bool set_protocol(std::string_view input)
bool set_port(std::string_view input)