AdaUrl

A struct representing a parsed URL, providing methods to access and manipulate URL components. Wraps the functionality of the Ada URL parsing library.

Constructors

this
this(ParseOptions options)

Constructs an AdaUrl instance with the given parsing options.

Destructor

~this
~this()

Destructor that frees the underlying URL resources.

Members

Functions

clearHash
void clearHash()

Clears the hash (fragment) component of the URL.

clearPort
void clearPort()

Clears the port component of the URL.

clearSearch
void clearSearch()

Clears the search (query) component of the URL.

copy
ada_url copy()

Creates a copy of the URL.

getComponents
const(ada_url_components)* getComponents()

Retrieves the URL components (e.g., offsets for protocol, host, etc.).

getHash
string getHash()

Retrieves the hash (fragment) component of the URL.

getHost
string getHost()

Retrieves the host component of the URL (hostname + port).

getHostType
ubyte getHostType()

Retrieves the host type of the URL.

getHostname
string getHostname()

Retrieves the hostname component of the URL.

getHref
string getHref()

Retrieves the full URL as a string (href).

getOrigin
string getOrigin()

Retrieves the origin of the URL (e.g., protocol + host + port).

getPassword
string getPassword()

Retrieves the password component of the URL.

getPathname
string getPathname()

Retrieves the pathname component of the URL.

getPort
string getPort()

Retrieves the port component of the URL.

getProtocol
string getProtocol()

Retrieves the protocol component of the URL (e.g., "http:").

getSchemeType
ubyte getSchemeType()

Retrieves the scheme type of the URL.

getSearch
SearchParams getSearch()

Retrieves the search (query) parameters of the URL.

getSearchParams
string getSearchParams(SearchParams search)

Converts the search parameters to a string.

getUsername
string getUsername()

Retrieves the username component of the URL.

hasCredentials
bool hasCredentials()

Checks if the URL has credentials (username or password).

hasEmptyHostname
bool hasEmptyHostname()

Checks if the URL has an empty hostname.

hasHash
bool hasHash()

Checks if the URL has a hash (fragment).

hasHostname
bool hasHostname()

Checks if the URL has a hostname.

hasNonEmptyPassword
bool hasNonEmptyPassword()

Checks if the URL has a non-empty password.

hasNonEmptyUsername
bool hasNonEmptyUsername()

Checks if the URL has a non-empty username.

hasPassword
bool hasPassword()

Checks if the URL has a password.

hasPort
bool hasPort()

Checks if the URL has a port.

hasSearch
bool hasSearch()

Checks if the URL has a search (query) component.

isValid
bool isValid()

Checks if the URL is valid.

setHash
void setHash(string input)

Sets the hash (fragment) component of the URL.

setHost
bool setHost(string input)

Sets the host component of the URL.

setHostname
bool setHostname(string input)

Sets the hostname component of the URL.

setHref
bool setHref(string input)

Sets the full URL (href).

setPassword
bool setPassword(string input)

Sets the password component of the URL.

setPathname
bool setPathname(string input)

Sets the pathname component of the URL.

setPort
bool setPort(string input)

Sets the port component of the URL.

setProtocol
bool setProtocol(string input)

Sets the protocol component of the URL.

setSearch
void setSearch(string input)

Sets the search (query) component of the URL.

setUsername
bool setUsername(string input)

Sets the username component of the URL.

Meta