class Descriptor

Defined at line 371 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

Defined in this file.

Public Methods

void Descriptor (const Descriptor & )

Defined at line 375 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

Descriptor & operator= (const Descriptor & )

Defined at line 376 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

absl::string_view name ()

The name of the message type, not including its scope.

Defined at line 2865 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

absl::string_view 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 2865 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

int index ()

Index of this descriptor within the file or containing type's message

type array.

Defined at line 3107 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

const FileDescriptor * file ()

The .proto file in which this message type was defined. Never nullptr.

Defined at line 2866 of file ../../third_party/protobuf/src/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 2867 of file ../../third_party/protobuf/src/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 2895 of file ../../third_party/protobuf/src/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 2896 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

WellKnownType well_known_type ()

A few accessors differ from the macros...

Defined at line 2984 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

int field_count ()

The number of fields in this message type.

Defined at line 2869 of file ../../third_party/protobuf/src/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, not

the field number order. (Use `FindFieldByNumber()` for

tag number -> value lookup).

Defined at line 2875 of file ../../third_party/protobuf/src/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 2870 of file ../../third_party/protobuf/src/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 2871 of file ../../third_party/protobuf/src/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 2876 of file ../../third_party/protobuf/src/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 2879 of file ../../third_party/protobuf/src/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 2872 of file ../../third_party/protobuf/src/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 2877 of file ../../third_party/protobuf/src/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 2873 of file ../../third_party/protobuf/src/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 2878 of file ../../third_party/protobuf/src/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 2884 of file ../../third_party/protobuf/src/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 2886 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

bool IsExtensionNumber (int number)

Returns true if the number is in one of the extension ranges.

Defined at line 2988 of file ../../third_party/protobuf/src/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 2885 of file ../../third_party/protobuf/src/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 2888 of file ../../third_party/protobuf/src/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 2890 of file ../../third_party/protobuf/src/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 2891 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

bool IsReservedNumber (int number)

Returns true if the number is in one of the reserved ranges.

Defined at line 2992 of file ../../third_party/protobuf/src/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 2893 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

absl::string_view reserved_name (int index)

Gets a reserved name by index, where 0

<

= index

<

reserved_name_count().

Defined at line 3007 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

bool IsReservedName (absl::string_view name)

Returns true if the field name is reserved.

Defined at line 2996 of file ../../third_party/protobuf/src/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 Comments
WELLKNOWNTYPE_UNSPECIFIED 0

Not a well-known type.

WELLKNOWNTYPE_DOUBLEVALUE 1

google.protobuf.DoubleValue

WELLKNOWNTYPE_FLOATVALUE 2

google.protobuf.FloatValue

WELLKNOWNTYPE_INT64VALUE 3

google.protobuf.Int64Value

WELLKNOWNTYPE_UINT64VALUE 4

google.protobuf.UInt64Value

WELLKNOWNTYPE_INT32VALUE 5

google.protobuf.Int32Value

WELLKNOWNTYPE_UINT32VALUE 6

google.protobuf.UInt32Value

WELLKNOWNTYPE_STRINGVALUE 7

google.protobuf.StringValue

WELLKNOWNTYPE_BYTESVALUE 8

google.protobuf.BytesValue

WELLKNOWNTYPE_BOOLVALUE 9

google.protobuf.BoolValue

WELLKNOWNTYPE_ANY 10

google.protobuf.Any

WELLKNOWNTYPE_FIELDMASK 11

google.protobuf.FieldMask

WELLKNOWNTYPE_DURATION 12

google.protobuf.Duration

WELLKNOWNTYPE_TIMESTAMP 13

google.protobuf.Timestamp

WELLKNOWNTYPE_VALUE 14

google.protobuf.Value

WELLKNOWNTYPE_LISTVALUE 15

google.protobuf.ListValue

WELLKNOWNTYPE_STRUCT 16

google.protobuf.Struct

__WELLKNOWNTYPE__DO_NOT_USE__ADD_DEFAULT_INSTEAD__ 17

New well-known types may be added in the future.
Please make sure any switch() statements have a 'default' case.

Defined at line 437 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h

Records

Friends

class SymbolChecker
class FileDescriptor
class MethodDescriptor
class OneofDescriptor
class FileDescriptorTables
class FieldDescriptor
class EnumDescriptor
class DescriptorPool
class DescriptorBuilder
class InternalFeatureHelper
class Reflection
class Formatter
class Printer
class DescriptorTest
class Symbol
template <typename Sink>
void Descriptor (Sink & sinkconst Descriptor & d)