olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
olp::utils::Url Class Reference

Builds and parses URLs. More...

#include <Url.h>

Public Types

using HostAndRest = std::pair< std::string, std::string >
 Represents the host part and rest of full URL.
 

Static Public Member Functions

static std::string Decode (const std::string &in)
 Decodes a URL on a given input string by replacing percent-encoded characters with actual ones.
 
static std::string Encode (const std::string &in)
 Encodes a given input string by escaping non-ASCII characters.
 
static std::string Construct (const std::string &base, const std::string &path, const std::multimap< std::string, std::string > &query_params)
 Produces a full URL from a URL base, path, and query parameters.
 
static porting::optional< HostAndRestParseHostAndRest (const std::string &url)
 Separates full URL to the host part the rest. Helps to split URL from credentials to parts passed to the OlpClient and NetworkRequest.
 

Detailed Description

Builds and parses URLs.

Member Function Documentation

◆ Construct()

static std::string olp::utils::Url::Construct ( const std::string &  base,
const std::string &  path,
const std::multimap< std::string, std::string > &  query_params 
)
static

Produces a full URL from a URL base, path, and query parameters.

Parameters
baseThe base of the URL.
pathThe path part of the URL.
query_paramsThe multimap of query parameters.
Returns
The URL-encoded result string.

◆ Decode()

static std::string olp::utils::Url::Decode ( const std::string &  in)
static

Decodes a URL on a given input string by replacing percent-encoded characters with actual ones.

Parameters
inThe URL-encoded string.
Returns
The URL-decoded result string.

◆ Encode()

static std::string olp::utils::Url::Encode ( const std::string &  in)
static

Encodes a given input string by escaping non-ASCII characters.

Parameters
inThe URL string to be encoded.
Returns
The URL-encoded result string.

◆ ParseHostAndRest()

static porting::optional< HostAndRest > olp::utils::Url::ParseHostAndRest ( const std::string &  url)
static

Separates full URL to the host part the rest. Helps to split URL from credentials to parts passed to the OlpClient and NetworkRequest.

Parameters
urlFull URL.
Returns
An optional pair representing host part and the rest of URL. Returns olp::porting::none when url cannot be split.

The documentation for this class was generated from the following file: