forked from srinathh/gooxml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ST_ParameterVal.go
400 lines (393 loc) · 13.9 KB
/
ST_ParameterVal.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased by contacting sales@baliance.com.
package diagram
import (
"encoding/xml"
"fmt"
)
// ST_ParameterVal is a union type
type ST_ParameterVal struct {
ST_DiagramHorizontalAlignment ST_DiagramHorizontalAlignment
ST_VerticalAlignment ST_VerticalAlignment
ST_ChildDirection ST_ChildDirection
ST_ChildAlignment ST_ChildAlignment
ST_SecondaryChildAlignment ST_SecondaryChildAlignment
ST_LinearDirection ST_LinearDirection
ST_SecondaryLinearDirection ST_SecondaryLinearDirection
ST_StartingElement ST_StartingElement
ST_BendPoint ST_BendPoint
ST_ConnectorRouting ST_ConnectorRouting
ST_ArrowheadStyle ST_ArrowheadStyle
ST_ConnectorDimension ST_ConnectorDimension
ST_RotationPath ST_RotationPath
ST_CenterShapeMapping ST_CenterShapeMapping
ST_NodeHorizontalAlignment ST_NodeHorizontalAlignment
ST_NodeVerticalAlignment ST_NodeVerticalAlignment
ST_FallbackDimension ST_FallbackDimension
ST_TextDirection ST_TextDirection
ST_PyramidAccentPosition ST_PyramidAccentPosition
ST_PyramidAccentTextMargin ST_PyramidAccentTextMargin
ST_TextBlockDirection ST_TextBlockDirection
ST_TextAnchorHorizontal ST_TextAnchorHorizontal
ST_TextAnchorVertical ST_TextAnchorVertical
ST_DiagramTextAlignment ST_DiagramTextAlignment
ST_AutoTextRotation ST_AutoTextRotation
ST_GrowDirection ST_GrowDirection
ST_FlowDirection ST_FlowDirection
ST_ContinueDirection ST_ContinueDirection
ST_Breakpoint ST_Breakpoint
ST_Offset ST_Offset
ST_HierarchyAlignment ST_HierarchyAlignment
Int32 *int32
Float64 *float64
Bool *bool
StringVal *string
ST_ConnectorPoint ST_ConnectorPoint
}
func (m *ST_ParameterVal) Validate() error {
return m.ValidateWithPath("")
}
func (m ST_ParameterVal) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.ST_DiagramHorizontalAlignment != ST_DiagramHorizontalAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_DiagramHorizontalAlignment.String()))
}
if m.ST_VerticalAlignment != ST_VerticalAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_VerticalAlignment.String()))
}
if m.ST_ChildDirection != ST_ChildDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_ChildDirection.String()))
}
if m.ST_ChildAlignment != ST_ChildAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_ChildAlignment.String()))
}
if m.ST_SecondaryChildAlignment != ST_SecondaryChildAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_SecondaryChildAlignment.String()))
}
if m.ST_LinearDirection != ST_LinearDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_LinearDirection.String()))
}
if m.ST_SecondaryLinearDirection != ST_SecondaryLinearDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_SecondaryLinearDirection.String()))
}
if m.ST_StartingElement != ST_StartingElementUnset {
e.EncodeToken(xml.CharData(m.ST_StartingElement.String()))
}
if m.ST_BendPoint != ST_BendPointUnset {
e.EncodeToken(xml.CharData(m.ST_BendPoint.String()))
}
if m.ST_ConnectorRouting != ST_ConnectorRoutingUnset {
e.EncodeToken(xml.CharData(m.ST_ConnectorRouting.String()))
}
if m.ST_ArrowheadStyle != ST_ArrowheadStyleUnset {
e.EncodeToken(xml.CharData(m.ST_ArrowheadStyle.String()))
}
if m.ST_ConnectorDimension != ST_ConnectorDimensionUnset {
e.EncodeToken(xml.CharData(m.ST_ConnectorDimension.String()))
}
if m.ST_RotationPath != ST_RotationPathUnset {
e.EncodeToken(xml.CharData(m.ST_RotationPath.String()))
}
if m.ST_CenterShapeMapping != ST_CenterShapeMappingUnset {
e.EncodeToken(xml.CharData(m.ST_CenterShapeMapping.String()))
}
if m.ST_NodeHorizontalAlignment != ST_NodeHorizontalAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_NodeHorizontalAlignment.String()))
}
if m.ST_NodeVerticalAlignment != ST_NodeVerticalAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_NodeVerticalAlignment.String()))
}
if m.ST_FallbackDimension != ST_FallbackDimensionUnset {
e.EncodeToken(xml.CharData(m.ST_FallbackDimension.String()))
}
if m.ST_TextDirection != ST_TextDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_TextDirection.String()))
}
if m.ST_PyramidAccentPosition != ST_PyramidAccentPositionUnset {
e.EncodeToken(xml.CharData(m.ST_PyramidAccentPosition.String()))
}
if m.ST_PyramidAccentTextMargin != ST_PyramidAccentTextMarginUnset {
e.EncodeToken(xml.CharData(m.ST_PyramidAccentTextMargin.String()))
}
if m.ST_TextBlockDirection != ST_TextBlockDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_TextBlockDirection.String()))
}
if m.ST_TextAnchorHorizontal != ST_TextAnchorHorizontalUnset {
e.EncodeToken(xml.CharData(m.ST_TextAnchorHorizontal.String()))
}
if m.ST_TextAnchorVertical != ST_TextAnchorVerticalUnset {
e.EncodeToken(xml.CharData(m.ST_TextAnchorVertical.String()))
}
if m.ST_DiagramTextAlignment != ST_DiagramTextAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_DiagramTextAlignment.String()))
}
if m.ST_AutoTextRotation != ST_AutoTextRotationUnset {
e.EncodeToken(xml.CharData(m.ST_AutoTextRotation.String()))
}
if m.ST_GrowDirection != ST_GrowDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_GrowDirection.String()))
}
if m.ST_FlowDirection != ST_FlowDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_FlowDirection.String()))
}
if m.ST_ContinueDirection != ST_ContinueDirectionUnset {
e.EncodeToken(xml.CharData(m.ST_ContinueDirection.String()))
}
if m.ST_Breakpoint != ST_BreakpointUnset {
e.EncodeToken(xml.CharData(m.ST_Breakpoint.String()))
}
if m.ST_Offset != ST_OffsetUnset {
e.EncodeToken(xml.CharData(m.ST_Offset.String()))
}
if m.ST_HierarchyAlignment != ST_HierarchyAlignmentUnset {
e.EncodeToken(xml.CharData(m.ST_HierarchyAlignment.String()))
}
if m.Int32 != nil {
e.EncodeToken(xml.CharData(fmt.Sprintf("%d", *m.Int32)))
}
if m.Float64 != nil {
e.EncodeToken(xml.CharData(fmt.Sprintf("%f", *m.Float64)))
}
if m.Bool != nil {
e.EncodeToken(xml.CharData(fmt.Sprintf("%d", b2i(*m.Bool))))
}
if m.StringVal != nil {
e.EncodeToken(xml.CharData(*m.StringVal))
}
if m.ST_ConnectorPoint != ST_ConnectorPointUnset {
e.EncodeToken(xml.CharData(m.ST_ConnectorPoint.String()))
}
return e.EncodeToken(xml.EndElement{Name: start.Name})
}
func (m *ST_ParameterVal) ValidateWithPath(path string) error {
mems := []string{}
if m.ST_DiagramHorizontalAlignment != ST_DiagramHorizontalAlignmentUnset {
mems = append(mems, "ST_DiagramHorizontalAlignment")
}
if m.ST_VerticalAlignment != ST_VerticalAlignmentUnset {
mems = append(mems, "ST_VerticalAlignment")
}
if m.ST_ChildDirection != ST_ChildDirectionUnset {
mems = append(mems, "ST_ChildDirection")
}
if m.ST_ChildAlignment != ST_ChildAlignmentUnset {
mems = append(mems, "ST_ChildAlignment")
}
if m.ST_SecondaryChildAlignment != ST_SecondaryChildAlignmentUnset {
mems = append(mems, "ST_SecondaryChildAlignment")
}
if m.ST_LinearDirection != ST_LinearDirectionUnset {
mems = append(mems, "ST_LinearDirection")
}
if m.ST_SecondaryLinearDirection != ST_SecondaryLinearDirectionUnset {
mems = append(mems, "ST_SecondaryLinearDirection")
}
if m.ST_StartingElement != ST_StartingElementUnset {
mems = append(mems, "ST_StartingElement")
}
if m.ST_BendPoint != ST_BendPointUnset {
mems = append(mems, "ST_BendPoint")
}
if m.ST_ConnectorRouting != ST_ConnectorRoutingUnset {
mems = append(mems, "ST_ConnectorRouting")
}
if m.ST_ArrowheadStyle != ST_ArrowheadStyleUnset {
mems = append(mems, "ST_ArrowheadStyle")
}
if m.ST_ConnectorDimension != ST_ConnectorDimensionUnset {
mems = append(mems, "ST_ConnectorDimension")
}
if m.ST_RotationPath != ST_RotationPathUnset {
mems = append(mems, "ST_RotationPath")
}
if m.ST_CenterShapeMapping != ST_CenterShapeMappingUnset {
mems = append(mems, "ST_CenterShapeMapping")
}
if m.ST_NodeHorizontalAlignment != ST_NodeHorizontalAlignmentUnset {
mems = append(mems, "ST_NodeHorizontalAlignment")
}
if m.ST_NodeVerticalAlignment != ST_NodeVerticalAlignmentUnset {
mems = append(mems, "ST_NodeVerticalAlignment")
}
if m.ST_FallbackDimension != ST_FallbackDimensionUnset {
mems = append(mems, "ST_FallbackDimension")
}
if m.ST_TextDirection != ST_TextDirectionUnset {
mems = append(mems, "ST_TextDirection")
}
if m.ST_PyramidAccentPosition != ST_PyramidAccentPositionUnset {
mems = append(mems, "ST_PyramidAccentPosition")
}
if m.ST_PyramidAccentTextMargin != ST_PyramidAccentTextMarginUnset {
mems = append(mems, "ST_PyramidAccentTextMargin")
}
if m.ST_TextBlockDirection != ST_TextBlockDirectionUnset {
mems = append(mems, "ST_TextBlockDirection")
}
if m.ST_TextAnchorHorizontal != ST_TextAnchorHorizontalUnset {
mems = append(mems, "ST_TextAnchorHorizontal")
}
if m.ST_TextAnchorVertical != ST_TextAnchorVerticalUnset {
mems = append(mems, "ST_TextAnchorVertical")
}
if m.ST_DiagramTextAlignment != ST_DiagramTextAlignmentUnset {
mems = append(mems, "ST_DiagramTextAlignment")
}
if m.ST_AutoTextRotation != ST_AutoTextRotationUnset {
mems = append(mems, "ST_AutoTextRotation")
}
if m.ST_GrowDirection != ST_GrowDirectionUnset {
mems = append(mems, "ST_GrowDirection")
}
if m.ST_FlowDirection != ST_FlowDirectionUnset {
mems = append(mems, "ST_FlowDirection")
}
if m.ST_ContinueDirection != ST_ContinueDirectionUnset {
mems = append(mems, "ST_ContinueDirection")
}
if m.ST_Breakpoint != ST_BreakpointUnset {
mems = append(mems, "ST_Breakpoint")
}
if m.ST_Offset != ST_OffsetUnset {
mems = append(mems, "ST_Offset")
}
if m.ST_HierarchyAlignment != ST_HierarchyAlignmentUnset {
mems = append(mems, "ST_HierarchyAlignment")
}
if m.Int32 != nil {
mems = append(mems, "Int32")
}
if m.Float64 != nil {
mems = append(mems, "Float64")
}
if m.Bool != nil {
mems = append(mems, "Bool")
}
if m.StringVal != nil {
mems = append(mems, "StringVal")
}
if m.ST_ConnectorPoint != ST_ConnectorPointUnset {
mems = append(mems, "ST_ConnectorPoint")
}
if len(mems) > 1 {
return fmt.Errorf("%s too many members set: %v", path, mems)
}
return nil
}
func (m ST_ParameterVal) String() string {
if m.ST_DiagramHorizontalAlignment != ST_DiagramHorizontalAlignmentUnset {
return m.ST_DiagramHorizontalAlignment.String()
}
if m.ST_VerticalAlignment != ST_VerticalAlignmentUnset {
return m.ST_VerticalAlignment.String()
}
if m.ST_ChildDirection != ST_ChildDirectionUnset {
return m.ST_ChildDirection.String()
}
if m.ST_ChildAlignment != ST_ChildAlignmentUnset {
return m.ST_ChildAlignment.String()
}
if m.ST_SecondaryChildAlignment != ST_SecondaryChildAlignmentUnset {
return m.ST_SecondaryChildAlignment.String()
}
if m.ST_LinearDirection != ST_LinearDirectionUnset {
return m.ST_LinearDirection.String()
}
if m.ST_SecondaryLinearDirection != ST_SecondaryLinearDirectionUnset {
return m.ST_SecondaryLinearDirection.String()
}
if m.ST_StartingElement != ST_StartingElementUnset {
return m.ST_StartingElement.String()
}
if m.ST_BendPoint != ST_BendPointUnset {
return m.ST_BendPoint.String()
}
if m.ST_ConnectorRouting != ST_ConnectorRoutingUnset {
return m.ST_ConnectorRouting.String()
}
if m.ST_ArrowheadStyle != ST_ArrowheadStyleUnset {
return m.ST_ArrowheadStyle.String()
}
if m.ST_ConnectorDimension != ST_ConnectorDimensionUnset {
return m.ST_ConnectorDimension.String()
}
if m.ST_RotationPath != ST_RotationPathUnset {
return m.ST_RotationPath.String()
}
if m.ST_CenterShapeMapping != ST_CenterShapeMappingUnset {
return m.ST_CenterShapeMapping.String()
}
if m.ST_NodeHorizontalAlignment != ST_NodeHorizontalAlignmentUnset {
return m.ST_NodeHorizontalAlignment.String()
}
if m.ST_NodeVerticalAlignment != ST_NodeVerticalAlignmentUnset {
return m.ST_NodeVerticalAlignment.String()
}
if m.ST_FallbackDimension != ST_FallbackDimensionUnset {
return m.ST_FallbackDimension.String()
}
if m.ST_TextDirection != ST_TextDirectionUnset {
return m.ST_TextDirection.String()
}
if m.ST_PyramidAccentPosition != ST_PyramidAccentPositionUnset {
return m.ST_PyramidAccentPosition.String()
}
if m.ST_PyramidAccentTextMargin != ST_PyramidAccentTextMarginUnset {
return m.ST_PyramidAccentTextMargin.String()
}
if m.ST_TextBlockDirection != ST_TextBlockDirectionUnset {
return m.ST_TextBlockDirection.String()
}
if m.ST_TextAnchorHorizontal != ST_TextAnchorHorizontalUnset {
return m.ST_TextAnchorHorizontal.String()
}
if m.ST_TextAnchorVertical != ST_TextAnchorVerticalUnset {
return m.ST_TextAnchorVertical.String()
}
if m.ST_DiagramTextAlignment != ST_DiagramTextAlignmentUnset {
return m.ST_DiagramTextAlignment.String()
}
if m.ST_AutoTextRotation != ST_AutoTextRotationUnset {
return m.ST_AutoTextRotation.String()
}
if m.ST_GrowDirection != ST_GrowDirectionUnset {
return m.ST_GrowDirection.String()
}
if m.ST_FlowDirection != ST_FlowDirectionUnset {
return m.ST_FlowDirection.String()
}
if m.ST_ContinueDirection != ST_ContinueDirectionUnset {
return m.ST_ContinueDirection.String()
}
if m.ST_Breakpoint != ST_BreakpointUnset {
return m.ST_Breakpoint.String()
}
if m.ST_Offset != ST_OffsetUnset {
return m.ST_Offset.String()
}
if m.ST_HierarchyAlignment != ST_HierarchyAlignmentUnset {
return m.ST_HierarchyAlignment.String()
}
if m.Int32 != nil {
return fmt.Sprintf("%v", *m.Int32)
}
if m.Float64 != nil {
return fmt.Sprintf("%v", *m.Float64)
}
if m.Bool != nil {
return fmt.Sprintf("%v", *m.Bool)
}
if m.StringVal != nil {
return fmt.Sprintf("%v", *m.StringVal)
}
if m.ST_ConnectorPoint != ST_ConnectorPointUnset {
return m.ST_ConnectorPoint.String()
}
return ""
}