forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ST_LayoutShapeType.go
62 lines (54 loc) · 1.7 KB
/
ST_LayoutShapeType.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
// 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"
"baliance.com/gooxml/schema/soo/dml"
)
// ST_LayoutShapeType is a union type
type ST_LayoutShapeType struct {
ST_ShapeType dml.ST_ShapeType
ST_OutputShapeType ST_OutputShapeType
}
func (m *ST_LayoutShapeType) Validate() error {
return m.ValidateWithPath("")
}
func (m ST_LayoutShapeType) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.ST_ShapeType != dml.ST_ShapeTypeUnset {
e.EncodeToken(xml.CharData(m.ST_ShapeType.String()))
}
if m.ST_OutputShapeType != ST_OutputShapeTypeUnset {
e.EncodeToken(xml.CharData(m.ST_OutputShapeType.String()))
}
return e.EncodeToken(xml.EndElement{Name: start.Name})
}
func (m *ST_LayoutShapeType) ValidateWithPath(path string) error {
mems := []string{}
if m.ST_ShapeType != dml.ST_ShapeTypeUnset {
mems = append(mems, "ST_ShapeType")
}
if m.ST_OutputShapeType != ST_OutputShapeTypeUnset {
mems = append(mems, "ST_OutputShapeType")
}
if len(mems) > 1 {
return fmt.Errorf("%s too many members set: %v", path, mems)
}
return nil
}
func (m ST_LayoutShapeType) String() string {
if m.ST_ShapeType != dml.ST_ShapeTypeUnset {
return m.ST_ShapeType.String()
}
if m.ST_OutputShapeType != ST_OutputShapeTypeUnset {
return m.ST_OutputShapeType.String()
}
return ""
}