-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinisection.go
More file actions
35 lines (30 loc) · 860 Bytes
/
Copy pathinisection.go
File metadata and controls
35 lines (30 loc) · 860 Bytes
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
package main
type iniSection struct {
name string
propertyOrder []string
propertyMap map[string]*iniProperty
}
func newSection(name string) *iniSection {
return &iniSection{
name: name,
propertyOrder: []string{},
propertyMap: make(map[string]*iniProperty),
}
}
func (section *iniSection) getProperty(name string) *iniProperty {
if property, isFound := section.propertyMap[name]; isFound {
return property
}
property := newProperty(name)
section.propertyOrder = append(section.propertyOrder, name)
section.propertyMap[name] = property
return property
}
func (section *iniSection) allProperties() []*iniProperty {
properties := []*iniProperty{}
for _, propertyName := range section.propertyOrder {
property := section.propertyMap[propertyName]
properties = append(properties, property)
}
return properties
}