Commit | Line | Data |
---|---|---|
970ed795 EL |
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 | module Types { | |
9 | ||
af710487 | 10 | import from JsonData all; |
11 | ||
970ed795 EL |
12 | const integer c_imported_i :=11; |
13 | ||
14 | type component MTC {} | |
15 | ||
16 | type enumerated Days { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }; | |
17 | ||
18 | type record R { | |
19 | integer i, | |
20 | charstring cs, | |
21 | boolean b, | |
22 | Days d | |
23 | } | |
24 | ||
25 | type record R2 { | |
26 | R r, | |
27 | float f | |
28 | } | |
29 | ||
30 | type record EmptyRec { } | |
31 | ||
32 | type union A { | |
33 | R r, | |
34 | integer i, | |
35 | boolean b, | |
36 | float f | |
37 | } | |
38 | ||
39 | type record of universal charstring RoUCS; | |
40 | type record of charstring RoCS; | |
41 | type record of octetstring RoOS; | |
42 | type record of integer RoI; | |
43 | ||
44 | type record of verdicttype RoV; | |
45 | type record of float RoF; | |
46 | ||
47 | type integer IntArr[3]; | |
48 | type float FloatArr[3]; | |
49 | type universal charstring StrArr[4]; | |
50 | ||
51 | type record Date { | |
52 | charstring month, | |
53 | integer day_idx, | |
54 | Days day_name | |
55 | } | |
56 | ||
57 | type record of Date Dates; | |
58 | ||
59 | type record PhoneNumber { | |
60 | integer country_prefix, | |
61 | integer network_prefix, | |
62 | integer local_number | |
63 | } with { | |
64 | variant(country_prefix) "JSON: name as CountryPrefix"; | |
65 | variant(network_prefix) "JSON: name as NetworkPrefix"; | |
66 | variant(local_number) "JSON : name as LocalNumber" | |
67 | } | |
68 | ||
69 | ||
70 | type record Profile0 { | |
71 | charstring name, | |
72 | PhoneNumber phone_no, | |
73 | charstring email_addr optional, | |
74 | Dates meetings optional | |
75 | } | |
76 | ||
77 | type record Profile { | |
78 | charstring name, | |
79 | PhoneNumber phone_no, | |
80 | charstring email_addr optional, | |
81 | Dates meetings optional | |
82 | } with { | |
83 | //variant(email_addr) "JSON : omit as null"; | |
84 | variant(meetings) "JSON:omit as null"; | |
85 | variant(phone_no) "JSON: name as phone"; | |
86 | variant(email_addr) "JSON: name as email"; | |
87 | } | |
88 | ||
89 | type union CBA { | |
90 | integer i_val, | |
91 | Date date_val, | |
92 | float f_val, | |
93 | charstring cs_val | |
94 | } with { | |
95 | variant(date_val) "JSON:name as date"; | |
96 | variant(i_val) "JSON:name as int"; | |
97 | variant(f_val) "JSON:name as float"; | |
98 | variant(cs_val) "JSON:name as string"; | |
99 | } | |
100 | ||
101 | type set Product { | |
102 | charstring name, | |
103 | float price optional, | |
104 | hexstring code | |
105 | } with { | |
106 | variant(price) "JSON:omit as null" | |
107 | } | |
108 | ||
109 | type union Thing { | |
110 | integer ival, | |
111 | float fval, | |
112 | boolean bval, | |
113 | enumerated { Tiny, Small, Average, Large, Huge } sizeval, | |
114 | bitstring bsval, | |
115 | octetstring osval, | |
116 | union { | |
117 | hexstring hsval, | |
118 | record of charstring rocsval | |
119 | } unival, | |
120 | charstring csval, | |
121 | universal charstring ucsval, | |
122 | Product prodval, | |
123 | record of integer roival, | |
124 | record { | |
125 | charstring name, | |
126 | float price, | |
127 | hexstring productID optional | |
128 | } prod2val | |
129 | } with { | |
130 | variant "JSON:as value"; | |
131 | variant (prod2val.productID) "JSON:name as code"; | |
132 | variant(unival) "JSON:as value"; | |
133 | } | |
134 | ||
135 | type record of Thing Stuff; | |
136 | ||
137 | type record RecDef { | |
138 | integer i, | |
139 | float f, | |
140 | boolean b optional, | |
141 | bitstring bs, | |
142 | hexstring hs, | |
143 | octetstring os, | |
144 | charstring cs, | |
145 | universal charstring ucs, | |
146 | enumerated { Tiny, Small, Medium, Large, Huge } size, | |
147 | verdicttype vt | |
148 | } with { | |
149 | variant(cs) "JSON : default(empty)"; | |
150 | variant(i) "JSON:default(-19)"; | |
151 | variant(f) "JSON:default(1.0e6)"; | |
152 | variant(size) "JSON:default(Tiny)"; | |
153 | variant(os) "JSON : default(1DE7)"; | |
154 | variant(ucs) "JSON:default(üres)"; | |
155 | variant(bs) "JSON:default (101)"; | |
156 | variant(hs) "JSON:default(DEAD)"; | |
157 | variant(vt) "JSON:default(fail)"; | |
158 | variant(b) "JSON:default(false)"; | |
159 | } | |
160 | ||
af710487 | 161 | type record HasPardType { |
162 | ProtocolElem_Field1 pard, | |
163 | boolean buul, | |
164 | Price price | |
165 | } | |
970ed795 EL |
166 | |
167 | } with { | |
168 | encode "JSON"; | |
169 | } |