forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ST_FunctionValue.go
110 lines (103 loc) · 3.03 KB
/
ST_FunctionValue.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
// 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_FunctionValue is a union type
type ST_FunctionValue struct {
Int32 *int32
Bool *bool
ST_Direction ST_Direction
ST_HierBranchStyle ST_HierBranchStyle
ST_AnimOneStr ST_AnimOneStr
ST_AnimLvlStr ST_AnimLvlStr
ST_ResizeHandlesStr ST_ResizeHandlesStr
}
func (m *ST_FunctionValue) Validate() error {
return m.ValidateWithPath("")
}
func (m ST_FunctionValue) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.Int32 != nil {
e.EncodeToken(xml.CharData(fmt.Sprintf("%d", *m.Int32)))
}
if m.Bool != nil {
e.EncodeToken(xml.CharData(fmt.Sprintf("%d", b2i(*m.Bool))))
}
if m.ST_Direction != ST_DirectionUnset {
e.EncodeToken(xml.CharData(m.ST_Direction.String()))
}
if m.ST_HierBranchStyle != ST_HierBranchStyleUnset {
e.EncodeToken(xml.CharData(m.ST_HierBranchStyle.String()))
}
if m.ST_AnimOneStr != ST_AnimOneStrUnset {
e.EncodeToken(xml.CharData(m.ST_AnimOneStr.String()))
}
if m.ST_AnimLvlStr != ST_AnimLvlStrUnset {
e.EncodeToken(xml.CharData(m.ST_AnimLvlStr.String()))
}
if m.ST_ResizeHandlesStr != ST_ResizeHandlesStrUnset {
e.EncodeToken(xml.CharData(m.ST_ResizeHandlesStr.String()))
}
return e.EncodeToken(xml.EndElement{Name: start.Name})
}
func (m *ST_FunctionValue) ValidateWithPath(path string) error {
mems := []string{}
if m.Int32 != nil {
mems = append(mems, "Int32")
}
if m.Bool != nil {
mems = append(mems, "Bool")
}
if m.ST_Direction != ST_DirectionUnset {
mems = append(mems, "ST_Direction")
}
if m.ST_HierBranchStyle != ST_HierBranchStyleUnset {
mems = append(mems, "ST_HierBranchStyle")
}
if m.ST_AnimOneStr != ST_AnimOneStrUnset {
mems = append(mems, "ST_AnimOneStr")
}
if m.ST_AnimLvlStr != ST_AnimLvlStrUnset {
mems = append(mems, "ST_AnimLvlStr")
}
if m.ST_ResizeHandlesStr != ST_ResizeHandlesStrUnset {
mems = append(mems, "ST_ResizeHandlesStr")
}
if len(mems) > 1 {
return fmt.Errorf("%s too many members set: %v", path, mems)
}
return nil
}
func (m ST_FunctionValue) String() string {
if m.Int32 != nil {
return fmt.Sprintf("%v", *m.Int32)
}
if m.Bool != nil {
return fmt.Sprintf("%v", *m.Bool)
}
if m.ST_Direction != ST_DirectionUnset {
return m.ST_Direction.String()
}
if m.ST_HierBranchStyle != ST_HierBranchStyleUnset {
return m.ST_HierBranchStyle.String()
}
if m.ST_AnimOneStr != ST_AnimOneStrUnset {
return m.ST_AnimOneStr.String()
}
if m.ST_AnimLvlStr != ST_AnimLvlStrUnset {
return m.ST_AnimLvlStr.String()
}
if m.ST_ResizeHandlesStr != ST_ResizeHandlesStrUnset {
return m.ST_ResizeHandlesStr.String()
}
return ""
}