...

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

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

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: md.proto
     3  
     4  package moredefaults
     5  
     6  import (
     7  	bytes "bytes"
     8  	fmt "fmt"
     9  	_ "github.com/gogo/protobuf/gogoproto"
    10  	proto "github.com/gogo/protobuf/proto"
    11  	example "github.com/gogo/protobuf/test/example"
    12  	math "math"
    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 MoreDefaultsB struct {
    27  	Field1               *string  `protobuf:"bytes,1,opt,name=Field1" json:"Field1,omitempty"`
    28  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    29  	XXX_unrecognized     []byte   `json:"-"`
    30  	XXX_sizecache        int32    `json:"-"`
    31  }
    32  
    33  func (m *MoreDefaultsB) Reset()         { *m = MoreDefaultsB{} }
    34  func (m *MoreDefaultsB) String() string { return proto.CompactTextString(m) }
    35  func (*MoreDefaultsB) ProtoMessage()    {}
    36  func (*MoreDefaultsB) Descriptor() ([]byte, []int) {
    37  	return fileDescriptor_e0e149d9fdc447d0, []int{0}
    38  }
    39  func (m *MoreDefaultsB) XXX_Unmarshal(b []byte) error {
    40  	return xxx_messageInfo_MoreDefaultsB.Unmarshal(m, b)
    41  }
    42  func (m *MoreDefaultsB) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    43  	return xxx_messageInfo_MoreDefaultsB.Marshal(b, m, deterministic)
    44  }
    45  func (m *MoreDefaultsB) XXX_Merge(src proto.Message) {
    46  	xxx_messageInfo_MoreDefaultsB.Merge(m, src)
    47  }
    48  func (m *MoreDefaultsB) XXX_Size() int {
    49  	return xxx_messageInfo_MoreDefaultsB.Size(m)
    50  }
    51  func (m *MoreDefaultsB) XXX_DiscardUnknown() {
    52  	xxx_messageInfo_MoreDefaultsB.DiscardUnknown(m)
    53  }
    54  
    55  var xxx_messageInfo_MoreDefaultsB proto.InternalMessageInfo
    56  
    57  func (m *MoreDefaultsB) GetField1() string {
    58  	if m != nil && m.Field1 != nil {
    59  		return *m.Field1
    60  	}
    61  	return ""
    62  }
    63  
    64  type MoreDefaultsA struct {
    65  	Field1               *int64         `protobuf:"varint,1,opt,name=Field1,def=1234" json:"Field1,omitempty"`
    66  	Field2               int64          `protobuf:"varint,2,opt,name=Field2" json:"Field2"`
    67  	B1                   *MoreDefaultsB `protobuf:"bytes,3,opt,name=B1" json:"B1,omitempty"`
    68  	B2                   MoreDefaultsB  `protobuf:"bytes,4,opt,name=B2" json:"B2"`
    69  	A1                   *example.A     `protobuf:"bytes,5,opt,name=A1" json:"A1,omitempty"`
    70  	A2                   example.A      `protobuf:"bytes,6,opt,name=A2" json:"A2"`
    71  	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
    72  	XXX_unrecognized     []byte         `json:"-"`
    73  	XXX_sizecache        int32          `json:"-"`
    74  }
    75  
    76  func (m *MoreDefaultsA) Reset()         { *m = MoreDefaultsA{} }
    77  func (m *MoreDefaultsA) String() string { return proto.CompactTextString(m) }
    78  func (*MoreDefaultsA) ProtoMessage()    {}
    79  func (*MoreDefaultsA) Descriptor() ([]byte, []int) {
    80  	return fileDescriptor_e0e149d9fdc447d0, []int{1}
    81  }
    82  func (m *MoreDefaultsA) XXX_Unmarshal(b []byte) error {
    83  	return xxx_messageInfo_MoreDefaultsA.Unmarshal(m, b)
    84  }
    85  func (m *MoreDefaultsA) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    86  	return xxx_messageInfo_MoreDefaultsA.Marshal(b, m, deterministic)
    87  }
    88  func (m *MoreDefaultsA) XXX_Merge(src proto.Message) {
    89  	xxx_messageInfo_MoreDefaultsA.Merge(m, src)
    90  }
    91  func (m *MoreDefaultsA) XXX_Size() int {
    92  	return xxx_messageInfo_MoreDefaultsA.Size(m)
    93  }
    94  func (m *MoreDefaultsA) XXX_DiscardUnknown() {
    95  	xxx_messageInfo_MoreDefaultsA.DiscardUnknown(m)
    96  }
    97  
    98  var xxx_messageInfo_MoreDefaultsA proto.InternalMessageInfo
    99  
   100  const Default_MoreDefaultsA_Field1 int64 = 1234
   101  
   102  func (m *MoreDefaultsA) GetField1() int64 {
   103  	if m != nil && m.Field1 != nil {
   104  		return *m.Field1
   105  	}
   106  	return Default_MoreDefaultsA_Field1
   107  }
   108  
   109  func (m *MoreDefaultsA) GetField2() int64 {
   110  	if m != nil {
   111  		return m.Field2
   112  	}
   113  	return 0
   114  }
   115  
   116  func (m *MoreDefaultsA) GetB1() *MoreDefaultsB {
   117  	if m != nil {
   118  		return m.B1
   119  	}
   120  	return nil
   121  }
   122  
   123  func (m *MoreDefaultsA) GetB2() MoreDefaultsB {
   124  	if m != nil {
   125  		return m.B2
   126  	}
   127  	return MoreDefaultsB{}
   128  }
   129  
   130  func (m *MoreDefaultsA) GetA1() *example.A {
   131  	if m != nil {
   132  		return m.A1
   133  	}
   134  	return nil
   135  }
   136  
   137  func (m *MoreDefaultsA) GetA2() example.A {
   138  	if m != nil {
   139  		return m.A2
   140  	}
   141  	return example.A{}
   142  }
   143  
   144  func init() {
   145  	proto.RegisterType((*MoreDefaultsB)(nil), "moredefaults.MoreDefaultsB")
   146  	proto.RegisterType((*MoreDefaultsA)(nil), "moredefaults.MoreDefaultsA")
   147  }
   148  
   149  func init() { proto.RegisterFile("md.proto", fileDescriptor_e0e149d9fdc447d0) }
   150  
   151  var fileDescriptor_e0e149d9fdc447d0 = []byte{
   152  	// 258 bytes of a gzipped FileDescriptorProto
   153  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xc8, 0x4d, 0xd1, 0x2b,
   154  	0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc9, 0xcd, 0x2f, 0x4a, 0x4d, 0x49, 0x4d, 0x4b, 0x2c, 0xcd,
   155  	0x29, 0x29, 0x96, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f,
   156  	0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x2b, 0x4a, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2,
   157  	0x59, 0xca, 0x18, 0xa7, 0xf2, 0x92, 0xd4, 0xe2, 0x12, 0xfd, 0xd4, 0x8a, 0xc4, 0xdc, 0x82, 0x9c,
   158  	0x54, 0x18, 0x0d, 0xd1, 0xa4, 0xa4, 0xce, 0xc5, 0xeb, 0x9b, 0x5f, 0x94, 0xea, 0x02, 0xb5, 0xd3,
   159  	0x49, 0x48, 0x8c, 0x8b, 0xcd, 0x2d, 0x33, 0x35, 0x27, 0xc5, 0x50, 0x82, 0x51, 0x81, 0x51, 0x83,
   160  	0x33, 0x08, 0xca, 0x53, 0x7a, 0xcc, 0x88, 0xaa, 0xd2, 0x51, 0x48, 0x06, 0x45, 0x25, 0xb3, 0x15,
   161  	0x8b, 0xa1, 0x91, 0xb1, 0x09, 0x4c, 0x3d, 0x5c, 0xd6, 0x48, 0x82, 0x09, 0x24, 0xeb, 0xc4, 0x72,
   162  	0xe2, 0x9e, 0x3c, 0x03, 0x54, 0xd6, 0x48, 0x48, 0x9b, 0x8b, 0xc9, 0xc9, 0x50, 0x82, 0x59, 0x81,
   163  	0x51, 0x83, 0xdb, 0x48, 0x5a, 0x0f, 0xd9, 0xd7, 0x7a, 0x28, 0xce, 0x09, 0x62, 0x72, 0x32, 0x14,
   164  	0x32, 0xe4, 0x62, 0x72, 0x32, 0x92, 0x60, 0x21, 0xa8, 0x18, 0x6a, 0x07, 0x93, 0x93, 0x91, 0x90,
   165  	0x38, 0x17, 0x93, 0xa3, 0xa1, 0x04, 0x2b, 0x58, 0x0b, 0xbb, 0x1e, 0xc8, 0xff, 0x7a, 0x8e, 0x41,
   166  	0x4c, 0x8e, 0x86, 0x42, 0xb2, 0x5c, 0x4c, 0x8e, 0x46, 0x12, 0x6c, 0x28, 0x12, 0x30, 0x7d, 0x8e,
   167  	0x46, 0x4e, 0x02, 0x27, 0x1e, 0xca, 0x31, 0xfe, 0x78, 0x28, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3,
   168  	0x8e, 0x47, 0x72, 0x8c, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xf0, 0x3f, 0xeb, 0x9d, 0x01,
   169  	0x00, 0x00,
   170  }
   171  
   172  func (this *MoreDefaultsB) Equal(that interface{}) bool {
   173  	if that == nil {
   174  		return this == nil
   175  	}
   176  
   177  	that1, ok := that.(*MoreDefaultsB)
   178  	if !ok {
   179  		that2, ok := that.(MoreDefaultsB)
   180  		if ok {
   181  			that1 = &that2
   182  		} else {
   183  			return false
   184  		}
   185  	}
   186  	if that1 == nil {
   187  		return this == nil
   188  	} else if this == nil {
   189  		return false
   190  	}
   191  	if this.Field1 != nil && that1.Field1 != nil {
   192  		if *this.Field1 != *that1.Field1 {
   193  			return false
   194  		}
   195  	} else if this.Field1 != nil {
   196  		return false
   197  	} else if that1.Field1 != nil {
   198  		return false
   199  	}
   200  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   201  		return false
   202  	}
   203  	return true
   204  }
   205  func (this *MoreDefaultsA) Equal(that interface{}) bool {
   206  	if that == nil {
   207  		return this == nil
   208  	}
   209  
   210  	that1, ok := that.(*MoreDefaultsA)
   211  	if !ok {
   212  		that2, ok := that.(MoreDefaultsA)
   213  		if ok {
   214  			that1 = &that2
   215  		} else {
   216  			return false
   217  		}
   218  	}
   219  	if that1 == nil {
   220  		return this == nil
   221  	} else if this == nil {
   222  		return false
   223  	}
   224  	if this.Field1 != nil && that1.Field1 != nil {
   225  		if *this.Field1 != *that1.Field1 {
   226  			return false
   227  		}
   228  	} else if this.Field1 != nil {
   229  		return false
   230  	} else if that1.Field1 != nil {
   231  		return false
   232  	}
   233  	if this.Field2 != that1.Field2 {
   234  		return false
   235  	}
   236  	if !this.B1.Equal(that1.B1) {
   237  		return false
   238  	}
   239  	if !this.B2.Equal(&that1.B2) {
   240  		return false
   241  	}
   242  	if !this.A1.Equal(that1.A1) {
   243  		return false
   244  	}
   245  	if !this.A2.Equal(&that1.A2) {
   246  		return false
   247  	}
   248  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   249  		return false
   250  	}
   251  	return true
   252  }
   253  func NewPopulatedMoreDefaultsB(r randyMd, easy bool) *MoreDefaultsB {
   254  	this := &MoreDefaultsB{}
   255  	if r.Intn(5) != 0 {
   256  		v1 := string(randStringMd(r))
   257  		this.Field1 = &v1
   258  	}
   259  	if !easy && r.Intn(10) != 0 {
   260  		this.XXX_unrecognized = randUnrecognizedMd(r, 2)
   261  	}
   262  	return this
   263  }
   264  
   265  func NewPopulatedMoreDefaultsA(r randyMd, easy bool) *MoreDefaultsA {
   266  	this := &MoreDefaultsA{}
   267  	if r.Intn(5) != 0 {
   268  		v2 := int64(r.Int63())
   269  		if r.Intn(2) == 0 {
   270  			v2 *= -1
   271  		}
   272  		this.Field1 = &v2
   273  	}
   274  	this.Field2 = int64(r.Int63())
   275  	if r.Intn(2) == 0 {
   276  		this.Field2 *= -1
   277  	}
   278  	if r.Intn(5) != 0 {
   279  		this.B1 = NewPopulatedMoreDefaultsB(r, easy)
   280  	}
   281  	v3 := NewPopulatedMoreDefaultsB(r, easy)
   282  	this.B2 = *v3
   283  	if r.Intn(5) != 0 {
   284  		this.A1 = example.NewPopulatedA(r, easy)
   285  	}
   286  	v4 := example.NewPopulatedA(r, easy)
   287  	this.A2 = *v4
   288  	if !easy && r.Intn(10) != 0 {
   289  		this.XXX_unrecognized = randUnrecognizedMd(r, 7)
   290  	}
   291  	return this
   292  }
   293  
   294  type randyMd interface {
   295  	Float32() float32
   296  	Float64() float64
   297  	Int63() int64
   298  	Int31() int32
   299  	Uint32() uint32
   300  	Intn(n int) int
   301  }
   302  
   303  func randUTF8RuneMd(r randyMd) rune {
   304  	ru := r.Intn(62)
   305  	if ru < 10 {
   306  		return rune(ru + 48)
   307  	} else if ru < 36 {
   308  		return rune(ru + 55)
   309  	}
   310  	return rune(ru + 61)
   311  }
   312  func randStringMd(r randyMd) string {
   313  	v5 := r.Intn(100)
   314  	tmps := make([]rune, v5)
   315  	for i := 0; i < v5; i++ {
   316  		tmps[i] = randUTF8RuneMd(r)
   317  	}
   318  	return string(tmps)
   319  }
   320  func randUnrecognizedMd(r randyMd, maxFieldNumber int) (dAtA []byte) {
   321  	l := r.Intn(5)
   322  	for i := 0; i < l; i++ {
   323  		wire := r.Intn(4)
   324  		if wire == 3 {
   325  			wire = 5
   326  		}
   327  		fieldNumber := maxFieldNumber + r.Intn(100)
   328  		dAtA = randFieldMd(dAtA, r, fieldNumber, wire)
   329  	}
   330  	return dAtA
   331  }
   332  func randFieldMd(dAtA []byte, r randyMd, fieldNumber int, wire int) []byte {
   333  	key := uint32(fieldNumber)<<3 | uint32(wire)
   334  	switch wire {
   335  	case 0:
   336  		dAtA = encodeVarintPopulateMd(dAtA, uint64(key))
   337  		v6 := r.Int63()
   338  		if r.Intn(2) == 0 {
   339  			v6 *= -1
   340  		}
   341  		dAtA = encodeVarintPopulateMd(dAtA, uint64(v6))
   342  	case 1:
   343  		dAtA = encodeVarintPopulateMd(dAtA, uint64(key))
   344  		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)))
   345  	case 2:
   346  		dAtA = encodeVarintPopulateMd(dAtA, uint64(key))
   347  		ll := r.Intn(100)
   348  		dAtA = encodeVarintPopulateMd(dAtA, uint64(ll))
   349  		for j := 0; j < ll; j++ {
   350  			dAtA = append(dAtA, byte(r.Intn(256)))
   351  		}
   352  	default:
   353  		dAtA = encodeVarintPopulateMd(dAtA, uint64(key))
   354  		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
   355  	}
   356  	return dAtA
   357  }
   358  func encodeVarintPopulateMd(dAtA []byte, v uint64) []byte {
   359  	for v >= 1<<7 {
   360  		dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
   361  		v >>= 7
   362  	}
   363  	dAtA = append(dAtA, uint8(v))
   364  	return dAtA
   365  }
   366  

View as plain text