-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenabled.pb.go
More file actions
95 lines (80 loc) · 2.16 KB
/
Copy pathenabled.pb.go
File metadata and controls
95 lines (80 loc) · 2.16 KB
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
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.14.0
// source: github.com/aperturerobotics/util/enabled/enabled.proto
package enabled
import (
strconv "strconv"
json "github.com/aperturerobotics/protobuf-go-lite/json"
)
// Enabled is a three-way boolean: default, enable, disable.
type Enabled int32
const (
// DEFAULT defaults to the default option.
Enabled_DEFAULT Enabled = 0
// ENABLE enables the option even if it would normally be false.
Enabled_ENABLE Enabled = 1
// DISABLE disables the option even if it would normally be true.
Enabled_DISABLE Enabled = 2
)
// Enum value maps for Enabled.
var (
Enabled_name = map[int32]string{
0: "DEFAULT",
1: "ENABLE",
2: "DISABLE",
}
Enabled_value = map[string]int32{
"DEFAULT": 0,
"ENABLE": 1,
"DISABLE": 2,
}
)
func (x Enabled) Enum() *Enabled {
p := new(Enabled)
*p = x
return p
}
func (x Enabled) String() string {
name, valid := Enabled_name[int32(x)]
if valid {
return name
}
return strconv.Itoa(int(x))
}
// MarshalProtoJSON marshals the Enabled to JSON.
func (x Enabled) MarshalProtoJSON(s *json.MarshalState) {
s.WriteEnum(int32(x), Enabled_name)
}
// MarshalText marshals the Enabled to text.
func (x Enabled) MarshalText() ([]byte, error) {
return []byte(json.GetEnumString(int32(x), Enabled_name)), nil
}
// MarshalJSON marshals the Enabled to JSON.
func (x Enabled) MarshalJSON() ([]byte, error) {
return json.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the Enabled from JSON.
func (x *Enabled) UnmarshalProtoJSON(s *json.UnmarshalState) {
v := s.ReadEnum(Enabled_value)
if err := s.Err(); err != nil {
s.SetErrorf("could not read Enabled enum: %v", err)
return
}
*x = Enabled(v)
}
// UnmarshalText unmarshals the Enabled from text.
func (x *Enabled) UnmarshalText(b []byte) error {
i, err := json.ParseEnumString(string(b), Enabled_value)
if err != nil {
return err
}
*x = Enabled(i)
return nil
}
// UnmarshalJSON unmarshals the Enabled from JSON.
func (x *Enabled) UnmarshalJSON(b []byte) error {
return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
func (x Enabled) MarshalProtoText() string {
return x.String()
}