descriptor.h
#include <google/protobuf/descriptor.h>
namespace google::protobuf
This file contains classes which describe a type of protocol message.
You can use a message's descriptor to learn at runtime what fields it contains and what the types of those fields are. The Message interface also allows you to dynamically access and modify individual fields by passing the FieldDescriptor of the field you are interested in.
Most users will not care about descriptors, because they will write code specific to certain protocol types and will simply use the classes generated by the protocol compiler directly. Advanced users who want to operate on arbitrary types (not known at compile time) may want to read descriptors in order to learn about the contents of a message. A very small number of users will want to construct their own Descriptors, either because they are implementing Message manually or because they are writing something like the protocol compiler.
For an example of how you might use descriptors, see the code example at the top of message.h.
Classes in this file | |
---|---|
NB, all indices are zero-based.
| |
Describes a type of protocol message, or a particular group within a message.
| |
A range of field numbers which are designated for third-party extensions.
| |
Describes a single field of a message.
| |
Describes an enum type defined in a .proto file.
| |
Describes an individual enum constant of a particular type.
| |
Describes an RPC service.
| |
Describes an individual service method.
| |
Describes a whole .proto file.
| |
Used to construct descriptors.
| |
When converting a
FileDescriptorProto to a
FileDescriptor, various errors might be detected in the input.
|
struct SourceLocation
#include <google/protobuf/descriptor.h>
namespace google::protobuf
NB, all indices are zero-based.
Members | |
---|---|
int |
start_line
|
int |
end_line
|
int |
start_column
|
int |
end_column
|
string |
leading_comments
Doc comments found at the source location.
more...
|
string |
trailing_comments
|
stringSourceLocation::leading_comments
Doc comments found at the source location.
TODO(kenton): Maybe this struct should have been named SourceInfo or something instead. Oh well.
class Descriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes a type of protocol message, or a particular group within a message.
To obtain the Descriptor for a given message object, call Message::GetDescriptor(). Generated message classes also have a static method called descriptor() which returns the type's descriptor. Use DescriptorPool to construct your own descriptors.
Members | |
---|---|
const string & |
name() const
The name of the message type, not including its scope.
|
const string & |
full_name() const
The fully-qualified name of the message type, scope delimited by periods.
more...
|
int |
index() const
Index of this descriptor within the file or containing type's message type array.
|
const FileDescriptor * |
file() const
The .proto file in which this message type was defined. Never NULL.
|
const Descriptor * |
containing_type() const
If this
Descriptor describes a nested type, this returns the type in which it is nested.
more...
|
const MessageOptions & |
options() const
Get options for this message type.
more...
|
void |
CopyTo(DescriptorProto * proto) const
|
string |
DebugString() const
Write the contents of this decriptor in a human-readable form.
more...
|
int |
nested_type_count() const
The number of nested types in this message type.
|
const Descriptor * |
nested_type(int index) const
Gets a nested type by index, where 0 <= index <
nested_type_count().
more...
|
const Descriptor * |
FindNestedTypeByName(const string & name) const
Looks up a nested type by name.
more...
|
int |
enum_type_count() const
The number of enum types in this message type.
|
const EnumDescriptor * |
enum_type(int index) const
Gets an enum type by index, where 0 <= index <
enum_type_count().
more...
|
const EnumDescriptor * |
FindEnumTypeByName(const string & name) const
Looks up an enum type by name. Returns NULL if no such enum type exists.
|
const EnumValueDescriptor* |
FindEnumValueByName(const string & name) const
Looks up an enum value by name, among all enum types in this message.
more...
|
int |
extension_range_count() const
The number of extension ranges in this message type.
|
const ExtensionRange * |
extension_range(int index) const
Gets an extension range by index, where 0 <= index <
extension_range_count().
more...
|
bool |
IsExtensionNumber(int number) const
Returns true if the number is in one of the extension ranges.
|
int |
extension_count() const
The number of extensions -- extending *other* messages -- that were defined nested within this message type's scope.
|
const FieldDescriptor * |
extension(int index) const
Get an extension by index, where 0 <= index <
extension_count().
more...
|
const FieldDescriptor * |
FindExtensionByName(const string & name) const
Looks up a named extension (which extends some *other* message type) defined within this message type's scope.
|
const FieldDescriptor * |
FindExtensionByLowercaseName(const string & name) const
Similar to
FindFieldByLowercaseName(), but finds extensions defined within this message type's scope.
|
const FieldDescriptor * |
FindExtensionByCamelcaseName(const string & name) const
Similar to
FindFieldByCamelcaseName(), but finds extensions defined within this message type's scope.
|
bool |
GetSourceLocation(SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this message declaration.
more...
|
Field stuff | |
int |
field_count() const
The number of fields in this message type.
|
const FieldDescriptor * |
field(int index) const
Gets a field by index, where 0 <= index <
field_count().
more...
|
const FieldDescriptor * |
FindFieldByNumber(int number) const
Looks up a field by declared tag number.
more...
|
const FieldDescriptor * |
FindFieldByName(const string & name) const
Looks up a field by name. Returns NULL if no such field exists.
|
const FieldDescriptor * |
FindFieldByLowercaseName(const string & lowercase_name) const
Looks up a field by lowercased name (as returned by lowercase_name()).
more...
|
const FieldDescriptor * |
FindFieldByCamelcaseName(const string & camelcase_name) const
Looks up a field by camel-case name (as returned by camelcase_name()).
more...
|
const string & Descriptor::full_name() const
The fully-qualified name of the message type, scope delimited by periods.
For example, message type "Foo" which is declared in package "bar" has full name "bar.Foo". If a type "Baz" is nested within Foo, Baz's full_name is "bar.Foo.Baz". To get only the part that comes after the last '.', use name().
const Descriptor *
Descriptor::containing_type() const
Descriptor::containing_type() const
If this Descriptor describes a nested type, this returns the type in which it is nested.
Otherwise, returns NULL.
const MessageOptions &
Descriptor::options() const
Descriptor::options() const
Get options for this message type.
These are specified in the .proto file by placing lines like "option foo = 1234;" in the message definition. Allowed options are defined byMessageOptions in google/protobuf/descriptor.proto, and any available extensions of that message.
void Descriptor::CopyTo(
DescriptorProto * proto) const
DescriptorProto * proto) const
Write the contents of this Descriptor into the given DescriptorProto.
The target DescriptorProto must be clear before calling this; if it isn't, the result may be garbage.
string Descriptor::DebugString() const
Write the contents of this decriptor in a human-readable form.
Output will be suitable for re-parsing.
const Descriptor *
Descriptor::nested_type(
int index) const
Descriptor::nested_type(
int index) const
Gets a nested type by index, where 0 <= index < nested_type_count().
These are returned in the order they were defined in the .proto file.
const Descriptor *
Descriptor::FindNestedTypeByName(
const string & name) const
Descriptor::FindNestedTypeByName(
const string & name) const
Looks up a nested type by name.
Returns NULL if no such nested type exists.
const EnumDescriptor *
Descriptor::enum_type(
int index) const
Descriptor::enum_type(
int index) const
Gets an enum type by index, where 0 <= index < enum_type_count().
These are returned in the order they were defined in the .proto file.
const EnumValueDescriptor *
Descriptor::FindEnumValueByName(
const string & name) const
Descriptor::FindEnumValueByName(
const string & name) const
Looks up an enum value by name, among all enum types in this message.
Returns NULL if no such value exists.
const ExtensionRange *
Descriptor::extension_range(
int index) const
Descriptor::extension_range(
int index) const
Gets an extension range by index, where 0 <= index < extension_range_count().
These are returned in the order they were defined in the .proto file.
const FieldDescriptor *
Descriptor::extension(
int index) const
Descriptor::extension(
int index) const
Get an extension by index, where 0 <= index < extension_count().
These are returned in the order they were defined in the .proto file.
bool Descriptor::GetSourceLocation(
SourceLocation * out_location) const
SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this message declaration.
Returns false and leaves |*out_location| unchanged iff location information was not available.
const FieldDescriptor *
Descriptor::field(
int index) const
Descriptor::field(
int index) const
Gets a field by index, where 0 <= index < field_count().
These are returned in the order they were defined in the .proto file.
const FieldDescriptor *
Descriptor::FindFieldByNumber(
int number) const
Descriptor::FindFieldByNumber(
int number) const
Looks up a field by declared tag number.
Returns NULL if no such field exists.
const FieldDescriptor *
Descriptor::FindFieldByLowercaseName(
const string & lowercase_name) const
Descriptor::FindFieldByLowercaseName(
const string & lowercase_name) const
Looks up a field by lowercased name (as returned by lowercase_name()).
This lookup may be ambiguous if multiple field names differ only by case, in which case the field returned is chosen arbitrarily from the matches.
const FieldDescriptor *
Descriptor::FindFieldByCamelcaseName(
const string & camelcase_name) const
Descriptor::FindFieldByCamelcaseName(
const string & camelcase_name) const
Looks up a field by camel-case name (as returned by camelcase_name()).
This lookup may be ambiguous if multiple field names differ in a way that leads them to have identical camel-case names, in which case the field returned is chosen arbitrarily from the matches.
struct Descriptor::ExtensionRange
#include <google/protobuf/descriptor.h>
namespace google::protobuf
A range of field numbers which are designated for third-party extensions.
Members | |
---|---|
int |
start
inclusive
|
int |
end
exclusive
|
class FieldDescriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes a single field of a message.
To get the descriptor for a given field, first get the Descriptor for the message in which it is defined, then call Descriptor::FindFieldByName(). To get a FieldDescriptor for an extension, do one of the following:
- Get the Descriptor or FileDescriptor for its containing scope, then call Descriptor::FindExtensionByName() orFileDescriptor::FindExtensionByName().
- Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber().
- Given a Reflection for a message object, call Reflection::FindKnownExtensionByName() or Reflection::FindKnownExtensionByNumber(). Use DescriptorPool to construct your own descriptors.
Members | |
---|---|
enum |
Type
Identifies a field type.
more...
|
enum |
CppType
Specifies the C++ data type used to represent the field.
more...
|
enum |
Label
Identifies whether the field is optional, required, or repeated.
more...
|
const int |
kMaxNumber = (1 << 29) - 1
Valid field numbers are positive integers up to kMaxNumber.
|
const int |
kFirstReservedNumber = 19000
First field number reserved for the protocol buffer library implementation.
more...
|
const int |
kLastReservedNumber = 19999
Last field number reserved for the protocol buffer library implementation.
more...
|
int32 |
default_value_int32_
|
int64 |
default_value_int64_
|
uint32 |
default_value_uint32_
|
uint64 |
default_value_uint64_
|
float |
default_value_float_
|
double |
default_value_double_
|
bool |
default_value_bool_
|
const EnumValueDescriptor * |
default_value_enum_
|
const string * |
default_value_string_
|
const string & |
name() const
Name of this field within the message.
|
const string & |
full_name() const
Fully-qualified name of the field.
|
const FileDescriptor * |
file() const
File in which this field was defined.
|
bool |
is_extension() const
Is this an extension field?
|
int |
number() const
Declared tag number.
|
const string & |
lowercase_name() const
|
const string & |
camelcase_name() const
|
Type |
type() const
Declared type of this field.
|
const char * |
type_name() const
Name of the declared type.
|
CppType |
cpp_type() const
C++ type of this field.
|
const char * |
cpp_type_name() const
Name of the C++ type.
|
Label |
label() const
optional/required/repeated
|
bool |
is_required() const
shorthand for
label() == LABEL_REQUIRED
|
bool |
is_optional() const
shorthand for
label() == LABEL_OPTIONAL
|
bool |
is_repeated() const
shorthand for
label() == LABEL_REPEATED
|
bool |
is_packable() const
shorthand for
is_repeated() && IsTypePackable(
type())
|
bool |
is_packed() const
shorthand for
is_packable() &&
options().packed()
|
int |
index() const
Index of this field within the message's field array, or the file or extension scope's extensions array.
|
bool |
has_default_value() const
Does this field have an explicitly-declared default value?
|
int32 |
default_value_int32() const
Get the field default value if
cpp_type() == CPPTYPE_INT32.
more...
|
int64 |
default_value_int64() const
Get the field default value if
cpp_type() == CPPTYPE_INT64.
more...
|
uint32 |
default_value_uint32() const
Get the field default value if
cpp_type() == CPPTYPE_UINT32.
more...
|
uint64 |
default_value_uint64() const
Get the field default value if
cpp_type() == CPPTYPE_UINT64.
more...
|
float |
default_value_float() const
Get the field default value if
cpp_type() == CPPTYPE_FLOAT.
more...
|
double |
default_value_double() const
Get the field default value if
cpp_type() == CPPTYPE_DOUBLE.
more...
|
bool |
default_value_bool() const
Get the field default value if
cpp_type() == CPPTYPE_BOOL.
more...
|
const EnumValueDescriptor * |
default_value_enum() const
Get the field default value if
cpp_type() == CPPTYPE_ENUM.
more...
|
const string & |
default_value_string() const
Get the field default value if
cpp_type() == CPPTYPE_STRING.
more...
|
const Descriptor * |
containing_type() const
The
Descriptor for the message of which this is a field.
more...
|
const Descriptor * |
extension_scope() const
An extension may be declared within the scope of another message.
more...
|
const Descriptor * |
message_type() const
If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the message or the group type.
more...
|
const EnumDescriptor * |
enum_type() const
If type is TYPE_ENUM, returns a descriptor for the enum.
more...
|
const FieldDescriptor * |
experimental_map_key() const
EXPERIMENTAL; DO NOT USE.
more...
|
const FieldOptions & |
options() const
Get the
FieldOptions for this field.
more...
|
void |
CopyTo(FieldDescriptorProto * proto) const
See
Descriptor::CopyTo().
|
string |
DebugString() const
|
static CppType |
TypeToCppType(Type type)
Helper method to get the CppType for a particular Type.
|
static bool |
IsTypePackable(Type field_type)
Return true iff [[]packed = true] is valid for fields of this type.
|
Source Location | |
bool |
GetSourceLocation(SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this field declaration.
more...
|
enum FieldDescriptor::Type {
TYPE_DOUBLE = 1,
TYPE_FLOAT = 2,
TYPE_INT64 = 3,
TYPE_UINT64 = 4,
TYPE_INT32 = 5,
TYPE_FIXED64 = 6,
TYPE_FIXED32 = 7,
TYPE_BOOL = 8,
TYPE_STRING = 9,
TYPE_GROUP = 10,
TYPE_MESSAGE = 11,
TYPE_BYTES = 12,
TYPE_UINT32 = 13,
TYPE_ENUM = 14,
TYPE_SFIXED32 = 15,
TYPE_SFIXED64 = 16,
TYPE_SINT32 = 17,
TYPE_SINT64 = 18,
MAX_TYPE = 18
}
TYPE_DOUBLE = 1,
TYPE_FLOAT = 2,
TYPE_INT64 = 3,
TYPE_UINT64 = 4,
TYPE_INT32 = 5,
TYPE_FIXED64 = 6,
TYPE_FIXED32 = 7,
TYPE_BOOL = 8,
TYPE_STRING = 9,
TYPE_GROUP = 10,
TYPE_MESSAGE = 11,
TYPE_BYTES = 12,
TYPE_UINT32 = 13,
TYPE_ENUM = 14,
TYPE_SFIXED32 = 15,
TYPE_SFIXED64 = 16,
TYPE_SINT32 = 17,
TYPE_SINT64 = 18,
MAX_TYPE = 18
}
Identifies a field type.
0 is reserved for errors. The order is weird for historical reasons. Types 12 and up are new in proto2.
TYPE_DOUBLE | double, exactly eight bytes on the wire. |
TYPE_FLOAT | float, exactly four bytes on the wire. |
TYPE_INT64 | int64, varint on the wire. Negative numbers take 10 bytes. Use TYPE_SINT64 if negative values are likely. |
TYPE_UINT64 | uint64, varint on the wire. |
TYPE_INT32 | int32, varint on the wire. Negative numbers take 10 bytes. Use TYPE_SINT32 if negative values are likely. |
TYPE_FIXED64 | uint64, exactly eight bytes on the wire. |
TYPE_FIXED32 | uint32, exactly four bytes on the wire. |
TYPE_BOOL | bool, varint on the wire. |
TYPE_STRING | UTF-8 text. |
TYPE_GROUP | Tag-delimited message. Deprecated. |
TYPE_MESSAGE | Length-delimited message. |
TYPE_BYTES | Arbitrary byte array. |
TYPE_UINT32 | uint32, varint on the wire |
TYPE_ENUM | Enum, varint on the wire. |
TYPE_SFIXED32 | int32, exactly four bytes on the wire |
TYPE_SFIXED64 | int64, exactly eight bytes on the wire |
TYPE_SINT32 | int32, ZigZag-encoded varint on the wire |
TYPE_SINT64 | int64, ZigZag-encoded varint on the wire |
MAX_TYPE | Constant useful for defining lookup tables indexed by Type. |
enum FieldDescriptor::CppType {
CPPTYPE_INT32 = 1,
CPPTYPE_INT64 = 2,
CPPTYPE_UINT32 = 3,
CPPTYPE_UINT64 = 4,
CPPTYPE_DOUBLE = 5,
CPPTYPE_FLOAT = 6,
CPPTYPE_BOOL = 7,
CPPTYPE_ENUM = 8,
CPPTYPE_STRING = 9,
CPPTYPE_MESSAGE = 10,
MAX_CPPTYPE = 10
}
CPPTYPE_INT32 = 1,
CPPTYPE_INT64 = 2,
CPPTYPE_UINT32 = 3,
CPPTYPE_UINT64 = 4,
CPPTYPE_DOUBLE = 5,
CPPTYPE_FLOAT = 6,
CPPTYPE_BOOL = 7,
CPPTYPE_ENUM = 8,
CPPTYPE_STRING = 9,
CPPTYPE_MESSAGE = 10,
MAX_CPPTYPE = 10
}
Specifies the C++ data type used to represent the field.
There is a fixed mapping from Type to CppType where each Type maps to exactly one CppType. 0 is reserved for errors.
CPPTYPE_INT32 | TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32. |
CPPTYPE_INT64 | TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64. |
CPPTYPE_UINT32 | TYPE_UINT32, TYPE_FIXED32. |
CPPTYPE_UINT64 | TYPE_UINT64, TYPE_FIXED64. |
CPPTYPE_DOUBLE | TYPE_DOUBLE. |
CPPTYPE_FLOAT | TYPE_FLOAT. |
CPPTYPE_BOOL | TYPE_BOOL. |
CPPTYPE_ENUM | TYPE_ENUM. |
CPPTYPE_STRING | TYPE_STRING, TYPE_BYTES. |
CPPTYPE_MESSAGE | TYPE_MESSAGE, TYPE_GROUP. |
MAX_CPPTYPE | Constant useful for defining lookup tables indexed by CppType. |
enum FieldDescriptor::Label {
LABEL_OPTIONAL = 1,
LABEL_REQUIRED = 2,
LABEL_REPEATED = 3,
MAX_LABEL = 3
}
LABEL_OPTIONAL = 1,
LABEL_REQUIRED = 2,
LABEL_REPEATED = 3,
MAX_LABEL = 3
}
Identifies whether the field is optional, required, or repeated.
0 is reserved for errors.
LABEL_OPTIONAL | optional |
LABEL_REQUIRED | required |
LABEL_REPEATED | repeated |
MAX_LABEL | Constant useful for defining lookup tables indexed by Label. |
const intFieldDescriptor::kFirstReservedNumber = 19000
First field number reserved for the protocol buffer library implementation.
Users may not declare fields that use reserved numbers.
const intFieldDescriptor::kLastReservedNumber = 19999
Last field number reserved for the protocol buffer library implementation.
Users may not declare fields that use reserved numbers.
const string & FieldDescriptor::lowercase_name() const
Same as name() except converted to lower-case.
This (and especially the FindFieldByLowercaseName() method) can be useful when parsing formats which prefer to use lowercase naming style. (Although, technically field names should be lowercased anyway according to the protobuf style guide, so this only makes a difference when dealing with old .proto files which do not follow the guide.)
const string & FieldDescriptor::camelcase_name() const
Same as name() except converted to camel-case.
In this conversion, any time an underscore appears in the name, it is removed and the next letter is capitalized. Furthermore, the first letter of the name is lower-cased. Examples:
FooBar -> fooBar foo_bar -> fooBar fooBar -> fooBar
This (and especially the FindFieldByCamelcaseName() method) can be useful when parsing formats which prefer to use camel-case naming style.
int32 FieldDescriptor::default_value_int32() const
Get the field default value if cpp_type() == CPPTYPE_INT32.
If no explicit default was defined, the default is 0.
int64 FieldDescriptor::default_value_int64() const
Get the field default value if cpp_type() == CPPTYPE_INT64.
If no explicit default was defined, the default is 0.
uint32 FieldDescriptor::default_value_uint32() const
Get the field default value if cpp_type() == CPPTYPE_UINT32.
If no explicit default was defined, the default is 0.
uint64 FieldDescriptor::default_value_uint64() const
Get the field default value if cpp_type() == CPPTYPE_UINT64.
If no explicit default was defined, the default is 0.
float FieldDescriptor::default_value_float() const
Get the field default value if cpp_type() == CPPTYPE_FLOAT.
If no explicit default was defined, the default is 0.0.
double FieldDescriptor::default_value_double() const
Get the field default value if cpp_type() == CPPTYPE_DOUBLE.
If no explicit default was defined, the default is 0.0.
bool FieldDescriptor::default_value_bool() const
Get the field default value if cpp_type() == CPPTYPE_BOOL.
If no explicit default was defined, the default is false.
const EnumValueDescriptor *
FieldDescriptor::default_value_enum() const
FieldDescriptor::default_value_enum() const
Get the field default value if cpp_type() == CPPTYPE_ENUM.
If no explicit default was defined, the default is the first value defined in the enum type (all enum types are required to have at least one value). This never returns NULL.
const string & FieldDescriptor::default_value_string() const
Get the field default value if cpp_type() == CPPTYPE_STRING.
If no explicit default was defined, the default is the empty string.
const Descriptor *
FieldDescriptor::containing_type() const
FieldDescriptor::containing_type() const
The Descriptor for the message of which this is a field.
For extensions, this is the extended type. Never NULL.
const Descriptor *
FieldDescriptor::extension_scope() const
FieldDescriptor::extension_scope() const
An extension may be declared within the scope of another message.
If this field is an extension (is_extension() is true), then extension_scope() returns that message, or NULL if the extension was declared at global scope. If this is not an extension, extension_scope() is undefined (may assert-fail).
const Descriptor *
FieldDescriptor::message_type() const
FieldDescriptor::message_type() const
If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the message or the group type.
Otherwise, undefined.
const EnumDescriptor *
FieldDescriptor::enum_type() const
FieldDescriptor::enum_type() const
If type is TYPE_ENUM, returns a descriptor for the enum.
Otherwise, undefined.
const FieldDescriptor *
FieldDescriptor::experimental_map_key() const
FieldDescriptor::experimental_map_key() const
EXPERIMENTAL; DO NOT USE.
If this field is a map field, experimental_map_key() is the field that is the key for this map. experimental_map_key()->containing_type() is the same as message_type().
const FieldOptions &
FieldDescriptor::options() const
FieldDescriptor::options() const
Get the FieldOptions for this field.
This includes things listed in square brackets after the field definition. E.g., the field:
optional string text = 1 [[]ctype=CORD];
has the "ctype" option set. Allowed options are defined by FieldOptions in google/protobuf/descriptor.proto, and any available extensions of that message.
bool FieldDescriptor::GetSourceLocation(
SourceLocation * out_location) const
SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this field declaration.
Returns false and leaves |*out_location| unchanged iff location information was not available.
class EnumDescriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes an enum type defined in a .proto file.
To get the EnumDescriptor for a generated enum type, call TypeName_descriptor(). Use DescriptorPool to construct your own descriptors.
Members | |
---|---|
const string & |
name() const
The name of this enum type in the containing scope.
|
const string & |
full_name() const
The fully-qualified name of the enum type, scope delimited by periods.
|
int |
index() const
Index of this enum within the file or containing message's enum array.
|
const FileDescriptor * |
file() const
The .proto file in which this enum type was defined. Never NULL.
|
int |
value_count() const
The number of values for this
EnumDescriptor.
more...
|
const EnumValueDescriptor * |
value(int index) const
Gets a value by index, where 0 <= index <
value_count().
more...
|
const EnumValueDescriptor * |
FindValueByName(const string & name) const
Looks up a value by name. Returns NULL if no such value exists.
|
const EnumValueDescriptor * |
FindValueByNumber(int number) const
Looks up a value by number.
more...
|
const Descriptor * |
containing_type() const
If this enum type is nested in a message type, this is that message type.
more...
|
const EnumOptions & |
options() const
Get options for this enum type.
more...
|
void |
CopyTo(EnumDescriptorProto * proto) const
See
Descriptor::CopyTo().
|
string |
DebugString() const
|
Source Location | |
bool |
GetSourceLocation(SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this enum declaration.
more...
|
int EnumDescriptor::value_count() const
The number of values for this EnumDescriptor.
Guaranteed to be greater than zero.
const EnumValueDescriptor *
EnumDescriptor::value(
int index) const
EnumDescriptor::value(
int index) const
Gets a value by index, where 0 <= index < value_count().
These are returned in the order they were defined in the .proto file.
const EnumValueDescriptor *
EnumDescriptor::FindValueByNumber(
int number) const
EnumDescriptor::FindValueByNumber(
int number) const
Looks up a value by number.
Returns NULL if no such value exists. If multiple values have this number, the first one defined is returned.
const Descriptor *
EnumDescriptor::containing_type() const
EnumDescriptor::containing_type() const
If this enum type is nested in a message type, this is that message type.
Otherwise, NULL.
const EnumOptions &
EnumDescriptor::options() const
EnumDescriptor::options() const
Get options for this enum type.
These are specified in the .proto file by placing lines like "option foo = 1234;" in the enum definition. Allowed options are defined by EnumOptionsin google/protobuf/descriptor.proto, and any available extensions of that message.
bool EnumDescriptor::GetSourceLocation(
SourceLocation * out_location) const
SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this enum declaration.
Returns false and leaves |*out_location| unchanged iff location information was not available.
class EnumValueDescriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes an individual enum constant of a particular type.
To get the EnumValueDescriptor for a given enum value, first get the EnumDescriptor for its type, then use EnumDescriptor::FindValueByName() orEnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct your own descriptors.
Members | |
---|---|
const string & |
name() const
Name of this enum constant.
|
int |
index() const
Index within the enums's
Descriptor.
|
int |
number() const
Numeric value of this enum constant.
|
const string & |
full_name() const
The full_name of an enum value is a sibling symbol of the enum type.
more...
|
const EnumDescriptor * |
type() const
The type of this value. Never NULL.
|
const EnumValueOptions & |
options() const
Get options for this enum value.
more...
|
void |
CopyTo(EnumValueDescriptorProto * proto) const
See
Descriptor::CopyTo().
|
string |
DebugString() const
|
Source Location | |
bool |
GetSourceLocation(SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this enum value declaration.
more...
|
const string & EnumValueDescriptor::full_name() const
The full_name of an enum value is a sibling symbol of the enum type.
e.g. the full name of FieldDescriptorProto::TYPE_INT32 is actually "google.protobuf.FieldDescriptorProto.TYPE_INT32", NOT "google.protobuf.FieldDescriptorProto.Type.TYPE_INT32". This is to conform with C++ scoping rules for enums.
const EnumValueOptions &
EnumValueDescriptor::options() const
EnumValueDescriptor::options() const
Get options for this enum value.
These are specified in the .proto file by adding text like "[[]foo = 1234]" after an enum value definition. Allowed options are defined byEnumValueOptions in google/protobuf/descriptor.proto, and any available extensions of that message.
bool EnumValueDescriptor::GetSourceLocation(
SourceLocation * out_location) const
SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this enum value declaration.
Returns false and leaves |*out_location| unchanged iff location information was not available.
class ServiceDescriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes an RPC service.
To get the ServiceDescriptor for a service, call Service::GetDescriptor(). Generated service classes also have a static method called descriptor() which returns the type's ServiceDescriptor. Use DescriptorPool to construct your own descriptors.
Members | |
---|---|
const string & |
name() const
The name of the service, not including its containing scope.
|
const string & |
full_name() const
The fully-qualified name of the service, scope delimited by periods.
|
int |
index() const
Index of this service within the file's services array.
|
const FileDescriptor * |
file() const
The .proto file in which this service was defined. Never NULL.
|
const ServiceOptions & |
options() const
Get options for this service type.
more...
|
int |
method_count() const
The number of methods this service defines.
|
const MethodDescriptor * |
method(int index) const
|
const MethodDescriptor * |
FindMethodByName(const string & name) const
Look up a
MethodDescriptor by name.
|
void |
CopyTo(ServiceDescriptorProto * proto) const
See
Descriptor::CopyTo().
|
string |
DebugString() const
|
Source Location | |
bool |
GetSourceLocation(SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this service declaration.
more...
|
const ServiceOptions &
ServiceDescriptor::options() const
ServiceDescriptor::options() const
Get options for this service type.
These are specified in the .proto file by placing lines like "option foo = 1234;" in the service definition. Allowed options are defined byServiceOptions in google/protobuf/descriptor.proto, and any available extensions of that message.
const MethodDescriptor *
ServiceDescriptor::method(
int index) const
ServiceDescriptor::method(
int index) const
Gets a MethodDescriptor by index, where 0 <= index < method_count().
These are returned in the order they were defined in the .proto file.
bool ServiceDescriptor::GetSourceLocation(
SourceLocation * out_location) const
SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this service declaration.
Returns false and leaves |*out_location| unchanged iff location information was not available.
class MethodDescriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes an individual service method.
To obtain a MethodDescriptor given a service, first get its ServiceDescriptor, then call ServiceDescriptor::FindMethodByName(). Use DescriptorPoolto construct your own descriptors.
Members | |
---|---|
const string & |
name() const
Name of this method, not including containing scope.
|
const string & |
full_name() const
The fully-qualified name of the method, scope delimited by periods.
|
int |
index() const
Index within the service's
Descriptor.
|
const ServiceDescriptor * |
service() const
Gets the service to which this method belongs. Never NULL.
|
const Descriptor * |
input_type() const
Gets the type of protocol message which this method accepts as input.
|
const Descriptor * |
output_type() const
Gets the type of protocol message which this message produces as output.
|
const MethodOptions & |
options() const
Get options for this method.
more...
|
void |
CopyTo(MethodDescriptorProto * proto) const
See
Descriptor::CopyTo().
|
string |
DebugString() const
|
Source Location | |
bool |
GetSourceLocation(SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this method declaration.
more...
|
const MethodOptions &
MethodDescriptor::options() const
MethodDescriptor::options() const
Get options for this method.
These are specified in the .proto file by placing lines like "option foo = 1234;" in curly-braces after a method declaration. Allowed options are defined by MethodOptions in google/protobuf/descriptor.proto, and any available extensions of that message.
bool MethodDescriptor::GetSourceLocation(
SourceLocation * out_location) const
SourceLocation * out_location) const
Updates |*out_location| to the source location of the complete extent of this method declaration.
Returns false and leaves |*out_location| unchanged iff location information was not available.
class FileDescriptor
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes a whole .proto file.
To get the FileDescriptor for a compiled-in file, get the descriptor for something defined in that file and call descriptor->file(). Use DescriptorPool to construct your own descriptors.
Members | |
---|---|
const string & |
name() const
The filename, relative to the source tree.
more...
|
const string & |
package() const
The package, e.g. "google.protobuf.compiler".
|
const DescriptorPool * |
pool() const
|
int |
dependency_count() const
The number of files imported by this one.
|
const FileDescriptor * |
dependency(int index) const
Gets an imported file by index, where 0 <= index <
dependency_count().
more...
|
int |
public_dependency_count() const
The number of files public imported by this one.
more...
|
const FileDescriptor * |
public_dependency(int index) const
Gets a public imported file by index, where 0 <= index <
public_dependency_count().
more...
|
int |
weak_dependency_count() const
The number of files that are imported for weak fields.
more...
|
const FileDescriptor * |
weak_dependency(int index) const
Gets a weak imported file by index, where 0 <= index <
weak_dependency_count().
more...
|
int |
message_type_count() const
Number of top-level message types defined in this file.
more...
|
const Descriptor * |
message_type(int index) const
Gets a top-level message type, where 0 <= index <
message_type_count().
more...
|
int |
enum_type_count() const
Number of top-level enum types defined in this file.
more...
|
const EnumDescriptor * |
enum_type(int index) const
Gets a top-level enum type, where 0 <= index <
enum_type_count().
more...
|
int |
service_count() const
Number of services defined in this file.
|
const ServiceDescriptor * |
service(int index) const
Gets a service, where 0 <= index <
service_count().
more...
|
int |
extension_count() const
Number of extensions defined at file scope.
more...
|
const FieldDescriptor * |
extension(int index) const
Gets an extension's descriptor, where 0 <= index <
extension_count().
more...
|
const FileOptions & |
options() const
Get options for this file.
more...
|
const Descriptor * |
FindMessageTypeByName(const string & name) const
Find a top-level message type by name. Returns NULL if not found.
|
const EnumDescriptor * |
FindEnumTypeByName(const string & name) const
Find a top-level enum type by name. Returns NULL if not found.
|
const EnumValueDescriptor * |
FindEnumValueByName(const string & name) const
Find an enum value defined in any top-level enum by name.
more...
|
const ServiceDescriptor * |
FindServiceByName(const string & name) const
Find a service definition by name. Returns NULL if not found.
|
const FieldDescriptor * |
FindExtensionByName(const string & name) const
Find a top-level extension definition by name. Returns NULL if not found.
|
const FieldDescriptor * |
FindExtensionByLowercaseName(const string & name) const
Similar to
FindExtensionByName(), but searches by lowercased-name.
more...
|
const FieldDescriptor * |
FindExtensionByCamelcaseName(const string & name) const
Similar to
FindExtensionByName(), but searches by camelcased-name.
more...
|
void |
CopyTo(FileDescriptorProto * proto) const
|
void |
CopySourceCodeInfoTo(FileDescriptorProto * proto) const
Write the source code information of this
FileDescriptor into the given
FileDescriptorProto.
more...
|
string |
DebugString() const
|
const string & FileDescriptor::name() const
The filename, relative to the source tree.
e.g. "google/protobuf/descriptor.proto"
const DescriptorPool *
FileDescriptor::pool() const
FileDescriptor::pool() const
The DescriptorPool in which this FileDescriptor and all its contents were allocated.
Never NULL.
const FileDescriptor *
FileDescriptor::dependency(
int index) const
FileDescriptor::dependency(
int index) const
Gets an imported file by index, where 0 <= index < dependency_count().
These are returned in the order they were defined in the .proto file.
int FileDescriptor::public_dependency_count() const
The number of files public imported by this one.
The public dependency list is a subset of the dependency list.
const FileDescriptor *
FileDescriptor::public_dependency(
int index) const
FileDescriptor::public_dependency(
int index) const
Gets a public imported file by index, where 0 <= index < public_dependency_count().
These are returned in the order they were defined in the .proto file.
int FileDescriptor::weak_dependency_count() const
The number of files that are imported for weak fields.
The weak dependency list is a subset of the dependency list.
const FileDescriptor *
FileDescriptor::weak_dependency(
int index) const
FileDescriptor::weak_dependency(
int index) const
Gets a weak imported file by index, where 0 <= index < weak_dependency_count().
These are returned in the order they were defined in the .proto file.
int FileDescriptor::message_type_count() const
Number of top-level message types defined in this file.
(This does not include nested types.)
const Descriptor *
FileDescriptor::message_type(
int index) const
FileDescriptor::message_type(
int index) const
Gets a top-level message type, where 0 <= index < message_type_count().
These are returned in the order they were defined in the .proto file.
int FileDescriptor::enum_type_count() const
Number of top-level enum types defined in this file.
(This does not include nested types.)
const EnumDescriptor *
FileDescriptor::enum_type(
int index) const
FileDescriptor::enum_type(
int index) const
Gets a top-level enum type, where 0 <= index < enum_type_count().
These are returned in the order they were defined in the .proto file.
const ServiceDescriptor *
FileDescriptor::service(
int index) const
FileDescriptor::service(
int index) const
Gets a service, where 0 <= index < service_count().
These are returned in the order they were defined in the .proto file.
int FileDescriptor::extension_count() const
Number of extensions defined at file scope.
(This does not include extensions nested within message types.)
const FieldDescriptor *
FileDescriptor::extension(
int index) const
FileDescriptor::extension(
int index) const
Gets an extension's descriptor, where 0 <= index < extension_count().
These are returned in the order they were defined in the .proto file.
const FileOptions &
FileDescriptor::options() const
FileDescriptor::options() const
Get options for this file.
These are specified in the .proto file by placing lines like "option foo = 1234;" at the top level, outside of any other definitions. Allowed options are defined by FileOptions in google/protobuf/descriptor.proto, and any available extensions of that message.
const EnumValueDescriptor *
FileDescriptor::FindEnumValueByName(
const string & name) const
FileDescriptor::FindEnumValueByName(
const string & name) const
Find an enum value defined in any top-level enum by name.
Returns NULL if not found.
const FieldDescriptor *
FileDescriptor::FindExtensionByLowercaseName(
const string & name) const
FileDescriptor::FindExtensionByLowercaseName(
const string & name) const
Similar to FindExtensionByName(), but searches by lowercased-name.
const FieldDescriptor *
FileDescriptor::FindExtensionByCamelcaseName(
const string & name) const
FileDescriptor::FindExtensionByCamelcaseName(
const string & name) const
Similar to FindExtensionByName(), but searches by camelcased-name.
void FileDescriptor::CopyTo(
FileDescriptorProto * proto) const
FileDescriptorProto * proto) const
See Descriptor::CopyTo().
Notes:
- This method does NOT copy source code information since it is relatively large and rarely needed. See CopySourceCodeInfoTo() below.
void FileDescriptor::CopySourceCodeInfoTo(
FileDescriptorProto * proto) const
FileDescriptorProto * proto) const
Write the source code information of this FileDescriptor into the given FileDescriptorProto.
See CopyTo() above.
class DescriptorPool
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Used to construct descriptors.
Normally you won't want to build your own descriptors. Message classes constructed by the protocol compiler will provide them for you. However, if you are implementing Message on your own, or if you are writing a program which can operate on totally arbitrary types and needs to load them from some sort of database, you might need to.
Since Descriptors are composed of a whole lot of cross-linked bits of data that would be a pain to put together manually, the DescriptorPool class is provided to make the process easier. It can take a FileDescriptorProto (defined in descriptor.proto), validate it, and convert it to a set of nicely cross-linked Descriptors.
DescriptorPool also helps with memory management. Descriptors are composed of many objects containing static data and pointers to each other. In all likelihood, when it comes time to delete this data, you'll want to delete it all at once. In fact, it is not uncommon to have a whole pool of descriptors all cross-linked with each other which you wish to delete all at once. This class represents such a pool, and handles the memory management for you.
You can also search for descriptors within a DescriptorPool by name, and extensions by number.
Members | |
---|---|
|
DescriptorPool()
Create a normal, empty
DescriptorPool.
|
explicit |
DescriptorPool(DescriptorDatabase * fallback_database, ErrorCollector * error_collector = NULL)
|
|
~DescriptorPool()
|
constFileDescriptor * |
FindFileByName(const string & name) const
Find a
FileDescriptor in the pool by file name.
more...
|
constFileDescriptor * |
FindFileContainingSymbol(const string & symbol_name) const
Find the
FileDescriptor in the pool which defines the given symbol.
more...
|
constFileDescriptor * |
BuildFile(const FileDescriptorProto & proto)
|
constFileDescriptor * |
BuildFileCollectingErrors(const FileDescriptorProto & proto, ErrorCollector * error_collector)
Same as
BuildFile() except errors are sent to the given
ErrorCollector.
|
void |
AllowUnknownDependencies()
By default, it is an error if a
FileDescriptorProto contains references to types or other files that are not found in the
DescriptorPool (or its backing
DescriptorDatabase, if any).
more...
|
explicit |
DescriptorPool(const DescriptorPool * underlay)
Create a
DescriptorPool which is overlaid on top of some other pool.
more...
|
void |
InternalDontEnforceDependencies()
For internal use only: Changes the behavior of
BuildFile() such that it allows the file to make reference to message types declared in other files which it did not officially declare as dependencies.
|
void |
internal_set_underlay(const DescriptorPool * underlay)
For internal use only.
|
bool |
InternalIsFileLoaded(const string & filename) const
For internal (unit test) use only: Returns true if a
FileDescriptor has been constructed for the given file, false otherwise.
more...
|
static constDescriptorPool * |
generated_pool()
Get a pointer to the generated pool.
more...
|
static void |
InternalAddGeneratedFile(const void * encoded_file_descriptor, int size)
Called by generated classes at init time to add their descriptors to generated_pool.
more...
|
staticDescriptorPool * |
internal_generated_pool()
For internal use only: Gets a non-const pointer to the generated pool.
more...
|
Looking up descriptors
These find descriptors by fully-qualified name. These will find both top-level descriptors and nested descriptors. They return NULL if not found.
| |
const Descriptor * |
FindMessageTypeByName(const string & name) const
|
constFieldDescriptor * |
FindFieldByName(const string & name) const
|
constFieldDescriptor * |
FindExtensionByName(const string & name) const
|
constEnumDescriptor * |
FindEnumTypeByName(const string & name) const
|
constEnumValueDescriptor* |
FindEnumValueByName(const string & name) const
|
constServiceDescriptor * |
FindServiceByName(const string & name) const
|
constMethodDescriptor * |
FindMethodByName(const string & name) const
|
constFieldDescriptor * |
FindExtensionByNumber(const Descriptor * extendee, int number) const
Finds an extension of the given type by number.
more...
|
void |
FindAllExtensions(const Descriptor * extendee, vector< const FieldDescriptor * > * out) const
Finds extensions of extendee.
more...
|
const FileDescriptor *
DescriptorPool::FindFileByName(
const string & name) const
DescriptorPool::FindFileByName(
const string & name) const
Find a FileDescriptor in the pool by file name.
Returns NULL if not found.
const FileDescriptor *
DescriptorPool::FindFileContainingSymbol(
const string & symbol_name) const
DescriptorPool::FindFileContainingSymbol(
const string & symbol_name) const
Find the FileDescriptor in the pool which defines the given symbol.
If any of the Find*ByName() methods below would succeed, then this is equivalent to calling that method and calling the result's file() method. Otherwise this returns NULL.
const FileDescriptor *
DescriptorPool::BuildFile(
const FileDescriptorProto & proto)
DescriptorPool::BuildFile(
const FileDescriptorProto & proto)
Convert the FileDescriptorProto to real descriptors and place them in this DescriptorPool.
All dependencies of the file must already be in the pool. Returns the resulting FileDescriptor, or NULL if there were problems with the input (e.g. the message was invalid, or dependencies were missing). Details about the errors are written to GOOGLE_LOG(ERROR).
void DescriptorPool::AllowUnknownDependencies()
By default, it is an error if a FileDescriptorProto contains references to types or other files that are not found in the DescriptorPool (or its backingDescriptorDatabase, if any).
If you call AllowUnknownDependencies(), however, then unknown types and files will be replaced by placeholder descriptors. This can allow you to perform some useful operations with a .proto file even if you do not have access to other .proto files on which it depends. However, some heuristics must be used to fill in the gaps in information, and these can lead to descriptors which are inaccurate. For example, the DescriptorPoolmay be forced to guess whether an unknown type is a message or an enum, as well as what package it resides in. Furthermore, placeholder types will not be discoverable via FindMessageTypeByName() and similar methods, which could confuse some descriptor-based algorithms. Generally, the results of this option should only be relied upon for debugging purposes.
explicit DescriptorPool::DescriptorPool(
const DescriptorPool * underlay)
const DescriptorPool * underlay)
Create a DescriptorPool which is overlaid on top of some other pool.
If you search for a descriptor in the overlay and it is not found, the underlay will be searched as a backup. If the underlay has its own underlay, that will be searched next, and so on. This also means that files built in the overlay will be cross-linked with the underlay's descriptors if necessary. The underlay remains property of the caller; it must remain valid for the lifetime of the newly-constructed pool.
Example: Say you want to parse a .proto file at runtime in order to use its type with a DynamicMessage. Say this .proto file has dependencies, but you know that all the dependencies will be things that are already compiled into the binary. For ease of use, you'd like to load the types right out of generated_pool() rather than have to parse redundant copies of all these .protos and runtime. But, you don't want to add the parsed types directly into generated_pool(): this is not allowed, and would be bad design anyway. So, instead, you could use generated_pool() as an underlay for a new DescriptorPool in which you add only the new file.
WARNING: Use of underlays can lead to many subtle gotchas. Instead, try to formulate what you want to do in terms of DescriptorDatabases.
bool DescriptorPool::InternalIsFileLoaded(
const string & filename) const
const string & filename) const
For internal (unit test) use only: Returns true if a FileDescriptor has been constructed for the given file, false otherwise.
Useful for testing lazy descriptor initialization behavior.
static const DescriptorPool *
DescriptorPool::generated_pool()
DescriptorPool::generated_pool()
Get a pointer to the generated pool.
Generated protocol message classes which are compiled into the binary will allocate their descriptors in this pool. Do not add your own descriptors to this pool.
static void DescriptorPool::InternalAddGeneratedFile(
const void * encoded_file_descriptor,
int size)
const void * encoded_file_descriptor,
int size)
Called by generated classes at init time to add their descriptors to generated_pool.
Do NOT call this in your own code! filename must be a permanent string (e.g. a string literal).
static DescriptorPool * DescriptorPool::internal_generated_pool()
For internal use only: Gets a non-const pointer to the generated pool.
This is called at static-initialization time only, so thread-safety is not a concern. If both an underlay and a fallback database are present, the underlay takes precedence.
const FieldDescriptor *
DescriptorPool::FindExtensionByNumber(
const Descriptor * extendee,
int number) const
DescriptorPool::FindExtensionByNumber(
const Descriptor * extendee,
int number) const
Finds an extension of the given type by number.
The extendee must be a member of this DescriptorPool or one of its underlays.
void DescriptorPool::FindAllExtensions(
const Descriptor * extendee,
vector< const FieldDescriptor * > * out) const
const Descriptor * extendee,
vector< const FieldDescriptor * > * out) const
Finds extensions of extendee.
The extensions will be appended to out in an undefined order. Only extensions defined directly in this DescriptorPool or one of its underlays are guaranteed to be found: extensions defined in the fallback database might not be found depending on the database implementation.
class DescriptorPool::ErrorCollector
#include <google/protobuf/descriptor.h>
namespace google::protobuf
When converting a FileDescriptorProto to a FileDescriptor, various errors might be detected in the input.
The caller may handle these programmatically by implementing an ErrorCollector.
Members | |
---|---|
enum |
ErrorLocation
These constants specify what exact part of the construct is broken.
more...
|
|
ErrorCollector()
|
virtual |
~ErrorCollector()
|
virtual void |
AddError(const string & filename, const string & element_name, const Message * descriptor, ErrorLocation location, const string & message) = 0
Reports an error in the
FileDescriptorProto.
|
enum ErrorCollector::ErrorLocation {
NAME,
NUMBER,
TYPE,
EXTENDEE,
DEFAULT_VALUE,
INPUT_TYPE,
OUTPUT_TYPE,
OPTION_NAME,
OPTION_VALUE,
OTHER
}
NAME,
NUMBER,
TYPE,
EXTENDEE,
DEFAULT_VALUE,
INPUT_TYPE,
OUTPUT_TYPE,
OPTION_NAME,
OPTION_VALUE,
OTHER
}
These constants specify what exact part of the construct is broken.
This is useful e.g. for mapping the error back to an exact location in a .proto file.
NAME | the symbol name, or the package name for files |
NUMBER | field or extension range number |
TYPE | field type |
EXTENDEE | field extendee |
DEFAULT_VALUE | field default value |
INPUT_TYPE | method input type |
OUTPUT_TYPE | method output type |
OPTION_NAME | name in assignment |
OPTION_VALUE | value in option assignment |
OTHER | some other problem |