Url.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/network/Url.hpp"

Url

Class holding URL information.

namespace oatpp { namespace network { 
  class Url {}
}}

Typedefs

Type Name Summary
oatpp::data::share::StringKeyLabel StringKeyLabel Convenience typedef for oatpp::data::share::StringKeyLabel.
std::unordered_map<oatpp::String, oatpp::String> Parameters Parameters - map string to string.
std::unordered_map<StringKeyLabel, StringKeyLabel> ParametersAsLabels Parameters as oatpp::data::share::StringKeyLabel. Advantage of oatpp::data::share::StringKeyLabel - is that there is no memory allocations needed to create "Memory Label".

Fields

Type Name Summary
oatpp::String scheme Url scheme. Ex.: [http, https, ftp, etc.]
Authority authority Utl authority.
oatpp::String path Path to resource.
Parameters queryParams Query params.

Url::StringKeyLabel

Convenience typedef for oatpp::data::share::StringKeyLabel.

typedef oatpp::data::share::StringKeyLabel StringKeyLabel

Url::Parameters

Parameters - map string to string.

typedef std::unordered_map<oatpp::String, oatpp::String> Parameters

Url::ParametersAsLabels

Parameters as oatpp::data::share::StringKeyLabel. Advantage of oatpp::data::share::StringKeyLabel - is that there is no memory allocations needed to create "Memory Label".

typedef std::unordered_map<StringKeyLabel, StringKeyLabel> ParametersAsLabels

Url::scheme

Url scheme. Ex.: [http, https, ftp, etc.]

oatpp::String scheme

Url::authority

Utl authority.

Authority authority

Url::path

Path to resource.

oatpp::String path

Url::queryParams

Query params.

Parameters queryParams

Url::Authority

Structure representing URL Authority information.

namespace oatpp { namespace network { 
  class Url {
    struct Authority {}
  };
}}

Fields

Type Name Summary
oatpp::String userInfo User info.
oatpp::String host Host.
v_int32 port Port. Treat -1 as undefined or as default.

Url::Authority::userInfo

User info.

oatpp::String userInfo

Url::Authority::host

Host.

oatpp::String host

Url::Authority::port

Port. Treat -1 as undefined or as default.

v_int32 port = -1

Url::Parser

Url parser.

namespace oatpp { namespace network { 
  class Url {
    class Parser {}
  };
}}

Methods

Return Type Name Summary
oatpp::String parseScheme parse <scheme>:
Url::Authority parseAuthority parse url authority components.
oatpp::String parsePath parse path of the url
void parseQueryParamsToMap Multiple implementations:
  1. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by ParsingCaret
  2. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by str
Url::Parameters parseQueryParams Multiple implementations:
  1. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by ParsingCaret
  2. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by str
ParametersAsLabels labelQueryParams Same as parseQueryParams() but use StringKeyLabel instead of a String.
Url parseUrl Multiple implementations:
  1. Parse Url
  2. Parse Url

Url::Parser::parseScheme

parse <scheme>: example "http", "https", "ftp" returns lowercase string before ':' char caret should be at the first char of the scheme

static oatpp::String parseScheme(oatpp::parser::Caret& caret)

Url::Parser::parseAuthority

parse url authority components. userinfo is not parsed into login and password separately as inclusion of password in userinfo is deprecated and ignored here caret should be at the first char of the authority (not at "//")

static Url::Authority parseAuthority(oatpp::parser::Caret& caret)

Url::Parser::parsePath

parse path of the url caret should be at the first char of the path

static oatpp::String parsePath(oatpp::parser::Caret& caret)

Url::Parser::parseQueryParamsToMap

  1. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by ParsingCaret and put that params to Parameters map
    static void parseQueryParamsToMap(Url::Parameters& params, oatpp::parser::Caret& caret)
    
  2. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by str and put that params to Parameters map
    static void parseQueryParamsToMap(Url::Parameters& params, const oatpp::String& str)
    

Url::Parser::parseQueryParams

  1. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by ParsingCaret
    static Url::Parameters parseQueryParams(oatpp::parser::Caret& caret)
    
  2. parse query params in form of "?<paramName>=<paramValue><paramName>=<paramValue>..." referred by str
    static Url::Parameters parseQueryParams(const oatpp::String& str)
    

Url::Parser::labelQueryParams

Same as parseQueryParams() but use StringKeyLabel instead of a String. Zero allocations. Use this method for better performance.

  • @param str
  • @return std::unordered_map<StringKeyLabel, StringKeyLabel>. See Url::StringKeyLabel.

static ParametersAsLabels labelQueryParams(const oatpp::String& str)

Url::Parser::parseUrl

  1. Parse Url
    • @param caret
    • @return parsed URL structure
    static Url parseUrl(oatpp::parser::Caret& caret)
    
  2. Parse Url
    • @param str
    • @return parsed URL structure
    static Url parseUrl(const oatpp::String& str)