class Descriptor
Defined at line 312 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
Defined in this file.
Public Methods
void Descriptor (const Descriptor & )
Defined at line 316 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
Descriptor & operator= (const Descriptor & )
Defined at line 317 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
internal::DescriptorStringView name ()
The name of the message type, not including its scope.
Defined at line 2538 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
internal::DescriptorStringView full_name ()
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().
Defined at line 2538 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
int index ()
Index of this descriptor within the file or containing type's message
type array.
Defined at line 2777 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const FileDescriptor * file ()
The .proto file in which this message type was defined. Never nullptr.
Defined at line 2539 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const Descriptor * containing_type ()
If this Descriptor describes a nested type, this returns the type
in which it is nested. Otherwise, returns nullptr.
Defined at line 2540 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const MessageOptions & options ()
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 by MessageOptions in descriptor.proto, and any
available extensions of that message.
Defined at line 2568 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
void CopyTo (DescriptorProto * proto)
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.
void CopyHeadingTo (DescriptorProto * proto)
Fills in the message-level settings of this message (e.g. name, reserved
fields, message options) to `proto`. This is essentially all of the
metadata owned exclusively by this descriptor, and not any nested
descriptors.
std::string DebugString ()
Write the contents of this descriptor in a human-readable form. Output
will be suitable for re-parsing.
std::string DebugStringWithOptions (const DebugStringOptions & options)
Similar to DebugString(), but additionally takes options (e.g.,
include original user comments in output).
bool is_placeholder ()
Returns true if this is a placeholder for an unknown type. This will
only be the case if this descriptor comes from a DescriptorPool
with AllowUnknownDependencies() set.
Defined at line 2569 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
WellKnownType well_known_type ()
A few accessors differ from the macros...
Defined at line 2651 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
int field_count ()
The number of fields in this message type.
Defined at line 2542 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const FieldDescriptor * field (int index)
Gets a field by index, where 0
<
= index
<
field_count().
These are returned in the order they were defined in the .proto file.
Defined at line 2548 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const FieldDescriptor * FindFieldByNumber (int number)
Looks up a field by declared tag number. Returns nullptr if no such field
exists.
const FieldDescriptor * FindFieldByName (absl::string_view name)
Looks up a field by name. Returns nullptr if no such field exists.
const FieldDescriptor * FindFieldByLowercaseName (absl::string_view lowercase_name)
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 * FindFieldByCamelcaseName (absl::string_view camelcase_name)
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.
int oneof_decl_count ()
The number of oneofs in this message type.
Defined at line 2543 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
int real_oneof_decl_count ()
The number of oneofs in this message type, excluding synthetic oneofs.
Real oneofs always come first, so iterating up to real_oneof_decl_cout()
will yield all real oneofs.
Defined at line 2544 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const OneofDescriptor * oneof_decl (int index)
Get a oneof by index, where 0
<
= index
<
oneof_decl_count().
These are returned in the order they were defined in the .proto file.
Defined at line 2549 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const OneofDescriptor * real_oneof_decl (int index)
Get a oneof by index, excluding synthetic oneofs, where 0
<
= index
<
real_oneof_decl_count(). These are returned in the order they were defined
in the .proto file.
Defined at line 2552 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const OneofDescriptor * FindOneofByName (absl::string_view name)
Looks up a oneof by name. Returns nullptr if no such oneof exists.
int nested_type_count ()
The number of nested types in this message type.
Defined at line 2545 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const Descriptor * nested_type (int index)
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.
Defined at line 2550 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const Descriptor * FindNestedTypeByName (absl::string_view name)
Looks up a nested type by name. Returns nullptr if no such nested type
exists.
int enum_type_count ()
The number of enum types in this message type.
Defined at line 2546 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const EnumDescriptor * enum_type (int index)
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.
Defined at line 2551 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const EnumDescriptor * FindEnumTypeByName (absl::string_view name)
Looks up an enum type by name. Returns nullptr if no such enum type
exists.
const EnumValueDescriptor * FindEnumValueByName (absl::string_view name)
Looks up an enum value by name, among all enum types in this message.
Returns nullptr if no such value exists.
int extension_range_count ()
The number of extension ranges in this message type.
Defined at line 2557 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const ExtensionRange * extension_range (int index)
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.
Defined at line 2559 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
bool IsExtensionNumber (int number)
Returns true if the number is in one of the extension ranges.
Defined at line 2655 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const ExtensionRange * FindExtensionRangeContainingNumber (int number)
Returns nullptr if no extension range contains the given number.
int extension_count ()
The number of extensions defined nested within this message type's scope.
See doc:
https://developers.google.com/protocol-buffers/docs/proto#nested-extensions
Note that the extensions may be extending *other* messages.
For example:
message M1 {
extensions 1 to max;
}
message M2 {
extend M1 {
optional int32 foo = 1;
}
}
In this case,
DescriptorPool::generated_pool()
->FindMessageTypeByName("M2")
->extension(0)
will return "foo", even though "foo" is an extension of M1.
To find all known extensions of a given message, instead use
DescriptorPool::FindAllExtensions.
Defined at line 2558 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const FieldDescriptor * extension (int index)
Get an extension by index, where 0
<
= index
<
extension_count().
These are returned in the order they were defined in the .proto file.
Defined at line 2561 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const FieldDescriptor * FindExtensionByName (absl::string_view name)
Looks up a named extension (which extends some *other* message type)
defined within this message type's scope.
const FieldDescriptor * FindExtensionByLowercaseName (absl::string_view name)
Similar to FindFieldByLowercaseName(), but finds extensions defined within
this message type's scope.
const FieldDescriptor * FindExtensionByCamelcaseName (absl::string_view name)
Similar to FindFieldByCamelcaseName(), but finds extensions defined within
this message type's scope.
int reserved_range_count ()
The number of reserved ranges in this message type.
Defined at line 2563 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const ReservedRange * reserved_range (int index)
Gets an reserved range by index, where 0
<
= index
<
reserved_range_count(). These are returned in the order they were defined
in the .proto file.
Defined at line 2564 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
bool IsReservedNumber (int number)
Returns true if the number is in one of the reserved ranges.
Defined at line 2659 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
const ReservedRange * FindReservedRangeContainingNumber (int number)
Returns nullptr if no reserved range contains the given number.
int reserved_name_count ()
The number of reserved field names in this message type.
Defined at line 2566 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
internal::DescriptorStringView reserved_name (int index)
Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because reserved_names_ is actually
an array of pointers rather than the usual array of objects.
Defined at line 2674 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
bool IsReservedName (absl::string_view name)
Returns true if the field name is reserved.
Defined at line 2663 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
bool GetSourceLocation (SourceLocation * out_location)
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 * map_key ()
Returns the FieldDescriptor for the "key" field. If this isn't a map entry
field, returns nullptr.
const FieldDescriptor * map_value ()
Returns the FieldDescriptor for the "value" field. If this isn't a map
entry field, returns nullptr.
Enumerations
enum WellKnownType
| Name | Value |
|---|---|
| WELLKNOWNTYPE_UNSPECIFIED | 0 |
| WELLKNOWNTYPE_DOUBLEVALUE | 1 |
| WELLKNOWNTYPE_FLOATVALUE | 2 |
| WELLKNOWNTYPE_INT64VALUE | 3 |
| WELLKNOWNTYPE_UINT64VALUE | 4 |
| WELLKNOWNTYPE_INT32VALUE | 5 |
| WELLKNOWNTYPE_UINT32VALUE | 6 |
| WELLKNOWNTYPE_STRINGVALUE | 7 |
| WELLKNOWNTYPE_BYTESVALUE | 8 |
| WELLKNOWNTYPE_BOOLVALUE | 9 |
| WELLKNOWNTYPE_ANY | 10 |
| WELLKNOWNTYPE_FIELDMASK | 11 |
| WELLKNOWNTYPE_DURATION | 12 |
| WELLKNOWNTYPE_TIMESTAMP | 13 |
| WELLKNOWNTYPE_VALUE | 14 |
| WELLKNOWNTYPE_LISTVALUE | 15 |
| WELLKNOWNTYPE_STRUCT | 16 |
| __WELLKNOWNTYPE__DO_NOT_USE__ADD_DEFAULT_INSTEAD__ | 17 |
Defined at line 377 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
Records
Friends
class FileDescriptor
class MethodDescriptor
class OneofDescriptor
class FileDescriptorTables
class FieldDescriptor
class EnumDescriptor
class DescriptorPool
class DescriptorBuilder
class InternalFeatureHelper
class Formatter
class Printer
class DescriptorTest
class Symbol
template <typename Sink>
void Descriptor (Sink & sinkconst Descriptor & d)