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