Uniform Resource Locator (URL)
More...
#include <base/net/Url.h>
Inherits Object.
Uniform Resource Locator (URL)
Implementation of Uniform Resource Locator (URL) as specified by RFC 1738 and
- A compact string representation for a resource available via the Internet. This class is used to break down a url into its components. The components of the url are stored internally in decoded format.
Url url(
"http://www.google.com")
- Version
- 1.0
- Examples
- testsuite/ftp.cpp, and testsuite/http.cpp.
◆ Url() [1/4]
Initializes an empty url.
◆ Url() [2/4]
Url::Url |
( |
const String & |
url, |
|
|
bool |
strict = true |
|
) |
| |
Initializes url from a string representation.
- Parameters
-
url | The string representation of the url. |
strict | Specifies that unsafe characters are required to be encoded. Default is true. |
◆ Url() [3/4]
Url::Url |
( |
const String & |
relative, |
|
|
const String & |
base, |
|
|
bool |
strict = true |
|
) |
| |
Initializes url from separate string representations of relative and base url.
- Parameters
-
relative | The relative url. |
base | The base url. |
strict | Specifies that unsafe characters are required to be encoded. Default is true. |
◆ Url() [4/4]
Url::Url |
( |
const Url & |
copy | ) |
|
|
noexcept |
Initializes url from other url.
◆ ~Url()
◆ decodeURIComponent()
static String Url::decodeURIComponent |
( |
const String & |
component | ) |
|
|
static |
Returns the decoded URI component.
◆ encodeURIComponent()
static String Url::encodeURIComponent |
( |
const String & |
component | ) |
|
|
static |
Returns the encoded URI component.
◆ getHost()
◆ getPassword()
String Url::getPassword |
( |
| ) |
const |
|
noexcept |
◆ getPath()
virtual String Url::getPath |
( |
| ) |
const |
|
virtual |
◆ getPort()
◆ getScheme()
String Url::getScheme |
( |
| ) |
const |
|
noexcept |
Returns the scheme (a.k.a. protocol).
◆ getUrl()
◆ getUser()
◆ isHost()
static bool Url::isHost |
( |
String::ReadIterator |
i, |
|
|
const String::ReadIterator & |
end |
|
) |
| |
|
staticprotectednoexcept |
Returns true if the string is a valid host specification.
◆ isPort()
static bool Url::isPort |
( |
String::ReadIterator |
i, |
|
|
const String::ReadIterator & |
end |
|
) |
| |
|
staticprotectednoexcept |
Returns true if the string is a valid port.
◆ isRelative()
bool Url::isRelative |
( |
| ) |
const |
|
noexcept |
Returns true if the url is relative.
◆ isReserved()
static bool Url::isReserved |
( |
ucs4 |
ch | ) |
|
|
static |
Returns true if character is reserved per RFC3986.
◆ isUnreserved()
static bool Url::isUnreserved |
( |
ucs4 |
ch | ) |
|
|
static |
Returns true if character is unreserved per RFC3986.
◆ operator=()
Url& Url::operator= |
( |
const Url & |
assign | ) |
|
|
noexcept |
Assignment of url by url.
◆ parse()
void Url::parse |
( |
const String & |
url, |
|
|
bool |
strict |
|
) |
| |
|
protected |
Parses the string as a url.
◆ setHost()
void Url::setHost |
( |
const String & |
value | ) |
|
◆ setPassword()
void Url::setPassword |
( |
const String & |
value | ) |
|
◆ setPath()
virtual void Url::setPath |
( |
const String & |
value | ) |
|
|
virtual |
◆ setPort()
void Url::setPort |
( |
const String & |
value | ) |
|
◆ setScheme()
virtual void Url::setScheme |
( |
const String & |
value | ) |
|
|
virtual |
Sets the scheme (a.k.a. protocol). The scheme is composed of letters ('a'-'z'), digits ('0'-'9'), and the characters plus ('+'), period ('.'), and hyphen ('-'). Upper case letters are also allowed but are converted into lower case. The exception URLException is raised if the set of allowed characters is violated.
◆ setUser()
void Url::setUser |
( |
const String & |
value | ) |
|
◆ validatePassword()
Validates the specified password and returns it.
◆ validateScheme()
Validates the specified scheme and returns a slightly converted scheme to be used.
◆ validateUser()
Validates the specified user and returns it.