#include <url.hpp>
|
std::string | toString (bool doUrlEncode=true, bool includeFragment=true) const |
| Converts the url to a string containing all parts: https://u:p@bla.com:80/path?k=v.
|
|
std::string | pathAsString (bool doUrlEncode=true) const |
| Will only create the path as a string with a leading slash: "/path/to/resource".
|
|
std::string | hostAsString () const |
| Returns the host part of the url as a string. Does not include the port! IPv6 addresses will be enclosed in square brackets.
|
|
std::string | getAuthority (bool doUrlEncode) const |
| Converts the entire authority part to string: "user:password@domain.com:770".
|
|
std::string | schemeAndAuthority (bool doUrlEncode=true) const |
| Converts the authority part and scheme to string: "https://user:password@domain.com:770".
|
|
|
static boost::leaf::result< Url > | fromString (std::string url) |
| Parses a string that is a url.
|
|
static boost::leaf::result< std::vector< std::string > > | parsePath (std::string const &path) |
| Splits up a path string into a vector compatible with this class. An empty path returns an empty vector.
|
|
◆ fromString()
boost::leaf::result< Url > Roar::Url::fromString |
( |
std::string |
url | ) |
|
|
static |
Parses a string that is a url.
- Parameters
-
- Returns
- std::optional<Url> A url or a runtime_error.
◆ getAuthority()
std::string Roar::Url::getAuthority |
( |
bool |
doUrlEncode | ) |
const |
Converts the entire authority part to string: "user:password@domain.com:770".
- Parameters
-
doUrlEncode | Will url encode necessary characters when true. |
- Returns
- std::string The authority part of the url as string.
◆ hostAsString()
std::string Roar::Url::hostAsString |
( |
| ) |
const |
Returns the host part of the url as a string. Does not include the port! IPv6 addresses will be enclosed in square brackets.
- Returns
- std::string The domain/ip of the url.
◆ parsePath()
boost::leaf::result< std::vector< std::string > > Roar::Url::parsePath |
( |
std::string const & |
path | ) |
|
|
static |
Splits up a path string into a vector compatible with this class. An empty path returns an empty vector.
- Parameters
-
path | A path string starting with a leading slash: "/path/to/resource". |
- Returns
- Fallible<std::vector<std::string>> The path segments ["path", "to", "resource"].
◆ pathAsString()
std::string Roar::Url::pathAsString |
( |
bool |
doUrlEncode = true | ) |
const |
Will only create the path as a string with a leading slash: "/path/to/resource".
- Parameters
-
doUrlEncode | Will url encode necessary characters when true. |
- Returns
- std::string the path part of the url.
◆ schemeAndAuthority()
std::string Roar::Url::schemeAndAuthority |
( |
bool |
doUrlEncode = true | ) |
const |
Converts the authority part and scheme to string: "https://user:password@domain.com:770".
- Parameters
-
doUrlEncode | Will url encode necessary characters when true. |
- Returns
- std::string The scheme and authority of the url.
◆ toString()
std::string Roar::Url::toString |
( |
bool |
doUrlEncode = true , |
|
|
bool |
includeFragment = true |
|
) |
| const |
Converts the url to a string containing all parts: https://u:p@bla.com:80/path?k=v.
- Parameters
-
doUrlEncode | Will url encode necessary characters when true. |
includeFragment | The fragment part will not be added when false. |
- Returns
- std::string the url
◆ authority
◆ fragment
std::string Roar::Url::fragment |
◆ path
std::vector<std::string> Roar::Url::path |
◆ query
std::unordered_map<std::string, std::string> Roar::Url::query |
◆ scheme
std::string Roar::Url::scheme |
The documentation for this struct was generated from the following files: