Contains parameters extracted from a path with convenience functions to convert to integers.
More...
#include <path_matcher.hpp>
|
| void | set (const std::string_view name, const std::string_view value) |
| | Set a parameter with the given name and value.
|
| const std::string * | get (const std::string_view name) const |
| | Get a parameter value by name.
|
| template<typename T> |
| std::enable_if_t< std::is_integral_v< T >, std::optional< T > > | get_as (const std::string_view name) const |
| | Get a parameter value by name and convert it to an integer of type T.
|
| const std::map< std::string, std::string > & | get_all () const |
| | Get all parameters as a map.
|
| bool | empty () const |
| void | clear () |
| | Clear all parameters.
|
Contains parameters extracted from a path with convenience functions to convert to integers.
Definition at line 57 of file path_matcher.hpp.
◆ clear()
| void rav::PathMatcher::Parameters::clear |
( |
| ) |
|
|
inline |
◆ empty()
| bool rav::PathMatcher::Parameters::empty |
( |
| ) |
const |
|
inlinenodiscard |
- Returns
- True if no parameters were set, false otherwise.
Definition at line 108 of file path_matcher.hpp.
◆ get()
| const std::string * rav::PathMatcher::Parameters::get |
( |
const std::string_view | name | ) |
const |
|
inlinenodiscard |
Get a parameter value by name.
- Parameters
-
| name | The parameter name (e.g. "id" in "{id}"). |
- Returns
- The parameter value, or nullptr if the parameter was not found.
Definition at line 73 of file path_matcher.hpp.
◆ get_all()
| const std::map< std::string, std::string > & rav::PathMatcher::Parameters::get_all |
( |
| ) |
const |
|
inlinenodiscard |
Get all parameters as a map.
- Returns
- A map of parameter names to values.
Definition at line 101 of file path_matcher.hpp.
◆ get_as()
template<typename T>
| std::enable_if_t< std::is_integral_v< T >, std::optional< T > > rav::PathMatcher::Parameters::get_as |
( |
const std::string_view | name | ) |
const |
|
inline |
Get a parameter value by name and convert it to an integer of type T.
- Template Parameters
-
| T | The type to convert to. Must be an integral type (e.g. int, long, etc.). |
- Parameters
-
| name | The parameter name (e.g. "id" in "{id}"). |
- Returns
- The parameter value as an optional of type T, or an empty optional if the parameter was not found or the conversion failed.
Definition at line 89 of file path_matcher.hpp.
◆ set()
| void rav::PathMatcher::Parameters::set |
( |
const std::string_view | name, |
|
|
const std::string_view | value ) |
|
inline |
Set a parameter with the given name and value.
- Parameters
-
| name | The parameter name (e.g. "id" in "{id}"). |
| value | The parameter value. |
Definition at line 64 of file path_matcher.hpp.
The documentation for this class was generated from the following file: