A class for parsing and manipulating the query string of a URI.
More...
#include <CesiumUtility/Uri.h>
|
| UriQuery (const std::string_view &queryString) |
| Creates a UriQuery object from a query string.
|
|
| UriQuery (const Uri &uri) |
| Creates a UriQuery object from a Uri instance.
|
|
std::optional< std::string_view > | getValue (const std::string &key) |
| Obtains the value of the given key from the query parameters, if possible.
|
|
void | setValue (const std::string &key, const std::string &value) |
| Sets the given key in the query parameters to the given value. If the key doesn't exist already, it will be added to the query parameters. Otherwise, the previous value will be overwritten.
|
|
bool | hasValue (const std::string &key) |
| Returns true if this query string contains a value for the given key, or false otherwise.
|
|
std::string | toQueryString () const |
| Converts this object back into a query string, including all modifications that have been made. This result can be passed directly to Uri::setQuery.
|
|
auto | begin () const |
| Returns an iterator pointing to the beginning of the query parameters.
|
|
auto | end () const |
| Returns an iterator pointing to the end of the query parameters.
|
|
auto | front () const |
| Returns the first element in the query parameters.
|
|
auto | back () const |
| Returns the last element in the query parameters.
|
|
A class for parsing and manipulating the query string of a URI.
Definition at line 337 of file Uri.h.
◆ UriQuery() [1/2]
CesiumUtility::UriQuery::UriQuery |
( |
const std::string_view & | queryString | ) |
|
|
inline |
Creates a UriQuery object from a query string.
This query string should be in the format key1=value1&key2=value2&key3=value3...
. This is the format returned by Uri::getQuery. This string can include percent-encoded values.
- Parameters
-
queryString | The query string to parse into a query params object. |
Definition at line 348 of file Uri.h.
◆ UriQuery() [2/2]
CesiumUtility::UriQuery::UriQuery |
( |
const Uri & | uri | ) |
|
|
inline |
Creates a UriQuery object from a Uri instance.
This is equivalent to UriQuery(uri.getQuery())
.
- Parameters
-
uri | The URI instance to obtain the query params from. |
Definition at line 356 of file Uri.h.
◆ back()
auto CesiumUtility::UriQuery::back |
( |
| ) |
const |
|
inline |
Returns the last element in the query parameters.
Definition at line 409 of file Uri.h.
◆ begin()
auto CesiumUtility::UriQuery::begin |
( |
| ) |
const |
|
inline |
Returns an iterator pointing to the beginning of the query parameters.
Definition at line 403 of file Uri.h.
◆ end()
auto CesiumUtility::UriQuery::end |
( |
| ) |
const |
|
inline |
Returns an iterator pointing to the end of the query parameters.
Definition at line 405 of file Uri.h.
◆ front()
auto CesiumUtility::UriQuery::front |
( |
| ) |
const |
|
inline |
Returns the first element in the query parameters.
Definition at line 407 of file Uri.h.
◆ getValue()
std::optional< std::string_view > CesiumUtility::UriQuery::getValue |
( |
const std::string & | key | ) |
|
|
inline |
Obtains the value of the given key from the query parameters, if possible.
If the URI can't be parsed, or the key doesn't exist in the query string, std::nullopt
will be returned.
- Parameters
-
key | The key whose value will be obtained from the query string, if possible. |
- Returns
- The value of the given key in the query string, or
std::nullopt
if not found.
Definition at line 370 of file Uri.h.
◆ hasValue()
bool CesiumUtility::UriQuery::hasValue |
( |
const std::string & | key | ) |
|
|
inline |
Returns true if this query string contains a value for the given key, or false otherwise.
- Parameters
-
Definition at line 392 of file Uri.h.
◆ setValue()
void CesiumUtility::UriQuery::setValue |
( |
const std::string & | key, |
|
|
const std::string & | value ) |
|
inline |
Sets the given key in the query parameters to the given value. If the key doesn't exist already, it will be added to the query parameters. Otherwise, the previous value will be overwritten.
- Parameters
-
key | The key to be added to the query string. |
value | The value to be added to the query string. |
Definition at line 382 of file Uri.h.
◆ toQueryString()
std::string CesiumUtility::UriQuery::toQueryString |
( |
| ) |
const |
|
inline |
Converts this object back into a query string, including all modifications that have been made. This result can be passed directly to Uri::setQuery.
Definition at line 399 of file Uri.h.
The documentation for this class was generated from the following file:
- /home/runner/work/cesium-native/cesium-native/CesiumUtility/include/CesiumUtility/Uri.h