class EnumDescriptor

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

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.

Public Methods

void CopyTo (EnumDescriptorProto * proto)

See Descriptor::CopyTo().

std::string DebugString ()

See Descriptor::DebugString().

std::string DebugStringWithOptions (const DebugStringOptions & options)

See Descriptor::DebugStringWithOptions().

void EnumDescriptor (const EnumDescriptor & )

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

internal::DescriptorStringView name ()

The name of this enum type in the containing scope.

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

internal::DescriptorStringView full_name ()

The fully-qualified name of the enum type, scope delimited by periods.

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

int index ()

Index of this enum within the file or containing message's enum array.

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

const FileDescriptor * file ()

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

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

int value_count ()

The number of values for this EnumDescriptor. Guaranteed to be greater

than zero.

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

const EnumValueDescriptor * value (int index)

Gets a value by index, where 0

<

= index

<

value_count().

These are returned in the order they were defined in the .proto file.

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

const EnumValueDescriptor * FindValueByName (absl::string_view name)

Looks up a value by name. Returns nullptr if no such value exists.

const EnumValueDescriptor * FindValueByNumber (int number)

Looks up a value by number. Returns nullptr if no such value exists. If

multiple values have this number, the first one defined is returned.

EnumDescriptor & operator= (const EnumDescriptor & )

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

const Descriptor * containing_type ()

If this enum type is nested in a message type, this is that message type.

Otherwise, nullptr.

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

const EnumOptions & options ()

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 EnumOptions in descriptor.proto, and any available

extensions of that message.

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

bool is_placeholder ()

Returns true if this is a placeholder for an unknown enum. This will

only be the case if this descriptor comes from a DescriptorPool

with AllowUnknownDependencies() set.

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

bool is_closed ()

Returns true whether this is a "closed" enum, meaning that it:

- Has a fixed set of values, rather than being equivalent to an int32.

- Encountering values not in this set causes them to be treated as unknown

fields.

- The first value (i.e., the default) may be nonzero.

WARNING: Some runtimes currently have a quirk where non-closed enums are

treated as closed when used as the type of fields defined in a

`syntax = proto2;` file. This quirk is not present in all runtimes; as of

writing, we know that:

- C++, Java, and C++-based Python share this quirk.

- UPB and UPB-based Python do not.

- PHP and Ruby treat all enums as open regardless of declaration.

Care should be taken when using this function to respect the target

runtime's enum handling quirks.

int reserved_range_count ()

The number of reserved ranges in this message type.

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

const EnumDescriptor::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 2603 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 2679 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h

const EnumDescriptor::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 2605 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 2694 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 2683 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 enum declaration. Returns false and leaves

|*out_location| unchanged iff location information was not available.

Records

Friends

class Reflection
class DescriptorPool
class FileDescriptor
class EnumValueDescriptor
class FileDescriptorTables
class FieldDescriptor
class Descriptor
class DescriptorBuilder
class InternalFeatureHelper
class DescriptorTest
class Formatter
class Printer
bool EnumDescriptor (const EnumDescriptor * enum_desc)
class Symbol
template <typename Sink>
void EnumDescriptor (Sink & sinkconst EnumDescriptor & d)