-
Notifications
You must be signed in to change notification settings - Fork 60
/
Vector.go
205 lines (196 loc) · 6.6 KB
/
Vector.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
// 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 docPropsVTypes
import (
"encoding/xml"
"strconv"
"time"
"github.com/carmel/gooxml"
)
type Vector struct {
CT_Vector
}
func NewVector() *Vector {
ret := &Vector{}
ret.CT_Vector = *NewCT_Vector()
return ret
}
func (m *Vector) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return m.CT_Vector.MarshalXML(e, start)
}
func (m *Vector) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
m.CT_Vector = *NewCT_Vector()
for _, attr := range start.Attr {
if attr.Name.Local == "size" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
m.SizeAttr = uint32(parsed)
continue
}
if attr.Name.Local == "baseType" {
m.BaseTypeAttr.UnmarshalXMLAttr(attr)
continue
}
}
lVector:
for {
tok, err := d.Token()
if err != nil {
return err
}
switch el := tok.(type) {
case xml.StartElement:
switch el.Name {
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "variant"}:
tmp := NewVariant()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Variant = append(m.Variant, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "i1"}:
var tmp int8
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.I1 = append(m.I1, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "i2"}:
var tmp int16
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.I2 = append(m.I2, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "i4"}:
var tmp int32
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.I4 = append(m.I4, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "i8"}:
var tmp int64
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.I8 = append(m.I8, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "ui1"}:
var tmp uint8
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Ui1 = append(m.Ui1, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "ui2"}:
var tmp uint16
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Ui2 = append(m.Ui2, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "ui4"}:
var tmp uint32
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Ui4 = append(m.Ui4, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "ui8"}:
var tmp uint64
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Ui8 = append(m.Ui8, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "r4"}:
var tmp float32
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.R4 = append(m.R4, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "r8"}:
var tmp float64
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.R8 = append(m.R8, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "lpstr"}:
var tmp string
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Lpstr = append(m.Lpstr, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "lpwstr"}:
var tmp string
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Lpwstr = append(m.Lpwstr, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "bstr"}:
var tmp string
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Bstr = append(m.Bstr, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "date"}:
var tmp time.Time
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Date = append(m.Date, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "filetime"}:
var tmp time.Time
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Filetime = append(m.Filetime, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "bool"}:
var tmp bool
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Bool = append(m.Bool, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "cy"}:
var tmp string
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Cy = append(m.Cy, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "error"}:
var tmp string
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Error = append(m.Error, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", Local: "clsid"}:
var tmp string
if err := d.DecodeElement(&tmp, &el); err != nil {
return err
}
m.Clsid = append(m.Clsid, tmp)
default:
gooxml.Log("skipping unsupported element on Vector %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lVector
case xml.CharData:
}
}
return nil
}
// Validate validates the Vector and its children
func (m *Vector) Validate() error {
return m.ValidateWithPath("Vector")
}
// ValidateWithPath validates the Vector and its children, prefixing error messages with path
func (m *Vector) ValidateWithPath(path string) error {
if err := m.CT_Vector.ValidateWithPath(path); err != nil {
return err
}
return nil
}