C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
|
Builder for constructing URIs incrementally. More...
#include <uri_builder.h>
Public Member Functions | |
uri_builder () | |
Creates a builder with an initially empty URI. More... | |
uri_builder (const uri &uri_str) | |
Creates a builder with a existing URI object. More... | |
const utility::string_t & | scheme () const |
Get the scheme component of the URI as an encoded string. More... | |
const utility::string_t & | user_info () const |
Get the user information component of the URI as an encoded string. More... | |
const utility::string_t & | host () const |
Get the host component of the URI as an encoded string. More... | |
int | port () const |
Get the port component of the URI. Returns -1 if no port is specified. More... | |
const utility::string_t & | path () const |
Get the path component of the URI as an encoded string. More... | |
const utility::string_t & | query () const |
Get the query component of the URI as an encoded string. More... | |
const utility::string_t & | fragment () const |
Get the fragment component of the URI as an encoded string. More... | |
uri_builder & | set_scheme (const utility::string_t &scheme) |
Set the scheme of the URI. More... | |
uri_builder & | set_user_info (const utility::string_t &user_info, bool do_encoding=false) |
Set the user info component of the URI. More... | |
uri_builder & | set_host (const utility::string_t &host, bool do_encoding=false) |
Set the host component of the URI. More... | |
uri_builder & | set_port (int port) |
Set the port component of the URI. More... | |
uri_builder & | set_port (const utility::string_t &port) |
Set the port component of the URI. More... | |
uri_builder & | set_path (const utility::string_t &path, bool do_encoding=false) |
Set the path component of the URI. More... | |
uri_builder & | set_query (const utility::string_t &query, bool do_encoding=false) |
Set the query component of the URI. More... | |
uri_builder & | set_fragment (const utility::string_t &fragment, bool do_encoding=false) |
Set the fragment component of the URI. More... | |
void | clear () |
Clears all components of the underlying URI in this uri_builder. More... | |
_ASYNCRTIMP uri_builder & | append_path (const utility::string_t &path, bool do_encoding=false) |
Appends another path to the path of this uri_builder. More... | |
_ASYNCRTIMP uri_builder & | append_query (const utility::string_t &query, bool do_encoding=false) |
Appends another query to the query of this uri_builder. More... | |
_ASYNCRTIMP uri_builder & | append (const uri &relative_uri) |
Appends an relative uri (Path, Query and fragment) at the end of the current uri. More... | |
template<typename T > | |
uri_builder & | append_query (const utility::string_t &name, const T &value, bool do_encoding=true) |
Appends another query to the query of this uri_builder, encoding it first. This overload is useful when building a query segment of the form "element=10", where the right hand side of the query is stored as a type other than a string, for instance, an integral type. More... | |
_ASYNCRTIMP utility::string_t | to_string () |
Combine and validate the URI components into a encoded string. An exception will be thrown if the URI is invalid. More... | |
_ASYNCRTIMP uri | to_uri () |
Combine and validate the URI components into a URI class instance. An exception will be thrown if the URI is invalid. More... | |
_ASYNCRTIMP bool | is_valid () |
Validate the generated URI from all existing components of this uri_builder. More... | |
Builder for constructing URIs incrementally.
|
inline |
Creates a builder with an initially empty URI.
|
inline |
Creates a builder with a existing URI object.
uri_str | Encoded string containing the URI. |
_ASYNCRTIMP uri_builder& web::uri_builder::append | ( | const uri & | relative_uri | ) |
Appends an relative uri (Path, Query and fragment) at the end of the current uri.
relative_uri | The relative uri to append. |
_ASYNCRTIMP uri_builder& web::uri_builder::append_path | ( | const utility::string_t & | path, |
bool | do_encoding = false |
||
) |
Appends another path to the path of this uri_builder.
path | Path to append as a already encoded string. |
do_encoding | Specify whether to apply URI encoding to the given string. |
_ASYNCRTIMP uri_builder& web::uri_builder::append_query | ( | const utility::string_t & | query, |
bool | do_encoding = false |
||
) |
Appends another query to the query of this uri_builder.
query | Query to append as a decoded string. |
do_encoding | Specify whether to apply URI encoding to the given string. |
|
inline |
Appends another query to the query of this uri_builder, encoding it first. This overload is useful when building a query segment of the form "element=10", where the right hand side of the query is stored as a type other than a string, for instance, an integral type.
name | The name portion of the query string |
value | The value portion of the query string |
|
inline |
Clears all components of the underlying URI in this uri_builder.
|
inline |
Get the fragment component of the URI as an encoded string.
|
inline |
Get the host component of the URI as an encoded string.
_ASYNCRTIMP bool web::uri_builder::is_valid | ( | ) |
Validate the generated URI from all existing components of this uri_builder.
|
inline |
Get the path component of the URI as an encoded string.
|
inline |
Get the port component of the URI. Returns -1 if no port is specified.
|
inline |
Get the query component of the URI as an encoded string.
|
inline |
Get the scheme component of the URI as an encoded string.
|
inline |
Set the fragment component of the URI.
fragment | Fragment as a decoded string. |
do_encoding | Specify whether to apply URI encoding to the given string. |
uri_builder
to support chaining.
|
inline |
Set the host component of the URI.
host | Host as a decoded string. |
do_encoding | Specify whether to apply URI encoding to the given string. |
uri_builder
to support chaining.
|
inline |
Set the path component of the URI.
path | Path as a decoded string. |
do_encoding | Specify whether to apply URI encoding to the given string. |
uri_builder
to support chaining.
|
inline |
Set the port component of the URI.
port | Port as an integer. |
uri_builder
to support chaining.
|
inline |
Set the port component of the URI.
port | Port as a string. |
uri_builder
to support chaining.When string can't be converted to an integer the port is left unchanged.
|
inline |
Set the query component of the URI.
query | Query as a decoded string. |
do_encoding | Specify whether apply URI encoding to the given string. |
uri_builder
to support chaining.
|
inline |
Set the scheme of the URI.
scheme | Uri scheme. |
uri_builder
to support chaining.
|
inline |
Set the user info component of the URI.
user_info | User info as a decoded string. |
do_encoding | Specify whether to apply URI encoding to the given string. |
uri_builder
to support chaining._ASYNCRTIMP utility::string_t web::uri_builder::to_string | ( | ) |
Combine and validate the URI components into a encoded string. An exception will be thrown if the URI is invalid.
_ASYNCRTIMP uri web::uri_builder::to_uri | ( | ) |
Combine and validate the URI components into a URI class instance. An exception will be thrown if the URI is invalid.
|
inline |
Get the user information component of the URI as an encoded string.