-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
address.go
77 lines (66 loc) · 2.14 KB
/
address.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
package sarif
// Address ...
type Address struct {
Index *uint `json:"index,omitempty"`
AbsoluteAddress *uint `json:"absoluteAddress,omitempty"`
RelativeAddress *int `json:"relativeAddress,omitempty"`
OffsetFromParent *int `json:"offsetFromParent,omitempty"`
Length *int `json:"length,omitempty"`
Name *string `json:"name,omitempty"`
FullyQualifiedName *string `json:"fullyQualifiedName,omitempty"`
Kind *string `json:"kind,omitempty"`
ParentIndex *uint `json:"parentIndex,omitempty"`
PropertyBag
}
// NewAddress create a new Address and returns a pointer to it
func NewAddress() *Address {
return &Address{}
}
// WithIndex sets the Index
func (address *Address) WithIndex(index int) *Address {
i := uint(index)
address.Index = &i
return address
}
// WithAbsoluteAddress sets the AbsoluteAddress
func (address *Address) WithAbsoluteAddress(absoluteAddress int) *Address {
i := uint(absoluteAddress)
address.AbsoluteAddress = &i
return address
}
// WithRelativeAddress sets the RelativeAddress
func (address *Address) WithRelativeAddress(relativeAddress int) *Address {
address.RelativeAddress = &relativeAddress
return address
}
// WithOffsetFromParent sets the OffsetFromParent
func (address *Address) WithOffsetFromParent(offsetFromParent int) *Address {
address.OffsetFromParent = &offsetFromParent
return address
}
// WithLength sets the Length
func (address *Address) WithLength(length int) *Address {
address.Length = &length
return address
}
// WithName sets the Name
func (address *Address) WithName(name string) *Address {
address.Name = &name
return address
}
// WithFullyQualifiedName sets the FullyQualifiedName
func (address *Address) WithFullyQualifiedName(fullyQualifiedName string) *Address {
address.FullyQualifiedName = &fullyQualifiedName
return address
}
// WithKind sets the Kind
func (address *Address) WithKind(kind string) *Address {
address.Kind = &kind
return address
}
// WithParentIndex sets the ParentIndex
func (address *Address) WithParentIndex(parentIndex int) *Address {
i := uint(parentIndex)
address.ParentIndex = &i
return address
}