github.com/gogo/protobuf@v1.3.2/test/protobuffer/protobuffer.pb.go (about)

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: protobuffer.proto
     3  
     4  package protobuffer
     5  
     6  import (
     7  	fmt "fmt"
     8  	_ "github.com/gogo/protobuf/gogoproto"
     9  	proto "github.com/gogo/protobuf/proto"
    10  	math "math"
    11  	math_bits "math/bits"
    12  )
    13  
    14  // Reference imports to suppress errors if they are not otherwise used.
    15  var _ = proto.Marshal
    16  var _ = fmt.Errorf
    17  var _ = math.Inf
    18  
    19  // This is a compile-time assertion to ensure that this generated file
    20  // is compatible with the proto package it is being compiled against.
    21  // A compilation error at this line likely means your copy of the
    22  // proto package needs to be updated.
    23  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    24  
    25  type PBuffMarshal struct {
    26  	Field1               []byte   `protobuf:"bytes,1,opt,name=Field1" json:"Field1,omitempty"`
    27  	Field2               *int32   `protobuf:"varint,2,opt,name=Field2" json:"Field2,omitempty"`
    28  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    29  	XXX_unrecognized     []byte   `json:"-"`
    30  	XXX_sizecache        int32    `json:"-"`
    31  }
    32  
    33  func (m *PBuffMarshal) Reset()         { *m = PBuffMarshal{} }
    34  func (m *PBuffMarshal) String() string { return proto.CompactTextString(m) }
    35  func (*PBuffMarshal) ProtoMessage()    {}
    36  func (*PBuffMarshal) Descriptor() ([]byte, []int) {
    37  	return fileDescriptor_12798c2215df1728, []int{0}
    38  }
    39  func (m *PBuffMarshal) XXX_Unmarshal(b []byte) error {
    40  	return xxx_messageInfo_PBuffMarshal.Unmarshal(m, b)
    41  }
    42  func (m *PBuffMarshal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    43  	return xxx_messageInfo_PBuffMarshal.Marshal(b, m, deterministic)
    44  }
    45  func (m *PBuffMarshal) XXX_Merge(src proto.Message) {
    46  	xxx_messageInfo_PBuffMarshal.Merge(m, src)
    47  }
    48  func (m *PBuffMarshal) XXX_Size() int {
    49  	return xxx_messageInfo_PBuffMarshal.Size(m)
    50  }
    51  func (m *PBuffMarshal) XXX_DiscardUnknown() {
    52  	xxx_messageInfo_PBuffMarshal.DiscardUnknown(m)
    53  }
    54  
    55  var xxx_messageInfo_PBuffMarshal proto.InternalMessageInfo
    56  
    57  func (m *PBuffMarshal) GetField1() []byte {
    58  	if m != nil {
    59  		return m.Field1
    60  	}
    61  	return nil
    62  }
    63  
    64  func (m *PBuffMarshal) GetField2() int32 {
    65  	if m != nil && m.Field2 != nil {
    66  		return *m.Field2
    67  	}
    68  	return 0
    69  }
    70  
    71  type PBuffMarshaler struct {
    72  	Field1               []byte   `protobuf:"bytes,1,opt,name=Field1" json:"Field1,omitempty"`
    73  	Field2               *int32   `protobuf:"varint,2,opt,name=Field2" json:"Field2,omitempty"`
    74  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    75  	XXX_unrecognized     []byte   `json:"-"`
    76  	XXX_sizecache        int32    `json:"-"`
    77  }
    78  
    79  func (m *PBuffMarshaler) Reset()         { *m = PBuffMarshaler{} }
    80  func (m *PBuffMarshaler) String() string { return proto.CompactTextString(m) }
    81  func (*PBuffMarshaler) ProtoMessage()    {}
    82  func (*PBuffMarshaler) Descriptor() ([]byte, []int) {
    83  	return fileDescriptor_12798c2215df1728, []int{1}
    84  }
    85  func (m *PBuffMarshaler) XXX_Unmarshal(b []byte) error {
    86  	return xxx_messageInfo_PBuffMarshaler.Unmarshal(m, b)
    87  }
    88  func (m *PBuffMarshaler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    89  	if deterministic {
    90  		return xxx_messageInfo_PBuffMarshaler.Marshal(b, m, deterministic)
    91  	} else {
    92  		b = b[:cap(b)]
    93  		n, err := m.MarshalToSizedBuffer(b)
    94  		if err != nil {
    95  			return nil, err
    96  		}
    97  		return b[:n], nil
    98  	}
    99  }
   100  func (m *PBuffMarshaler) XXX_Merge(src proto.Message) {
   101  	xxx_messageInfo_PBuffMarshaler.Merge(m, src)
   102  }
   103  func (m *PBuffMarshaler) XXX_Size() int {
   104  	return m.Size()
   105  }
   106  func (m *PBuffMarshaler) XXX_DiscardUnknown() {
   107  	xxx_messageInfo_PBuffMarshaler.DiscardUnknown(m)
   108  }
   109  
   110  var xxx_messageInfo_PBuffMarshaler proto.InternalMessageInfo
   111  
   112  func (m *PBuffMarshaler) GetField1() []byte {
   113  	if m != nil {
   114  		return m.Field1
   115  	}
   116  	return nil
   117  }
   118  
   119  func (m *PBuffMarshaler) GetField2() int32 {
   120  	if m != nil && m.Field2 != nil {
   121  		return *m.Field2
   122  	}
   123  	return 0
   124  }
   125  
   126  func init() {
   127  	proto.RegisterType((*PBuffMarshal)(nil), "protobuffer.PBuffMarshal")
   128  	proto.RegisterType((*PBuffMarshaler)(nil), "protobuffer.PBuffMarshaler")
   129  }
   130  
   131  func init() { proto.RegisterFile("protobuffer.proto", fileDescriptor_12798c2215df1728) }
   132  
   133  var fileDescriptor_12798c2215df1728 = []byte{
   134  	// 144 bytes of a gzipped FileDescriptorProto
   135  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x28, 0xca, 0x2f,
   136  	0xc9, 0x4f, 0x2a, 0x4d, 0x4b, 0x4b, 0x2d, 0xd2, 0x03, 0xb3, 0x85, 0xb8, 0x91, 0x84, 0xa4, 0x74,
   137  	0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5,
   138  	0x61, 0x92, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xf4, 0x2a, 0x79, 0x70, 0xf1, 0x04, 0x38, 0x95,
   139  	0xa6, 0xa5, 0xf9, 0x26, 0x16, 0x15, 0x67, 0x24, 0xe6, 0x08, 0x89, 0x71, 0xb1, 0xb9, 0x65, 0xa6,
   140  	0xe6, 0xa4, 0x18, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x41, 0x79, 0x70, 0x71, 0x23, 0x09,
   141  	0x26, 0x05, 0x46, 0x0d, 0x56, 0xa8, 0xb8, 0x91, 0x15, 0x47, 0xc7, 0x42, 0x79, 0x86, 0x05, 0x0b,
   142  	0xe5, 0x19, 0x94, 0xbc, 0xb8, 0xf8, 0x90, 0x4d, 0x4a, 0x2d, 0x22, 0xcb, 0x2c, 0xc6, 0x05, 0x0b,
   143  	0xe5, 0x19, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x9d, 0x92, 0xe0, 0xe5, 0x00, 0x00, 0x00,
   144  }
   145  
   146  func (m *PBuffMarshaler) Marshal() (dAtA []byte, err error) {
   147  	size := m.Size()
   148  	dAtA = make([]byte, size)
   149  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	return dAtA[:n], nil
   154  }
   155  
   156  func (m *PBuffMarshaler) MarshalTo(dAtA []byte) (int, error) {
   157  	size := m.Size()
   158  	return m.MarshalToSizedBuffer(dAtA[:size])
   159  }
   160  
   161  func (m *PBuffMarshaler) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   162  	i := len(dAtA)
   163  	_ = i
   164  	var l int
   165  	_ = l
   166  	if m.XXX_unrecognized != nil {
   167  		i -= len(m.XXX_unrecognized)
   168  		copy(dAtA[i:], m.XXX_unrecognized)
   169  	}
   170  	if m.Field2 != nil {
   171  		i = encodeVarintProtobuffer(dAtA, i, uint64(*m.Field2))
   172  		i--
   173  		dAtA[i] = 0x10
   174  	}
   175  	if m.Field1 != nil {
   176  		i -= len(m.Field1)
   177  		copy(dAtA[i:], m.Field1)
   178  		i = encodeVarintProtobuffer(dAtA, i, uint64(len(m.Field1)))
   179  		i--
   180  		dAtA[i] = 0xa
   181  	}
   182  	return len(dAtA) - i, nil
   183  }
   184  
   185  func encodeVarintProtobuffer(dAtA []byte, offset int, v uint64) int {
   186  	offset -= sovProtobuffer(v)
   187  	base := offset
   188  	for v >= 1<<7 {
   189  		dAtA[offset] = uint8(v&0x7f | 0x80)
   190  		v >>= 7
   191  		offset++
   192  	}
   193  	dAtA[offset] = uint8(v)
   194  	return base
   195  }
   196  func (m *PBuffMarshaler) Size() (n int) {
   197  	if m == nil {
   198  		return 0
   199  	}
   200  	var l int
   201  	_ = l
   202  	if m.Field1 != nil {
   203  		l = len(m.Field1)
   204  		n += 1 + l + sovProtobuffer(uint64(l))
   205  	}
   206  	if m.Field2 != nil {
   207  		n += 1 + sovProtobuffer(uint64(*m.Field2))
   208  	}
   209  	if m.XXX_unrecognized != nil {
   210  		n += len(m.XXX_unrecognized)
   211  	}
   212  	return n
   213  }
   214  
   215  func sovProtobuffer(x uint64) (n int) {
   216  	return (math_bits.Len64(x|1) + 6) / 7
   217  }
   218  func sozProtobuffer(x uint64) (n int) {
   219  	return sovProtobuffer(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   220  }