-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypes.go
180 lines (141 loc) · 2.44 KB
/
types.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
package hconf
import (
"github.com/hashicorp/hcl/hcl/token"
)
type stringSetter interface {
SetValue(v string)
}
type stringSliceSetter interface {
SetValue(v []string)
}
type int64Setter interface {
SetValue(v int64)
}
type boolSetter interface {
SetValue(v bool)
}
type sourceSetter interface {
SetSource(p token.Pos)
}
type sourceGetter interface {
Source() token.Pos
}
type String struct {
source token.Pos
value string
isset bool
}
func (s *String) Duplicate() String {
return String{
source: s.source,
value: s.value,
isset: s.isset,
}
}
func (s *String) SetSource(p token.Pos) {
s.source = p
}
func (s *String) Source() token.Pos {
return s.source
}
func (s *String) SetValue(v string) {
s.value = v
s.isset = true
}
func (s *String) Value() string {
return s.value
}
func (s *String) ValueString() string {
return s.value
}
func (s *String) IsSet() bool {
return s.isset
}
type StringSlice struct {
source token.Pos
value []string
isset bool
}
func (s *StringSlice) Duplicate() StringSlice {
b := make([]string, 0, len(s.value))
b = append(b, s.value...)
return StringSlice{
source: s.source,
value: b,
isset: s.isset,
}
}
func (s *StringSlice) SetSource(p token.Pos) {
s.source = p
}
func (s *StringSlice) Source() token.Pos {
return s.source
}
func (s *StringSlice) SetValue(v []string) {
s.value = v
s.isset = true
}
func (s *StringSlice) Value() []string {
return s.value
}
func (s *StringSlice) ValueStringSlice() []string {
return s.value
}
func (s *StringSlice) IsSet() bool {
return s.isset
}
type Int64 struct {
source token.Pos
value int64
isset bool
}
func (s *Int64) SetSource(p token.Pos) {
s.source = p
}
func (s *Int64) Source() token.Pos {
return s.source
}
func (s *Int64) SetValue(v int64) {
s.value = v
s.isset = true
}
func (s *Int64) Value() int64 {
return s.value
}
func (s *Int64) ValueInt64() int64 {
return s.value
}
func (s *Int64) IsSet() bool {
return s.isset
}
type Bool struct {
source token.Pos
value bool
isset bool
}
func (s *Bool) Duplicate() Bool {
return Bool{
source: s.source,
value: s.value,
isset: s.isset,
}
}
func (s *Bool) SetSource(p token.Pos) {
s.source = p
}
func (s *Bool) Source() token.Pos {
return s.source
}
func (s *Bool) SetValue(v bool) {
s.value = v
s.isset = true
}
func (s *Bool) Value() bool {
return s.value
}
func (s *Bool) ValueBool() bool {
return s.value
}
func (s *Bool) IsSet() bool {
return s.isset
}