Represents the location where a request will be performed.
More...
#include <url.hpp>
|
| | Url ()=default |
| | Constructs a new, empty URL object.
|
| |
| | Url (const std::string &encodedUrl) |
| | Constructs a URL from a URL-encoded string.
|
| |
| void | SetScheme (const std::string &scheme) |
| | Sets URL scheme.
|
| |
| void | SetHost (const std::string &encodedHost) |
| | Sets URL host.
|
| |
| void | SetPort (uint16_t port) |
| | Sets URL port.
|
| |
| void | SetPath (const std::string &encodedPath) |
| | Sets URL path.
|
| |
| void | SetQueryParameters (std::map< std::string, std::string > queryParameters) |
| | Sets the query parameters from an existing query parameter map.
|
| |
| void | AppendPath (const std::string &encodedPath) |
| | Appends an element of URL path.
|
| |
| 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.
|
| |
| void | RemoveQueryParameter (const std::string &encodedKey) |
| | Removes an existing query parameter.
|
| |
| const std::string & | GetHost () const |
| | Gets URL host.
|
| |
| const std::string & | GetPath () const |
| | Gets the URL path.
|
| |
| uint16_t | GetPort () const |
| | Gets the port number set for the URL.
|
| |
| std::map< std::string, std::string > | GetQueryParameters () const |
| | Gets a copy of the list of query parameters from the URL.
|
| |
| const std::string & | GetScheme () const |
| | Gets the URL scheme.
|
| |
| std::string | GetRelativeUrl () const |
| | Gets the path and query parameters.
|
| |
| std::string | GetAbsoluteUrl () const |
| | Gets Scheme, host, path and query parameters.
|
| |
|
| static std::string | Decode (const std::string &value) |
| | Decodes value by transforming all escaped characters to it's non-encoded value.
|
| |
| 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.
|
| |
It can be parsed and initialized from a string that contains all URL components (scheme, host, path, etc.). Authority is not currently supported.
◆ Url() [1/2]
| Azure::Core::Url::Url |
( |
| ) |
|
|
default |
◆ Url() [2/2]
| Azure::Core::Url::Url |
( |
const std::string & |
encodedUrl | ) |
|
|
explicit |
- Parameters
-
| encodedUrl | A URL-encoded string. |
- Note
- encodedUrl is expected to have all parts URL-encoded.
◆ AppendPath()
| void Azure::Core::Url::AppendPath |
( |
const std::string & |
encodedPath | ) |
|
|
inline |
- Parameters
-
| encodedPath | URL path element to append, already encoded. |
◆ AppendQueryParameter()
| void Azure::Core::Url::AppendQueryParameter |
( |
const std::string & |
encodedKey, |
|
|
const std::string & |
encodedValue |
|
) |
| |
|
inline |
- Note
- Overrides the value of existing query parameters.
- Parameters
-
| encodedKey | Name of the query parameter, already encoded. |
| encodedValue | Value of the query parameter, already encoded. |
◆ Decode()
| static std::string Azure::Core::Url::Decode |
( |
const std::string & |
value | ) |
|
|
static |
- Parameters
-
- Returns
std::string with non-URL encoded values.
◆ Encode()
| static std::string Azure::Core::Url::Encode |
( |
const std::string & |
value, |
|
|
const std::string & |
doNotEncodeSymbols = "" |
|
) |
| |
|
static |
- Note
doNotEncodeSymbols arg can be used to explicitly ask this function to skip characters from encoding. For instance, using this = - input would prevent encoding =, and -.
- Parameters
-
| value | Non URL-encoded string. |
| doNotEncodeSymbols | A string consisting of characters that do not need to be encoded. |
- Returns
- std::string
◆ GetAbsoluteUrl()
| std::string Azure::Core::Url::GetAbsoluteUrl |
( |
| ) |
const |
- Returns
- Absolute URL with URL-encoded query parameters.
◆ GetHost()
| const std::string & Azure::Core::Url::GetHost |
( |
| ) |
const |
|
inline |
◆ GetPath()
| const std::string & Azure::Core::Url::GetPath |
( |
| ) |
const |
|
inline |
- Returns
- const std::string&
◆ GetPort()
| uint16_t Azure::Core::Url::GetPort |
( |
| ) |
const |
|
inline |
- Note
- If the port was not set for the URL, the returned port is 0. An HTTP request cannot be performed to port zero, an HTTP client is expected to set the default port depending on the request's schema when the port was not defined in the URL.
- Returns
- The port number from the URL.
◆ GetQueryParameters()
| std::map< std::string, std::string > Azure::Core::Url::GetQueryParameters |
( |
| ) |
const |
|
inline |
- Note
- The query parameters are URL-encoded.
- Returns
- A copy of the query parameters map.
◆ GetRelativeUrl()
| std::string Azure::Core::Url::GetRelativeUrl |
( |
| ) |
const |
- Returns
- Relative URL with URL-encoded query parameters.
◆ GetScheme()
| const std::string & Azure::Core::Url::GetScheme |
( |
| ) |
const |
|
inline |
◆ RemoveQueryParameter()
| void Azure::Core::Url::RemoveQueryParameter |
( |
const std::string & |
encodedKey | ) |
|
|
inline |
- Parameters
-
| encodedKey | The name of the query parameter to be removed. |
◆ SetHost()
| void Azure::Core::Url::SetHost |
( |
const std::string & |
encodedHost | ) |
|
|
inline |
- Parameters
-
| encodedHost | URL host, already encoded. |
◆ SetPath()
| void Azure::Core::Url::SetPath |
( |
const std::string & |
encodedPath | ) |
|
|
inline |
- Parameters
-
| encodedPath | URL path, already encoded. |
◆ SetPort()
| void Azure::Core::Url::SetPort |
( |
uint16_t |
port | ) |
|
|
inline |
◆ SetQueryParameters()
| void Azure::Core::Url::SetQueryParameters |
( |
std::map< std::string, std::string > |
queryParameters | ) |
|
|
inline |
- Note
- Keys and values in
queryParameters are expected to be URL-encoded.
- Parameters
-
| queryParameters | query parameters for request. |
◆ SetScheme()
| void Azure::Core::Url::SetScheme |
( |
const std::string & |
scheme | ) |
|
|
inline |
The documentation for this class was generated from the following file: