...

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

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

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: issue617.proto
     3  
     4  package issue617
     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  )
    14  
    15  // Reference imports to suppress errors if they are not otherwise used.
    16  var _ = proto.Marshal
    17  var _ = fmt.Errorf
    18  var _ = math.Inf
    19  
    20  // This is a compile-time assertion to ensure that this generated file
    21  // is compatible with the proto package it is being compiled against.
    22  // A compilation error at this line likely means your copy of the
    23  // proto package needs to be updated.
    24  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    25  
    26  type Foo struct {
    27  	// Types that are valid to be assigned to Details:
    28  	//	*Foo_Bar_
    29  	Details              isFoo_Details `protobuf_oneof:"details"`
    30  	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
    31  	XXX_unrecognized     []byte        `json:"-"`
    32  	XXX_sizecache        int32         `json:"-"`
    33  }
    34  
    35  func (m *Foo) Reset()         { *m = Foo{} }
    36  func (m *Foo) String() string { return proto.CompactTextString(m) }
    37  func (*Foo) ProtoMessage()    {}
    38  func (*Foo) Descriptor() ([]byte, []int) {
    39  	return fileDescriptor_8be66a68e4f427ad, []int{0}
    40  }
    41  func (m *Foo) XXX_Unmarshal(b []byte) error {
    42  	return m.Unmarshal(b)
    43  }
    44  func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    45  	if deterministic {
    46  		return xxx_messageInfo_Foo.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 *Foo) XXX_Merge(src proto.Message) {
    57  	xxx_messageInfo_Foo.Merge(m, src)
    58  }
    59  func (m *Foo) XXX_Size() int {
    60  	return m.ProtoSize()
    61  }
    62  func (m *Foo) XXX_DiscardUnknown() {
    63  	xxx_messageInfo_Foo.DiscardUnknown(m)
    64  }
    65  
    66  var xxx_messageInfo_Foo proto.InternalMessageInfo
    67  
    68  type isFoo_Details interface {
    69  	isFoo_Details()
    70  	MarshalTo([]byte) (int, error)
    71  	ProtoSize() int
    72  }
    73  
    74  type Foo_Bar_ struct {
    75  	Bar *Foo_Bar `protobuf:"bytes,1,opt,name=bar,proto3,oneof" json:"bar,omitempty"`
    76  }
    77  
    78  func (*Foo_Bar_) isFoo_Details() {}
    79  
    80  func (m *Foo) GetDetails() isFoo_Details {
    81  	if m != nil {
    82  		return m.Details
    83  	}
    84  	return nil
    85  }
    86  
    87  func (m *Foo) GetBar() *Foo_Bar {
    88  	if x, ok := m.GetDetails().(*Foo_Bar_); ok {
    89  		return x.Bar
    90  	}
    91  	return nil
    92  }
    93  
    94  // XXX_OneofWrappers is for the internal use of the proto package.
    95  func (*Foo) XXX_OneofWrappers() []interface{} {
    96  	return []interface{}{
    97  		(*Foo_Bar_)(nil),
    98  	}
    99  }
   100  
   101  type Foo_Bar struct {
   102  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
   103  	XXX_unrecognized     []byte   `json:"-"`
   104  	XXX_sizecache        int32    `json:"-"`
   105  }
   106  
   107  func (m *Foo_Bar) Reset()         { *m = Foo_Bar{} }
   108  func (m *Foo_Bar) String() string { return proto.CompactTextString(m) }
   109  func (*Foo_Bar) ProtoMessage()    {}
   110  func (*Foo_Bar) Descriptor() ([]byte, []int) {
   111  	return fileDescriptor_8be66a68e4f427ad, []int{0, 0}
   112  }
   113  func (m *Foo_Bar) XXX_Unmarshal(b []byte) error {
   114  	return m.Unmarshal(b)
   115  }
   116  func (m *Foo_Bar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   117  	if deterministic {
   118  		return xxx_messageInfo_Foo_Bar.Marshal(b, m, deterministic)
   119  	} else {
   120  		b = b[:cap(b)]
   121  		n, err := m.MarshalToSizedBuffer(b)
   122  		if err != nil {
   123  			return nil, err
   124  		}
   125  		return b[:n], nil
   126  	}
   127  }
   128  func (m *Foo_Bar) XXX_Merge(src proto.Message) {
   129  	xxx_messageInfo_Foo_Bar.Merge(m, src)
   130  }
   131  func (m *Foo_Bar) XXX_Size() int {
   132  	return m.ProtoSize()
   133  }
   134  func (m *Foo_Bar) XXX_DiscardUnknown() {
   135  	xxx_messageInfo_Foo_Bar.DiscardUnknown(m)
   136  }
   137  
   138  var xxx_messageInfo_Foo_Bar proto.InternalMessageInfo
   139  
   140  func init() {
   141  	proto.RegisterType((*Foo)(nil), "issue617.Foo")
   142  	proto.RegisterType((*Foo_Bar)(nil), "issue617.Foo.Bar")
   143  }
   144  
   145  func init() { proto.RegisterFile("issue617.proto", fileDescriptor_8be66a68e4f427ad) }
   146  
   147  var fileDescriptor_8be66a68e4f427ad = []byte{
   148  	// 153 bytes of a gzipped FileDescriptorProto
   149  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x2c, 0x2e, 0x2e,
   150  	0x4d, 0x35, 0x33, 0x34, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74,
   151  	0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5,
   152  	0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0xb2, 0xe3, 0x62,
   153  	0x76, 0xcb, 0xcf, 0x17, 0x52, 0xe5, 0x62, 0x4e, 0x4a, 0x2c, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0,
   154  	0x36, 0x12, 0xd4, 0x83, 0x9b, 0xee, 0x96, 0x9f, 0xaf, 0xe7, 0x94, 0x58, 0xe4, 0xc1, 0x10, 0x04,
   155  	0x92, 0x97, 0x62, 0xe5, 0x62, 0x76, 0x4a, 0x2c, 0x72, 0xe2, 0xe4, 0x62, 0x4f, 0x49, 0x2d, 0x49,
   156  	0xcc, 0xcc, 0x29, 0x76, 0x12, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f,
   157  	0xe4, 0x18, 0x16, 0x3c, 0x96, 0x63, 0x4c, 0x62, 0x03, 0x1b, 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff,
   158  	0xff, 0x8f, 0xa2, 0x8a, 0xc0, 0xa3, 0x00, 0x00, 0x00,
   159  }
   160  
   161  func (m *Foo) Marshal() (dAtA []byte, err error) {
   162  	size := m.ProtoSize()
   163  	dAtA = make([]byte, size)
   164  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   165  	if err != nil {
   166  		return nil, err
   167  	}
   168  	return dAtA[:n], nil
   169  }
   170  
   171  func (m *Foo) MarshalTo(dAtA []byte) (int, error) {
   172  	size := m.ProtoSize()
   173  	return m.MarshalToSizedBuffer(dAtA[:size])
   174  }
   175  
   176  func (m *Foo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   177  	i := len(dAtA)
   178  	_ = i
   179  	var l int
   180  	_ = l
   181  	if m.XXX_unrecognized != nil {
   182  		i -= len(m.XXX_unrecognized)
   183  		copy(dAtA[i:], m.XXX_unrecognized)
   184  	}
   185  	if m.Details != nil {
   186  		{
   187  			size := m.Details.ProtoSize()
   188  			i -= size
   189  			if _, err := m.Details.MarshalTo(dAtA[i:]); err != nil {
   190  				return 0, err
   191  			}
   192  		}
   193  	}
   194  	return len(dAtA) - i, nil
   195  }
   196  
   197  func (m *Foo_Bar_) MarshalTo(dAtA []byte) (int, error) {
   198  	size := m.ProtoSize()
   199  	return m.MarshalToSizedBuffer(dAtA[:size])
   200  }
   201  
   202  func (m *Foo_Bar_) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   203  	i := len(dAtA)
   204  	if m.Bar != nil {
   205  		{
   206  			size, err := m.Bar.MarshalToSizedBuffer(dAtA[:i])
   207  			if err != nil {
   208  				return 0, err
   209  			}
   210  			i -= size
   211  			i = encodeVarintIssue617(dAtA, i, uint64(size))
   212  		}
   213  		i--
   214  		dAtA[i] = 0xa
   215  	}
   216  	return len(dAtA) - i, nil
   217  }
   218  func (m *Foo_Bar) Marshal() (dAtA []byte, err error) {
   219  	size := m.ProtoSize()
   220  	dAtA = make([]byte, size)
   221  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   222  	if err != nil {
   223  		return nil, err
   224  	}
   225  	return dAtA[:n], nil
   226  }
   227  
   228  func (m *Foo_Bar) MarshalTo(dAtA []byte) (int, error) {
   229  	size := m.ProtoSize()
   230  	return m.MarshalToSizedBuffer(dAtA[:size])
   231  }
   232  
   233  func (m *Foo_Bar) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   234  	i := len(dAtA)
   235  	_ = i
   236  	var l int
   237  	_ = l
   238  	if m.XXX_unrecognized != nil {
   239  		i -= len(m.XXX_unrecognized)
   240  		copy(dAtA[i:], m.XXX_unrecognized)
   241  	}
   242  	return len(dAtA) - i, nil
   243  }
   244  
   245  func encodeVarintIssue617(dAtA []byte, offset int, v uint64) int {
   246  	offset -= sovIssue617(v)
   247  	base := offset
   248  	for v >= 1<<7 {
   249  		dAtA[offset] = uint8(v&0x7f | 0x80)
   250  		v >>= 7
   251  		offset++
   252  	}
   253  	dAtA[offset] = uint8(v)
   254  	return base
   255  }
   256  func (m *Foo) ProtoSize() (n int) {
   257  	if m == nil {
   258  		return 0
   259  	}
   260  	var l int
   261  	_ = l
   262  	if m.Details != nil {
   263  		n += m.Details.ProtoSize()
   264  	}
   265  	if m.XXX_unrecognized != nil {
   266  		n += len(m.XXX_unrecognized)
   267  	}
   268  	return n
   269  }
   270  
   271  func (m *Foo_Bar_) ProtoSize() (n int) {
   272  	if m == nil {
   273  		return 0
   274  	}
   275  	var l int
   276  	_ = l
   277  	if m.Bar != nil {
   278  		l = m.Bar.ProtoSize()
   279  		n += 1 + l + sovIssue617(uint64(l))
   280  	}
   281  	return n
   282  }
   283  func (m *Foo_Bar) ProtoSize() (n int) {
   284  	if m == nil {
   285  		return 0
   286  	}
   287  	var l int
   288  	_ = l
   289  	if m.XXX_unrecognized != nil {
   290  		n += len(m.XXX_unrecognized)
   291  	}
   292  	return n
   293  }
   294  
   295  func sovIssue617(x uint64) (n int) {
   296  	return (math_bits.Len64(x|1) + 6) / 7
   297  }
   298  func sozIssue617(x uint64) (n int) {
   299  	return sovIssue617(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   300  }
   301  func (m *Foo) Unmarshal(dAtA []byte) error {
   302  	l := len(dAtA)
   303  	iNdEx := 0
   304  	for iNdEx < l {
   305  		preIndex := iNdEx
   306  		var wire uint64
   307  		for shift := uint(0); ; shift += 7 {
   308  			if shift >= 64 {
   309  				return ErrIntOverflowIssue617
   310  			}
   311  			if iNdEx >= l {
   312  				return io.ErrUnexpectedEOF
   313  			}
   314  			b := dAtA[iNdEx]
   315  			iNdEx++
   316  			wire |= uint64(b&0x7F) << shift
   317  			if b < 0x80 {
   318  				break
   319  			}
   320  		}
   321  		fieldNum := int32(wire >> 3)
   322  		wireType := int(wire & 0x7)
   323  		if wireType == 4 {
   324  			return fmt.Errorf("proto: Foo: wiretype end group for non-group")
   325  		}
   326  		if fieldNum <= 0 {
   327  			return fmt.Errorf("proto: Foo: illegal tag %d (wire type %d)", fieldNum, wire)
   328  		}
   329  		switch fieldNum {
   330  		case 1:
   331  			if wireType != 2 {
   332  				return fmt.Errorf("proto: wrong wireType = %d for field Bar", wireType)
   333  			}
   334  			var msglen int
   335  			for shift := uint(0); ; shift += 7 {
   336  				if shift >= 64 {
   337  					return ErrIntOverflowIssue617
   338  				}
   339  				if iNdEx >= l {
   340  					return io.ErrUnexpectedEOF
   341  				}
   342  				b := dAtA[iNdEx]
   343  				iNdEx++
   344  				msglen |= int(b&0x7F) << shift
   345  				if b < 0x80 {
   346  					break
   347  				}
   348  			}
   349  			if msglen < 0 {
   350  				return ErrInvalidLengthIssue617
   351  			}
   352  			postIndex := iNdEx + msglen
   353  			if postIndex < 0 {
   354  				return ErrInvalidLengthIssue617
   355  			}
   356  			if postIndex > l {
   357  				return io.ErrUnexpectedEOF
   358  			}
   359  			v := &Foo_Bar{}
   360  			if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
   361  				return err
   362  			}
   363  			m.Details = &Foo_Bar_{v}
   364  			iNdEx = postIndex
   365  		default:
   366  			iNdEx = preIndex
   367  			skippy, err := skipIssue617(dAtA[iNdEx:])
   368  			if err != nil {
   369  				return err
   370  			}
   371  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   372  				return ErrInvalidLengthIssue617
   373  			}
   374  			if (iNdEx + skippy) > l {
   375  				return io.ErrUnexpectedEOF
   376  			}
   377  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   378  			iNdEx += skippy
   379  		}
   380  	}
   381  
   382  	if iNdEx > l {
   383  		return io.ErrUnexpectedEOF
   384  	}
   385  	return nil
   386  }
   387  func (m *Foo_Bar) Unmarshal(dAtA []byte) error {
   388  	l := len(dAtA)
   389  	iNdEx := 0
   390  	for iNdEx < l {
   391  		preIndex := iNdEx
   392  		var wire uint64
   393  		for shift := uint(0); ; shift += 7 {
   394  			if shift >= 64 {
   395  				return ErrIntOverflowIssue617
   396  			}
   397  			if iNdEx >= l {
   398  				return io.ErrUnexpectedEOF
   399  			}
   400  			b := dAtA[iNdEx]
   401  			iNdEx++
   402  			wire |= uint64(b&0x7F) << shift
   403  			if b < 0x80 {
   404  				break
   405  			}
   406  		}
   407  		fieldNum := int32(wire >> 3)
   408  		wireType := int(wire & 0x7)
   409  		if wireType == 4 {
   410  			return fmt.Errorf("proto: Bar: wiretype end group for non-group")
   411  		}
   412  		if fieldNum <= 0 {
   413  			return fmt.Errorf("proto: Bar: illegal tag %d (wire type %d)", fieldNum, wire)
   414  		}
   415  		switch fieldNum {
   416  		default:
   417  			iNdEx = preIndex
   418  			skippy, err := skipIssue617(dAtA[iNdEx:])
   419  			if err != nil {
   420  				return err
   421  			}
   422  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   423  				return ErrInvalidLengthIssue617
   424  			}
   425  			if (iNdEx + skippy) > l {
   426  				return io.ErrUnexpectedEOF
   427  			}
   428  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   429  			iNdEx += skippy
   430  		}
   431  	}
   432  
   433  	if iNdEx > l {
   434  		return io.ErrUnexpectedEOF
   435  	}
   436  	return nil
   437  }
   438  func skipIssue617(dAtA []byte) (n int, err error) {
   439  	l := len(dAtA)
   440  	iNdEx := 0
   441  	depth := 0
   442  	for iNdEx < l {
   443  		var wire uint64
   444  		for shift := uint(0); ; shift += 7 {
   445  			if shift >= 64 {
   446  				return 0, ErrIntOverflowIssue617
   447  			}
   448  			if iNdEx >= l {
   449  				return 0, io.ErrUnexpectedEOF
   450  			}
   451  			b := dAtA[iNdEx]
   452  			iNdEx++
   453  			wire |= (uint64(b) & 0x7F) << shift
   454  			if b < 0x80 {
   455  				break
   456  			}
   457  		}
   458  		wireType := int(wire & 0x7)
   459  		switch wireType {
   460  		case 0:
   461  			for shift := uint(0); ; shift += 7 {
   462  				if shift >= 64 {
   463  					return 0, ErrIntOverflowIssue617
   464  				}
   465  				if iNdEx >= l {
   466  					return 0, io.ErrUnexpectedEOF
   467  				}
   468  				iNdEx++
   469  				if dAtA[iNdEx-1] < 0x80 {
   470  					break
   471  				}
   472  			}
   473  		case 1:
   474  			iNdEx += 8
   475  		case 2:
   476  			var length int
   477  			for shift := uint(0); ; shift += 7 {
   478  				if shift >= 64 {
   479  					return 0, ErrIntOverflowIssue617
   480  				}
   481  				if iNdEx >= l {
   482  					return 0, io.ErrUnexpectedEOF
   483  				}
   484  				b := dAtA[iNdEx]
   485  				iNdEx++
   486  				length |= (int(b) & 0x7F) << shift
   487  				if b < 0x80 {
   488  					break
   489  				}
   490  			}
   491  			if length < 0 {
   492  				return 0, ErrInvalidLengthIssue617
   493  			}
   494  			iNdEx += length
   495  		case 3:
   496  			depth++
   497  		case 4:
   498  			if depth == 0 {
   499  				return 0, ErrUnexpectedEndOfGroupIssue617
   500  			}
   501  			depth--
   502  		case 5:
   503  			iNdEx += 4
   504  		default:
   505  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   506  		}
   507  		if iNdEx < 0 {
   508  			return 0, ErrInvalidLengthIssue617
   509  		}
   510  		if depth == 0 {
   511  			return iNdEx, nil
   512  		}
   513  	}
   514  	return 0, io.ErrUnexpectedEOF
   515  }
   516  
   517  var (
   518  	ErrInvalidLengthIssue617        = fmt.Errorf("proto: negative length found during unmarshaling")
   519  	ErrIntOverflowIssue617          = fmt.Errorf("proto: integer overflow")
   520  	ErrUnexpectedEndOfGroupIssue617 = fmt.Errorf("proto: unexpected end of group")
   521  )
   522  

View as plain text