| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package events |
| 5 |
|
| 6 |
import ( |
| 7 |
bytes "bytes" |
| 8 |
fmt "fmt" |
| 9 |
_ "github.com/gogo/protobuf/gogoproto" |
| 10 |
proto "github.com/gogo/protobuf/proto" |
| 11 |
issue312 "github.com/gogo/protobuf/test/issue312" |
| 12 |
math "math" |
| 13 |
reflect "reflect" |
| 14 |
strings "strings" |
| 15 |
) |
| 16 |
|
| 17 |
|
| 18 |
var _ = proto.Marshal |
| 19 |
var _ = fmt.Errorf |
| 20 |
var _ = math.Inf |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
const _ = proto.GoGoProtoPackageIsVersion3 |
| 27 |
|
| 28 |
type Subtype struct { |
| 29 |
State *issue312.TaskState `protobuf:"varint,4,opt,name=state,enum=issue312.TaskState" json:"state,omitempty"` |
| 30 |
XXX_NoUnkeyedLiteral struct{} `json:"-"` |
| 31 |
XXX_unrecognized []byte `json:"-"` |
| 32 |
XXX_sizecache int32 `json:"-"` |
| 33 |
} |
| 34 |
|
| 35 |
func (m *Subtype) Reset() { *m = Subtype{} } |
| 36 |
func (m *Subtype) String() string { return proto.CompactTextString(m) } |
| 37 |
func (*Subtype) ProtoMessage() {} |
| 38 |
func (*Subtype) Descriptor() ([]byte, []int) { |
| 39 |
return fileDescriptor_8f22242cb04491f9, []int{0} |
| 40 |
} |
| 41 |
func (m *Subtype) XXX_Unmarshal(b []byte) error { |
| 42 |
return xxx_messageInfo_Subtype.Unmarshal(m, b) |
| 43 |
} |
| 44 |
func (m *Subtype) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 45 |
return xxx_messageInfo_Subtype.Marshal(b, m, deterministic) |
| 46 |
} |
| 47 |
func (m *Subtype) XXX_Merge(src proto.Message) { |
| 48 |
xxx_messageInfo_Subtype.Merge(m, src) |
| 49 |
} |
| 50 |
func (m *Subtype) XXX_Size() int { |
| 51 |
return xxx_messageInfo_Subtype.Size(m) |
| 52 |
} |
| 53 |
func (m *Subtype) XXX_DiscardUnknown() { |
| 54 |
xxx_messageInfo_Subtype.DiscardUnknown(m) |
| 55 |
} |
| 56 |
|
| 57 |
var xxx_messageInfo_Subtype proto.InternalMessageInfo |
| 58 |
|
| 59 |
func (m *Subtype) GetState() issue312.TaskState { |
| 60 |
if m != nil && m.State != nil { |
| 61 |
return *m.State |
| 62 |
} |
| 63 |
return issue312.TaskState_TASK_STAGING |
| 64 |
} |
| 65 |
|
| 66 |
func init() { |
| 67 |
proto.RegisterType((*Subtype)(nil), "issue312.events.Subtype") |
| 68 |
} |
| 69 |
|
| 70 |
func init() { proto.RegisterFile("events.proto", fileDescriptor_8f22242cb04491f9) } |
| 71 |
|
| 72 |
var fileDescriptor_8f22242cb04491f9 = []byte{ |
| 73 |
|
| 74 |
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2d, 0x4b, 0xcd, |
| 75 |
0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcf, 0x2c, 0x2e, 0x2e, 0x4d, 0x35, |
| 76 |
0x36, 0x34, 0xd2, 0x83, 0x08, 0x4b, 0x99, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, |
| 77 |
0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xd5, 0x25, 0x95, 0xa6, 0xe9, 0x97, 0xa4, 0x16, |
| 78 |
0x97, 0xe8, 0xc3, 0x94, 0xc3, 0x19, 0x10, 0x73, 0xa4, 0x74, 0x71, 0x6a, 0x03, 0xf1, 0xc0, 0x1c, |
| 79 |
0x30, 0x0b, 0xa2, 0x5c, 0xc9, 0x84, 0x8b, 0x3d, 0xb8, 0x34, 0xa9, 0xa4, 0xb2, 0x20, 0x55, 0x48, |
| 80 |
0x93, 0x8b, 0xb5, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0x82, 0x45, 0x81, 0x51, 0x83, 0xcf, 0x48, 0x58, |
| 81 |
0x0f, 0x6e, 0x72, 0x48, 0x62, 0x71, 0x76, 0x30, 0x48, 0x2a, 0x08, 0xa2, 0xc2, 0x49, 0xe2, 0xc3, |
| 82 |
0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x57, 0x3c, 0x92, 0x63, 0xdc, 0xf1, 0x48, 0x8e, 0x31, |
| 83 |
0x8a, 0x0d, 0xe2, 0x6a, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x76, 0xdc, 0x82, 0xd5, 0x00, |
| 84 |
0x00, 0x00, |
| 85 |
} |
| 86 |
|
| 87 |
func (this *Subtype) Equal(that interface{}) bool { |
| 88 |
if that == nil { |
| 89 |
return this == nil |
| 90 |
} |
| 91 |
|
| 92 |
that1, ok := that.(*Subtype) |
| 93 |
if !ok { |
| 94 |
that2, ok := that.(Subtype) |
| 95 |
if ok { |
| 96 |
that1 = &that2 |
| 97 |
} else { |
| 98 |
return false |
| 99 |
} |
| 100 |
} |
| 101 |
if that1 == nil { |
| 102 |
return this == nil |
| 103 |
} else if this == nil { |
| 104 |
return false |
| 105 |
} |
| 106 |
if this.State != nil && that1.State != nil { |
| 107 |
if *this.State != *that1.State { |
| 108 |
return false |
| 109 |
} |
| 110 |
} else if this.State != nil { |
| 111 |
return false |
| 112 |
} else if that1.State != nil { |
| 113 |
return false |
| 114 |
} |
| 115 |
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { |
| 116 |
return false |
| 117 |
} |
| 118 |
return true |
| 119 |
} |
| 120 |
func (this *Subtype) GoString() string { |
| 121 |
if this == nil { |
| 122 |
return "nil" |
| 123 |
} |
| 124 |
s := make([]string, 0, 5) |
| 125 |
s = append(s, "&events.Subtype{") |
| 126 |
if this.State != nil { |
| 127 |
s = append(s, "State: "+valueToGoStringEvents(this.State, "issue312.TaskState")+",\n") |
| 128 |
} |
| 129 |
if this.XXX_unrecognized != nil { |
| 130 |
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") |
| 131 |
} |
| 132 |
s = append(s, "}") |
| 133 |
return strings.Join(s, "") |
| 134 |
} |
| 135 |
func valueToGoStringEvents(v interface{}, typ string) string { |
| 136 |
rv := reflect.ValueOf(v) |
| 137 |
if rv.IsNil() { |
| 138 |
return "nil" |
| 139 |
} |
| 140 |
pv := reflect.Indirect(rv).Interface() |
| 141 |
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) |
| 142 |
} |
| 143 |
func NewPopulatedSubtype(r randyEvents, easy bool) *Subtype { |
| 144 |
this := &Subtype{} |
| 145 |
if r.Intn(5) != 0 { |
| 146 |
v1 := issue312.TaskState([]int32{6, 0, 1}[r.Intn(3)]) |
| 147 |
this.State = &v1 |
| 148 |
} |
| 149 |
if !easy && r.Intn(10) != 0 { |
| 150 |
this.XXX_unrecognized = randUnrecognizedEvents(r, 5) |
| 151 |
} |
| 152 |
return this |
| 153 |
} |
| 154 |
|
| 155 |
type randyEvents interface { |
| 156 |
Float32() float32 |
| 157 |
Float64() float64 |
| 158 |
Int63() int64 |
| 159 |
Int31() int32 |
| 160 |
Uint32() uint32 |
| 161 |
Intn(n int) int |
| 162 |
} |
| 163 |
|
| 164 |
func randUTF8RuneEvents(r randyEvents) rune { |
| 165 |
ru := r.Intn(62) |
| 166 |
if ru < 10 { |
| 167 |
return rune(ru + 48) |
| 168 |
} else if ru < 36 { |
| 169 |
return rune(ru + 55) |
| 170 |
} |
| 171 |
return rune(ru + 61) |
| 172 |
} |
| 173 |
func randStringEvents(r randyEvents) string { |
| 174 |
v2 := r.Intn(100) |
| 175 |
tmps := make([]rune, v2) |
| 176 |
for i := 0; i < v2; i++ { |
| 177 |
tmps[i] = randUTF8RuneEvents(r) |
| 178 |
} |
| 179 |
return string(tmps) |
| 180 |
} |
| 181 |
func randUnrecognizedEvents(r randyEvents, maxFieldNumber int) (dAtA []byte) { |
| 182 |
l := r.Intn(5) |
| 183 |
for i := 0; i < l; i++ { |
| 184 |
wire := r.Intn(4) |
| 185 |
if wire == 3 { |
| 186 |
wire = 5 |
| 187 |
} |
| 188 |
fieldNumber := maxFieldNumber + r.Intn(100) |
| 189 |
dAtA = randFieldEvents(dAtA, r, fieldNumber, wire) |
| 190 |
} |
| 191 |
return dAtA |
| 192 |
} |
| 193 |
func randFieldEvents(dAtA []byte, r randyEvents, fieldNumber int, wire int) []byte { |
| 194 |
key := uint32(fieldNumber)<<3 | uint32(wire) |
| 195 |
switch wire { |
| 196 |
case 0: |
| 197 |
dAtA = encodeVarintPopulateEvents(dAtA, uint64(key)) |
| 198 |
v3 := r.Int63() |
| 199 |
if r.Intn(2) == 0 { |
| 200 |
v3 *= -1 |
| 201 |
} |
| 202 |
dAtA = encodeVarintPopulateEvents(dAtA, uint64(v3)) |
| 203 |
case 1: |
| 204 |
dAtA = encodeVarintPopulateEvents(dAtA, uint64(key)) |
| 205 |
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) |
| 206 |
case 2: |
| 207 |
dAtA = encodeVarintPopulateEvents(dAtA, uint64(key)) |
| 208 |
ll := r.Intn(100) |
| 209 |
dAtA = encodeVarintPopulateEvents(dAtA, uint64(ll)) |
| 210 |
for j := 0; j < ll; j++ { |
| 211 |
dAtA = append(dAtA, byte(r.Intn(256))) |
| 212 |
} |
| 213 |
default: |
| 214 |
dAtA = encodeVarintPopulateEvents(dAtA, uint64(key)) |
| 215 |
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) |
| 216 |
} |
| 217 |
return dAtA |
| 218 |
} |
| 219 |
func encodeVarintPopulateEvents(dAtA []byte, v uint64) []byte { |
| 220 |
for v >= 1<<7 { |
| 221 |
dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) |
| 222 |
v >>= 7 |
| 223 |
} |
| 224 |
dAtA = append(dAtA, uint8(v)) |
| 225 |
return dAtA |
| 226 |
} |