102 #include "../base/macros.h"
124 kNonHierarchical = 1,
160 Separator separator = Separator::kAmpersand);
170 Separator separator = Separator::kAmpersand);
188 explicit UrlParser(
const std::map<Component, std::string>& components,
Category category,
bool rooted,
189 Separator separator = Separator::kAmpersand);
319 void setup(
const std::string& str,
Category category);
321 std::string::const_iterator parse_transport(
const std::string& str, std::string::const_iterator transport_start);
323 std::string::const_iterator parse_content(
const std::string& str, std::string::const_iterator content_start);
325 std::string::const_iterator parse_username(
const std::string& str,
const std::string& content,
326 std::string::const_iterator username_start);
328 std::string::const_iterator parse_password(
const std::string& str,
const std::string& content,
329 std::string::const_iterator password_start);
331 std::string::const_iterator parse_host(
const std::string& str,
const std::string& content,
332 std::string::const_iterator host_start);
334 std::string::const_iterator parse_port(
const std::string& str,
const std::string& content,
335 std::string::const_iterator port_start);
337 std::string::const_iterator parse_query(
const std::string& str, std::string::const_iterator query_start);
339 std::string::const_iterator parse_fragment(
const std::string& str, std::string::const_iterator fragment_start);
341 void init_query_dictionary();
343 std::string transport_;
344 std::string content_;
345 std::string username_;
346 std::string password_;
350 std::string fragment_;
351 std::map<std::string, std::string> query_dict_;
352 Category category_{Category::kHierarchical};
354 bool is_rooted_{
false};
355 Separator separator_{Separator::kAmpersand};
Immutable URL decomposition used by the VLink transport router.
Definition: url_parser.h:116
const std::string & get_path() const
Returns the path component of the URL.
UrlParser(const std::map< Component, std::string > &components, Category category, bool rooted, Separator separator=Separator::kAmpersand)
Builds a parser directly from an explicit component map.
UrlParser(const UrlParser &other, const std::map< Component, std::string > &replacements)
Builds a parser by copying other and overriding selected components.
std::string to_string() const
Reconstructs the URL string from the parsed components.
UrlParser(const std::string &str, Category category=Category::kHierarchical, Separator separator=Separator::kAmpersand)
Parses str as an std::string URL.
const std::string & get_query() const
Returns the raw query string (without the leading ?).
const std::string & get_username() const
Returns the authentication username component.
Component
Component identifiers accepted by the explicit-components constructor.
Definition: url_parser.h:131
UrlParser(const char *str, Category category=Category::kHierarchical, Separator separator=Separator::kAmpersand)
Parses str as a null-terminated URL string.
const std::string & get_fragment() const
Returns the fragment identifier (without the leading #).
const std::string & get_password() const
Returns the authentication password component.
const std::map< std::string, std::string > & get_query_dictionary() const
Returns the parsed query string as a key/value dictionary.
int64_t get_port() const
Returns the port number, or 0 when no port was specified.
Separator
Selectable separator used to break the query string into key/value pairs.
Definition: url_parser.h:147
const std::string & get_transport() const
Returns the parsed transport string (e.g. "dds" or "intra").
Category
Distinguishes hierarchical and non-hierarchical URI forms.
Definition: url_parser.h:122
const std::string & get_host() const
Returns the host component (hostname or IP address).
const std::string & get_content() const
Returns the full content portion of a non-hierarchical URL.
Category get_category() const
Returns the URL category supplied at construction time.
#define VLINK_EXPORT
Definition: macros.h:81