-
Notifications
You must be signed in to change notification settings - Fork 20
/
condition-clause.go
55 lines (45 loc) · 1.03 KB
/
condition-clause.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
package tosca_v2_0
import (
"github.com/tliron/kutil/ard"
"github.com/tliron/puccini/tosca"
)
//
// ConditionClause
//
// [TOSCA-v2.0] @ ?
// [TOSCA-Simple-Profile-YAML-v1.3] @ 3.6.25
// [TOSCA-Simple-Profile-YAML-v1.2] @ 3.6.21
// [TOSCA-Simple-Profile-YAML-v1.1] @ 3.5.19
//
type ConditionClause struct {
*Entity `name:"condition clause"`
}
func NewConditionClause(context *tosca.Context) *ConditionClause {
return &ConditionClause{Entity: NewEntity(context)}
}
// tosca.Reader signature
func ReadConditionClause(context *tosca.Context) tosca.EntityPtr {
self := NewConditionClause(context)
if context.ValidateType(ard.TypeMap) {
for _, childContext := range context.FieldChildren() {
if !self.readField(childContext) {
childContext.ReportFieldUnsupported()
}
}
}
return self
}
func (self *ConditionClause) readField(context *tosca.Context) bool {
switch context.Name {
case "and":
case "or":
case "assert":
default:
return false
}
return true
}
//
// ConditionClauses
//
type ConditionClauses []*ConditionClause