Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
Array.hpp
1
#pragma once
2
3
#include "util/config/ConfigValue.hpp"
4
#include "util/config/Error.hpp"
5
#include "util/config/Types.hpp"
6
7
#include <cstddef>
8
#include <optional>
9
#include <ostream>
10
#include <string_view>
11
#include <vector>
12
13
namespace
util::config {
14
22
class
Array
{
23
public
:
29
Array
(
ConfigValue
arg);
30
40
static
std::string_view
41
prefix
(std::string_view key);
42
50
[[nodiscard]] std::optional<Error>
51
addValue
(Value value, std::optional<std::string_view> key = std::nullopt);
52
61
[[nodiscard]] std::optional<Error>
62
addNull
(std::optional<std::string_view> key = std::nullopt);
63
69
[[nodiscard]]
size_t
70
size
()
const
;
71
78
[[nodiscard]]
ConfigValue
const
&
79
at
(std::size_t idx)
const
;
80
87
[[nodiscard]]
ConfigValue
const
&
88
getArrayPattern
()
const
;
89
95
[[nodiscard]] std::vector<ConfigValue>::const_iterator
96
begin
()
const
;
97
103
[[nodiscard]] std::vector<ConfigValue>::const_iterator
104
end
()
const
;
105
106
private
:
107
ConfigValue
itemPattern_;
108
std::vector<ConfigValue> elements_;
109
};
110
118
inline
std::ostream&
119
operator<<(std::ostream& stream,
Array
arr)
120
{
121
stream << arr.
getArrayPattern
();
122
return
stream;
123
}
124
125
}
// namespace util::config
util::config::Array
Array definition to store multiple values provided by the user from Json/Yaml.
Definition
Array.hpp:22
util::config::Array::at
ConfigValue const & at(std::size_t idx) const
Returns the ConfigValue at the specified index.
Definition
Array.cpp:61
util::config::Array::getArrayPattern
ConfigValue const & getArrayPattern() const
Returns the ConfigValue that defines the type/constraint every ConfigValue must follow in Array.
Definition
Array.cpp:68
util::config::Array::addNull
std::optional< Error > addNull(std::optional< std::string_view > key=std::nullopt)
Add null value to the array.
Definition
Array.cpp:41
util::config::Array::addValue
std::optional< Error > addValue(Value value, std::optional< std::string_view > key=std::nullopt)
Add ConfigValues to Array class.
Definition
Array.cpp:30
util::config::Array::end
std::vector< ConfigValue >::const_iterator end() const
Returns an iterator to the end of the ConfigValue vector.
Definition
Array.cpp:80
util::config::Array::size
size_t size() const
Returns the number of values stored in the Array.
Definition
Array.cpp:55
util::config::Array::Array
Array(ConfigValue arg)
Constructs an Array with provided Arg.
Definition
Array.cpp:16
util::config::Array::begin
std::vector< ConfigValue >::const_iterator begin() const
Returns an iterator to the beginning of the ConfigValue vector.
Definition
Array.cpp:74
util::config::Array::prefix
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....
Definition
Array.cpp:21
util::config::ConfigValue
Represents the config values for Json/Yaml config.
Definition
ConfigValue.hpp:28
src
util
config
Array.hpp
Generated by
1.17.0