Array definition to store multiple values provided by the user from Json/Yaml.
More...
#include <Array.hpp>
|
static std::string_view | prefix (std::string_view key) |
| Extract array prefix from a key, For example for a key foo.[].bar the method will return foo.[].
|
|
Array definition to store multiple values provided by the user from Json/Yaml.
Used in ClioConfigDefinition to represent multiple potential values (like whitelist) Is constructed with only 1 element which states which type/constraint must every element In the array satisfy
◆ Array()
Constructs an Array with provided Arg.
- Parameters
-
arg | Argument to set the type and constraint of ConfigValues in Array |
◆ addValue()
std::optional< Error > util::config::Array::addValue |
( |
Value | value, |
|
|
std::optional< std::string_view > | key = std::nullopt ) |
Add ConfigValues to Array class.
- Parameters
-
value | The ConfigValue to add |
key | optional string key to include that will show in error message |
- Returns
- optional error if adding config value to array fails. nullopt otherwise
◆ at()
ConfigValue const & util::config::Array::at |
( |
std::size_t | idx | ) |
const |
|
nodiscard |
◆ begin()
std::vector< ConfigValue >::const_iterator util::config::Array::begin |
( |
| ) |
const |
|
nodiscard |
Returns an iterator to the beginning of the ConfigValue vector.
- Returns
- A constant iterator to the beginning of the vector.
◆ end()
std::vector< ConfigValue >::const_iterator util::config::Array::end |
( |
| ) |
const |
|
nodiscard |
Returns an iterator to the end of the ConfigValue vector.
- Returns
- A constant iterator to the end of the vector.
◆ getArrayPattern()
ConfigValue const & util::config::Array::getArrayPattern |
( |
| ) |
const |
|
nodiscard |
◆ prefix()
std::string_view util::config::Array::prefix |
( |
std::string_view | key | ) |
|
|
static |
Extract array prefix from a key, For example for a key foo.[].bar the method will return foo.[].
- Note
- Provided key must contain '.[]'
- Warning
- Be careful with string_view! Returned value is valid only while the key is valid
- Parameters
-
key | The key to extract the array prefix from |
- Returns
- Prefix of array extracted from the key
◆ size()
size_t util::config::Array::size |
( |
| ) |
const |
|
nodiscard |
Returns the number of values stored in the Array.
- Returns
- Number of values stored in the Array
The documentation for this class was generated from the following files:
- /__w/clio/clio/src/util/newconfig/Array.hpp
- /__w/clio/clio/src/util/newconfig/Array.cpp