JsonArray.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
17* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
18* GNU General Public License
19*/
20
21#pragma once
22
23#include <memory>
24#include <vector>
25
26#include "JsonData.h"
27#include "JsonValue.h"
28
29namespace armarx
30{
31 class JsonArray;
32 using JsonArrayPtr = std::shared_ptr<JsonArray>;
33
34 class JsonArray : public JsonData
35 {
36 friend class JPathNavigator;
37
38 public:
39 JsonArray();
40 JsonArray(const std::vector<JsonValue>& values);
41 void writeJson(const JsonWriterPtr& writer) override;
42 void add(const JsonDataPtr& value);
43 void add(const JsonValue& value);
44 void add(const JsonArray& value);
45 void set(uint index, const JsonDataPtr& value);
46 void set(uint index, const JsonValue& value);
47 void remove(uint index);
48 uint size();
49 void clear();
51 JsonDataPtr clone() override;
52
53 private:
54 std::vector<JsonDataPtr> elements;
55 };
56} // namespace armarx
uint8_t index
void remove(uint index)
Definition JsonArray.cpp:84
JsonArrayPtr toSharedPtr() const
void add(const JsonDataPtr &value)
Definition JsonArray.cpp:53
friend class JPathNavigator
Definition JsonArray.h:36
void writeJson(const JsonWriterPtr &writer) override
Definition JsonArray.cpp:40
void set(uint index, const JsonDataPtr &value)
Definition JsonArray.cpp:71
JsonDataPtr clone() override
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< JsonData > JsonDataPtr
Definition JsonData.h:31
std::shared_ptr< JsonArray > JsonArrayPtr
Definition JsonArray.h:32
std::shared_ptr< JsonWriter > JsonWriterPtr
Definition JsonWriter.h:30