10Duke Scale C++ Client
Loading...
Searching...
No Matches
CJsonObject.h
1#ifndef TENDUKE_JSON_CJSONOBJECT_H
2#define TENDUKE_JSON_CJSONOBJECT_H
3
4#include "./CJsonElement.h"
5#include "json/JSONObject.h"
6
7#include <memory>
8
9namespace tenduke { namespace json { namespace cjson {
10
15{
16public:
23 std::unique_ptr<std::map<std::string, std::shared_ptr<tenduke::json::JSONElement>>> properties,
24 cJSON * element
25 ) : CjsonElement(JSONElement::Type::OBJECT, element), properties(std::move(properties))
26 {}
27
28 ~CjsonObject() override;
29
30 // ::tenduke::json::JSONObject interface
31public:
32 std::shared_ptr<tenduke::json::JSONElement> getProperty(const std::string &propertyName) const override;
33 bool hasProperty(const std::string &propertyName) const override;
34 std::shared_ptr<tenduke::json::JSONElement> removeProperty(const std::string & propertyName) override;
35 const std::map<std::string, std::shared_ptr<tenduke::json::JSONElement>> & getProperties() const override;
36
37private:
38 std::unique_ptr<std::map<std::string, std::shared_ptr<tenduke::json::JSONElement>>> properties;
39};
40
41}}}
42
43#endif // TENDUKE_JSON_CJSONOBJECT_H
Superclass of JSON elements.
Definition JSONElement.h:12
Type
Type of the element.
Definition JSONElement.h:17
JSON object element.
Definition JSONObject.h:16
cJSON-implementation of tenduke::json::JSONElement.
Definition CJsonElement.h:14
cJSON * element
Pointer to the cJSON element.
Definition CJsonElement.h:62
cJSON-implementation of tenduke::json::JSONObject.
Definition CJsonObject.h:15
CjsonObject(std::unique_ptr< std::map< std::string, std::shared_ptr< tenduke::json::JSONElement > > > properties, cJSON *element)
Constructs new instance.
Definition CJsonObject.h:22
std::shared_ptr< tenduke::json::JSONElement > getProperty(const std::string &propertyName) const override
Returns object property by name.
Definition CJsonObject.cpp:10
std::shared_ptr< tenduke::json::JSONElement > removeProperty(const std::string &propertyName) override
Removes property from this object.
Definition CJsonObject.cpp:33
const std::map< std::string, std::shared_ptr< tenduke::json::JSONElement > > & getProperties() const override
Returns all properties of this object.
Definition CJsonObject.cpp:28
bool hasProperty(const std::string &propertyName) const override
Checks if the object has a property with given name.
Definition CJsonObject.cpp:21
Implementation of JSON service interfaces using cJSON.
Definition CJsonArray.h:10
JSON support.
Definition JSONArray.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7