added warning for when the buffer is not empty after decoding in decmatch
[deliverable/titan.core.git] / xsdconvert / PredefinedModules.cc
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Godar, Marton
11 * Szabo, Bence Janos
12 *
13 ******************************************************************************/
14 /**
15 * Predefined and standardized TTCN-3 modules
16 * containing mappings of XSD element from the http://www.w3.org/2001/XMLSchema namespace
17 *
18 * Modules are generated always when conversion is called
19 *
20 */
21 const char * moduleUsefulTtcn3Types = {
22 "module UsefulTtcn3Types {\n\n\n"
23
24
25 " type integer byte (-128 .. 127) with { variant \"/* 8 bit */\" };\n\n"
26
27 " type integer unsignedbyte (0 .. 255) with { variant \"/*unsigned 8 bit*/\" };\n\n"
28
29 " type integer short (-32768 .. 32767) with { variant \"/*16 bit*/\" };\n\n"
30
31 " type integer unsignedshort (0 .. 65535) with { variant \"/*unsigned 16 bit*/\" };\n\n"
32
33 " type integer long (-2147483648 .. 2147483647) with { variant \"/*32 bit*/\" };\n\n"
34
35 " type integer unsignedlong (0 .. 4294967295) with { variant \"/*unsigned 32 bit*/\" };\n\n"
36
37 " type integer longlong /* ( -9223372036854775808 .. 9223372036854775807 ) */ with { variant \"/*64 bit*/\" };\n\n"
38
39 " type integer unsignedlonglong /* ( 0 .. 18446744073709551615 ) */ with { variant \"/*unsigned 64 bit*/\" };\n\n"
40
41 " type float IEEE754float with { variant \"/*IEEE754 float*/\" };\n\n"
42
43 " type float IEEE754double with { variant \"/*IEEE754 double*/\" };\n\n"
44
45 " type float IEEE754extfloat with { variant \"/*IEEE754 extended float*/\" };\n\n"
46
47 " type float IEEE754extdouble with { variant \"/*IEEE754 extended double*/\" };\n\n"
48
49 " type universal charstring utf8string with { variant \"/*UTF-8*/\" };\n\n"
50
51 " type universal charstring bmpstring ( char ( 0,0,0,0 ) .. char ( 0,0,255,255) ) with { variant \"/*UCS-2*/\" };\n\n"
52
53 " type universal charstring utf16string ( char ( 0,0,0,0 ) .. char ( 0,16,255,255) ) with { variant \"/*UTF-16*/\" };\n\n"
54
55 " type universal charstring iso8859string ( char ( 0,0,0,0 ) .. char ( 0,0,0,255) ) with { variant \"/*8 bit*/\" };\n\n"
56
57 " type record IDLfixed\n"
58 " {\n"
59 " unsignedshort digits,\n"
60 " short scale,\n"
61 " charstring value_\n"
62 " }\n"
63 " with {\n"
64 " variant \"/*IDL:fixed FORMAL/01-12-01 v.2.6*/\";\n"
65 " };\n\n"
66
67 " /*\n"
68 " type charstring char length (1);\n\n"
69
70 " NOTE 1: The name of this useful type is the same as the TTCN-3 keyword used to denote universal\n"
71 " charstring values in the quadraple form. In general it is disallowed to use TTCN-3 keywords as\n"
72 " identifiers. The \"char\" useful type is a solitary exception and allowed only for backward compatibility\n"
73 " with previous versions of the TTCN-3 standard. (except Titan doesn't)\n\n"
74
75 " NOTE 2: The special string \"8 bit\" defined in clause 28.2.3 may be used with this type to specify a given encoding\n"
76 " for its values. Also, other properties of the base type can be changed by using attribute mechanisms.\n"
77 " */\n\n"
78
79 " type universal charstring uchar length (1);\n\n"
80
81 " /*\n"
82 " NOTE: Special strings defined in clause 28.2.3 except \"8 bit\" may be used with this type to specify a given\n"
83 " encoding for its values. Also, other properties of the base type can be changed by using attribute\n"
84 " mechanisms.\n"
85 " */\n\n"
86
87 " type bitstring bit length (1);\n\n"
88
89 " type hexstring hex length (1);\n\n"
90
91 " type octetstring octet length (1);\n\n"
92
93 "}\n"
94 "with {\n"
95 "encode \"XML\";\n"
96 "}\n"
97
98 };
99
100 const char * moduleXSD = {
101
102 "module XSD {\n\n"
103
104 "import from UsefulTtcn3Types all;\n\n"
105
106 "//These constants are used in the XSD date/time type definitions\n"
107 "const charstring\n"
108 " dash := \"-\",\n"
109 " cln := \":\",\n"
110 " year := \"[0-9]#4\",\n"
111 " yearExpansion := \"(-([1-9][0-9]#(0,))#(,1))#(,1)\",\n"
112 " month := \"(0[1-9]|1[0-2])\",\n"
113 " dayOfMonth := \"(0[1-9]|[12][0-9]|3[01])\",\n"
114 " hour := \"([01][0-9]|2[0-3])\",\n"
115 " minute := \"([0-5][0-9])\",\n"
116 " second := \"([0-5][0-9])\",\n"
117 " sFraction := \"(.[0-9]#(1,))#(,1)\",\n"
118 " endOfDayExt := \"24:00:00(.0#(1,))#(,1)\",\n"
119 " nums := \"[0-9]#(1,)\",\n"
120 " ZorTimeZoneExt := \"(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))#(,1)\",\n"
121 " durTime := \"(T[0-9]#(1,)\"&\n"
122 " \"(H([0-9]#(1,)(M([0-9]#(1,)(S|.[0-9]#(1,)S))#(,1)|.[0-9]#(1,)S|S))#(,1)|\"&\n"
123 " \"M([0-9]#(1,)(S|.[0-9]#(1,)S)|.[0-9]#(1,)M)#(,1)|\"&\n"
124 " \"S|\"&\n"
125 " \".[0-9]#(1,)S))\"\n\n"
126
127 "//anySimpleType\n\n"
128
129 "type XMLCompatibleString AnySimpleType\n"
130 "with {\n"
131 "variant \"XSD:anySimpleType\";\n"
132 "};\n\n"
133
134 "//anyType;\n\n"
135
136 "type record AnyType\n"
137 "{\n"
138 " record of String embed_values optional,\n"
139 " record of String attr optional,\n"
140 " record of String elem_list\n"
141 "}\n"
142 "with {\n"
143 "variant \"XSD:anyType\";\n"
144 "variant \"embedValues\";\n"
145 "variant (attr) \"anyAttributes\";\n"
146 "variant (elem_list) \"anyElement\";\n"
147 "};\n"
148
149 "// String types\n\n"
150
151 "type XMLCompatibleString String\n"
152 "with {\n"
153 "variant \"XSD:string\";\n"
154 "};\n\n"
155
156 "type XMLStringWithNoCRLFHT NormalizedString\n"
157 "with {\n"
158 "variant \"XSD:normalizedString\";\n"
159 "};\n\n"
160
161 "type NormalizedString Token\n"
162 "with {\n"
163 "variant \"XSD:token\";\n"
164 "};\n\n"
165
166 "type XMLStringWithNoWhitespace Name\n"
167 "with {\n"
168 "variant \"XSD:Name\";\n"
169 "};\n\n"
170
171 "type XMLStringWithNoWhitespace NMTOKEN\n"
172 "with {\n"
173 "variant \"XSD:NMTOKEN\";\n"
174 "};\n\n"
175
176 "type Name NCName\n"
177 "with {\n"
178 "variant \"XSD:NCName\";\n"
179 "};\n\n"
180
181 "type NCName ID\n"
182 "with {\n"
183 "variant \"XSD:ID\";\n"
184 "};\n\n"
185
186 "type NCName IDREF\n"
187 "with {\n"
188 "variant \"XSD:IDREF\";\n"
189 "};\n\n"
190
191 "type NCName ENTITY\n"
192 "with {\n"
193 "variant \"XSD:ENTITY\";\n"
194 "};\n\n"
195
196 "type octetstring HexBinary\n"
197 "with {\n"
198 "variant \"XSD:hexBinary\";\n"
199 "};\n\n"
200
201 "type octetstring Base64Binary\n"
202 "with {\n"
203 "variant \"XSD:base64Binary\";\n"
204 "};\n\n"
205
206 "type XMLStringWithNoCRLFHT AnyURI\n"
207 "with {\n"
208 "variant \"XSD:anyURI\";\n"
209 "};\n\n"
210
211 "type charstring Language (pattern \"[a-zA-Z]#(1,8)(-\\w#(1,8))#(0,)\")\n"
212 "with {\n"
213 "variant \"XSD:language\";\n"
214 "};\n"
215
216 "// Integer types\n\n"
217
218 "type integer Integer\n"
219 "with {\n"
220 "variant \"XSD:integer\";\n"
221 "};\n\n"
222
223 "type integer PositiveInteger (1 .. infinity)\n"
224 "with {\n"
225 "variant \"XSD:positiveInteger\";\n"
226 "};\n\n"
227
228 "type integer NonPositiveInteger (-infinity .. 0)\n"
229 "with {\n"
230 "variant \"XSD:nonPositiveInteger\";\n"
231 "};\n\n"
232
233 "type integer NegativeInteger (-infinity .. -1)\n"
234 "with {\n"
235 "variant \"XSD:negativeInteger\";\n"
236 "};\n\n"
237
238 "type integer NonNegativeInteger (0 .. infinity)\n"
239 "with {\n"
240 "variant \"XSD:nonNegativeInteger\";\n"
241 "};\n\n"
242
243 "type longlong Long\n"
244 "with {\n"
245 "variant \"XSD:long\";\n"
246 "};\n\n"
247
248 "type unsignedlonglong UnsignedLong\n"
249 "with {\n"
250 "variant \"XSD:unsignedLong\";\n"
251 "};\n\n"
252
253 "type long Int\n"
254 "with {\n"
255 "variant \"XSD:int\";\n"
256 "};\n\n"
257
258 "type unsignedlong UnsignedInt\n"
259 "with {\n"
260 "variant \"XSD:unsignedInt\";\n"
261 "};\n\n"
262
263 "type short Short\n"
264 "with {\n"
265 "variant \"XSD:short\";\n"
266 "};\n\n"
267
268 "type unsignedshort UnsignedShort\n"
269 "with {\n"
270 "variant \"XSD:unsignedShort\";\n"
271 "};\n\n"
272
273 "type byte Byte\n"
274 "with {\n"
275 "variant \"XSD:byte\";\n"
276 "};\n\n"
277
278 "type unsignedbyte UnsignedByte\n"
279 "with {\n"
280 "variant \"XSD:unsignedByte\";\n"
281 "};\n\n"
282
283 "// Float types\n\n"
284
285 "type float Decimal\n"
286 "with {\n"
287 "variant \"XSD:decimal\";\n"
288 "};\n\n"
289
290 "type IEEE754float Float\n"
291 "with {\n"
292 "variant \"XSD:float\";\n"
293 "};\n\n"
294
295 "type IEEE754double Double\n"
296 "with {\n"
297 "variant \"XSD:double\";\n"
298 "};\n\n"
299
300 "// Time types\n\n"
301
302
303 "type charstring Duration (pattern\n"
304 " \"{dash}#(,1)P({nums}(Y({nums}(M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|\" &\n"
305 " \"{durTime}#(,1))|M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|{durTime})\")\n"
306 "with {\n"
307 "variant \"XSD:duration\";\n"
308 "};\n\n"
309
310 "type charstring DateTime (pattern\n"
311 " \"{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}T({hour}{cln}{minute}{cln}{second}\" &\n"
312 " \"{sFraction}|{endOfDayExt}){ZorTimeZoneExt}\" )\n"
313 "with {\n"
314 "variant \"XSD:dateTime\";\n"
315 "};\n\n"
316
317 "type charstring Time (pattern\n"
318 " \"({hour}{cln}{minute}{cln}{second}{sFraction}|{endOfDayExt}){ZorTimeZoneExt}\" )\n"
319 "with {\n"
320 "variant \"XSD:time\";\n"
321 "};\n\n"
322
323 "type charstring Date (pattern\n"
324 " \"{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}\" )\n"
325 "with {\n"
326 "variant \"XSD:date\";\n"
327 "};\n\n"
328
329 "type charstring GYearMonth (pattern\n"
330 " \"{yearExpansion}{year}{dash}{month}{ZorTimeZoneExt}\" )\n"
331 "with {\n"
332 "variant \"XSD:gYearMonth\";\n"
333 "};\n\n"
334
335 "type charstring GYear (pattern\n"
336 " \"{yearExpansion}{year}{ZorTimeZoneExt}\" )\n"
337 "with {\n"
338 "variant \"XSD:gYear\";\n"
339 "};\n\n"
340
341 "type charstring GMonthDay (pattern\n"
342 " \"{dash}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}\" )\n"
343 "with {\n"
344 "variant \"XSD:gMonthDay\";\n"
345 "};\n\n"
346
347 "type charstring GDay (pattern\n"
348 " \"{dash}{dash}{dash}{dayOfMonth}{ZorTimeZoneExt}\" )\n"
349 "with {\n"
350 "variant \"XSD:gDay\";\n"
351 "};\n\n"
352
353 "type charstring GMonth (pattern\n"
354 " \"{dash}{dash}{month}{ZorTimeZoneExt}\" )\n"
355 "with {\n"
356 "variant \"XSD:gMonth\";\n"
357 "};\n\n"
358
359 "// Sequence types\n\n"
360
361 "type record of NMTOKEN NMTOKENS\n"
362 "with {\n"
363 "variant \"XSD:NMTOKENS\";\n"
364 "};\n\n"
365
366 "type record of IDREF IDREFS\n"
367 "with {\n"
368 "variant \"XSD:IDREFS\";\n"
369 "};\n\n"
370
371 "type record of ENTITY ENTITIES\n"
372 "with {\n"
373 "variant \"XSD:ENTITIES\";\n"
374 "};\n\n"
375
376 "type record QName\n"
377 "{\n"
378 " AnyURI uri optional,\n"
379 " NCName name\n"
380 "}\n"
381 "with {\n"
382 "variant \"XSD:QName\";\n"
383 "};\n\n"
384
385 "// Boolean type\n\n"
386
387 "type boolean Boolean\n"
388 "with {\n"
389 "variant \"XSD:boolean\";\n"
390 "};\n\n"
391
392 "//TTCN-3 type definitions supporting the mapping of W3C XML Schema built-in datatypes\n\n"
393
394 "type utf8string XMLCompatibleString\n"
395 "(\n"
396 " char(0,0,0,9)..char(0,0,0,9),\n"
397 " char(0,0,0,10)..char(0,0,0,10),\n"
398 " char(0,0,0,13)..char(0,0,0,13),\n"
399 " char(0,0,0,32)..char(0,0,215,255),\n"
400 " char(0,0,224,0)..char(0,0,255,253),\n"
401 " char(0,1,0,0)..char(0,16,255,253)\n"
402 ")\n\n"
403
404 "type utf8string XMLStringWithNoWhitespace\n"
405 "(\n"
406 " char(0,0,0,33)..char(0,0,215,255),\n"
407 " char(0,0,224,0)..char(0,0,255,253),\n"
408 " char(0,1,0,0)..char(0,16,255,253)\n"
409 ")\n\n"
410
411 "type utf8string XMLStringWithNoCRLFHT\n"
412 "(\n"
413 " char(0,0,0,32)..char(0,0,215,255),\n"
414 " char(0,0,224,0)..char(0,0,255,253),\n"
415 " char(0,1,0,0)..char(0,16,255,253)\n"
416 ")\n\n"
417
418 "}\n"
419 "with{\n"
420 "encode \"XML\"\n"
421 "}\n"
422
423 };
This page took 0.03911 seconds and 5 git commands to generate.