github.com/gogo/protobuf@v1.3.2/test/int64support/object.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: object.proto 3 4 package int64support 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 // Reference imports to suppress errors if they are not otherwise used. 18 var _ = proto.Marshal 19 var _ = fmt.Errorf 20 var _ = math.Inf 21 22 // This is a compile-time assertion to ensure that this generated file 23 // is compatible with the proto package it is being compiled against. 24 // A compilation error at this line likely means your copy of the 25 // proto package needs to be updated. 26 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 27 28 type Object struct { 29 OptionalNumber *int64 `protobuf:"varint,1,opt,name=optional_number,json=optionalNumber" json:"optional_number,omitempty"` 30 XXX_NoUnkeyedLiteral struct{} `json:"-"` 31 XXX_sizecache int32 `json:"-"` 32 } 33 34 func (m *Object) Reset() { *m = Object{} } 35 func (*Object) ProtoMessage() {} 36 func (*Object) Descriptor() ([]byte, []int) { 37 return fileDescriptor_41d48463eef19a5f, []int{0} 38 } 39 func (m *Object) XXX_Unmarshal(b []byte) error { 40 return m.Unmarshal(b) 41 } 42 func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 43 if deterministic { 44 return xxx_messageInfo_Object.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 *Object) XXX_Merge(src proto.Message) { 55 xxx_messageInfo_Object.Merge(m, src) 56 } 57 func (m *Object) XXX_Size() int { 58 return m.Size() 59 } 60 func (m *Object) XXX_DiscardUnknown() { 61 xxx_messageInfo_Object.DiscardUnknown(m) 62 } 63 64 var xxx_messageInfo_Object proto.InternalMessageInfo 65 66 func (m *Object) GetOptionalNumber() int64 { 67 if m != nil && m.OptionalNumber != nil { 68 return *m.OptionalNumber 69 } 70 return 0 71 } 72 73 func init() { 74 proto.RegisterType((*Object)(nil), "int64support.Object") 75 } 76 77 func init() { proto.RegisterFile("object.proto", fileDescriptor_41d48463eef19a5f) } 78 79 var fileDescriptor_41d48463eef19a5f = []byte{ 80 // 190 bytes of a gzipped FileDescriptorProto 81 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0x4f, 0xca, 0x4a, 82 0x4d, 0x2e, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc9, 0xcc, 0x2b, 0x31, 0x33, 0x29, 83 0x2e, 0x2d, 0x28, 0xc8, 0x2f, 0x2a, 0x91, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 84 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x2b, 0x4a, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 85 0x1c, 0x30, 0x0b, 0xa2, 0x59, 0xc9, 0x90, 0x8b, 0xcd, 0x1f, 0x6c, 0x98, 0x90, 0x3a, 0x17, 0x7f, 86 0x7e, 0x41, 0x49, 0x66, 0x7e, 0x5e, 0x62, 0x4e, 0x7c, 0x5e, 0x69, 0x6e, 0x52, 0x6a, 0x91, 0x04, 87 0xa3, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x1f, 0x4c, 0xd8, 0x0f, 0x2c, 0xea, 0xe4, 0x75, 0xe1, 0xa1, 88 0x1c, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0f, 0x1e, 0xca, 0x31, 0x7e, 0x78, 0x28, 0xc7, 0xf8, 0xe3, 89 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x77, 0x3c, 0x92, 0x63, 0x3c, 90 0xf0, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 91 0x7c, 0xf1, 0x48, 0x8e, 0xe1, 0xc3, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0xa2, 0x50, 0x5c, 92 0x0b, 0x08, 0x00, 0x00, 0xff, 0xff, 0x73, 0x60, 0x3c, 0xd6, 0xca, 0x00, 0x00, 0x00, 93 } 94 95 func (this *Object) VerboseEqual(that interface{}) error { 96 if that == nil { 97 if this == nil { 98 return nil 99 } 100 return fmt.Errorf("that == nil && this != nil") 101 } 102 103 that1, ok := that.(*Object) 104 if !ok { 105 that2, ok := that.(Object) 106 if ok { 107 that1 = &that2 108 } else { 109 return fmt.Errorf("that is not of type *Object") 110 } 111 } 112 if that1 == nil { 113 if this == nil { 114 return nil 115 } 116 return fmt.Errorf("that is type *Object but is nil && this != nil") 117 } else if this == nil { 118 return fmt.Errorf("that is type *Object but is not nil && this == nil") 119 } 120 if this.OptionalNumber != nil && that1.OptionalNumber != nil { 121 if *this.OptionalNumber != *that1.OptionalNumber { 122 return fmt.Errorf("OptionalNumber this(%v) Not Equal that(%v)", *this.OptionalNumber, *that1.OptionalNumber) 123 } 124 } else if this.OptionalNumber != nil { 125 return fmt.Errorf("this.OptionalNumber == nil && that.OptionalNumber != nil") 126 } else if that1.OptionalNumber != nil { 127 return fmt.Errorf("OptionalNumber this(%v) Not Equal that(%v)", this.OptionalNumber, that1.OptionalNumber) 128 } 129 return nil 130 } 131 func (this *Object) Equal(that interface{}) bool { 132 if that == nil { 133 return this == nil 134 } 135 136 that1, ok := that.(*Object) 137 if !ok { 138 that2, ok := that.(Object) 139 if ok { 140 that1 = &that2 141 } else { 142 return false 143 } 144 } 145 if that1 == nil { 146 return this == nil 147 } else if this == nil { 148 return false 149 } 150 if this.OptionalNumber != nil && that1.OptionalNumber != nil { 151 if *this.OptionalNumber != *that1.OptionalNumber { 152 return false 153 } 154 } else if this.OptionalNumber != nil { 155 return false 156 } else if that1.OptionalNumber != nil { 157 return false 158 } 159 return true 160 } 161 func (this *Object) GoString() string { 162 if this == nil { 163 return "nil" 164 } 165 s := make([]string, 0, 5) 166 s = append(s, "&int64support.Object{") 167 if this.OptionalNumber != nil { 168 s = append(s, "OptionalNumber: "+valueToGoStringObject(this.OptionalNumber, "int64")+",\n") 169 } 170 s = append(s, "}") 171 return strings.Join(s, "") 172 } 173 func valueToGoStringObject(v interface{}, typ string) string { 174 rv := reflect.ValueOf(v) 175 if rv.IsNil() { 176 return "nil" 177 } 178 pv := reflect.Indirect(rv).Interface() 179 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 180 } 181 func (m *Object) Marshal() (dAtA []byte, err error) { 182 size := m.Size() 183 dAtA = make([]byte, size) 184 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 185 if err != nil { 186 return nil, err 187 } 188 return dAtA[:n], nil 189 } 190 191 func (m *Object) MarshalTo(dAtA []byte) (int, error) { 192 size := m.Size() 193 return m.MarshalToSizedBuffer(dAtA[:size]) 194 } 195 196 func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { 197 i := len(dAtA) 198 _ = i 199 var l int 200 _ = l 201 if m.OptionalNumber != nil { 202 i = encodeVarintObject(dAtA, i, uint64(*m.OptionalNumber)) 203 i-- 204 dAtA[i] = 0x8 205 } 206 return len(dAtA) - i, nil 207 } 208 209 func encodeVarintObject(dAtA []byte, offset int, v uint64) int { 210 offset -= sovObject(v) 211 base := offset 212 for v >= 1<<7 { 213 dAtA[offset] = uint8(v&0x7f | 0x80) 214 v >>= 7 215 offset++ 216 } 217 dAtA[offset] = uint8(v) 218 return base 219 } 220 func NewPopulatedObject(r randyObject, easy bool) *Object { 221 this := &Object{} 222 if r.Intn(5) != 0 { 223 v1 := int64(r.Int63()) 224 if r.Intn(2) == 0 { 225 v1 *= -1 226 } 227 this.OptionalNumber = &v1 228 } 229 if !easy && r.Intn(10) != 0 { 230 } 231 return this 232 } 233 234 type randyObject interface { 235 Float32() float32 236 Float64() float64 237 Int63() int64 238 Int31() int32 239 Uint32() uint32 240 Intn(n int) int 241 } 242 243 func randUTF8RuneObject(r randyObject) rune { 244 ru := r.Intn(62) 245 if ru < 10 { 246 return rune(ru + 48) 247 } else if ru < 36 { 248 return rune(ru + 55) 249 } 250 return rune(ru + 61) 251 } 252 func randStringObject(r randyObject) string { 253 v2 := r.Intn(100) 254 tmps := make([]rune, v2) 255 for i := 0; i < v2; i++ { 256 tmps[i] = randUTF8RuneObject(r) 257 } 258 return string(tmps) 259 } 260 func randUnrecognizedObject(r randyObject, maxFieldNumber int) (dAtA []byte) { 261 l := r.Intn(5) 262 for i := 0; i < l; i++ { 263 wire := r.Intn(4) 264 if wire == 3 { 265 wire = 5 266 } 267 fieldNumber := maxFieldNumber + r.Intn(100) 268 dAtA = randFieldObject(dAtA, r, fieldNumber, wire) 269 } 270 return dAtA 271 } 272 func randFieldObject(dAtA []byte, r randyObject, fieldNumber int, wire int) []byte { 273 key := uint32(fieldNumber)<<3 | uint32(wire) 274 switch wire { 275 case 0: 276 dAtA = encodeVarintPopulateObject(dAtA, uint64(key)) 277 v3 := r.Int63() 278 if r.Intn(2) == 0 { 279 v3 *= -1 280 } 281 dAtA = encodeVarintPopulateObject(dAtA, uint64(v3)) 282 case 1: 283 dAtA = encodeVarintPopulateObject(dAtA, uint64(key)) 284 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))) 285 case 2: 286 dAtA = encodeVarintPopulateObject(dAtA, uint64(key)) 287 ll := r.Intn(100) 288 dAtA = encodeVarintPopulateObject(dAtA, uint64(ll)) 289 for j := 0; j < ll; j++ { 290 dAtA = append(dAtA, byte(r.Intn(256))) 291 } 292 default: 293 dAtA = encodeVarintPopulateObject(dAtA, uint64(key)) 294 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 295 } 296 return dAtA 297 } 298 func encodeVarintPopulateObject(dAtA []byte, v uint64) []byte { 299 for v >= 1<<7 { 300 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 301 v >>= 7 302 } 303 dAtA = append(dAtA, uint8(v)) 304 return dAtA 305 } 306 func (m *Object) Size() (n int) { 307 if m == nil { 308 return 0 309 } 310 var l int 311 _ = l 312 if m.OptionalNumber != nil { 313 n += 1 + sovObject(uint64(*m.OptionalNumber)) 314 } 315 return n 316 } 317 318 func sovObject(x uint64) (n int) { 319 return (math_bits.Len64(x|1) + 6) / 7 320 } 321 func sozObject(x uint64) (n int) { 322 return sovObject(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 323 } 324 func (this *Object) String() string { 325 if this == nil { 326 return "nil" 327 } 328 s := strings.Join([]string{`&Object{`, 329 `OptionalNumber:` + valueToStringObject(this.OptionalNumber) + `,`, 330 `}`, 331 }, "") 332 return s 333 } 334 func valueToStringObject(v interface{}) string { 335 rv := reflect.ValueOf(v) 336 if rv.IsNil() { 337 return "nil" 338 } 339 pv := reflect.Indirect(rv).Interface() 340 return fmt.Sprintf("*%v", pv) 341 } 342 func (m *Object) Unmarshal(dAtA []byte) error { 343 l := len(dAtA) 344 iNdEx := 0 345 for iNdEx < l { 346 preIndex := iNdEx 347 var wire uint64 348 for shift := uint(0); ; shift += 7 { 349 if shift >= 64 { 350 return ErrIntOverflowObject 351 } 352 if iNdEx >= l { 353 return io.ErrUnexpectedEOF 354 } 355 b := dAtA[iNdEx] 356 iNdEx++ 357 wire |= uint64(b&0x7F) << shift 358 if b < 0x80 { 359 break 360 } 361 } 362 fieldNum := int32(wire >> 3) 363 wireType := int(wire & 0x7) 364 if wireType == 4 { 365 return fmt.Errorf("proto: Object: wiretype end group for non-group") 366 } 367 if fieldNum <= 0 { 368 return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire) 369 } 370 switch fieldNum { 371 case 1: 372 if wireType != 0 { 373 return fmt.Errorf("proto: wrong wireType = %d for field OptionalNumber", wireType) 374 } 375 var v int64 376 for shift := uint(0); ; shift += 7 { 377 if shift >= 64 { 378 return ErrIntOverflowObject 379 } 380 if iNdEx >= l { 381 return io.ErrUnexpectedEOF 382 } 383 b := dAtA[iNdEx] 384 iNdEx++ 385 v |= int64(b&0x7F) << shift 386 if b < 0x80 { 387 break 388 } 389 } 390 m.OptionalNumber = &v 391 default: 392 iNdEx = preIndex 393 skippy, err := skipObject(dAtA[iNdEx:]) 394 if err != nil { 395 return err 396 } 397 if (skippy < 0) || (iNdEx+skippy) < 0 { 398 return ErrInvalidLengthObject 399 } 400 if (iNdEx + skippy) > l { 401 return io.ErrUnexpectedEOF 402 } 403 iNdEx += skippy 404 } 405 } 406 407 if iNdEx > l { 408 return io.ErrUnexpectedEOF 409 } 410 return nil 411 } 412 func skipObject(dAtA []byte) (n int, err error) { 413 l := len(dAtA) 414 iNdEx := 0 415 depth := 0 416 for iNdEx < l { 417 var wire uint64 418 for shift := uint(0); ; shift += 7 { 419 if shift >= 64 { 420 return 0, ErrIntOverflowObject 421 } 422 if iNdEx >= l { 423 return 0, io.ErrUnexpectedEOF 424 } 425 b := dAtA[iNdEx] 426 iNdEx++ 427 wire |= (uint64(b) & 0x7F) << shift 428 if b < 0x80 { 429 break 430 } 431 } 432 wireType := int(wire & 0x7) 433 switch wireType { 434 case 0: 435 for shift := uint(0); ; shift += 7 { 436 if shift >= 64 { 437 return 0, ErrIntOverflowObject 438 } 439 if iNdEx >= l { 440 return 0, io.ErrUnexpectedEOF 441 } 442 iNdEx++ 443 if dAtA[iNdEx-1] < 0x80 { 444 break 445 } 446 } 447 case 1: 448 iNdEx += 8 449 case 2: 450 var length int 451 for shift := uint(0); ; shift += 7 { 452 if shift >= 64 { 453 return 0, ErrIntOverflowObject 454 } 455 if iNdEx >= l { 456 return 0, io.ErrUnexpectedEOF 457 } 458 b := dAtA[iNdEx] 459 iNdEx++ 460 length |= (int(b) & 0x7F) << shift 461 if b < 0x80 { 462 break 463 } 464 } 465 if length < 0 { 466 return 0, ErrInvalidLengthObject 467 } 468 iNdEx += length 469 case 3: 470 depth++ 471 case 4: 472 if depth == 0 { 473 return 0, ErrUnexpectedEndOfGroupObject 474 } 475 depth-- 476 case 5: 477 iNdEx += 4 478 default: 479 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 480 } 481 if iNdEx < 0 { 482 return 0, ErrInvalidLengthObject 483 } 484 if depth == 0 { 485 return iNdEx, nil 486 } 487 } 488 return 0, io.ErrUnexpectedEOF 489 } 490 491 var ( 492 ErrInvalidLengthObject = fmt.Errorf("proto: negative length found during unmarshaling") 493 ErrIntOverflowObject = fmt.Errorf("proto: integer overflow") 494 ErrUnexpectedEndOfGroupObject = fmt.Errorf("proto: unexpected end of group") 495 )