10Duke Enterprise C++ SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
SimpleJSONNumber.h
1
#ifndef TENDUKE_JSON_SIMPLEJSONNUMBER_H
2
#define TENDUKE_JSON_SIMPLEJSONNUMBER_H
3
4
#include "./SimpleJSONElement.h"
5
#include "json/JSONNumber.h"
6
7
#include <cmath>
8
9
namespace
tenduke
{
namespace
json
{
10
11
class
SimpleJSONNumber :
public
virtual
::tenduke::json::JSONNumber
,
public
::tenduke::json::SimpleJSONElement
12
{
13
public
:
14
explicit
SimpleJSONNumber(
double
value)
15
: SimpleJSONElement(::tenduke::json::JSONElement::NUMBER),
16
value(value)
17
{
18
}
19
20
double
getValue
()
const override
21
{
22
return
this->value;
23
}
24
25
std::string
asJSON
()
const override
26
{
27
if
(std::trunc(this->value) == this->value) {
28
return
std::to_string(
static_cast<
std::int64_t
>
(this->value));
29
}
30
return
std::to_string(this->value);
31
}
32
33
private
:
34
double
value;
35
};
36
37
}}
// tenduke
38
39
#endif
//TENDUKE_JSON_SIMPLEJSONNUMBER_H
tenduke::json::JSONNumber
Represents JSON number.
Definition
JSONNumber.h:12
tenduke::json::SimpleJSONElement
Definition
SimpleJSONElement.h:11
tenduke::json::SimpleJSONNumber::asJSON
std::string asJSON() const override
Serializes the element as JSON.
Definition
SimpleJSONNumber.h:25
tenduke::json::SimpleJSONNumber::getValue
double getValue() const override
Returns the value.
Definition
SimpleJSONNumber.h:20
tenduke::json
JSON support.
Definition
JSONArray.h:10
tenduke
Root for classes, functions and globals of 10Duke C++ Client.
Definition
APIRequest.h:4
core
services
common
src
json
SimpleJSONNumber.h
Generated by
1.17.0