Represents a URL. More...
#include <urlparser.h>
Collaboration diagram for TLD::Url:Public Member Functions | |
| Url () noexcept=default | |
| Default constructor for the Url class. Creates an empty URL object. | |
| Url (const std::string &url, const bool ignore_www=DEFAULT_IGNORE_WWW) | |
| Construct a Url object from a given URL string. | |
| std::string | abspath () const noexcept |
| Get the absolute path of the URL. | |
| const std::string & | domain () const noexcept |
| Get the domain of the URL. | |
| std::string | domainName () const noexcept |
| Get the domain name of the URL. | |
| const std::string & | fragment () const noexcept |
| Get the fragment part of the URL. | |
| const std::string & | fulldomain () const noexcept |
| Get the full domain of the URL. | |
| const Host & | host () const |
| Get the host object of the URL. | |
| bool | operator== (const Url &other) const |
| Equality operator for comparing two Url objects. | |
| QueryParams | params () const noexcept |
| Get the parameters of the URL. | |
| const int | port () const noexcept |
| Get the port of the URL. | |
| const std::string & | protocol () const noexcept |
| Get the protocol of the URL. | |
| const std::string & | query () const noexcept |
| Get the query part of the URL. | |
| std::string | str () const noexcept |
| Get the complete URL as a string. | |
| const std::string & | subdomain () const noexcept |
| Get the subdomain of the URL. | |
| const std::string & | suffix () const noexcept |
| Get the suffix of the URL. | |
| const std::string & | userinfo () const noexcept |
| Get the userinfo part of the URL. | |
Static Public Member Functions | |
| static std::string | extractHost (const std::string &url) noexcept |
| Extract the host from a given URL. | |
| static bool | isPslLoaded () noexcept |
| Check if the Public Suffix List (PSL) is loaded. | |
Represents a URL.
The Url class provides functionalities for parsing and managing URLs. It allows access to various components of a URL such as protocol, subdomain, domain, suffix, query, fragment, userinfo, port, and parameters.
| TLD::Url::Url | ( | const std::string & | url, |
| const bool | ignore_www = DEFAULT_IGNORE_WWW |
||
| ) |
Construct a Url object from a given URL string.
| url | The URL string to parse. |
| ignore_www | Whether to ignore the "www" subdomain. Default is false. |
| std::invalid_argument | If the URL is malformed or cannot be parsed. |
|
defaultnoexcept |
Default constructor for the Url class. Creates an empty URL object.
|
noexcept |
Get the absolute path of the URL.
|
noexcept |
Get the domain of the URL.
|
noexcept |
Get the domain name of the URL.
|
staticnoexcept |
Extract the host from a given URL.
| url | The URL from which to extract the host. |
|
noexcept |
Get the fragment part of the URL.
|
noexcept |
Get the full domain of the URL.
| const Host & TLD::Url::host | ( | ) | const |
Get the host object of the URL.
|
staticnoexcept |
Check if the Public Suffix List (PSL) is loaded.
| bool TLD::Url::operator== | ( | const Url & | other | ) | const |
|
noexcept |
Get the parameters of the URL.
|
noexcept |
Get the port of the URL.
|
noexcept |
Get the protocol of the URL.
|
noexcept |
Get the query part of the URL.
|
noexcept |
Get the complete URL as a string.
|
noexcept |
Get the subdomain of the URL.
|
noexcept |
Get the suffix of the URL.
|
noexcept |
Get the userinfo part of the URL.