10Duke Scale C++ Client
Loading...
Searching...
No Matches
CJsonNumber.h
1#ifndef TENDUKE_JSON_CJSONNUMBER_H
2#define TENDUKE_JSON_CJSONNUMBER_H
3
4#include "./CJsonElement.h"
5#include "json/JSONNumber.h"
6
7namespace tenduke { namespace json { namespace cjson {
8
13{
14public:
20 CjsonNumber(double value, cJSON * element)
21 : CjsonElement(JSONElement::Type::NUMBER, element), value(value)
22 {}
23 ~CjsonNumber() override = default;
24
25 // tenduke::json::JSONNumber interface
26public:
27 std::string asString() const override
28 {
29 return std::to_string(value);
30 }
31 double getValue() const override {return value;}
32
33private:
34 double value;
35};
36
37}}}
38
39#endif // TENDUKE_JSON_CJSONNUMBER_H
Superclass of JSON elements.
Definition JSONElement.h:12
Type
Type of the element.
Definition JSONElement.h:17
Represents JSON number.
Definition JSONNumber.h:12
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::JSONNumber.
Definition CJsonNumber.h:13
double getValue() const override
Returns the value.
Definition CJsonNumber.h:31
CjsonNumber(double value, cJSON *element)
Constructs new instance.
Definition CJsonNumber.h:20
std::string asString() const override
Returns string representation of this element.
Definition CJsonNumber.h:27
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