211 explicit operator bool()
const {
return is_valid(); }
#define UExport
Definition Exports.h:22
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:31
size_t Hash() const
Hash function.
Parsed web address.
Definition URL.h:104
bool has_port() const
Whether or not the URL carries an explicit port.
unsigned short port() const
Get the explicit port number (0 when has_port() is false).
URL()
Create an empty, invalid URL.
void clear_port()
Remove the explicit port, if any.
bool operator==(const String &other) const
Compare the canonical serialization against a raw string.
String host() const
Get the host, without the port (eg, "example.com"; "" if invalid or hostless).
void set_username(const String &username)
Set the username portion of the URL's credentials (percent-encoded as needed).
bool operator<(const URL &other) const
Lexicographic ordering over the canonical serialization (for ordered containers).
bool has_query_parameter(const String &key) const
Whether or not the query contains a parameter with the given key (form-decoded match).
static String DecodeComponent(const String &encoded)
Decode a percent-encoded URL component.
String origin() const
Get the origin serialization, like JavaScript's URL.origin.
void set_password(const String &password)
Set the password portion of the URL's credentials (percent-encoded as needed).
bool operator!=(const String &other) const
Inequality against a raw string (see the equality operator taking a String).
void set_port(unsigned short port)
Set an explicit port.
friend bool operator==(const String &lhs, const URL &rhs)
Equality with the string on the left-hand side.
Definition URL.h:442
friend bool operator!=(const String &lhs, const URL &rhs)
Inequality with the string on the left-hand side.
Definition URL.h:447
bool empty() const
Whether or not this URL is empty (equivalent to !is_valid()).
String password() const
Get the password portion of the URL's credentials, percent-decoded ("" if none).
static String EncodeComponent(const String &component)
Percent-encode a string for safe embedding inside a URL component.
String query() const
Get the query string, without the leading '?
String ToFilePath() const
Get the native file-system path for a file: URL.
URL(const URL &base, const String &relative)
Resolve a (possibly relative) reference against a base URL.
String path() const
Get the path (eg, "/a/b"; "" if invalid).
void set_query(const String &query)
Set the raw query string (without the leading '?
bool is_valid() const
Whether or not this URL parsed successfully.
void set_path(const String &path)
Set the path.
bool operator==(const URL &other) const
Equality over the canonical serialization.
void set_fragment(const String &fragment)
Set the fragment (without the leading '#').
void AppendQueryParameter(const String &key, const String &value)
Append a key-value pair to the query, form-encoding both.
bool operator!=(const URL &other) const
Inequality over the canonical serialization.
bool set_scheme(const String &scheme)
Set the scheme.
String username() const
Get the username portion of the URL's credentials, percent-decoded ("" if none).
URL(const URL &other)
Copy constructor.
String scheme() const
Get the scheme, lowercased, without the trailing colon (eg, "https"; "" if invalid).
String host_with_port() const
Get the host with the explicit port appended, if one is present (eg, "example.com:8080").
String fragment() const
Get the fragment, without the leading '#' ("" if none).
static URL FromFilePath(const String &file_path)
Create a file: URL from a native file-system path.
String str() const
Get the canonical serialization of the whole URL ("" if invalid).
URL(const String &url_string)
Parse a string as an absolute URL (WHATWG-standard parsing).
void set_host(const String &host)
Set the host (without port).
URL & operator=(URL &&other)
Move assignment operator.
URL & operator=(const URL &other)
Assignment operator.
URL(URL &&other)
Move constructor.
URL Resolve(const String &relative) const
Resolve a relative or absolute reference against this URL (same as the two-argument constructor).
String query_parameter(const String &key) const
Get the first query-parameter value for the given key, form-decoded ("" if absent).
Definition StringSTL.h:166
Root namespace for every public Ultralight type, function, and enumeration.
size_t operator()(const ultralight::URL &url) const
Definition URL.h:462