...

Source file src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go

Documentation: github.com/gogo/protobuf/vanity/test/fast

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: gogovanity.proto
     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  )
    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 B struct {
    27  	String_              *string  `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"`
    28  	Int64                *int64   `protobuf:"varint,2,opt,name=Int64" json:"Int64,omitempty"`
    29  	Int32                *int32   `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"`
    30  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    31  	XXX_unrecognized     []byte   `json:"-"`
    32  	XXX_sizecache        int32    `json:"-"`
    33  }
    34  
    35  func (m *B) Reset()         { *m = B{} }
    36  func (m *B) String() string { return proto.CompactTextString(m) }
    37  func (*B) ProtoMessage()    {}
    38  func (*B) Descriptor() ([]byte, []int) {
    39  	return fileDescriptor_f8c9b51615339d8e, []int{0}
    40  }
    41  func (m *B) XXX_Unmarshal(b []byte) error {
    42  	return m.Unmarshal(b)
    43  }
    44  func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    45  	if deterministic {
    46  		return xxx_messageInfo_B.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 *B) XXX_Merge(src proto.Message) {
    57  	xxx_messageInfo_B.Merge(m, src)
    58  }
    59  func (m *B) XXX_Size() int {
    60  	return m.Size()
    61  }
    62  func (m *B) XXX_DiscardUnknown() {
    63  	xxx_messageInfo_B.DiscardUnknown(m)
    64  }
    65  
    66  var xxx_messageInfo_B proto.InternalMessageInfo
    67  
    68  const Default_B_Int32 int32 = 1234
    69  
    70  func (m *B) GetString_() string {
    71  	if m != nil && m.String_ != nil {
    72  		return *m.String_
    73  	}
    74  	return ""
    75  }
    76  
    77  func (m *B) GetInt64() int64 {
    78  	if m != nil && m.Int64 != nil {
    79  		return *m.Int64
    80  	}
    81  	return 0
    82  }
    83  
    84  func (m *B) GetInt32() int32 {
    85  	if m != nil && m.Int32 != nil {
    86  		return *m.Int32
    87  	}
    88  	return Default_B_Int32
    89  }
    90  
    91  func init() {
    92  	proto.RegisterType((*B)(nil), "vanity.B")
    93  }
    94  
    95  func init() { proto.RegisterFile("gogovanity.proto", fileDescriptor_f8c9b51615339d8e) }
    96  
    97  var fileDescriptor_f8c9b51615339d8e = []byte{
    98  	// 157 bytes of a gzipped FileDescriptorProto
    99  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf,
   100  	0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0,
   101  	0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4,
   102  	0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x05, 0x73, 0x31,
   103  	0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a,
   104  	0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x12, 0xe1, 0x62, 0xf5, 0xcc,
   105  	0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x0e, 0x82, 0x70, 0x84, 0xa4, 0xc0, 0xa2,
   106  	0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, 0x10,
   107  	0x21, 0x27, 0x9e, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x11,
   108  	0x10, 0x00, 0x00, 0xff, 0xff, 0x35, 0x73, 0x31, 0x4a, 0xac, 0x00, 0x00, 0x00,
   109  }
   110  
   111  func (m *B) Marshal() (dAtA []byte, err error) {
   112  	size := m.Size()
   113  	dAtA = make([]byte, size)
   114  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return dAtA[:n], nil
   119  }
   120  
   121  func (m *B) MarshalTo(dAtA []byte) (int, error) {
   122  	size := m.Size()
   123  	return m.MarshalToSizedBuffer(dAtA[:size])
   124  }
   125  
   126  func (m *B) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   127  	i := len(dAtA)
   128  	_ = i
   129  	var l int
   130  	_ = l
   131  	if m.XXX_unrecognized != nil {
   132  		i -= len(m.XXX_unrecognized)
   133  		copy(dAtA[i:], m.XXX_unrecognized)
   134  	}
   135  	if m.Int32 != nil {
   136  		i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32))
   137  		i--
   138  		dAtA[i] = 0x18
   139  	}
   140  	if m.Int64 != nil {
   141  		i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int64))
   142  		i--
   143  		dAtA[i] = 0x10
   144  	}
   145  	if m.String_ != nil {
   146  		i -= len(*m.String_)
   147  		copy(dAtA[i:], *m.String_)
   148  		i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_)))
   149  		i--
   150  		dAtA[i] = 0xa
   151  	}
   152  	return len(dAtA) - i, nil
   153  }
   154  
   155  func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int {
   156  	offset -= sovGogovanity(v)
   157  	base := offset
   158  	for v >= 1<<7 {
   159  		dAtA[offset] = uint8(v&0x7f | 0x80)
   160  		v >>= 7
   161  		offset++
   162  	}
   163  	dAtA[offset] = uint8(v)
   164  	return base
   165  }
   166  func (m *B) Size() (n int) {
   167  	if m == nil {
   168  		return 0
   169  	}
   170  	var l int
   171  	_ = l
   172  	if m.String_ != nil {
   173  		l = len(*m.String_)
   174  		n += 1 + l + sovGogovanity(uint64(l))
   175  	}
   176  	if m.Int64 != nil {
   177  		n += 1 + sovGogovanity(uint64(*m.Int64))
   178  	}
   179  	if m.Int32 != nil {
   180  		n += 1 + sovGogovanity(uint64(*m.Int32))
   181  	}
   182  	if m.XXX_unrecognized != nil {
   183  		n += len(m.XXX_unrecognized)
   184  	}
   185  	return n
   186  }
   187  
   188  func sovGogovanity(x uint64) (n int) {
   189  	return (math_bits.Len64(x|1) + 6) / 7
   190  }
   191  func sozGogovanity(x uint64) (n int) {
   192  	return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   193  }
   194  func (m *B) Unmarshal(dAtA []byte) error {
   195  	l := len(dAtA)
   196  	iNdEx := 0
   197  	for iNdEx < l {
   198  		preIndex := iNdEx
   199  		var wire uint64
   200  		for shift := uint(0); ; shift += 7 {
   201  			if shift >= 64 {
   202  				return ErrIntOverflowGogovanity
   203  			}
   204  			if iNdEx >= l {
   205  				return io.ErrUnexpectedEOF
   206  			}
   207  			b := dAtA[iNdEx]
   208  			iNdEx++
   209  			wire |= uint64(b&0x7F) << shift
   210  			if b < 0x80 {
   211  				break
   212  			}
   213  		}
   214  		fieldNum := int32(wire >> 3)
   215  		wireType := int(wire & 0x7)
   216  		if wireType == 4 {
   217  			return fmt.Errorf("proto: B: wiretype end group for non-group")
   218  		}
   219  		if fieldNum <= 0 {
   220  			return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire)
   221  		}
   222  		switch fieldNum {
   223  		case 1:
   224  			if wireType != 2 {
   225  				return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType)
   226  			}
   227  			var stringLen uint64
   228  			for shift := uint(0); ; shift += 7 {
   229  				if shift >= 64 {
   230  					return ErrIntOverflowGogovanity
   231  				}
   232  				if iNdEx >= l {
   233  					return io.ErrUnexpectedEOF
   234  				}
   235  				b := dAtA[iNdEx]
   236  				iNdEx++
   237  				stringLen |= uint64(b&0x7F) << shift
   238  				if b < 0x80 {
   239  					break
   240  				}
   241  			}
   242  			intStringLen := int(stringLen)
   243  			if intStringLen < 0 {
   244  				return ErrInvalidLengthGogovanity
   245  			}
   246  			postIndex := iNdEx + intStringLen
   247  			if postIndex < 0 {
   248  				return ErrInvalidLengthGogovanity
   249  			}
   250  			if postIndex > l {
   251  				return io.ErrUnexpectedEOF
   252  			}
   253  			s := string(dAtA[iNdEx:postIndex])
   254  			m.String_ = &s
   255  			iNdEx = postIndex
   256  		case 2:
   257  			if wireType != 0 {
   258  				return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType)
   259  			}
   260  			var v int64
   261  			for shift := uint(0); ; shift += 7 {
   262  				if shift >= 64 {
   263  					return ErrIntOverflowGogovanity
   264  				}
   265  				if iNdEx >= l {
   266  					return io.ErrUnexpectedEOF
   267  				}
   268  				b := dAtA[iNdEx]
   269  				iNdEx++
   270  				v |= int64(b&0x7F) << shift
   271  				if b < 0x80 {
   272  					break
   273  				}
   274  			}
   275  			m.Int64 = &v
   276  		case 3:
   277  			if wireType != 0 {
   278  				return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType)
   279  			}
   280  			var v int32
   281  			for shift := uint(0); ; shift += 7 {
   282  				if shift >= 64 {
   283  					return ErrIntOverflowGogovanity
   284  				}
   285  				if iNdEx >= l {
   286  					return io.ErrUnexpectedEOF
   287  				}
   288  				b := dAtA[iNdEx]
   289  				iNdEx++
   290  				v |= int32(b&0x7F) << shift
   291  				if b < 0x80 {
   292  					break
   293  				}
   294  			}
   295  			m.Int32 = &v
   296  		default:
   297  			iNdEx = preIndex
   298  			skippy, err := skipGogovanity(dAtA[iNdEx:])
   299  			if err != nil {
   300  				return err
   301  			}
   302  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   303  				return ErrInvalidLengthGogovanity
   304  			}
   305  			if (iNdEx + skippy) > l {
   306  				return io.ErrUnexpectedEOF
   307  			}
   308  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   309  			iNdEx += skippy
   310  		}
   311  	}
   312  
   313  	if iNdEx > l {
   314  		return io.ErrUnexpectedEOF
   315  	}
   316  	return nil
   317  }
   318  func skipGogovanity(dAtA []byte) (n int, err error) {
   319  	l := len(dAtA)
   320  	iNdEx := 0
   321  	depth := 0
   322  	for iNdEx < l {
   323  		var wire uint64
   324  		for shift := uint(0); ; shift += 7 {
   325  			if shift >= 64 {
   326  				return 0, ErrIntOverflowGogovanity
   327  			}
   328  			if iNdEx >= l {
   329  				return 0, io.ErrUnexpectedEOF
   330  			}
   331  			b := dAtA[iNdEx]
   332  			iNdEx++
   333  			wire |= (uint64(b) & 0x7F) << shift
   334  			if b < 0x80 {
   335  				break
   336  			}
   337  		}
   338  		wireType := int(wire & 0x7)
   339  		switch wireType {
   340  		case 0:
   341  			for shift := uint(0); ; shift += 7 {
   342  				if shift >= 64 {
   343  					return 0, ErrIntOverflowGogovanity
   344  				}
   345  				if iNdEx >= l {
   346  					return 0, io.ErrUnexpectedEOF
   347  				}
   348  				iNdEx++
   349  				if dAtA[iNdEx-1] < 0x80 {
   350  					break
   351  				}
   352  			}
   353  		case 1:
   354  			iNdEx += 8
   355  		case 2:
   356  			var length int
   357  			for shift := uint(0); ; shift += 7 {
   358  				if shift >= 64 {
   359  					return 0, ErrIntOverflowGogovanity
   360  				}
   361  				if iNdEx >= l {
   362  					return 0, io.ErrUnexpectedEOF
   363  				}
   364  				b := dAtA[iNdEx]
   365  				iNdEx++
   366  				length |= (int(b) & 0x7F) << shift
   367  				if b < 0x80 {
   368  					break
   369  				}
   370  			}
   371  			if length < 0 {
   372  				return 0, ErrInvalidLengthGogovanity
   373  			}
   374  			iNdEx += length
   375  		case 3:
   376  			depth++
   377  		case 4:
   378  			if depth == 0 {
   379  				return 0, ErrUnexpectedEndOfGroupGogovanity
   380  			}
   381  			depth--
   382  		case 5:
   383  			iNdEx += 4
   384  		default:
   385  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   386  		}
   387  		if iNdEx < 0 {
   388  			return 0, ErrInvalidLengthGogovanity
   389  		}
   390  		if depth == 0 {
   391  			return iNdEx, nil
   392  		}
   393  	}
   394  	return 0, io.ErrUnexpectedEOF
   395  }
   396  
   397  var (
   398  	ErrInvalidLengthGogovanity        = fmt.Errorf("proto: negative length found during unmarshaling")
   399  	ErrIntOverflowGogovanity          = fmt.Errorf("proto: integer overflow")
   400  	ErrUnexpectedEndOfGroupGogovanity = fmt.Errorf("proto: unexpected end of group")
   401  )
   402  

View as plain text