mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-16 18:56:52 +02:00
fixed array element updating problem in JSONConfiguration
This commit is contained in:
@@ -154,6 +154,9 @@ public:
|
||||
void add(const Dynamic::Var& value);
|
||||
/// Add the given value to the array
|
||||
|
||||
void set(unsigned int index, const Dynamic::Var &value);
|
||||
/// Update the element on the given index to specified value
|
||||
|
||||
void stringify(std::ostream& out, unsigned int indent = 0, int step = -1) const;
|
||||
/// Prints the array to out. When indent has zero value,
|
||||
/// the array will be printed without newline breaks and spaces between elements.
|
||||
@@ -221,6 +224,13 @@ inline void Array::add(const Dynamic::Var& value)
|
||||
}
|
||||
|
||||
|
||||
inline void Array::set(unsigned int index, const Dynamic::Var &value)
|
||||
{
|
||||
if (index >= _values.size()) _values.resize(index + 1);
|
||||
_values[index] = value;
|
||||
}
|
||||
|
||||
|
||||
inline void Array::remove(unsigned int index)
|
||||
{
|
||||
_values.erase(_values.begin() + index);
|
||||
|
Reference in New Issue
Block a user