annotate Resources/CodeGeneration/Graveyard/playground.ts @ 986:4e2de6b8a70b

Uninit. var.
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 09 Sep 2019 10:41:27 +0200
parents 6405435480ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
490
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
1 /*
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
2 1 2 3 4 5 6 7
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
3 12345678901234567890123456789012345678901234567890123456789012345678901234567890
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
4 */
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
5
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
6 namespace VsolStuff
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
7 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
8 enum EnumMonth0
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
9 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
10 January,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
11 February,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
12 March
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
13 };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
14
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
15 // interface Serializer
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
16 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
17 // Serialize(value: number): string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
18 // Serialize(value: string): string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
19 // Serialize(value: EnumMonth0): string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
20 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
21 function printf(value: any):void
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
22 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
23 console.log(value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
24 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
25
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
26 // function StoneSerialize(value: string) : string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
27 // function StoneSerialize(value: number) : string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
28 // function StoneSerialize(value: EnumMonth0) : string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
29 function StoneSerialize<T>(value: T[]) : string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
30
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
31 function StoneSerialize<T>(value: T[] | EnumMonth0) : string
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
32 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
33 let valueType = typeof value;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
34 printf(`About to serialize value. Type is ${valueType}`)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
35 printf(`About to serialize value. Type is ${typeof value}`)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
36 return "Choucroute";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
37 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
38
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
39 function main():number
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
40 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
41 enum Color {Red = 1, Green = 2, Blue = 4}
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
42 let color: Color = Color.Green;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
43 printf("---------------------------");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
44 printf(`typeof color: ${typeof color}`);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
45 printf("---------------------------");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
46 let colors: Color[] = []
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
47 colors.push(Color.Green);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
48 colors.push(Color.Red);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
49 printf(`typeof colors: ${typeof colors}`);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
50 printf(`Array.isArray(colors): ${Array.isArray(colors)}`);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
51 printf("---------------------------");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
52
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
53
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
54 let toto:EnumMonth0[] = [];
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
55
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
56 toto.push(EnumMonth0.February);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
57 toto.push(EnumMonth0.March);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
58
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
59 printf(JSON.stringify(toto));
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
60
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
61 return 0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
62
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
63 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
64
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
65 main()
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
66
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
67 // string StoneSerialize_number(int32_t value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
68 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
69
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
70 // Json::Value result(value);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
71 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
72 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
73
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
74 // Json::Value StoneSerialize(double value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
75 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
76 // Json::Value result(value);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
77 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
78 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
79
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
80 // Json::Value StoneSerialize(bool value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
81 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
82 // Json::Value result(value);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
83 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
84 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
85
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
86 // Json::Value StoneSerialize(const std::string& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
87 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
88 // // the following is better than
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
89 // Json::Value result(value.data(),value.data()+value.size());
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
90 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
91 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
92
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
93 // template<typename T>
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
94 // Json::Value StoneSerialize(const std::map<std::string,T>& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
95 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
96 // Json::Value result(Json::objectValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
97
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
98 // for (std::map<std::string, T>::const_iterator it = value.cbegin();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
99 // it != value.cend(); ++it)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
100 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
101 // // it->first it->second
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
102 // result[it->first] = StoneSerialize(it->second);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
103 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
104 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
105 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
106
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
107 // template<typename T>
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
108 // Json::Value StoneSerialize(const std::vector<T>& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
109 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
110 // Json::Value result(Json::arrayValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
111 // for (size_t i = 0; i < value.size(); ++i)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
112 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
113 // result.append(StoneSerialize(value[i]));
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
114 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
115 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
116 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
117
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
118 // enum EnumMonth0
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
119 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
120 // January,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
121 // February,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
122 // March
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
123 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
124
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
125 // std::string ToString(EnumMonth0 value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
126 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
127 // switch(value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
128 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
129 // case January:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
130 // return "January";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
131 // case February:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
132 // return "February";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
133 // case March:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
134 // return "March";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
135 // default:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
136 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
137 // std::stringstream ss;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
138 // ss << "Unrecognized EnumMonth0 value (" << static_cast<int64_t>(value) << ")";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
139 // throw std::runtime_error(ss.str());
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
140 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
141 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
142 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
143
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
144 // void FromString(EnumMonth0& value, std::string strValue)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
145 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
146 // if (strValue == "January" || strValue == "EnumMonth0_January")
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
147 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
148 // return January;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
149 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
150 // else if (strValue == "February" || strValue == "EnumMonth0_February")
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
151 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
152 // return February;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
153 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
154 // #error Not implemented yet
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
155 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
156
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
157 // Json::Value StoneSerialize(const EnumMonth0& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
158 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
159 // return StoneSerialize(ToString(value));
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
160 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
161 // struct Message1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
162 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
163 // int32_t a;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
164 // std::string b;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
165 // EnumMonth0 c;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
166 // bool d;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
167 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
168
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
169 // struct Message2
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
170 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
171 // std::string toto;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
172 // std::vector<Message1> tata;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
173 // std::vector<std::string> tutu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
174 // std::map<std::string, std::string> titi;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
175 // std::map<std::string, Message1> lulu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
176 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
177
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
178 // Json::Value StoneSerialize(const Message1& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
179 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
180 // Json::Value result(Json::objectValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
181 // result["a"] = StoneSerialize(value.a);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
182 // result["b"] = StoneSerialize(value.b);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
183 // result["c"] = StoneSerialize(value.c);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
184 // result["d"] = StoneSerialize(value.d);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
185 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
186 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
187
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
188 // Json::Value StoneSerialize(const Message2& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
189 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
190 // Json::Value result(Json::objectValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
191 // result["toto"] = StoneSerialize(value.toto);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
192 // result["tata"] = StoneSerialize(value.tata);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
193 // result["tutu"] = StoneSerialize(value.tutu);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
194 // result["titi"] = StoneSerialize(value.titi);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
195 // result["lulu"] = StoneSerialize(value.lulu);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
196 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
197 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
198 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
199
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
200 // int main()
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
201 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
202 // VsolStuff::Message1 msg1_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
203 // msg1_0.a = 42;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
204 // msg1_0.b = "Benjamin";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
205 // msg1_0.c = VsolStuff::January;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
206 // msg1_0.d = true;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
207
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
208 // VsolStuff::Message1 msg1_1;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
209 // msg1_1.a = 43;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
210 // msg1_1.b = "Sandrine";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
211 // msg1_1.c = VsolStuff::March;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
212 // msg1_0.d = false;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
213
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
214 // // std::string toto;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
215 // // std::vector<Message1> tata;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
216 // // std::vector<std::string> tutu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
217 // // std::map<int32_t, std::string> titi;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
218 // // std::map<int32_t, Message1> lulu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
219
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
220 // VsolStuff::Message2 msg2_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
221 // msg2_0.toto = "Prout zizi";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
222 // msg2_0.tata.push_back(msg1_0);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
223 // msg2_0.tata.push_back(msg1_1);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
224 // msg2_0.tutu.push_back("Mercadet");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
225 // msg2_0.tutu.push_back("Poisson");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
226 // msg2_0.titi["44"] = "key 44";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
227 // msg2_0.titi["45"] = "key 45";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
228 // msg2_0.lulu["54"] = msg1_1;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
229 // msg2_0.lulu["55"] = msg1_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
230 // auto result = VsolStuff::StoneSerialize(msg2_0);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
231 // auto resultStr = result.toStyledString();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
232
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
233 // Json::Value readValue;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
234
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
235 // Json::CharReaderBuilder builder;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
236 // Json::CharReader* reader = builder.newCharReader();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
237 // std::string errors;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
238
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
239 // bool ok = reader->parse(
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
240 // resultStr.c_str(),
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
241 // resultStr.c_str() + resultStr.size(),
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
242 // &readValue,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
243 // &errors
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
244 // );
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
245 // delete reader;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
246
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
247 // if (!ok)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
248 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
249 // std::stringstream ss;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
250 // ss << "Json parsing error: " << errors;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
251 // throw std::runtime_error(ss.str());
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
252 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
253 // std::cout << readValue.get("toto", "Default Value").asString() << std::endl;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
254 // return 0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
255 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
256
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
257
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
258 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
259