/
simpleDefinition.go
52 lines (43 loc) · 1.25 KB
/
simpleDefinition.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
package main
// SimpleDefinition represents a simple Definition.
type SimpleDefinition struct {
id IDType
valueType Type
comment string
inlined bool
}
// ID returns the ID of this Definition.
func (instance SimpleDefinition) ID() IDType {
return instance.id
}
// ValueType returns the value type of this Definition.
func (instance SimpleDefinition) ValueType() Type {
return instance.valueType
}
// Description returns the description of this Definition.
func (instance SimpleDefinition) Description() string {
return instance.comment
}
// Inlined returns "true" if this Definition should be inlined.
func (instance SimpleDefinition) Inlined() bool {
return instance.inlined
}
// TypeName returns the type name of this Definition.
func (instance SimpleDefinition) TypeName() string {
return "simple"
}
// IsTopLevel returns "true" if this element is a top level Definition.
func (instance SimpleDefinition) IsTopLevel() bool {
return true
}
func newSimpleDefinition(id IDType, valueType Type, comment string, inlined bool) *SimpleDefinition {
return &SimpleDefinition{
id: id,
valueType: valueType,
comment: comment,
inlined: inlined,
}
}
func (instance SimpleDefinition) String() string {
return FormatDefinition(&instance)
}