154 explicit UrlParser(
const std::map<Component, std::string>& components,
Category category,
bool rooted,
266 void setup(
const std::string& str,
Category category);
268 std::string::const_iterator parse_transport(
const std::string& str, std::string::const_iterator transport_start);
270 std::string::const_iterator parse_content(
const std::string& str, std::string::const_iterator content_start);
272 std::string::const_iterator parse_username(
const std::string& str,
const std::string& content,
273 std::string::const_iterator username_start);
275 std::string::const_iterator parse_password(
const std::string& str,
const std::string& content,
276 std::string::const_iterator password_start);
278 std::string::const_iterator parse_host(
const std::string& str,
const std::string& content,
279 std::string::const_iterator host_start);
281 std::string::const_iterator parse_port(
const std::string& str,
const std::string& content,
282 std::string::const_iterator port_start);
284 std::string::const_iterator parse_query(
const std::string& str, std::string::const_iterator query_start);
286 std::string::const_iterator parse_fragment(
const std::string& str, std::string::const_iterator fragment_start);
288 void init_query_dictionary();
290 std::string transport_;
291 std::string content_;
292 std::string username_;
293 std::string password_;
297 std::string fragment_;
298 std::map<std::string, std::string> query_dict_;
301 bool is_rooted_{
false};
302 Separator separator_{Separator::kAmpersand};
const std::string & get_transport() const
Returns the transport string parsed from the URL (e.g. "dds", "intra").
UrlParser(const std::map< Component, std::string > &components, Category category, bool rooted, Separator separator=Separator::kAmpersand)
Constructs a URL from an explicit component map.
UrlParser(const UrlParser &other, const std::map< Component, std::string > &replacements)
Constructs a parser by copying other and overriding specific components.
std::string to_string() const
Reconstructs the URL as a canonical string from parsed components.
UrlParser(const std::string &str, Category category=Category::kHierarchical, Separator separator=Separator::kAmpersand)
Constructs a parser by parsing the given std::string URL.
Component
Identifies individual URL components for the components-map constructor.
Definition url_parser.h:100
const std::string & get_username() const
Returns the authentication username component.
const std::string & get_content() const
Returns the full content portion of the URL (after the scheme separator).
const std::string & get_fragment() const
Returns the fragment identifier component (without the leading #).
const std::string & get_password() const
Returns the authentication password component.
UrlParser(const char *str, Category category=Category::kHierarchical, Separator separator=Separator::kAmpersand)
Constructs a parser by parsing the given C-string URL.
int64_t get_port() const
Returns the port number, or 0 if no port was specified.
Separator
Query-string key-value pair delimiter.
Definition url_parser.h:116
@ kAmpersand
& separator (default; key=val&key2=val2).
Definition url_parser.h:117
const std::string & get_path() const
Returns the path component of the URL.
const std::string & get_query() const
Returns the raw query string (without the leading ? character).
Category
Distinguishes hierarchical and non-hierarchical URL forms.
Definition url_parser.h:91
@ kHierarchical
Standard scheme://authority/path form (most VLink transports).
Definition url_parser.h:92
const std::string & get_host() const
Returns the host component (hostname or IP address).
Category get_category() const
Returns the URL category (hierarchical or non-hierarchical).
const std::map< std::string, std::string > & get_query_dictionary() const
Returns the parsed query string as a key-value dictionary.
Platform-independent macro definitions for the VLink library.
#define VLINK_EXPORT
Definition macros.h:85