Object.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <etk/Hash.hpp>
10 #include <algorithm>
11 #include <ejson/Value.hpp>
12 #include <ejson/iterator.hpp>
13 
14 namespace ejson {
18  class Object : public ejson::Value {
19  public:
29  Object(const ejson::Object& _obj);
33  Object();
38  Object(const std::string& _data);
45 
46  public:
52  bool valueExist(const std::string& _name) const;
58  ejson::Value operator[] (const std::string& _name);
64  const ejson::Value operator[] (const std::string& _name) const;
65  public:
70  std::vector<std::string> getKeys() const;
75  size_t size() const;
81  ejson::Value operator[] (size_t _id);
87  const ejson::Value operator[] (size_t _id) const;
93  std::string getKey(size_t _id) const;
94  public:
101  bool add(const std::string& _name, const ejson::Value& _value);
106  void remove(const std::string& _name);
111  void remove(size_t _id);
112  public:
114 
118  iterator begin();
123  iterator end();
128  const iterator begin() const;
133  const iterator end() const;
139  iterator remove(const iterator& _it);
140  };
141 }
142 
bool add(const std::string &_name, const ejson::Value &_value)
add an element in the Object
iterator begin()
Get iterator of the first Value.
the element "..."
ejson namespace containing all function for JSON interpretor
Definition: Array.hpp:12
ejson Object interface { ... }.
Definition: Object.hpp:18
size_t size() const
get the number of sub element in the current one
bool valueExist(const std::string &_name) const
check if an element exist.
Basic main object of all json elements.
Definition: Value.hpp:31
iterator end()
Get iterator of the next of the last Value.
std::string getKey(size_t _id) const
Get the element name (key).
Definition: iterator.hpp:16
ejson::Object & operator=(const ejson::Object &_obj)
Copy constructor.
ejson::Value operator[](const std::string &_name)
Cet the sub element with his name (no cast check)
std::vector< std::string > getKeys() const
Get all the element name (keys).
Object()
Constructor.