...

Source file src/github.com/gogo/protobuf/test/sizeunderscore/sizeunderscore.pb.go

Documentation: github.com/gogo/protobuf/test/sizeunderscore

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: sizeunderscore.proto
     3  
     4  package sizeunderscore
     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  // Reference imports to suppress errors if they are not otherwise used.
    17  var _ = proto.Marshal
    18  var _ = fmt.Errorf
    19  var _ = math.Inf
    20  
    21  // This is a compile-time assertion to ensure that this generated file
    22  // is compatible with the proto package it is being compiled against.
    23  // A compilation error at this line likely means your copy of the
    24  // proto package needs to be updated.
    25  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    26  
    27  type SizeMessage struct {
    28  	Size_                *int64   `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
    29  	Equal_               *bool    `protobuf:"varint,2,opt,name=Equal" json:"Equal,omitempty"`
    30  	String_              *string  `protobuf:"bytes,3,opt,name=String" json:"String,omitempty"`
    31  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    32  	XXX_unrecognized     []byte   `json:"-"`
    33  	XXX_sizecache        int32    `json:"-"`
    34  }
    35  
    36  func (m *SizeMessage) Reset()         { *m = SizeMessage{} }
    37  func (m *SizeMessage) String() string { return proto.CompactTextString(m) }
    38  func (*SizeMessage) ProtoMessage()    {}
    39  func (*SizeMessage) Descriptor() ([]byte, []int) {
    40  	return fileDescriptor_4ba72c70f4572a8b, []int{0}
    41  }
    42  func (m *SizeMessage) XXX_Unmarshal(b []byte) error {
    43  	return m.Unmarshal(b)
    44  }
    45  func (m *SizeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    46  	if deterministic {
    47  		return xxx_messageInfo_SizeMessage.Marshal(b, m, deterministic)
    48  	} else {
    49  		b = b[:cap(b)]
    50  		n, err := m.MarshalToSizedBuffer(b)
    51  		if err != nil {
    52  			return nil, err
    53  		}
    54  		return b[:n], nil
    55  	}
    56  }
    57  func (m *SizeMessage) XXX_Merge(src proto.Message) {
    58  	xxx_messageInfo_SizeMessage.Merge(m, src)
    59  }
    60  func (m *SizeMessage) XXX_Size() int {
    61  	return m.Size()
    62  }
    63  func (m *SizeMessage) XXX_DiscardUnknown() {
    64  	xxx_messageInfo_SizeMessage.DiscardUnknown(m)
    65  }
    66  
    67  var xxx_messageInfo_SizeMessage proto.InternalMessageInfo
    68  
    69  func (m *SizeMessage) GetSize_() int64 {
    70  	if m != nil && m.Size_ != nil {
    71  		return *m.Size_
    72  	}
    73  	return 0
    74  }
    75  
    76  func (m *SizeMessage) GetEqual_() bool {
    77  	if m != nil && m.Equal_ != nil {
    78  		return *m.Equal_
    79  	}
    80  	return false
    81  }
    82  
    83  func (m *SizeMessage) GetString_() string {
    84  	if m != nil && m.String_ != nil {
    85  		return *m.String_
    86  	}
    87  	return ""
    88  }
    89  
    90  func init() {
    91  	proto.RegisterType((*SizeMessage)(nil), "sizeunderscore.SizeMessage")
    92  }
    93  
    94  func init() { proto.RegisterFile("sizeunderscore.proto", fileDescriptor_4ba72c70f4572a8b) }
    95  
    96  var fileDescriptor_4ba72c70f4572a8b = []byte{
    97  	// 174 bytes of a gzipped FileDescriptorProto
    98  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0xce, 0xac, 0x4a,
    99  	0x2d, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0x4e, 0xce, 0x2f, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
   100  	0x17, 0xe2, 0x43, 0x15, 0x95, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf,
   101  	0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x2b, 0x4b, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30,
   102  	0x0b, 0xa2, 0x5d, 0xc9, 0x9f, 0x8b, 0x3b, 0x38, 0xb3, 0x2a, 0xd5, 0x37, 0xb5, 0xb8, 0x38, 0x31,
   103  	0x3d, 0x55, 0x48, 0x88, 0x8b, 0x05, 0x64, 0x9e, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x98,
   104  	0x2d, 0x24, 0xc2, 0xc5, 0xea, 0x5a, 0x58, 0x9a, 0x98, 0x23, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x11,
   105  	0x04, 0xe1, 0x08, 0x89, 0x71, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2b, 0x30,
   106  	0x6a, 0x70, 0x06, 0x41, 0x79, 0x4e, 0x12, 0x3f, 0x1e, 0xca, 0x31, 0xae, 0x78, 0x24, 0xc7, 0xb8,
   107  	0xe3, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7,
   108  	0x08, 0x08, 0x00, 0x00, 0xff, 0xff, 0x37, 0x1c, 0x48, 0xa4, 0xc0, 0x00, 0x00, 0x00,
   109  }
   110  
   111  func (this *SizeMessage) Equal(that interface{}) bool {
   112  	if that == nil {
   113  		return this == nil
   114  	}
   115  
   116  	that1, ok := that.(*SizeMessage)
   117  	if !ok {
   118  		that2, ok := that.(SizeMessage)
   119  		if ok {
   120  			that1 = &that2
   121  		} else {
   122  			return false
   123  		}
   124  	}
   125  	if that1 == nil {
   126  		return this == nil
   127  	} else if this == nil {
   128  		return false
   129  	}
   130  	if this.Size_ != nil && that1.Size_ != nil {
   131  		if *this.Size_ != *that1.Size_ {
   132  			return false
   133  		}
   134  	} else if this.Size_ != nil {
   135  		return false
   136  	} else if that1.Size_ != nil {
   137  		return false
   138  	}
   139  	if this.Equal_ != nil && that1.Equal_ != nil {
   140  		if *this.Equal_ != *that1.Equal_ {
   141  			return false
   142  		}
   143  	} else if this.Equal_ != nil {
   144  		return false
   145  	} else if that1.Equal_ != nil {
   146  		return false
   147  	}
   148  	if this.String_ != nil && that1.String_ != nil {
   149  		if *this.String_ != *that1.String_ {
   150  			return false
   151  		}
   152  	} else if this.String_ != nil {
   153  		return false
   154  	} else if that1.String_ != nil {
   155  		return false
   156  	}
   157  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   158  		return false
   159  	}
   160  	return true
   161  }
   162  func (m *SizeMessage) Marshal() (dAtA []byte, err error) {
   163  	size := m.Size()
   164  	dAtA = make([]byte, size)
   165  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   166  	if err != nil {
   167  		return nil, err
   168  	}
   169  	return dAtA[:n], nil
   170  }
   171  
   172  func (m *SizeMessage) MarshalTo(dAtA []byte) (int, error) {
   173  	size := m.Size()
   174  	return m.MarshalToSizedBuffer(dAtA[:size])
   175  }
   176  
   177  func (m *SizeMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   178  	i := len(dAtA)
   179  	_ = i
   180  	var l int
   181  	_ = l
   182  	if m.XXX_unrecognized != nil {
   183  		i -= len(m.XXX_unrecognized)
   184  		copy(dAtA[i:], m.XXX_unrecognized)
   185  	}
   186  	if m.String_ != nil {
   187  		i -= len(*m.String_)
   188  		copy(dAtA[i:], *m.String_)
   189  		i = encodeVarintSizeunderscore(dAtA, i, uint64(len(*m.String_)))
   190  		i--
   191  		dAtA[i] = 0x1a
   192  	}
   193  	if m.Equal_ != nil {
   194  		i--
   195  		if *m.Equal_ {
   196  			dAtA[i] = 1
   197  		} else {
   198  			dAtA[i] = 0
   199  		}
   200  		i--
   201  		dAtA[i] = 0x10
   202  	}
   203  	if m.Size_ != nil {
   204  		i = encodeVarintSizeunderscore(dAtA, i, uint64(*m.Size_))
   205  		i--
   206  		dAtA[i] = 0x8
   207  	}
   208  	return len(dAtA) - i, nil
   209  }
   210  
   211  func encodeVarintSizeunderscore(dAtA []byte, offset int, v uint64) int {
   212  	offset -= sovSizeunderscore(v)
   213  	base := offset
   214  	for v >= 1<<7 {
   215  		dAtA[offset] = uint8(v&0x7f | 0x80)
   216  		v >>= 7
   217  		offset++
   218  	}
   219  	dAtA[offset] = uint8(v)
   220  	return base
   221  }
   222  func NewPopulatedSizeMessage(r randySizeunderscore, easy bool) *SizeMessage {
   223  	this := &SizeMessage{}
   224  	if r.Intn(5) != 0 {
   225  		v1 := int64(r.Int63())
   226  		if r.Intn(2) == 0 {
   227  			v1 *= -1
   228  		}
   229  		this.Size_ = &v1
   230  	}
   231  	if r.Intn(5) != 0 {
   232  		v2 := bool(bool(r.Intn(2) == 0))
   233  		this.Equal_ = &v2
   234  	}
   235  	if r.Intn(5) != 0 {
   236  		v3 := string(randStringSizeunderscore(r))
   237  		this.String_ = &v3
   238  	}
   239  	if !easy && r.Intn(10) != 0 {
   240  		this.XXX_unrecognized = randUnrecognizedSizeunderscore(r, 4)
   241  	}
   242  	return this
   243  }
   244  
   245  type randySizeunderscore interface {
   246  	Float32() float32
   247  	Float64() float64
   248  	Int63() int64
   249  	Int31() int32
   250  	Uint32() uint32
   251  	Intn(n int) int
   252  }
   253  
   254  func randUTF8RuneSizeunderscore(r randySizeunderscore) rune {
   255  	ru := r.Intn(62)
   256  	if ru < 10 {
   257  		return rune(ru + 48)
   258  	} else if ru < 36 {
   259  		return rune(ru + 55)
   260  	}
   261  	return rune(ru + 61)
   262  }
   263  func randStringSizeunderscore(r randySizeunderscore) string {
   264  	v4 := r.Intn(100)
   265  	tmps := make([]rune, v4)
   266  	for i := 0; i < v4; i++ {
   267  		tmps[i] = randUTF8RuneSizeunderscore(r)
   268  	}
   269  	return string(tmps)
   270  }
   271  func randUnrecognizedSizeunderscore(r randySizeunderscore, maxFieldNumber int) (dAtA []byte) {
   272  	l := r.Intn(5)
   273  	for i := 0; i < l; i++ {
   274  		wire := r.Intn(4)
   275  		if wire == 3 {
   276  			wire = 5
   277  		}
   278  		fieldNumber := maxFieldNumber + r.Intn(100)
   279  		dAtA = randFieldSizeunderscore(dAtA, r, fieldNumber, wire)
   280  	}
   281  	return dAtA
   282  }
   283  func randFieldSizeunderscore(dAtA []byte, r randySizeunderscore, fieldNumber int, wire int) []byte {
   284  	key := uint32(fieldNumber)<<3 | uint32(wire)
   285  	switch wire {
   286  	case 0:
   287  		dAtA = encodeVarintPopulateSizeunderscore(dAtA, uint64(key))
   288  		v5 := r.Int63()
   289  		if r.Intn(2) == 0 {
   290  			v5 *= -1
   291  		}
   292  		dAtA = encodeVarintPopulateSizeunderscore(dAtA, uint64(v5))
   293  	case 1:
   294  		dAtA = encodeVarintPopulateSizeunderscore(dAtA, uint64(key))
   295  		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)))
   296  	case 2:
   297  		dAtA = encodeVarintPopulateSizeunderscore(dAtA, uint64(key))
   298  		ll := r.Intn(100)
   299  		dAtA = encodeVarintPopulateSizeunderscore(dAtA, uint64(ll))
   300  		for j := 0; j < ll; j++ {
   301  			dAtA = append(dAtA, byte(r.Intn(256)))
   302  		}
   303  	default:
   304  		dAtA = encodeVarintPopulateSizeunderscore(dAtA, uint64(key))
   305  		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
   306  	}
   307  	return dAtA
   308  }
   309  func encodeVarintPopulateSizeunderscore(dAtA []byte, v uint64) []byte {
   310  	for v >= 1<<7 {
   311  		dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
   312  		v >>= 7
   313  	}
   314  	dAtA = append(dAtA, uint8(v))
   315  	return dAtA
   316  }
   317  func (m *SizeMessage) Size() (n int) {
   318  	if m == nil {
   319  		return 0
   320  	}
   321  	var l int
   322  	_ = l
   323  	if m.Size_ != nil {
   324  		n += 1 + sovSizeunderscore(uint64(*m.Size_))
   325  	}
   326  	if m.Equal_ != nil {
   327  		n += 2
   328  	}
   329  	if m.String_ != nil {
   330  		l = len(*m.String_)
   331  		n += 1 + l + sovSizeunderscore(uint64(l))
   332  	}
   333  	if m.XXX_unrecognized != nil {
   334  		n += len(m.XXX_unrecognized)
   335  	}
   336  	return n
   337  }
   338  
   339  func sovSizeunderscore(x uint64) (n int) {
   340  	return (math_bits.Len64(x|1) + 6) / 7
   341  }
   342  func sozSizeunderscore(x uint64) (n int) {
   343  	return sovSizeunderscore(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   344  }
   345  func (m *SizeMessage) Unmarshal(dAtA []byte) error {
   346  	l := len(dAtA)
   347  	iNdEx := 0
   348  	for iNdEx < l {
   349  		preIndex := iNdEx
   350  		var wire uint64
   351  		for shift := uint(0); ; shift += 7 {
   352  			if shift >= 64 {
   353  				return ErrIntOverflowSizeunderscore
   354  			}
   355  			if iNdEx >= l {
   356  				return io.ErrUnexpectedEOF
   357  			}
   358  			b := dAtA[iNdEx]
   359  			iNdEx++
   360  			wire |= uint64(b&0x7F) << shift
   361  			if b < 0x80 {
   362  				break
   363  			}
   364  		}
   365  		fieldNum := int32(wire >> 3)
   366  		wireType := int(wire & 0x7)
   367  		if wireType == 4 {
   368  			return fmt.Errorf("proto: SizeMessage: wiretype end group for non-group")
   369  		}
   370  		if fieldNum <= 0 {
   371  			return fmt.Errorf("proto: SizeMessage: illegal tag %d (wire type %d)", fieldNum, wire)
   372  		}
   373  		switch fieldNum {
   374  		case 1:
   375  			if wireType != 0 {
   376  				return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType)
   377  			}
   378  			var v int64
   379  			for shift := uint(0); ; shift += 7 {
   380  				if shift >= 64 {
   381  					return ErrIntOverflowSizeunderscore
   382  				}
   383  				if iNdEx >= l {
   384  					return io.ErrUnexpectedEOF
   385  				}
   386  				b := dAtA[iNdEx]
   387  				iNdEx++
   388  				v |= int64(b&0x7F) << shift
   389  				if b < 0x80 {
   390  					break
   391  				}
   392  			}
   393  			m.Size_ = &v
   394  		case 2:
   395  			if wireType != 0 {
   396  				return fmt.Errorf("proto: wrong wireType = %d for field Equal_", wireType)
   397  			}
   398  			var v int
   399  			for shift := uint(0); ; shift += 7 {
   400  				if shift >= 64 {
   401  					return ErrIntOverflowSizeunderscore
   402  				}
   403  				if iNdEx >= l {
   404  					return io.ErrUnexpectedEOF
   405  				}
   406  				b := dAtA[iNdEx]
   407  				iNdEx++
   408  				v |= int(b&0x7F) << shift
   409  				if b < 0x80 {
   410  					break
   411  				}
   412  			}
   413  			b := bool(v != 0)
   414  			m.Equal_ = &b
   415  		case 3:
   416  			if wireType != 2 {
   417  				return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType)
   418  			}
   419  			var stringLen uint64
   420  			for shift := uint(0); ; shift += 7 {
   421  				if shift >= 64 {
   422  					return ErrIntOverflowSizeunderscore
   423  				}
   424  				if iNdEx >= l {
   425  					return io.ErrUnexpectedEOF
   426  				}
   427  				b := dAtA[iNdEx]
   428  				iNdEx++
   429  				stringLen |= uint64(b&0x7F) << shift
   430  				if b < 0x80 {
   431  					break
   432  				}
   433  			}
   434  			intStringLen := int(stringLen)
   435  			if intStringLen < 0 {
   436  				return ErrInvalidLengthSizeunderscore
   437  			}
   438  			postIndex := iNdEx + intStringLen
   439  			if postIndex < 0 {
   440  				return ErrInvalidLengthSizeunderscore
   441  			}
   442  			if postIndex > l {
   443  				return io.ErrUnexpectedEOF
   444  			}
   445  			s := string(dAtA[iNdEx:postIndex])
   446  			m.String_ = &s
   447  			iNdEx = postIndex
   448  		default:
   449  			iNdEx = preIndex
   450  			skippy, err := skipSizeunderscore(dAtA[iNdEx:])
   451  			if err != nil {
   452  				return err
   453  			}
   454  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   455  				return ErrInvalidLengthSizeunderscore
   456  			}
   457  			if (iNdEx + skippy) > l {
   458  				return io.ErrUnexpectedEOF
   459  			}
   460  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   461  			iNdEx += skippy
   462  		}
   463  	}
   464  
   465  	if iNdEx > l {
   466  		return io.ErrUnexpectedEOF
   467  	}
   468  	return nil
   469  }
   470  func skipSizeunderscore(dAtA []byte) (n int, err error) {
   471  	l := len(dAtA)
   472  	iNdEx := 0
   473  	depth := 0
   474  	for iNdEx < l {
   475  		var wire uint64
   476  		for shift := uint(0); ; shift += 7 {
   477  			if shift >= 64 {
   478  				return 0, ErrIntOverflowSizeunderscore
   479  			}
   480  			if iNdEx >= l {
   481  				return 0, io.ErrUnexpectedEOF
   482  			}
   483  			b := dAtA[iNdEx]
   484  			iNdEx++
   485  			wire |= (uint64(b) & 0x7F) << shift
   486  			if b < 0x80 {
   487  				break
   488  			}
   489  		}
   490  		wireType := int(wire & 0x7)
   491  		switch wireType {
   492  		case 0:
   493  			for shift := uint(0); ; shift += 7 {
   494  				if shift >= 64 {
   495  					return 0, ErrIntOverflowSizeunderscore
   496  				}
   497  				if iNdEx >= l {
   498  					return 0, io.ErrUnexpectedEOF
   499  				}
   500  				iNdEx++
   501  				if dAtA[iNdEx-1] < 0x80 {
   502  					break
   503  				}
   504  			}
   505  		case 1:
   506  			iNdEx += 8
   507  		case 2:
   508  			var length int
   509  			for shift := uint(0); ; shift += 7 {
   510  				if shift >= 64 {
   511  					return 0, ErrIntOverflowSizeunderscore
   512  				}
   513  				if iNdEx >= l {
   514  					return 0, io.ErrUnexpectedEOF
   515  				}
   516  				b := dAtA[iNdEx]
   517  				iNdEx++
   518  				length |= (int(b) & 0x7F) << shift
   519  				if b < 0x80 {
   520  					break
   521  				}
   522  			}
   523  			if length < 0 {
   524  				return 0, ErrInvalidLengthSizeunderscore
   525  			}
   526  			iNdEx += length
   527  		case 3:
   528  			depth++
   529  		case 4:
   530  			if depth == 0 {
   531  				return 0, ErrUnexpectedEndOfGroupSizeunderscore
   532  			}
   533  			depth--
   534  		case 5:
   535  			iNdEx += 4
   536  		default:
   537  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   538  		}
   539  		if iNdEx < 0 {
   540  			return 0, ErrInvalidLengthSizeunderscore
   541  		}
   542  		if depth == 0 {
   543  			return iNdEx, nil
   544  		}
   545  	}
   546  	return 0, io.ErrUnexpectedEOF
   547  }
   548  
   549  var (
   550  	ErrInvalidLengthSizeunderscore        = fmt.Errorf("proto: negative length found during unmarshaling")
   551  	ErrIntOverflowSizeunderscore          = fmt.Errorf("proto: integer overflow")
   552  	ErrUnexpectedEndOfGroupSizeunderscore = fmt.Errorf("proto: unexpected end of group")
   553  )
   554  

View as plain text