|
Ada 3.4.0
Fast spec-compliant URL parser
|
Abstract base class for URL representations. More...
#include <url_base.h>
Public Member Functions | |
| virtual | ~url_base ()=default |
| ada_really_inline constexpr bool | is_special () const noexcept |
| virtual std::string | get_origin () const noexcept=0 |
| virtual bool | has_valid_domain () const noexcept=0 |
| virtual std::string | to_string () const =0 |
Public Attributes | |
| bool | is_valid {true} |
| bool | has_opaque_path {false} |
| url_host_type | host_type = url_host_type::DEFAULT |
Abstract base class for URL representations.
The url_base class provides the common interface and state shared by both ada::url and ada::url_aggregator. It contains basic URL attributes like validity status and scheme type, but delegates component storage and access to derived classes.
ada::url or ada::url_aggregator instead.Definition at line 49 of file url_base.h.
|
virtualdefault |
|
nodiscardpure virtualnoexcept |
Returns the URL's origin (scheme + host + port for special URLs).
Implemented in ada::url, and ada::url_aggregator.
References get_origin().
Referenced by get_origin().
|
nodiscardpure virtualnoexcept |
Validates whether the hostname is a valid domain according to RFC 1034. Checks that the domain and its labels have valid lengths.
true if the domain is valid, false otherwise. Implemented in ada::url, and ada::url_aggregator.
References ada_really_inline, and has_valid_domain().
Referenced by has_valid_domain().
|
nodiscardconstexprnoexcept |
Checks if the URL has a special scheme (http, https, ws, wss, ftp, file). Special schemes have specific parsing rules and default ports.
true if the scheme is special, false otherwise. Definition at line 19 of file url_base-inl.h.
References ada_really_inline, and ada::scheme::NOT_SPECIAL.
Referenced by ada::url::get_origin(), ada::url_aggregator::get_origin(), ada::url::get_protocol(), ada::parser::parse_url_impl(), ada::url::set_search(), and ada::url_aggregator::set_search().
|
nodiscardpure virtual |
Returns a JSON string representation of this URL for debugging.
Implemented in ada::url, and ada::url_aggregator.
| bool ada::url_base::has_opaque_path {false} |
Indicates whether the URL has an opaque path (non-hierarchical). Opaque paths occur in non-special URLs like mailto: or javascript:.
Definition at line 62 of file url_base.h.
Referenced by ada::url::get_components(), ada::url::get_href(), ada::parser::parse_url_impl(), ada::url::set_pathname(), ada::url_aggregator::set_pathname(), ada::url::to_string(), ada::url_aggregator::to_string(), and ada::url_aggregator::validate().
| url_host_type ada::url_base::host_type = url_host_type::DEFAULT |
The type of the URL's host (domain, IPv4, or IPv6).
Definition at line 67 of file url_base.h.
| bool ada::url_base::is_valid {true} |
Indicates whether the URL was successfully parsed. Set to false if parsing failed (e.g., invalid URL syntax).
Definition at line 56 of file url_base.h.
Referenced by ada::can_parse(), ada::parser::parse_url_impl(), ada::url::set_port(), ada::url_aggregator::set_port(), ada::url_aggregator::to_diagram(), ada::url::to_string(), ada::url_aggregator::to_string(), and ada::url_aggregator::validate().