10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
SimpleJSONString.h
1#ifndef TENDUKE_JSON_SIMPLEJSONSTRING_H
2#define TENDUKE_JSON_SIMPLEJSONSTRING_H
3
4#include "./SimpleJSONElement.h"
5#include "json/JSONString.h"
6
7namespace tenduke { namespace json {
8
9class SimpleJSONString : public virtual ::tenduke::json::JSONString, public ::tenduke::json::SimpleJSONElement
10{
11public:
12 explicit SimpleJSONString(const std::string &value)
13 : SimpleJSONElement(::tenduke::json::JSONElement::Type::STRING)
14 , value(value)
15 {
16 }
17
18 std::string asJSON() const override
19 {
20 return std::string("\"") + getValue() + '"';
21 }
22
23 std::string asString() const override
24 {
25 return getValue();
26 }
27
28 std::string getValue() const override
29 {
30 return this->value;
31 }
32
33protected:
34 std::string value;
35};
36
37}}
38
39#endif //TENDUKE_JSON_SIMPLEJSONSTRING_H
JSON string element.
Definition JSONString.h:14
Definition SimpleJSONElement.h:11
std::string getValue() const override
Returns the value of this string.
Definition SimpleJSONString.h:28
std::string asString() const override
Gets the value of the element as a string.
Definition SimpleJSONString.h:23
std::string asJSON() const override
Serializes the element as JSON.
Definition SimpleJSONString.h:18
JSON support.
Definition JSONArray.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4