-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjson.cpp
73 lines (55 loc) · 1.41 KB
/
json.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// name: json.cpp
// version: 1.0
// description: json parsing
// json class header
#include "json.h"
// constructors
json::json() { /* do nothing */ }
// constructors
json::json(char *raw) { storage = raw; }
// operators
void json::operator=(char *raw) { storage = raw; }
// templates
template<class type>
type json::parse(char *data) {
//return;
};
std::string json::stringify(bool data) {
return (data) ? "true" : "false";
};
std::string json::stringify(short int data) {
return std::to_string(data);
};
std::string json::stringify(unsigned short int data) {
return std::to_string(data);
};
std::string json::stringify(int data) {
return std::to_string(data);
};
std::string json::stringify(long int data) {
return std::to_string(data);
};
std::string json::stringify(long long int data) {
return std::to_string(data);
};
std::string json::stringify(unsigned int data) {
return std::to_string(data);
};
std::string json::stringify(unsigned long int data) {
return std::to_string(data);
};
std::string json::stringify(unsigned long long int data) {
return std::to_string(data);
};
std::string json::stringify(double data) {
return std::to_string(data);
};
std::string json::stringify(long double data) {
return std::to_string(data);
};
std::string json::stringify(float data) {
return std::to_string(data);
};
std::string json::stringify(char *data) {
return data;
};