1
2
3
4 package enumdecl
5
6 import (
7 bytes "bytes"
8 fmt "fmt"
9 _ "github.com/gogo/protobuf/gogoproto"
10 proto "github.com/gogo/protobuf/proto"
11 io "io"
12 math "math"
13 math_bits "math/bits"
14 )
15
16
17 var _ = proto.Marshal
18 var _ = fmt.Errorf
19 var _ = math.Inf
20
21
22
23
24
25 const _ = proto.GoGoProtoPackageIsVersion3
26
27 var MyEnum_name = map[int32]string{
28 0: "A",
29 1: "B",
30 }
31
32 var MyEnum_value = map[string]int32{
33 "A": 0,
34 "B": 1,
35 }
36
37 func (x MyEnum) String() string {
38 return proto.EnumName(MyEnum_name, int32(x))
39 }
40
41 func (MyEnum) EnumDescriptor() ([]byte, []int) {
42 return fileDescriptor_869e4edba7b1e4e3, []int{0}
43 }
44
45 type Message struct {
46 EnumeratedField MyEnum `protobuf:"varint,1,opt,name=enumerated_field,json=enumeratedField,proto3,enum=enumdecl.MyEnum" json:"enumerated_field,omitempty"`
47 XXX_NoUnkeyedLiteral struct{} `json:"-"`
48 XXX_unrecognized []byte `json:"-"`
49 XXX_sizecache int32 `json:"-"`
50 }
51
52 func (m *Message) Reset() { *m = Message{} }
53 func (m *Message) String() string { return proto.CompactTextString(m) }
54 func (*Message) ProtoMessage() {}
55 func (*Message) Descriptor() ([]byte, []int) {
56 return fileDescriptor_869e4edba7b1e4e3, []int{0}
57 }
58 func (m *Message) XXX_Unmarshal(b []byte) error {
59 return m.Unmarshal(b)
60 }
61 func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
62 if deterministic {
63 return xxx_messageInfo_Message.Marshal(b, m, deterministic)
64 } else {
65 b = b[:cap(b)]
66 n, err := m.MarshalToSizedBuffer(b)
67 if err != nil {
68 return nil, err
69 }
70 return b[:n], nil
71 }
72 }
73 func (m *Message) XXX_Merge(src proto.Message) {
74 xxx_messageInfo_Message.Merge(m, src)
75 }
76 func (m *Message) XXX_Size() int {
77 return m.Size()
78 }
79 func (m *Message) XXX_DiscardUnknown() {
80 xxx_messageInfo_Message.DiscardUnknown(m)
81 }
82
83 var xxx_messageInfo_Message proto.InternalMessageInfo
84
85 func (m *Message) GetEnumeratedField() MyEnum {
86 if m != nil {
87 return m.EnumeratedField
88 }
89 return A
90 }
91
92 func init() {
93 proto.RegisterEnum("enumdecl.MyEnum", MyEnum_name, MyEnum_value)
94 proto.RegisterType((*Message)(nil), "enumdecl.Message")
95 }
96
97 func init() { proto.RegisterFile("enumdecl.proto", fileDescriptor_869e4edba7b1e4e3) }
98
99 var fileDescriptor_869e4edba7b1e4e3 = []byte{
100
101 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0xcd, 0x2b, 0xcd,
102 0x4d, 0x49, 0x4d, 0xce, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74,
103 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5,
104 0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0x72, 0xe3, 0x62,
105 0xf7, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0xb2, 0xe6, 0x12, 0x00, 0x99, 0x92, 0x5a, 0x94,
106 0x58, 0x92, 0x9a, 0x12, 0x9f, 0x96, 0x99, 0x9a, 0x93, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x67,
107 0x24, 0xa0, 0x07, 0xb7, 0xce, 0xb7, 0xd2, 0x35, 0xaf, 0x34, 0x37, 0x88, 0x1f, 0xa1, 0xd2, 0x0d,
108 0xa4, 0x50, 0x4b, 0x81, 0x8b, 0x0d, 0x22, 0x25, 0xc4, 0xca, 0xc5, 0xe8, 0x28, 0xc0, 0x00, 0xa2,
109 0x9c, 0x04, 0x18, 0xa5, 0x38, 0x3a, 0x16, 0xcb, 0x31, 0x1c, 0x58, 0x22, 0xc7, 0xe0, 0xa4, 0xf1,
110 0xe0, 0xa1, 0x1c, 0xe3, 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0xee, 0x78, 0x24, 0xc7,
111 0x78, 0xe0, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24,
112 0xc7, 0xf8, 0xe3, 0x91, 0x1c, 0x43, 0xc3, 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0xd3, 0x8c, 0x01,
113 0x01, 0x00, 0x00, 0xff, 0xff, 0x76, 0x04, 0x55, 0xb7, 0xe5, 0x00, 0x00, 0x00,
114 }
115
116 func (this *Message) VerboseEqual(that interface{}) error {
117 if that == nil {
118 if this == nil {
119 return nil
120 }
121 return fmt.Errorf("that == nil && this != nil")
122 }
123
124 that1, ok := that.(*Message)
125 if !ok {
126 that2, ok := that.(Message)
127 if ok {
128 that1 = &that2
129 } else {
130 return fmt.Errorf("that is not of type *Message")
131 }
132 }
133 if that1 == nil {
134 if this == nil {
135 return nil
136 }
137 return fmt.Errorf("that is type *Message but is nil && this != nil")
138 } else if this == nil {
139 return fmt.Errorf("that is type *Message but is not nil && this == nil")
140 }
141 if this.EnumeratedField != that1.EnumeratedField {
142 return fmt.Errorf("EnumeratedField this(%v) Not Equal that(%v)", this.EnumeratedField, that1.EnumeratedField)
143 }
144 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
145 return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
146 }
147 return nil
148 }
149 func (this *Message) Equal(that interface{}) bool {
150 if that == nil {
151 return this == nil
152 }
153
154 that1, ok := that.(*Message)
155 if !ok {
156 that2, ok := that.(Message)
157 if ok {
158 that1 = &that2
159 } else {
160 return false
161 }
162 }
163 if that1 == nil {
164 return this == nil
165 } else if this == nil {
166 return false
167 }
168 if this.EnumeratedField != that1.EnumeratedField {
169 return false
170 }
171 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
172 return false
173 }
174 return true
175 }
176 func (m *Message) Marshal() (dAtA []byte, err error) {
177 size := m.Size()
178 dAtA = make([]byte, size)
179 n, err := m.MarshalToSizedBuffer(dAtA[:size])
180 if err != nil {
181 return nil, err
182 }
183 return dAtA[:n], nil
184 }
185
186 func (m *Message) MarshalTo(dAtA []byte) (int, error) {
187 size := m.Size()
188 return m.MarshalToSizedBuffer(dAtA[:size])
189 }
190
191 func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) {
192 i := len(dAtA)
193 _ = i
194 var l int
195 _ = l
196 if m.XXX_unrecognized != nil {
197 i -= len(m.XXX_unrecognized)
198 copy(dAtA[i:], m.XXX_unrecognized)
199 }
200 if m.EnumeratedField != 0 {
201 i = encodeVarintEnumdecl(dAtA, i, uint64(m.EnumeratedField))
202 i--
203 dAtA[i] = 0x8
204 }
205 return len(dAtA) - i, nil
206 }
207
208 func encodeVarintEnumdecl(dAtA []byte, offset int, v uint64) int {
209 offset -= sovEnumdecl(v)
210 base := offset
211 for v >= 1<<7 {
212 dAtA[offset] = uint8(v&0x7f | 0x80)
213 v >>= 7
214 offset++
215 }
216 dAtA[offset] = uint8(v)
217 return base
218 }
219 func NewPopulatedMessage(r randyEnumdecl, easy bool) *Message {
220 this := &Message{}
221 this.EnumeratedField = MyEnum([]int32{0, 1}[r.Intn(2)])
222 if !easy && r.Intn(10) != 0 {
223 this.XXX_unrecognized = randUnrecognizedEnumdecl(r, 2)
224 }
225 return this
226 }
227
228 type randyEnumdecl interface {
229 Float32() float32
230 Float64() float64
231 Int63() int64
232 Int31() int32
233 Uint32() uint32
234 Intn(n int) int
235 }
236
237 func randUTF8RuneEnumdecl(r randyEnumdecl) rune {
238 ru := r.Intn(62)
239 if ru < 10 {
240 return rune(ru + 48)
241 } else if ru < 36 {
242 return rune(ru + 55)
243 }
244 return rune(ru + 61)
245 }
246 func randStringEnumdecl(r randyEnumdecl) string {
247 v1 := r.Intn(100)
248 tmps := make([]rune, v1)
249 for i := 0; i < v1; i++ {
250 tmps[i] = randUTF8RuneEnumdecl(r)
251 }
252 return string(tmps)
253 }
254 func randUnrecognizedEnumdecl(r randyEnumdecl, maxFieldNumber int) (dAtA []byte) {
255 l := r.Intn(5)
256 for i := 0; i < l; i++ {
257 wire := r.Intn(4)
258 if wire == 3 {
259 wire = 5
260 }
261 fieldNumber := maxFieldNumber + r.Intn(100)
262 dAtA = randFieldEnumdecl(dAtA, r, fieldNumber, wire)
263 }
264 return dAtA
265 }
266 func randFieldEnumdecl(dAtA []byte, r randyEnumdecl, fieldNumber int, wire int) []byte {
267 key := uint32(fieldNumber)<<3 | uint32(wire)
268 switch wire {
269 case 0:
270 dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(key))
271 v2 := r.Int63()
272 if r.Intn(2) == 0 {
273 v2 *= -1
274 }
275 dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(v2))
276 case 1:
277 dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(key))
278 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)))
279 case 2:
280 dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(key))
281 ll := r.Intn(100)
282 dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(ll))
283 for j := 0; j < ll; j++ {
284 dAtA = append(dAtA, byte(r.Intn(256)))
285 }
286 default:
287 dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(key))
288 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
289 }
290 return dAtA
291 }
292 func encodeVarintPopulateEnumdecl(dAtA []byte, v uint64) []byte {
293 for v >= 1<<7 {
294 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
295 v >>= 7
296 }
297 dAtA = append(dAtA, uint8(v))
298 return dAtA
299 }
300 func (m *Message) Size() (n int) {
301 if m == nil {
302 return 0
303 }
304 var l int
305 _ = l
306 if m.EnumeratedField != 0 {
307 n += 1 + sovEnumdecl(uint64(m.EnumeratedField))
308 }
309 if m.XXX_unrecognized != nil {
310 n += len(m.XXX_unrecognized)
311 }
312 return n
313 }
314
315 func sovEnumdecl(x uint64) (n int) {
316 return (math_bits.Len64(x|1) + 6) / 7
317 }
318 func sozEnumdecl(x uint64) (n int) {
319 return sovEnumdecl(uint64((x << 1) ^ uint64((int64(x) >> 63))))
320 }
321 func (m *Message) Unmarshal(dAtA []byte) error {
322 l := len(dAtA)
323 iNdEx := 0
324 for iNdEx < l {
325 preIndex := iNdEx
326 var wire uint64
327 for shift := uint(0); ; shift += 7 {
328 if shift >= 64 {
329 return ErrIntOverflowEnumdecl
330 }
331 if iNdEx >= l {
332 return io.ErrUnexpectedEOF
333 }
334 b := dAtA[iNdEx]
335 iNdEx++
336 wire |= uint64(b&0x7F) << shift
337 if b < 0x80 {
338 break
339 }
340 }
341 fieldNum := int32(wire >> 3)
342 wireType := int(wire & 0x7)
343 if wireType == 4 {
344 return fmt.Errorf("proto: Message: wiretype end group for non-group")
345 }
346 if fieldNum <= 0 {
347 return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire)
348 }
349 switch fieldNum {
350 case 1:
351 if wireType != 0 {
352 return fmt.Errorf("proto: wrong wireType = %d for field EnumeratedField", wireType)
353 }
354 m.EnumeratedField = 0
355 for shift := uint(0); ; shift += 7 {
356 if shift >= 64 {
357 return ErrIntOverflowEnumdecl
358 }
359 if iNdEx >= l {
360 return io.ErrUnexpectedEOF
361 }
362 b := dAtA[iNdEx]
363 iNdEx++
364 m.EnumeratedField |= MyEnum(b&0x7F) << shift
365 if b < 0x80 {
366 break
367 }
368 }
369 default:
370 iNdEx = preIndex
371 skippy, err := skipEnumdecl(dAtA[iNdEx:])
372 if err != nil {
373 return err
374 }
375 if (skippy < 0) || (iNdEx+skippy) < 0 {
376 return ErrInvalidLengthEnumdecl
377 }
378 if (iNdEx + skippy) > l {
379 return io.ErrUnexpectedEOF
380 }
381 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
382 iNdEx += skippy
383 }
384 }
385
386 if iNdEx > l {
387 return io.ErrUnexpectedEOF
388 }
389 return nil
390 }
391 func skipEnumdecl(dAtA []byte) (n int, err error) {
392 l := len(dAtA)
393 iNdEx := 0
394 depth := 0
395 for iNdEx < l {
396 var wire uint64
397 for shift := uint(0); ; shift += 7 {
398 if shift >= 64 {
399 return 0, ErrIntOverflowEnumdecl
400 }
401 if iNdEx >= l {
402 return 0, io.ErrUnexpectedEOF
403 }
404 b := dAtA[iNdEx]
405 iNdEx++
406 wire |= (uint64(b) & 0x7F) << shift
407 if b < 0x80 {
408 break
409 }
410 }
411 wireType := int(wire & 0x7)
412 switch wireType {
413 case 0:
414 for shift := uint(0); ; shift += 7 {
415 if shift >= 64 {
416 return 0, ErrIntOverflowEnumdecl
417 }
418 if iNdEx >= l {
419 return 0, io.ErrUnexpectedEOF
420 }
421 iNdEx++
422 if dAtA[iNdEx-1] < 0x80 {
423 break
424 }
425 }
426 case 1:
427 iNdEx += 8
428 case 2:
429 var length int
430 for shift := uint(0); ; shift += 7 {
431 if shift >= 64 {
432 return 0, ErrIntOverflowEnumdecl
433 }
434 if iNdEx >= l {
435 return 0, io.ErrUnexpectedEOF
436 }
437 b := dAtA[iNdEx]
438 iNdEx++
439 length |= (int(b) & 0x7F) << shift
440 if b < 0x80 {
441 break
442 }
443 }
444 if length < 0 {
445 return 0, ErrInvalidLengthEnumdecl
446 }
447 iNdEx += length
448 case 3:
449 depth++
450 case 4:
451 if depth == 0 {
452 return 0, ErrUnexpectedEndOfGroupEnumdecl
453 }
454 depth--
455 case 5:
456 iNdEx += 4
457 default:
458 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
459 }
460 if iNdEx < 0 {
461 return 0, ErrInvalidLengthEnumdecl
462 }
463 if depth == 0 {
464 return iNdEx, nil
465 }
466 }
467 return 0, io.ErrUnexpectedEOF
468 }
469
470 var (
471 ErrInvalidLengthEnumdecl = fmt.Errorf("proto: negative length found during unmarshaling")
472 ErrIntOverflowEnumdecl = fmt.Errorf("proto: integer overflow")
473 ErrUnexpectedEndOfGroupEnumdecl = fmt.Errorf("proto: unexpected end of group")
474 )
475
View as plain text