github.com/gogo/protobuf@v1.3.2/vanity/test/fast/vanity.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: vanity.proto 3 4 package vanity 5 6 import ( 7 fmt "fmt" 8 github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" 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 A struct { 27 Strings *string `protobuf:"bytes,1,opt,name=Strings" json:"Strings,omitempty"` 28 Int *int64 `protobuf:"varint,2,req,name=Int" json:"Int,omitempty"` 29 XXX_NoUnkeyedLiteral struct{} `json:"-"` 30 XXX_unrecognized []byte `json:"-"` 31 XXX_sizecache int32 `json:"-"` 32 } 33 34 func (m *A) Reset() { *m = A{} } 35 func (m *A) String() string { return proto.CompactTextString(m) } 36 func (*A) ProtoMessage() {} 37 func (*A) Descriptor() ([]byte, []int) { 38 return fileDescriptor_d4f40d14cd1329d6, []int{0} 39 } 40 func (m *A) XXX_Unmarshal(b []byte) error { 41 return m.Unmarshal(b) 42 } 43 func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 44 if deterministic { 45 return xxx_messageInfo_A.Marshal(b, m, deterministic) 46 } else { 47 b = b[:cap(b)] 48 n, err := m.MarshalToSizedBuffer(b) 49 if err != nil { 50 return nil, err 51 } 52 return b[:n], nil 53 } 54 } 55 func (m *A) XXX_Merge(src proto.Message) { 56 xxx_messageInfo_A.Merge(m, src) 57 } 58 func (m *A) XXX_Size() int { 59 return m.Size() 60 } 61 func (m *A) XXX_DiscardUnknown() { 62 xxx_messageInfo_A.DiscardUnknown(m) 63 } 64 65 var xxx_messageInfo_A proto.InternalMessageInfo 66 67 func (m *A) GetStrings() string { 68 if m != nil && m.Strings != nil { 69 return *m.Strings 70 } 71 return "" 72 } 73 74 func (m *A) GetInt() int64 { 75 if m != nil && m.Int != nil { 76 return *m.Int 77 } 78 return 0 79 } 80 81 func init() { 82 proto.RegisterType((*A)(nil), "vanity.A") 83 } 84 85 func init() { proto.RegisterFile("vanity.proto", fileDescriptor_d4f40d14cd1329d6) } 86 87 var fileDescriptor_d4f40d14cd1329d6 = []byte{ 88 // 97 bytes of a gzipped FileDescriptorProto 89 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, 90 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xf4, 0xb9, 0x18, 91 0x1d, 0x85, 0x24, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, 92 0x35, 0x38, 0x83, 0x60, 0x5c, 0x21, 0x01, 0x2e, 0x66, 0xcf, 0xbc, 0x12, 0x09, 0x26, 0x05, 0x26, 93 0x0d, 0xe6, 0x20, 0x10, 0xd3, 0x89, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 94 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x7a, 0xd7, 0x63, 0x55, 0x00, 0x00, 95 0x00, 96 } 97 98 func (m *A) Marshal() (dAtA []byte, err error) { 99 size := m.Size() 100 dAtA = make([]byte, size) 101 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 102 if err != nil { 103 return nil, err 104 } 105 return dAtA[:n], nil 106 } 107 108 func (m *A) MarshalTo(dAtA []byte) (int, error) { 109 size := m.Size() 110 return m.MarshalToSizedBuffer(dAtA[:size]) 111 } 112 113 func (m *A) MarshalToSizedBuffer(dAtA []byte) (int, error) { 114 i := len(dAtA) 115 _ = i 116 var l int 117 _ = l 118 if m.XXX_unrecognized != nil { 119 i -= len(m.XXX_unrecognized) 120 copy(dAtA[i:], m.XXX_unrecognized) 121 } 122 if m.Int == nil { 123 return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") 124 } else { 125 i = encodeVarintVanity(dAtA, i, uint64(*m.Int)) 126 i-- 127 dAtA[i] = 0x10 128 } 129 if m.Strings != nil { 130 i -= len(*m.Strings) 131 copy(dAtA[i:], *m.Strings) 132 i = encodeVarintVanity(dAtA, i, uint64(len(*m.Strings))) 133 i-- 134 dAtA[i] = 0xa 135 } 136 return len(dAtA) - i, nil 137 } 138 139 func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { 140 offset -= sovVanity(v) 141 base := offset 142 for v >= 1<<7 { 143 dAtA[offset] = uint8(v&0x7f | 0x80) 144 v >>= 7 145 offset++ 146 } 147 dAtA[offset] = uint8(v) 148 return base 149 } 150 func (m *A) Size() (n int) { 151 if m == nil { 152 return 0 153 } 154 var l int 155 _ = l 156 if m.Strings != nil { 157 l = len(*m.Strings) 158 n += 1 + l + sovVanity(uint64(l)) 159 } 160 if m.Int != nil { 161 n += 1 + sovVanity(uint64(*m.Int)) 162 } 163 if m.XXX_unrecognized != nil { 164 n += len(m.XXX_unrecognized) 165 } 166 return n 167 } 168 169 func sovVanity(x uint64) (n int) { 170 return (math_bits.Len64(x|1) + 6) / 7 171 } 172 func sozVanity(x uint64) (n int) { 173 return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 174 } 175 func (m *A) Unmarshal(dAtA []byte) error { 176 var hasFields [1]uint64 177 l := len(dAtA) 178 iNdEx := 0 179 for iNdEx < l { 180 preIndex := iNdEx 181 var wire uint64 182 for shift := uint(0); ; shift += 7 { 183 if shift >= 64 { 184 return ErrIntOverflowVanity 185 } 186 if iNdEx >= l { 187 return io.ErrUnexpectedEOF 188 } 189 b := dAtA[iNdEx] 190 iNdEx++ 191 wire |= uint64(b&0x7F) << shift 192 if b < 0x80 { 193 break 194 } 195 } 196 fieldNum := int32(wire >> 3) 197 wireType := int(wire & 0x7) 198 if wireType == 4 { 199 return fmt.Errorf("proto: A: wiretype end group for non-group") 200 } 201 if fieldNum <= 0 { 202 return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) 203 } 204 switch fieldNum { 205 case 1: 206 if wireType != 2 { 207 return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) 208 } 209 var stringLen uint64 210 for shift := uint(0); ; shift += 7 { 211 if shift >= 64 { 212 return ErrIntOverflowVanity 213 } 214 if iNdEx >= l { 215 return io.ErrUnexpectedEOF 216 } 217 b := dAtA[iNdEx] 218 iNdEx++ 219 stringLen |= uint64(b&0x7F) << shift 220 if b < 0x80 { 221 break 222 } 223 } 224 intStringLen := int(stringLen) 225 if intStringLen < 0 { 226 return ErrInvalidLengthVanity 227 } 228 postIndex := iNdEx + intStringLen 229 if postIndex < 0 { 230 return ErrInvalidLengthVanity 231 } 232 if postIndex > l { 233 return io.ErrUnexpectedEOF 234 } 235 s := string(dAtA[iNdEx:postIndex]) 236 m.Strings = &s 237 iNdEx = postIndex 238 case 2: 239 if wireType != 0 { 240 return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) 241 } 242 var v int64 243 for shift := uint(0); ; shift += 7 { 244 if shift >= 64 { 245 return ErrIntOverflowVanity 246 } 247 if iNdEx >= l { 248 return io.ErrUnexpectedEOF 249 } 250 b := dAtA[iNdEx] 251 iNdEx++ 252 v |= int64(b&0x7F) << shift 253 if b < 0x80 { 254 break 255 } 256 } 257 m.Int = &v 258 hasFields[0] |= uint64(0x00000001) 259 default: 260 iNdEx = preIndex 261 skippy, err := skipVanity(dAtA[iNdEx:]) 262 if err != nil { 263 return err 264 } 265 if (skippy < 0) || (iNdEx+skippy) < 0 { 266 return ErrInvalidLengthVanity 267 } 268 if (iNdEx + skippy) > l { 269 return io.ErrUnexpectedEOF 270 } 271 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 272 iNdEx += skippy 273 } 274 } 275 if hasFields[0]&uint64(0x00000001) == 0 { 276 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") 277 } 278 279 if iNdEx > l { 280 return io.ErrUnexpectedEOF 281 } 282 return nil 283 } 284 func skipVanity(dAtA []byte) (n int, err error) { 285 l := len(dAtA) 286 iNdEx := 0 287 depth := 0 288 for iNdEx < l { 289 var wire uint64 290 for shift := uint(0); ; shift += 7 { 291 if shift >= 64 { 292 return 0, ErrIntOverflowVanity 293 } 294 if iNdEx >= l { 295 return 0, io.ErrUnexpectedEOF 296 } 297 b := dAtA[iNdEx] 298 iNdEx++ 299 wire |= (uint64(b) & 0x7F) << shift 300 if b < 0x80 { 301 break 302 } 303 } 304 wireType := int(wire & 0x7) 305 switch wireType { 306 case 0: 307 for shift := uint(0); ; shift += 7 { 308 if shift >= 64 { 309 return 0, ErrIntOverflowVanity 310 } 311 if iNdEx >= l { 312 return 0, io.ErrUnexpectedEOF 313 } 314 iNdEx++ 315 if dAtA[iNdEx-1] < 0x80 { 316 break 317 } 318 } 319 case 1: 320 iNdEx += 8 321 case 2: 322 var length int 323 for shift := uint(0); ; shift += 7 { 324 if shift >= 64 { 325 return 0, ErrIntOverflowVanity 326 } 327 if iNdEx >= l { 328 return 0, io.ErrUnexpectedEOF 329 } 330 b := dAtA[iNdEx] 331 iNdEx++ 332 length |= (int(b) & 0x7F) << shift 333 if b < 0x80 { 334 break 335 } 336 } 337 if length < 0 { 338 return 0, ErrInvalidLengthVanity 339 } 340 iNdEx += length 341 case 3: 342 depth++ 343 case 4: 344 if depth == 0 { 345 return 0, ErrUnexpectedEndOfGroupVanity 346 } 347 depth-- 348 case 5: 349 iNdEx += 4 350 default: 351 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 352 } 353 if iNdEx < 0 { 354 return 0, ErrInvalidLengthVanity 355 } 356 if depth == 0 { 357 return iNdEx, nil 358 } 359 } 360 return 0, io.ErrUnexpectedEOF 361 } 362 363 var ( 364 ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") 365 ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") 366 ErrUnexpectedEndOfGroupVanity = fmt.Errorf("proto: unexpected end of group") 367 )