1
2
3
4 package vanity
5
6 import (
7 fmt "fmt"
8 _ "github.com/gogo/protobuf/gogoproto"
9 proto "github.com/gogo/protobuf/proto"
10 io "io"
11 math "math"
12 math_bits "math/bits"
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 B struct {
29 String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"`
30 Int64 int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64"`
31 Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"`
32 }
33
34 func (m *B) Reset() { *m = B{} }
35 func (*B) ProtoMessage() {}
36 func (*B) Descriptor() ([]byte, []int) {
37 return fileDescriptor_f8c9b51615339d8e, []int{0}
38 }
39 func (m *B) XXX_Unmarshal(b []byte) error {
40 return m.Unmarshal(b)
41 }
42 func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
43 if deterministic {
44 return xxx_messageInfo_B.Marshal(b, m, deterministic)
45 } else {
46 b = b[:cap(b)]
47 n, err := m.MarshalToSizedBuffer(b)
48 if err != nil {
49 return nil, err
50 }
51 return b[:n], nil
52 }
53 }
54 func (m *B) XXX_Merge(src proto.Message) {
55 xxx_messageInfo_B.Merge(m, src)
56 }
57 func (m *B) XXX_Size() int {
58 return m.Size()
59 }
60 func (m *B) XXX_DiscardUnknown() {
61 xxx_messageInfo_B.DiscardUnknown(m)
62 }
63
64 var xxx_messageInfo_B proto.InternalMessageInfo
65
66 const Default_B_Int32 int32 = 1234
67
68 func (m *B) GetString_() string {
69 if m != nil && m.String_ != nil {
70 return *m.String_
71 }
72 return ""
73 }
74
75 func (m *B) GetInt64() int64 {
76 if m != nil {
77 return m.Int64
78 }
79 return 0
80 }
81
82 func (m *B) GetInt32() int32 {
83 if m != nil && m.Int32 != nil {
84 return *m.Int32
85 }
86 return Default_B_Int32
87 }
88
89 func init() {
90 proto.RegisterType((*B)(nil), "vanity.B")
91 }
92
93 func init() { proto.RegisterFile("gogovanity.proto", fileDescriptor_f8c9b51615339d8e) }
94
95 var fileDescriptor_f8c9b51615339d8e = []byte{
96
97 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf,
98 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0,
99 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4,
100 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x45, 0x72, 0x31,
101 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a,
102 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x92, 0xe2, 0x62, 0xf5, 0xcc,
103 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x06, 0x4b, 0x32, 0x04, 0x41, 0x84, 0xa0,
104 0x72, 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41,
105 0x10, 0x21, 0x27, 0x93, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e,
106 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24,
107 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, 0x0c, 0x1f, 0x1e, 0xc9, 0x31, 0x4e, 0x78,
108 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x80, 0x00, 0x00, 0x00, 0xff,
109 0xff, 0xab, 0xeb, 0xeb, 0x07, 0xda, 0x00, 0x00, 0x00,
110 }
111
112 func (this *B) Equal(that interface{}) bool {
113 if that == nil {
114 return this == nil
115 }
116
117 that1, ok := that.(*B)
118 if !ok {
119 that2, ok := that.(B)
120 if ok {
121 that1 = &that2
122 } else {
123 return false
124 }
125 }
126 if that1 == nil {
127 return this == nil
128 } else if this == nil {
129 return false
130 }
131 if this.String_ != nil && that1.String_ != nil {
132 if *this.String_ != *that1.String_ {
133 return false
134 }
135 } else if this.String_ != nil {
136 return false
137 } else if that1.String_ != nil {
138 return false
139 }
140 if this.Int64 != that1.Int64 {
141 return false
142 }
143 if this.Int32 != nil && that1.Int32 != nil {
144 if *this.Int32 != *that1.Int32 {
145 return false
146 }
147 } else if this.Int32 != nil {
148 return false
149 } else if that1.Int32 != nil {
150 return false
151 }
152 return true
153 }
154 func (this *B) GoString() string {
155 if this == nil {
156 return "nil"
157 }
158 s := make([]string, 0, 7)
159 s = append(s, "&vanity.B{")
160 if this.String_ != nil {
161 s = append(s, "String_: "+valueToGoStringGogovanity(this.String_, "string")+",\n")
162 }
163 s = append(s, "Int64: "+fmt.Sprintf("%#v", this.Int64)+",\n")
164 if this.Int32 != nil {
165 s = append(s, "Int32: "+valueToGoStringGogovanity(this.Int32, "int32")+",\n")
166 }
167 s = append(s, "}")
168 return strings.Join(s, "")
169 }
170 func valueToGoStringGogovanity(v interface{}, typ string) string {
171 rv := reflect.ValueOf(v)
172 if rv.IsNil() {
173 return "nil"
174 }
175 pv := reflect.Indirect(rv).Interface()
176 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
177 }
178 func (m *B) Marshal() (dAtA []byte, err error) {
179 size := m.Size()
180 dAtA = make([]byte, size)
181 n, err := m.MarshalToSizedBuffer(dAtA[:size])
182 if err != nil {
183 return nil, err
184 }
185 return dAtA[:n], nil
186 }
187
188 func (m *B) MarshalTo(dAtA []byte) (int, error) {
189 size := m.Size()
190 return m.MarshalToSizedBuffer(dAtA[:size])
191 }
192
193 func (m *B) MarshalToSizedBuffer(dAtA []byte) (int, error) {
194 i := len(dAtA)
195 _ = i
196 var l int
197 _ = l
198 if m.Int32 != nil {
199 i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32))
200 i--
201 dAtA[i] = 0x18
202 }
203 i = encodeVarintGogovanity(dAtA, i, uint64(m.Int64))
204 i--
205 dAtA[i] = 0x10
206 if m.String_ != nil {
207 i -= len(*m.String_)
208 copy(dAtA[i:], *m.String_)
209 i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_)))
210 i--
211 dAtA[i] = 0xa
212 }
213 return len(dAtA) - i, nil
214 }
215
216 func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int {
217 offset -= sovGogovanity(v)
218 base := offset
219 for v >= 1<<7 {
220 dAtA[offset] = uint8(v&0x7f | 0x80)
221 v >>= 7
222 offset++
223 }
224 dAtA[offset] = uint8(v)
225 return base
226 }
227 func (m *B) Size() (n int) {
228 if m == nil {
229 return 0
230 }
231 var l int
232 _ = l
233 if m.String_ != nil {
234 l = len(*m.String_)
235 n += 1 + l + sovGogovanity(uint64(l))
236 }
237 n += 1 + sovGogovanity(uint64(m.Int64))
238 if m.Int32 != nil {
239 n += 1 + sovGogovanity(uint64(*m.Int32))
240 }
241 return n
242 }
243
244 func sovGogovanity(x uint64) (n int) {
245 return (math_bits.Len64(x|1) + 6) / 7
246 }
247 func sozGogovanity(x uint64) (n int) {
248 return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63))))
249 }
250 func (this *B) String() string {
251 if this == nil {
252 return "nil"
253 }
254 s := strings.Join([]string{`&B{`,
255 `String_:` + valueToStringGogovanity(this.String_) + `,`,
256 `Int64:` + fmt.Sprintf("%v", this.Int64) + `,`,
257 `Int32:` + valueToStringGogovanity(this.Int32) + `,`,
258 `}`,
259 }, "")
260 return s
261 }
262 func valueToStringGogovanity(v interface{}) string {
263 rv := reflect.ValueOf(v)
264 if rv.IsNil() {
265 return "nil"
266 }
267 pv := reflect.Indirect(rv).Interface()
268 return fmt.Sprintf("*%v", pv)
269 }
270 func (m *B) Unmarshal(dAtA []byte) error {
271 l := len(dAtA)
272 iNdEx := 0
273 for iNdEx < l {
274 preIndex := iNdEx
275 var wire uint64
276 for shift := uint(0); ; shift += 7 {
277 if shift >= 64 {
278 return ErrIntOverflowGogovanity
279 }
280 if iNdEx >= l {
281 return io.ErrUnexpectedEOF
282 }
283 b := dAtA[iNdEx]
284 iNdEx++
285 wire |= uint64(b&0x7F) << shift
286 if b < 0x80 {
287 break
288 }
289 }
290 fieldNum := int32(wire >> 3)
291 wireType := int(wire & 0x7)
292 if wireType == 4 {
293 return fmt.Errorf("proto: B: wiretype end group for non-group")
294 }
295 if fieldNum <= 0 {
296 return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire)
297 }
298 switch fieldNum {
299 case 1:
300 if wireType != 2 {
301 return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType)
302 }
303 var stringLen uint64
304 for shift := uint(0); ; shift += 7 {
305 if shift >= 64 {
306 return ErrIntOverflowGogovanity
307 }
308 if iNdEx >= l {
309 return io.ErrUnexpectedEOF
310 }
311 b := dAtA[iNdEx]
312 iNdEx++
313 stringLen |= uint64(b&0x7F) << shift
314 if b < 0x80 {
315 break
316 }
317 }
318 intStringLen := int(stringLen)
319 if intStringLen < 0 {
320 return ErrInvalidLengthGogovanity
321 }
322 postIndex := iNdEx + intStringLen
323 if postIndex < 0 {
324 return ErrInvalidLengthGogovanity
325 }
326 if postIndex > l {
327 return io.ErrUnexpectedEOF
328 }
329 s := string(dAtA[iNdEx:postIndex])
330 m.String_ = &s
331 iNdEx = postIndex
332 case 2:
333 if wireType != 0 {
334 return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType)
335 }
336 m.Int64 = 0
337 for shift := uint(0); ; shift += 7 {
338 if shift >= 64 {
339 return ErrIntOverflowGogovanity
340 }
341 if iNdEx >= l {
342 return io.ErrUnexpectedEOF
343 }
344 b := dAtA[iNdEx]
345 iNdEx++
346 m.Int64 |= int64(b&0x7F) << shift
347 if b < 0x80 {
348 break
349 }
350 }
351 case 3:
352 if wireType != 0 {
353 return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType)
354 }
355 var v int32
356 for shift := uint(0); ; shift += 7 {
357 if shift >= 64 {
358 return ErrIntOverflowGogovanity
359 }
360 if iNdEx >= l {
361 return io.ErrUnexpectedEOF
362 }
363 b := dAtA[iNdEx]
364 iNdEx++
365 v |= int32(b&0x7F) << shift
366 if b < 0x80 {
367 break
368 }
369 }
370 m.Int32 = &v
371 default:
372 iNdEx = preIndex
373 skippy, err := skipGogovanity(dAtA[iNdEx:])
374 if err != nil {
375 return err
376 }
377 if (skippy < 0) || (iNdEx+skippy) < 0 {
378 return ErrInvalidLengthGogovanity
379 }
380 if (iNdEx + skippy) > l {
381 return io.ErrUnexpectedEOF
382 }
383 iNdEx += skippy
384 }
385 }
386
387 if iNdEx > l {
388 return io.ErrUnexpectedEOF
389 }
390 return nil
391 }
392 func skipGogovanity(dAtA []byte) (n int, err error) {
393 l := len(dAtA)
394 iNdEx := 0
395 depth := 0
396 for iNdEx < l {
397 var wire uint64
398 for shift := uint(0); ; shift += 7 {
399 if shift >= 64 {
400 return 0, ErrIntOverflowGogovanity
401 }
402 if iNdEx >= l {
403 return 0, io.ErrUnexpectedEOF
404 }
405 b := dAtA[iNdEx]
406 iNdEx++
407 wire |= (uint64(b) & 0x7F) << shift
408 if b < 0x80 {
409 break
410 }
411 }
412 wireType := int(wire & 0x7)
413 switch wireType {
414 case 0:
415 for shift := uint(0); ; shift += 7 {
416 if shift >= 64 {
417 return 0, ErrIntOverflowGogovanity
418 }
419 if iNdEx >= l {
420 return 0, io.ErrUnexpectedEOF
421 }
422 iNdEx++
423 if dAtA[iNdEx-1] < 0x80 {
424 break
425 }
426 }
427 case 1:
428 iNdEx += 8
429 case 2:
430 var length int
431 for shift := uint(0); ; shift += 7 {
432 if shift >= 64 {
433 return 0, ErrIntOverflowGogovanity
434 }
435 if iNdEx >= l {
436 return 0, io.ErrUnexpectedEOF
437 }
438 b := dAtA[iNdEx]
439 iNdEx++
440 length |= (int(b) & 0x7F) << shift
441 if b < 0x80 {
442 break
443 }
444 }
445 if length < 0 {
446 return 0, ErrInvalidLengthGogovanity
447 }
448 iNdEx += length
449 case 3:
450 depth++
451 case 4:
452 if depth == 0 {
453 return 0, ErrUnexpectedEndOfGroupGogovanity
454 }
455 depth--
456 case 5:
457 iNdEx += 4
458 default:
459 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
460 }
461 if iNdEx < 0 {
462 return 0, ErrInvalidLengthGogovanity
463 }
464 if depth == 0 {
465 return iNdEx, nil
466 }
467 }
468 return 0, io.ErrUnexpectedEOF
469 }
470
471 var (
472 ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling")
473 ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow")
474 ErrUnexpectedEndOfGroupGogovanity = fmt.Errorf("proto: unexpected end of group")
475 )
476
View as plain text