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