|
Represents the location where a request will be performed. More...
#include <url.hpp>
Public Member Functions | |
Url () | |
Constructs a new, empty URL object. More... | |
Url (const std::string &encodedUrl) | |
Constructs a URL from a URL-encoded string. More... | |
void | SetScheme (const std::string &scheme) |
Sets URL scheme. More... | |
void | SetHost (const std::string &encodedHost) |
Sets URL host. More... | |
void | SetPort (uint16_t port) |
Sets URL port. More... | |
void | SetPath (const std::string &encodedPath) |
Sets URL path. More... | |
void | SetQueryParameters (std::map< std::string, std::string > queryParameters) |
Sets the query parameters from an existing query parameter map. More... | |
void | AppendPath (const std::string &encodedPath) |
Appends an element of URL path. More... | |
void | AppendQueryParameter (const std::string &encodedKey, const std::string &encodedValue) |
The value of a query parameter is expected to be non-URL-encoded and, by default, it will be encoded before adding to the URL. Use isValueEncoded = true when the value is already encoded. More... | |
void | RemoveQueryParameter (const std::string &encodedKey) |
Removes an existing query parameter. More... | |
const std::string & | GetHost () const |
Gets URL host. More... | |
const std::string & | GetPath () const |
Gets the URL path. More... | |
uint16_t | GetPort () const |
Gets the port number set for the URL. More... | |
std::map< std::string, std::string > | GetQueryParameters () const |
Gets a copy of the list of query parameters from the URL. More... | |
const std::string & | GetScheme () const |
Gets the URL scheme. More... | |
std::string | GetRelativeUrl () const |
Gets the path and query parameters. More... | |
std::string | GetAbsoluteUrl () const |
Gets Scheme, host, path and query parameters. More... | |
Static Public Member Functions | |
static std::string | Decode (const std::string &value) |
Decodes value by transforming all escaped characters to it's non-encoded value. More... | |
static std::string | Encode (const std::string &value, const std::string &doNotEncodeSymbols="") |
Encodes value by escaping characters to the form of HH where HH are hex digits. More... | |
It can be parsed and initialized from a string that contains all URL components (scheme, host, path, etc.). Authority is not currently supported.
|
inline |
|
explicit |
encodedUrl | A URL-encoded string. |
|
inline |
encodedPath | URL path element to append, already encoded. |
|
inline |
encodedKey | Name of the query parameter, already encoded. |
encodedValue | Value of the query parameter, already encoded. |
|
static |
value | URL-encoded string. |
std::string
with non-URL encoded values.
|
static |
doNotEncodeSymbols
arg can be used to explicitly ask this function to skip characters from encoding. For instance, using this = -
input would prevent encoding =
,
and -
.value | Non URL-encoded string. |
doNotEncodeSymbols | A string consisting of characters that do not need to be encoded. |
std::string Url::GetAbsoluteUrl | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
std::string Url::GetRelativeUrl | ( | ) | const |
|
inline |
|
inline |
encodedKey | The name of the query parameter to be removed. |
|
inline |
encodedHost | URL host, already encoded. |
|
inline |
encodedPath | URL path, already encoded. |
|
inline |
port | URL port. |
|
inline |
queryParameters
are expected to be URL-encoded.queryParameters | query parameters for request. |
|
inline |
scheme | URL scheme. |