The class for parsing URIs that use the http and https schemes, and for constructing URI strings.
More...
|
| HttpStyleUri () noexcept |
| Instantiates the object with default parameters (default constructor). Initializes an object.
|
|
bool | FromUri (const Uri &uri) noexcept |
| Converts from a URI object. More...
|
|
bool | ToUri (Uri *uri) const noexcept |
| Converts to a URI object. More...
|
|
bool | Parse (const char *str) noexcept |
| Parses URIs. More...
|
|
bool | ComposeString (char *buf, size_t size) const noexcept |
| Writes a URI string. More...
|
|
template<size_t N> |
bool | ComposeString (char(&buf)[N]) const noexcept |
| Calls ComposeString(buf, N) .
|
|
bool | SetScheme (const char *scheme) noexcept |
| Sets the scheme. More...
|
|
bool | SetUserInfo (const char *userinfo) noexcept |
| Sets the user information. More...
|
|
bool | SetHost (const char *host) noexcept |
| Sets the hostname. It does not need to be percent-encoded. More...
|
|
bool | SetPort (int port) noexcept |
| Sets the port number. More...
|
|
bool | SetPath (const char *path) noexcept |
| Sets a path. More...
|
|
bool | SetQuery (const char *query) noexcept |
| Sets a query based on a query string. More...
|
|
bool | SetFragment (const char *fragment) noexcept |
| Sets a fragment string. More...
|
|
bool | AddQuery (const char *key, const char *value) noexcept |
| Adds a key and value to a query. More...
|
|
const char * | GetScheme () const noexcept |
| Gets the name of the URI scheme. The name is either http or https . More...
|
|
const char * | GetUserInfo () const noexcept |
| Gets the user information. More...
|
|
const char * | GetHost () const noexcept |
| Gets the hostname. More...
|
|
int | GetPort () const noexcept |
| Gets the port number. More...
|
|
size_t | GetNumSegment () const noexcept |
| Gets the number of stored segments. More...
|
|
const char * | GetSegment (size_t i) const noexcept |
| Specifies an index and gets a segment. More...
|
|
bool | IsPathDirectory () const noexcept |
| Gets whether the path is in the form of a directory path. More...
|
|
const char * | GetQueryValue (const char *key) const noexcept |
| Specifies a key and gets a value. If not found, returns NULL . More...
|
|
size_t | GetNumQuery () const noexcept |
| Gets the value corresponding to the key. If not found, returns NULL . More...
|
|
const KeyValue * | GetQueryKeyValue (size_t i) const noexcept |
| Specifies an index and gets a key/value pair. If not found, returns NULL . More...
|
|
const char * | GetFragment () const noexcept |
| Gets a fragment string. More...
|
|
bool | AddBaseUri (const Uri &relative, const HttpStyleUri &base) noexcept |
| Resolves the relative path using the base URI. More...
|
|
void | Reset () noexcept |
| Initializes (resets) an object.
|
|
The class for parsing URIs that use the http and https schemes, and for constructing URI strings.
- Description
- The URI string of characters is checked, divided up, normalized, and stored. During parsing, partial strings such as the "../" and "./" dot-segments are normalized and then the whole string is divided into segments and stored. For example, a path like
/test/../../../a/b/c
would be normalized to /a/b/c
and then divided into segments and stored. The percent-encoded characters in each segment are decoded.
- Supports query strings that consist of a series of
key=value
pairs connected using the ampersand (&
). The query string is stored in order of the ampersand signs (&
that delimit the key/value pairs and the first equal sign (=
) in each component that separates key
and value
. If there are duplicate key
values, they are stored that way. Any percent-encoded characters in key
and value
are decoded.
- Examples:
- misc/uri/uri.cpp.
Definition at line 12 of file HttpStyleUri.h.