File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,12 @@ JSONVar::JSONVar(int i) :
39
39
*this = i;
40
40
}
41
41
42
+ JSONVar::JSONVar (long l) :
43
+ JSONVar()
44
+ {
45
+ *this = l;
46
+ }
47
+
42
48
JSONVar::JSONVar (double d) :
43
49
JSONVar()
44
50
{
@@ -125,6 +131,11 @@ JSONVar::operator int() const
125
131
return cJSON_IsNumber (_json) ? _json->valueint : 0 ;
126
132
}
127
133
134
+ JSONVar::operator long () const
135
+ {
136
+ return cJSON_IsNumber (_json) ? _json->valueint : 0 ;
137
+ }
138
+
128
139
JSONVar::operator double () const
129
140
{
130
141
return cJSON_IsNumber (_json) ? _json->valuedouble : NAN;
@@ -184,6 +195,11 @@ void JSONVar::operator=(int i)
184
195
replaceJson (cJSON_CreateNumber (i));
185
196
}
186
197
198
+ void JSONVar::operator =(long l)
199
+ {
200
+ replaceJson (cJSON_CreateNumber (l));
201
+ }
202
+
187
203
void JSONVar::operator =(double d)
188
204
{
189
205
replaceJson (cJSON_CreateNumber (d));
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class JSONVar : public Printable {
32
32
JSONVar ();
33
33
JSONVar (bool b);
34
34
JSONVar (int i);
35
+ JSONVar (long l);
35
36
JSONVar (double d);
36
37
JSONVar (const char * s);
37
38
JSONVar (const String& s);
@@ -46,6 +47,7 @@ class JSONVar : public Printable {
46
47
47
48
operator bool () const ;
48
49
operator int () const ;
50
+ operator long () const ;
49
51
operator double () const ;
50
52
operator const char *() const ;
51
53
@@ -55,6 +57,7 @@ class JSONVar : public Printable {
55
57
#endif
56
58
void operator =(bool b);
57
59
void operator =(int i);
60
+ void operator =(long l);
58
61
void operator =(double d);
59
62
void operator =(const char * s);
60
63
void operator =(const String& s);
You can’t perform that action at this time.
0 commit comments