2019-06-20 03:09:57 -07:00
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
2020-02-20 10:30:38 -08:00
|
|
|
// Use of this source code is governed by a BSD-style
|
2019-06-20 03:09:57 -07:00
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Code generated by generate-types. DO NOT EDIT.
|
|
|
|
|
|
|
|
package impl
|
|
|
|
|
|
|
|
import (
|
|
|
|
"google.golang.org/protobuf/reflect/protoreflect"
|
2019-07-10 23:14:31 -07:00
|
|
|
"google.golang.org/protobuf/runtime/protoiface"
|
2019-06-20 03:09:57 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func (m *messageState) Descriptor() protoreflect.MessageDescriptor {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.messageInfo().Desc
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-07-02 14:58:02 -07:00
|
|
|
func (m *messageState) Type() protoreflect.MessageType {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.messageInfo()
|
2019-07-02 14:58:02 -07:00
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
func (m *messageState) New() protoreflect.Message {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.messageInfo().New()
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
func (m *messageState) Interface() protoreflect.ProtoMessage {
|
2019-09-03 16:30:39 -07:00
|
|
|
return m.protoUnwrap().(protoreflect.ProtoMessage)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-09-03 16:30:39 -07:00
|
|
|
func (m *messageState) protoUnwrap() interface{} {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-07-10 23:14:31 -07:00
|
|
|
func (m *messageState) ProtoMethods() *protoiface.Methods {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
return &m.messageInfo().methods
|
2019-07-10 23:14:31 -07:00
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
|
2019-07-15 15:56:54 -07:00
|
|
|
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
|
|
|
|
// to be able to retrieve a v2 MessageInfo struct.
|
|
|
|
//
|
|
|
|
// WARNING: This method is exempt from the compatibility promise and
|
|
|
|
// may be removed in the future without warning.
|
|
|
|
func (m *messageState) ProtoMessageInfo() *MessageInfo {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo()
|
2019-07-15 15:56:54 -07:00
|
|
|
}
|
|
|
|
|
2019-06-20 03:09:57 -07:00
|
|
|
func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
2019-09-18 18:08:52 -07:00
|
|
|
for _, ri := range m.messageInfo().rangeInfos {
|
|
|
|
switch ri := ri.(type) {
|
|
|
|
case *fieldInfo:
|
|
|
|
if ri.has(m.pointer()) {
|
|
|
|
if !f(ri.fieldDesc, ri.get(m.pointer())) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case *oneofInfo:
|
|
|
|
if n := ri.which(m.pointer()); n > 0 {
|
|
|
|
fi := m.messageInfo().fields[n]
|
|
|
|
if !f(fi.fieldDesc, fi.get(m.pointer())) {
|
|
|
|
return
|
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().extensionMap(m.pointer()).Range(f)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
return fi.has(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo().extensionMap(m.pointer()).Has(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageState) Clear(fd protoreflect.FieldDescriptor) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
fi.clear(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().extensionMap(m.pointer()).Clear(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
return fi.get(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo().extensionMap(m.pointer()).Get(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
fi.set(m.pointer(), v)
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
return fi.mutable(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
all: add NewField, NewElement, NewValue
Add methods to protoreflect.{Message,List,Map} to constrict values
assignable to a message field, list element, or map value. These
methods return the default value for scalar fields, the zero value for
scalar list elements and map values, and an empty, mutable value for
messages, lists, and maps.
Deprecate the NewMessage methods on these types, which are superseded.
Updates golang/protobuf#879
Change-Id: I0f064f60c89a239330ccea81523f559f14fd2c4f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-05 10:48:38 -07:00
|
|
|
func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
all: add NewField, NewElement, NewValue
Add methods to protoreflect.{Message,List,Map} to constrict values
assignable to a message field, list element, or map value. These
methods return the default value for scalar fields, the zero value for
scalar list elements and map values, and an empty, mutable value for
messages, lists, and maps.
Deprecate the NewMessage methods on these types, which are superseded.
Updates golang/protobuf#879
Change-Id: I0f064f60c89a239330ccea81523f559f14fd2c4f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-05 10:48:38 -07:00
|
|
|
return fi.newField()
|
2019-06-20 03:09:57 -07:00
|
|
|
} else {
|
all: add NewField, NewElement, NewValue
Add methods to protoreflect.{Message,List,Map} to constrict values
assignable to a message field, list element, or map value. These
methods return the default value for scalar fields, the zero value for
scalar list elements and map values, and an empty, mutable value for
messages, lists, and maps.
Deprecate the NewMessage methods on these types, which are superseded.
Updates golang/protobuf#879
Change-Id: I0f064f60c89a239330ccea81523f559f14fd2c4f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-05 10:48:38 -07:00
|
|
|
return xt.New()
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
|
2019-06-20 03:09:57 -07:00
|
|
|
return od.Fields().ByNumber(oi.which(m.pointer()))
|
|
|
|
}
|
|
|
|
panic("invalid oneof descriptor")
|
|
|
|
}
|
|
|
|
func (m *messageState) GetUnknown() protoreflect.RawFields {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
return m.messageInfo().getUnknown(m.pointer())
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
func (m *messageState) SetUnknown(b protoreflect.RawFields) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
m.messageInfo().setUnknown(m.pointer(), b)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-11-26 13:27:24 -08:00
|
|
|
func (m *messageState) IsValid() bool {
|
2019-12-16 13:23:25 -08:00
|
|
|
return !m.pointer().IsNil()
|
2019-11-26 13:27:24 -08:00
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
|
|
|
|
func (m *messageReflectWrapper) Descriptor() protoreflect.MessageDescriptor {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.messageInfo().Desc
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-07-02 14:58:02 -07:00
|
|
|
func (m *messageReflectWrapper) Type() protoreflect.MessageType {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.messageInfo()
|
2019-07-02 14:58:02 -07:00
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
func (m *messageReflectWrapper) New() protoreflect.Message {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.messageInfo().New()
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage {
|
2019-09-03 16:30:39 -07:00
|
|
|
if m, ok := m.protoUnwrap().(protoreflect.ProtoMessage); ok {
|
2019-06-20 03:09:57 -07:00
|
|
|
return m
|
|
|
|
}
|
|
|
|
return (*messageIfaceWrapper)(m)
|
|
|
|
}
|
2019-09-03 16:30:39 -07:00
|
|
|
func (m *messageReflectWrapper) protoUnwrap() interface{} {
|
2019-08-06 15:43:25 -07:00
|
|
|
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-07-10 23:14:31 -07:00
|
|
|
func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
return &m.messageInfo().methods
|
2019-07-10 23:14:31 -07:00
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
|
2019-07-15 15:56:54 -07:00
|
|
|
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
|
|
|
|
// to be able to retrieve a v2 MessageInfo struct.
|
|
|
|
//
|
|
|
|
// WARNING: This method is exempt from the compatibility promise and
|
|
|
|
// may be removed in the future without warning.
|
|
|
|
func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo()
|
2019-07-15 15:56:54 -07:00
|
|
|
}
|
|
|
|
|
2019-06-20 03:09:57 -07:00
|
|
|
func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
2019-09-18 18:08:52 -07:00
|
|
|
for _, ri := range m.messageInfo().rangeInfos {
|
|
|
|
switch ri := ri.(type) {
|
|
|
|
case *fieldInfo:
|
|
|
|
if ri.has(m.pointer()) {
|
|
|
|
if !f(ri.fieldDesc, ri.get(m.pointer())) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case *oneofInfo:
|
|
|
|
if n := ri.which(m.pointer()); n > 0 {
|
|
|
|
fi := m.messageInfo().fields[n]
|
|
|
|
if !f(fi.fieldDesc, fi.get(m.pointer())) {
|
|
|
|
return
|
|
|
|
}
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().extensionMap(m.pointer()).Range(f)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
return fi.has(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo().extensionMap(m.pointer()).Has(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
fi.clear(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().extensionMap(m.pointer()).Clear(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
return fi.get(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo().extensionMap(m.pointer()).Get(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
fi.set(m.pointer(), v)
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
2019-06-20 03:09:57 -07:00
|
|
|
return fi.mutable(m.pointer())
|
|
|
|
} else {
|
2019-07-31 12:27:30 -07:00
|
|
|
return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
all: add NewField, NewElement, NewValue
Add methods to protoreflect.{Message,List,Map} to constrict values
assignable to a message field, list element, or map value. These
methods return the default value for scalar fields, the zero value for
scalar list elements and map values, and an empty, mutable value for
messages, lists, and maps.
Deprecate the NewMessage methods on these types, which are superseded.
Updates golang/protobuf#879
Change-Id: I0f064f60c89a239330ccea81523f559f14fd2c4f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-05 10:48:38 -07:00
|
|
|
func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
all: add NewField, NewElement, NewValue
Add methods to protoreflect.{Message,List,Map} to constrict values
assignable to a message field, list element, or map value. These
methods return the default value for scalar fields, the zero value for
scalar list elements and map values, and an empty, mutable value for
messages, lists, and maps.
Deprecate the NewMessage methods on these types, which are superseded.
Updates golang/protobuf#879
Change-Id: I0f064f60c89a239330ccea81523f559f14fd2c4f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-05 10:48:38 -07:00
|
|
|
return fi.newField()
|
2019-06-20 03:09:57 -07:00
|
|
|
} else {
|
all: add NewField, NewElement, NewValue
Add methods to protoreflect.{Message,List,Map} to constrict values
assignable to a message field, list element, or map value. These
methods return the default value for scalar fields, the zero value for
scalar list elements and map values, and an empty, mutable value for
messages, lists, and maps.
Deprecate the NewMessage methods on these types, which are superseded.
Updates golang/protobuf#879
Change-Id: I0f064f60c89a239330ccea81523f559f14fd2c4f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188997
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-05 10:48:38 -07:00
|
|
|
return xt.New()
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
|
2019-06-20 03:09:57 -07:00
|
|
|
return od.Fields().ByNumber(oi.which(m.pointer()))
|
|
|
|
}
|
|
|
|
panic("invalid oneof descriptor")
|
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
return m.messageInfo().getUnknown(m.pointer())
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
|
|
|
func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {
|
2019-07-31 12:27:30 -07:00
|
|
|
m.messageInfo().init()
|
|
|
|
m.messageInfo().setUnknown(m.pointer(), b)
|
2019-06-20 03:09:57 -07:00
|
|
|
}
|
2019-11-26 13:27:24 -08:00
|
|
|
func (m *messageReflectWrapper) IsValid() bool {
|
2019-12-16 13:23:25 -08:00
|
|
|
return !m.pointer().IsNil()
|
2019-11-26 13:27:24 -08:00
|
|
|
}
|