-
Notifications
You must be signed in to change notification settings - Fork 0
/
group-abbreviation-display.go
38 lines (28 loc) · 1.05 KB
/
group-abbreviation-display.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
package mxml
import (
"encoding/xml"
"strings"
)
// GroupAbbreviationDisplay is the structure for group-abbreviation-display MusicXML element.
type GroupAbbreviationDisplay struct {
XMLName xml.Name `xml:"group-abbreviation-display"`
PrintObjectAttr string `xml:"print-object,attr,omitempty"`
AccidentalText []AccidentalText `xml:"accidental-text,omitempty"`
DisplayText []DisplayText `xml:"display-text,omitempty"`
IValue string `xml:",chardata"`
}
// ToMXML creates a MXML.
func (r *GroupAbbreviationDisplay) ToMXML() *MXML {
attributes := make(map[string]string)
children := make(map[string][]*MXML)
attributes["print-object"] = r.PrintObjectAttr
children["accidental-text"] = make([]*MXML, len(r.AccidentalText))
for i, c := range r.AccidentalText {
children["accidental-text"][i] = c.ToMXML()
}
children["display-text"] = make([]*MXML, len(r.DisplayText))
for i, c := range r.DisplayText {
children["display-text"][i] = c.ToMXML()
}
return newMXML("group-abbreviation-display", strings.TrimSpace(r.IValue), attributes, children)
}