annotate Resources/CodeGeneration/Graveyard/playground3.ts @ 525:2549363fadc3 am-touch-events

Close branch am-touch-events.
author Alain Mazy <am@osimis.io>
date Tue, 12 Mar 2019 17:29:12 +0000
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
491
8e7e151ef472 Unit tests pass for enum generation
bgo-osimis
parents: 490
diff changeset
6 namespace VsolStuff222 {
490
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
7 export enum EnumMonth0 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
8 January,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
9 February,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
10 March
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
11 };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
12
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
13 export class Message1 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
14 a: number;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
15 b: string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
16 c: EnumMonth0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
17 d: boolean;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
18 public StoneSerialize(): string {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
19 let container: object = {};
491
8e7e151ef472 Unit tests pass for enum generation
bgo-osimis
parents: 490
diff changeset
20 container['type'] = 'VsolStuff.Message1';
490
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
21 container['value'] = this;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
22 return JSON.stringify(container);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
23 }
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 export class Message2 {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
27 toto: string;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
28 tata: Message1[];
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
29 tutu: string[];
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
30 titi: Map<string, string>;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
31 lulu: Map<string, Message1>;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
32
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
33 public StoneSerialize(): string {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
34 let container: object = {};
491
8e7e151ef472 Unit tests pass for enum generation
bgo-osimis
parents: 490
diff changeset
35 container['type'] = 'VsolStuff.Message2';
490
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
36 container['value'] = this;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
37 return JSON.stringify(container);
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 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
41
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
42 function printf(value: any): void {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
43 console.log(value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
44 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
45
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
46 function main(): number {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
47
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
48 let msg1_0 = new VsolStuff.Message1();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
49 msg1_0.a = 42;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
50 msg1_0.b = "Benjamin";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
51 msg1_0.c = VsolStuff.EnumMonth0.January;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
52 msg1_0.d = true;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
53
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
54 let msg1_1 = new VsolStuff.Message1();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
55 msg1_1.a = 43;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
56 msg1_1.b = "Sandrine";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
57 msg1_1.c = VsolStuff.EnumMonth0.March;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
58 msg1_0.d = false;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
59
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
60 // std::string toto;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
61 // std::vector<Message1> tata;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
62 // std::vector<std::string> tutu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
63 // std::map<int32_t, std::string> titi;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
64 // std::map<int32_t, Message1> lulu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
65
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
66 let msg2_0 = new VsolStuff.Message2();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
67 msg2_0.toto = "Prout zizi";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
68 msg2_0.tata = new Array<VsolStuff.Message1>();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
69 msg2_0.tata.push(msg1_0);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
70 msg2_0.tata.push(msg1_1);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
71 msg2_0.tutu.push("Mercadet");
491
8e7e151ef472 Unit tests pass for enum generation
bgo-osimis
parents: 490
diff changeset
72 msg2_0.tutu.push("Poisson");ing
490
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
73 msg2_0.titi["44"] = "key 44";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
74 msg2_0.titi["45"] = "key 45";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
75 msg2_0.lulu["54"] = msg1_1;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
76 msg2_0.lulu["55"] = msg1_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
77 let result:string = VsolStuff.StoneSerialize(msg2_0);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
78 return 0;
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 main()
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
82
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
83 // string StoneSerialize_number(int32_t value)
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 result(value);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
87 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
88 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
89
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
90 // Json::Value StoneSerialize(double value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
91 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
92 // Json::Value result(value);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
93 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
94 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
95
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
96 // Json::Value StoneSerialize(bool value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
97 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
98 // Json::Value result(value);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
99 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
100 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
101
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
102 // Json::Value StoneSerialize(const std::string& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
103 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
104 // // the following is better than
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
105 // Json::Value result(value.data(),value.data()+value.size());
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
106 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
107 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
108
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
109 // template<typename T>
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
110 // Json::Value StoneSerialize(const std::map<std::string,T>& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
111 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
112 // Json::Value result(Json::objectValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
113
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
114 // for (std::map<std::string, T>::const_iterator it = value.cbegin();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
115 // it != value.cend(); ++it)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
116 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
117 // // it->first it->second
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
118 // result[it->first] = StoneSerialize(it->second);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
119 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
120 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
121 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
122
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
123 // template<typename T>
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
124 // Json::Value StoneSerialize(const std::vector<T>& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
125 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
126 // Json::Value result(Json::arrayValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
127 // for (size_t i = 0; i < value.size(); ++i)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
128 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
129 // result.append(StoneSerialize(value[i]));
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
130 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
131 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
132 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
133
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
134 // enum EnumMonth0
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
135 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
136 // January,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
137 // February,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
138 // March
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
139 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
140
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
141 // std::string ToString(EnumMonth0 value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
142 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
143 // switch(value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
144 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
145 // case January:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
146 // return "January";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
147 // case February:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
148 // return "February";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
149 // case March:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
150 // return "March";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
151 // default:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
152 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
153 // std::stringstream ss;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
154 // ss << "Unrecognized EnumMonth0 value (" << static_cast<int64_t>(value) << ")";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
155 // throw std::runtime_error(ss.str());
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 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
159
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
160 // void FromString(EnumMonth0& value, std::string strValue)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
161 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
162 // if (strValue == "January" || strValue == "EnumMonth0_January")
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
163 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
164 // return January;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
165 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
166 // else if (strValue == "February" || strValue == "EnumMonth0_February")
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
167 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
168 // return February;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
169 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
170 // #error Not implemented yet
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
171 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
172
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
173 // Json::Value StoneSerialize(const EnumMonth0& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
174 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
175 // return StoneSerialize(ToString(value));
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
176 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
177 // struct Message1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
178 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
179 // int32_t a;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
180 // std::string b;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
181 // EnumMonth0 c;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
182 // bool d;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
183 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
184
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
185 // struct Message2
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
186 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
187 // std::string toto;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
188 // std::vector<Message1> tata;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
189 // std::vector<std::string> tutu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
190 // std::map<std::string, std::string> titi;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
191 // std::map<std::string, Message1> lulu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
192 // };
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
193
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
194 // Json::Value StoneSerialize(const Message1& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
195 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
196 // Json::Value result(Json::objectValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
197 // result["a"] = StoneSerialize(value.a);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
198 // result["b"] = StoneSerialize(value.b);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
199 // result["c"] = StoneSerialize(value.c);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
200 // result["d"] = StoneSerialize(value.d);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
201 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
202 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
203
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
204 // Json::Value StoneSerialize(const Message2& value)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
205 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
206 // Json::Value result(Json::objectValue);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
207 // result["toto"] = StoneSerialize(value.toto);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
208 // result["tata"] = StoneSerialize(value.tata);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
209 // result["tutu"] = StoneSerialize(value.tutu);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
210 // result["titi"] = StoneSerialize(value.titi);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
211 // result["lulu"] = StoneSerialize(value.lulu);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
212 // return result;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
213 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
214 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
215
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
216 // int main()
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
217 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
218 // VsolStuff::Message1 msg1_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
219 // msg1_0.a = 42;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
220 // msg1_0.b = "Benjamin";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
221 // msg1_0.c = VsolStuff::January;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
222 // msg1_0.d = true;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
223
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
224 // VsolStuff::Message1 msg1_1;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
225 // msg1_1.a = 43;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
226 // msg1_1.b = "Sandrine";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
227 // msg1_1.c = VsolStuff::March;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
228 // msg1_0.d = false;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
229
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
230 // // std::string toto;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
231 // // std::vector<Message1> tata;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
232 // // std::vector<std::string> tutu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
233 // // std::map<int32_t, std::string> titi;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
234 // // std::map<int32_t, Message1> lulu;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
235
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
236 // VsolStuff::Message2 msg2_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
237 // msg2_0.toto = "Prout zizi";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
238 // msg2_0.tata.push_back(msg1_0);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
239 // msg2_0.tata.push_back(msg1_1);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
240 // msg2_0.tutu.push_back("Mercadet");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
241 // msg2_0.tutu.push_back("Poisson");
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
242 // msg2_0.titi["44"] = "key 44";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
243 // msg2_0.titi["45"] = "key 45";
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
244 // msg2_0.lulu["54"] = msg1_1;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
245 // msg2_0.lulu["55"] = msg1_0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
246 // auto result = VsolStuff::StoneSerialize(msg2_0);
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
247 // auto resultStr = result.toStyledString();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
248
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
249 // Json::Value readValue;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
250
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
251 // Json::CharReaderBuilder builder;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
252 // Json::CharReader* reader = builder.newCharReader();
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
253 // std::string errors;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
254
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
255 // bool ok = reader->parse(
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
256 // resultStr.c_str(),
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
257 // resultStr.c_str() + resultStr.size(),
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
258 // &readValue,
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
259 // &errors
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
260 // );
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
261 // delete reader;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
262
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
263 // if (!ok)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
264 // {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
265 // std::stringstream ss;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
266 // ss << "Json parsing error: " << errors;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
267 // throw std::runtime_error(ss.str());
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
268 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
269 // std::cout << readValue.get("toto", "Default Value").asString() << std::endl;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
270 // return 0;
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
271 // }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
272
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
273
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
274 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
275