|
Ada 3.4.0
Fast spec-compliant URL parser
|
Class for parsing and manipulating URL query strings. More...
#include <url_search_params.h>
Public Member Functions | |
| url_search_params ()=default | |
| url_search_params (const std::string_view input) | |
| url_search_params (const url_search_params &u)=default | |
| url_search_params (url_search_params &&u) noexcept=default | |
| url_search_params & | operator= (url_search_params &&u) noexcept=default |
| url_search_params & | operator= (const url_search_params &u)=default |
| ~url_search_params ()=default | |
| size_t | size () const noexcept |
| void | append (std::string_view key, std::string_view value) |
| void | remove (std::string_view key) |
| void | remove (std::string_view key, std::string_view value) |
| std::optional< std::string_view > | get (std::string_view key) |
| std::vector< std::string > | get_all (std::string_view key) |
| bool | has (std::string_view key) noexcept |
| bool | has (std::string_view key, std::string_view value) noexcept |
| void | set (std::string_view key, std::string_view value) |
| void | sort () |
| std::string | to_string () const |
| url_search_params_keys_iter | get_keys () |
| url_search_params_values_iter | get_values () |
| url_search_params_entries_iter | get_entries () |
| auto | begin () const |
| auto | end () const |
| auto | front () const |
| auto | back () const |
| auto | operator[] (size_t index) const |
Friends | |
| template<typename T, url_search_params_iter_type Type> | |
| struct | url_search_params_iter |
Class for parsing and manipulating URL query strings.
The url_search_params class provides methods to parse, modify, and serialize URL query parameters (the part after '?' in a URL). It handles percent-encoding and decoding automatically.
All string inputs must be valid UTF-8. The caller is responsible for ensuring UTF-8 validity.
Definition at line 60 of file url_search_params.h.
|
default |
Referenced by operator=(), operator=(), url_search_params(), and url_search_params().
|
inlineexplicit |
Constructs url_search_params by parsing a query string.
| input | A query string (with or without leading '?'). Must be UTF-8. |
Definition at line 67 of file url_search_params.h.
|
default |
References url_search_params().
|
defaultnoexcept |
References url_search_params().
|
default |
References append(), get(), get_all(), get_entries(), get_keys(), get_values(), has(), remove(), set(), sort(), and to_string().
|
inline |
Appends a new key-value pair to the parameter list.
| key | The parameter name (must be valid UTF-8). |
| value | The parameter value (must be valid UTF-8). |
Definition at line 70 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Definition at line 187 of file url_search_params.h.
|
inline |
C++ style conventional iterator support. const only because we do not really want the params to be modified via the iterator.
Definition at line 184 of file url_search_params.h.
References begin().
Referenced by begin().
|
inline |
Definition at line 185 of file url_search_params.h.
|
inline |
Definition at line 186 of file url_search_params.h.
|
inline |
Returns the value of the first pair with the given key.
| key | The parameter name to search for. |
Definition at line 77 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Returns all values for pairs with the given key.
| key | The parameter name to search for. |
Definition at line 89 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Returns an iterator over all key-value pairs.
Definition at line 255 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Returns an iterator over all parameter keys. Keys may repeat if there are duplicate parameters.
Definition at line 241 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Returns an iterator over all parameter values.
Definition at line 248 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inlinenoexcept |
Checks if any pair has the given key.
| key | The parameter name to search for. |
true if at least one pair has this key. Definition at line 102 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inlinenoexcept |
Checks if any pair matches the given key and value.
| key | The parameter name to search for. |
| value | The parameter value to match. |
true if a matching pair exists. Definition at line 108 of file url_search_params-inl.h.
|
default |
References url_search_params().
|
defaultnoexcept |
References url_search_params().
|
inline |
Definition at line 188 of file url_search_params.h.
|
inline |
Removes all pairs with the given key.
| key | The parameter name to remove. |
Definition at line 152 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Removes all pairs with the given key and value.
| key | The parameter name. |
| value | The parameter value to match. |
Definition at line 157 of file url_search_params-inl.h.
|
inline |
Sets a parameter value, replacing any existing pairs with the same key.
| key | The parameter name (must be valid UTF-8). |
| value | The parameter value (must be valid UTF-8). |
Definition at line 137 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inlinenodiscardnoexcept |
Returns the number of key-value pairs.
Definition at line 75 of file url_search_params-inl.h.
|
inline |
Sorts all key-value pairs by their keys using code unit comparison.
Definition at line 164 of file url_search_params-inl.h.
Referenced by ~url_search_params().
|
inline |
Serializes the parameters to a query string (without leading '?').
Definition at line 116 of file url_search_params-inl.h.
References ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE.
Referenced by ~url_search_params().
|
friend |
Definition at line 209 of file url_search_params.h.
References url_search_params_iter.
Referenced by url_search_params_iter.