...

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

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

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: data.proto
     3  
     4  package data
     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  	reflect "reflect"
    15  	strings "strings"
    16  )
    17  
    18  // Reference imports to suppress errors if they are not otherwise used.
    19  var _ = proto.Marshal
    20  var _ = fmt.Errorf
    21  var _ = math.Inf
    22  
    23  // This is a compile-time assertion to ensure that this generated file
    24  // is compatible with the proto package it is being compiled against.
    25  // A compilation error at this line likely means your copy of the
    26  // proto package needs to be updated.
    27  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    28  
    29  type MyMessage struct {
    30  	MyData               uint32   `protobuf:"varint,1,opt,name=my_data,json=myData,proto3" json:"my_data,omitempty"`
    31  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    32  	XXX_unrecognized     []byte   `json:"-"`
    33  	XXX_sizecache        int32    `json:"-"`
    34  }
    35  
    36  func (m *MyMessage) Reset()      { *m = MyMessage{} }
    37  func (*MyMessage) ProtoMessage() {}
    38  func (*MyMessage) Descriptor() ([]byte, []int) {
    39  	return fileDescriptor_871986018790d2fd, []int{0}
    40  }
    41  func (m *MyMessage) XXX_Unmarshal(b []byte) error {
    42  	return m.Unmarshal(b)
    43  }
    44  func (m *MyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    45  	if deterministic {
    46  		return xxx_messageInfo_MyMessage.Marshal(b, m, deterministic)
    47  	} else {
    48  		b = b[:cap(b)]
    49  		n, err := m.MarshalToSizedBuffer(b)
    50  		if err != nil {
    51  			return nil, err
    52  		}
    53  		return b[:n], nil
    54  	}
    55  }
    56  func (m *MyMessage) XXX_Merge(src proto.Message) {
    57  	xxx_messageInfo_MyMessage.Merge(m, src)
    58  }
    59  func (m *MyMessage) XXX_Size() int {
    60  	return m.Size()
    61  }
    62  func (m *MyMessage) XXX_DiscardUnknown() {
    63  	xxx_messageInfo_MyMessage.DiscardUnknown(m)
    64  }
    65  
    66  var xxx_messageInfo_MyMessage proto.InternalMessageInfo
    67  
    68  func (m *MyMessage) GetMyData() uint32 {
    69  	if m != nil {
    70  		return m.MyData
    71  	}
    72  	return 0
    73  }
    74  
    75  func init() {
    76  	proto.RegisterType((*MyMessage)(nil), "data.MyMessage")
    77  }
    78  
    79  func init() { proto.RegisterFile("data.proto", fileDescriptor_871986018790d2fd) }
    80  
    81  var fileDescriptor_871986018790d2fd = []byte{
    82  	// 160 bytes of a gzipped FileDescriptorProto
    83  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x49, 0x2c, 0x49,
    84  	0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0xb1, 0xa5, 0x74, 0xd3, 0x33, 0x4b, 0x32,
    85  	0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x92, 0x49, 0xa5,
    86  	0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x34, 0x29, 0xa9, 0x70, 0x71, 0xfa, 0x56, 0xfa, 0xa6,
    87  	0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x89, 0x73, 0xb1, 0xe7, 0x56, 0xc6, 0x83, 0x8c, 0x91, 0x60,
    88  	0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x62, 0xcb, 0xad, 0x74, 0x49, 0x2c, 0x49, 0x74, 0xd2, 0xb9, 0xf1,
    89  	0x50, 0x8e, 0xe1, 0xc1, 0x43, 0x39, 0xc6, 0x0f, 0x0f, 0xe5, 0x18, 0x7f, 0x3c, 0x94, 0x63, 0x6c,
    90  	0x78, 0x24, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x8e, 0x47, 0x72, 0x8c, 0x07, 0x1e, 0xc9, 0x31,
    91  	0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60,
    92  	0xa3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x4f, 0xfb, 0xa7, 0x9d, 0x00, 0x00, 0x00,
    93  }
    94  
    95  func (this *MyMessage) 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.(*MyMessage)
   104  	if !ok {
   105  		that2, ok := that.(MyMessage)
   106  		if ok {
   107  			that1 = &that2
   108  		} else {
   109  			return fmt.Errorf("that is not of type *MyMessage")
   110  		}
   111  	}
   112  	if that1 == nil {
   113  		if this == nil {
   114  			return nil
   115  		}
   116  		return fmt.Errorf("that is type *MyMessage but is nil && this != nil")
   117  	} else if this == nil {
   118  		return fmt.Errorf("that is type *MyMessage but is not nil && this == nil")
   119  	}
   120  	if this.MyData != that1.MyData {
   121  		return fmt.Errorf("MyData this(%v) Not Equal that(%v)", this.MyData, that1.MyData)
   122  	}
   123  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   124  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   125  	}
   126  	return nil
   127  }
   128  func (this *MyMessage) Equal(that interface{}) bool {
   129  	if that == nil {
   130  		return this == nil
   131  	}
   132  
   133  	that1, ok := that.(*MyMessage)
   134  	if !ok {
   135  		that2, ok := that.(MyMessage)
   136  		if ok {
   137  			that1 = &that2
   138  		} else {
   139  			return false
   140  		}
   141  	}
   142  	if that1 == nil {
   143  		return this == nil
   144  	} else if this == nil {
   145  		return false
   146  	}
   147  	if this.MyData != that1.MyData {
   148  		return false
   149  	}
   150  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   151  		return false
   152  	}
   153  	return true
   154  }
   155  func (this *MyMessage) GoString() string {
   156  	if this == nil {
   157  		return "nil"
   158  	}
   159  	s := make([]string, 0, 5)
   160  	s = append(s, "&data.MyMessage{")
   161  	s = append(s, "MyData: "+fmt.Sprintf("%#v", this.MyData)+",\n")
   162  	if this.XXX_unrecognized != nil {
   163  		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
   164  	}
   165  	s = append(s, "}")
   166  	return strings.Join(s, "")
   167  }
   168  func valueToGoStringData(v interface{}, typ string) string {
   169  	rv := reflect.ValueOf(v)
   170  	if rv.IsNil() {
   171  		return "nil"
   172  	}
   173  	pv := reflect.Indirect(rv).Interface()
   174  	return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
   175  }
   176  func (m *MyMessage) 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 *MyMessage) MarshalTo(dAtA []byte) (int, error) {
   187  	size := m.Size()
   188  	return m.MarshalToSizedBuffer(dAtA[:size])
   189  }
   190  
   191  func (m *MyMessage) 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.MyData != 0 {
   201  		i = encodeVarintData(dAtA, i, uint64(m.MyData))
   202  		i--
   203  		dAtA[i] = 0x8
   204  	}
   205  	return len(dAtA) - i, nil
   206  }
   207  
   208  func encodeVarintData(dAtA []byte, offset int, v uint64) int {
   209  	offset -= sovData(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 NewPopulatedMyMessage(r randyData, easy bool) *MyMessage {
   220  	this := &MyMessage{}
   221  	this.MyData = uint32(r.Uint32())
   222  	if !easy && r.Intn(10) != 0 {
   223  		this.XXX_unrecognized = randUnrecognizedData(r, 2)
   224  	}
   225  	return this
   226  }
   227  
   228  type randyData 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 randUTF8RuneData(r randyData) 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 randStringData(r randyData) string {
   247  	v1 := r.Intn(100)
   248  	tmps := make([]rune, v1)
   249  	for i := 0; i < v1; i++ {
   250  		tmps[i] = randUTF8RuneData(r)
   251  	}
   252  	return string(tmps)
   253  }
   254  func randUnrecognizedData(r randyData, 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 = randFieldData(dAtA, r, fieldNumber, wire)
   263  	}
   264  	return dAtA
   265  }
   266  func randFieldData(dAtA []byte, r randyData, fieldNumber int, wire int) []byte {
   267  	key := uint32(fieldNumber)<<3 | uint32(wire)
   268  	switch wire {
   269  	case 0:
   270  		dAtA = encodeVarintPopulateData(dAtA, uint64(key))
   271  		v2 := r.Int63()
   272  		if r.Intn(2) == 0 {
   273  			v2 *= -1
   274  		}
   275  		dAtA = encodeVarintPopulateData(dAtA, uint64(v2))
   276  	case 1:
   277  		dAtA = encodeVarintPopulateData(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 = encodeVarintPopulateData(dAtA, uint64(key))
   281  		ll := r.Intn(100)
   282  		dAtA = encodeVarintPopulateData(dAtA, uint64(ll))
   283  		for j := 0; j < ll; j++ {
   284  			dAtA = append(dAtA, byte(r.Intn(256)))
   285  		}
   286  	default:
   287  		dAtA = encodeVarintPopulateData(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 encodeVarintPopulateData(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 *MyMessage) Size() (n int) {
   301  	if m == nil {
   302  		return 0
   303  	}
   304  	var l int
   305  	_ = l
   306  	if m.MyData != 0 {
   307  		n += 1 + sovData(uint64(m.MyData))
   308  	}
   309  	if m.XXX_unrecognized != nil {
   310  		n += len(m.XXX_unrecognized)
   311  	}
   312  	return n
   313  }
   314  
   315  func sovData(x uint64) (n int) {
   316  	return (math_bits.Len64(x|1) + 6) / 7
   317  }
   318  func sozData(x uint64) (n int) {
   319  	return sovData(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   320  }
   321  func (this *MyMessage) String() string {
   322  	if this == nil {
   323  		return "nil"
   324  	}
   325  	s := strings.Join([]string{`&MyMessage{`,
   326  		`MyData:` + fmt.Sprintf("%v", this.MyData) + `,`,
   327  		`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
   328  		`}`,
   329  	}, "")
   330  	return s
   331  }
   332  func valueToStringData(v interface{}) string {
   333  	rv := reflect.ValueOf(v)
   334  	if rv.IsNil() {
   335  		return "nil"
   336  	}
   337  	pv := reflect.Indirect(rv).Interface()
   338  	return fmt.Sprintf("*%v", pv)
   339  }
   340  func (m *MyMessage) Unmarshal(dAtA []byte) error {
   341  	l := len(dAtA)
   342  	iNdEx := 0
   343  	for iNdEx < l {
   344  		preIndex := iNdEx
   345  		var wire uint64
   346  		for shift := uint(0); ; shift += 7 {
   347  			if shift >= 64 {
   348  				return ErrIntOverflowData
   349  			}
   350  			if iNdEx >= l {
   351  				return io.ErrUnexpectedEOF
   352  			}
   353  			b := dAtA[iNdEx]
   354  			iNdEx++
   355  			wire |= uint64(b&0x7F) << shift
   356  			if b < 0x80 {
   357  				break
   358  			}
   359  		}
   360  		fieldNum := int32(wire >> 3)
   361  		wireType := int(wire & 0x7)
   362  		if wireType == 4 {
   363  			return fmt.Errorf("proto: MyMessage: wiretype end group for non-group")
   364  		}
   365  		if fieldNum <= 0 {
   366  			return fmt.Errorf("proto: MyMessage: illegal tag %d (wire type %d)", fieldNum, wire)
   367  		}
   368  		switch fieldNum {
   369  		case 1:
   370  			if wireType != 0 {
   371  				return fmt.Errorf("proto: wrong wireType = %d for field MyData", wireType)
   372  			}
   373  			m.MyData = 0
   374  			for shift := uint(0); ; shift += 7 {
   375  				if shift >= 64 {
   376  					return ErrIntOverflowData
   377  				}
   378  				if iNdEx >= l {
   379  					return io.ErrUnexpectedEOF
   380  				}
   381  				b := dAtA[iNdEx]
   382  				iNdEx++
   383  				m.MyData |= uint32(b&0x7F) << shift
   384  				if b < 0x80 {
   385  					break
   386  				}
   387  			}
   388  		default:
   389  			iNdEx = preIndex
   390  			skippy, err := skipData(dAtA[iNdEx:])
   391  			if err != nil {
   392  				return err
   393  			}
   394  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   395  				return ErrInvalidLengthData
   396  			}
   397  			if (iNdEx + skippy) > l {
   398  				return io.ErrUnexpectedEOF
   399  			}
   400  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   401  			iNdEx += skippy
   402  		}
   403  	}
   404  
   405  	if iNdEx > l {
   406  		return io.ErrUnexpectedEOF
   407  	}
   408  	return nil
   409  }
   410  func skipData(dAtA []byte) (n int, err error) {
   411  	l := len(dAtA)
   412  	iNdEx := 0
   413  	depth := 0
   414  	for iNdEx < l {
   415  		var wire uint64
   416  		for shift := uint(0); ; shift += 7 {
   417  			if shift >= 64 {
   418  				return 0, ErrIntOverflowData
   419  			}
   420  			if iNdEx >= l {
   421  				return 0, io.ErrUnexpectedEOF
   422  			}
   423  			b := dAtA[iNdEx]
   424  			iNdEx++
   425  			wire |= (uint64(b) & 0x7F) << shift
   426  			if b < 0x80 {
   427  				break
   428  			}
   429  		}
   430  		wireType := int(wire & 0x7)
   431  		switch wireType {
   432  		case 0:
   433  			for shift := uint(0); ; shift += 7 {
   434  				if shift >= 64 {
   435  					return 0, ErrIntOverflowData
   436  				}
   437  				if iNdEx >= l {
   438  					return 0, io.ErrUnexpectedEOF
   439  				}
   440  				iNdEx++
   441  				if dAtA[iNdEx-1] < 0x80 {
   442  					break
   443  				}
   444  			}
   445  		case 1:
   446  			iNdEx += 8
   447  		case 2:
   448  			var length int
   449  			for shift := uint(0); ; shift += 7 {
   450  				if shift >= 64 {
   451  					return 0, ErrIntOverflowData
   452  				}
   453  				if iNdEx >= l {
   454  					return 0, io.ErrUnexpectedEOF
   455  				}
   456  				b := dAtA[iNdEx]
   457  				iNdEx++
   458  				length |= (int(b) & 0x7F) << shift
   459  				if b < 0x80 {
   460  					break
   461  				}
   462  			}
   463  			if length < 0 {
   464  				return 0, ErrInvalidLengthData
   465  			}
   466  			iNdEx += length
   467  		case 3:
   468  			depth++
   469  		case 4:
   470  			if depth == 0 {
   471  				return 0, ErrUnexpectedEndOfGroupData
   472  			}
   473  			depth--
   474  		case 5:
   475  			iNdEx += 4
   476  		default:
   477  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   478  		}
   479  		if iNdEx < 0 {
   480  			return 0, ErrInvalidLengthData
   481  		}
   482  		if depth == 0 {
   483  			return iNdEx, nil
   484  		}
   485  	}
   486  	return 0, io.ErrUnexpectedEOF
   487  }
   488  
   489  var (
   490  	ErrInvalidLengthData        = fmt.Errorf("proto: negative length found during unmarshaling")
   491  	ErrIntOverflowData          = fmt.Errorf("proto: integer overflow")
   492  	ErrUnexpectedEndOfGroupData = fmt.Errorf("proto: unexpected end of group")
   493  )
   494  

View as plain text