annotate Resources/CodeGeneration/playground.ts @ 490:6470248790db bgo-commands-codegen

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