class FileDescriptor

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

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.

Public Methods

void FileDescriptor (const FileDescriptor & )

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

FileDescriptor & operator= (const FileDescriptor & )

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

internal::DescriptorStringView name ()

The filename, relative to the source tree.

e.g. "foo/bar/baz.proto"

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

internal::DescriptorStringView package ()

The package, e.g. "google.protobuf.compiler".

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

const DescriptorPool * pool ()

The DescriptorPool in which this FileDescriptor and all its contents were

allocated. Never nullptr.

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

int dependency_count ()

The number of files imported by this one.

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

const FileDescriptor * dependency (int index)

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 public_dependency_count ()

The number of files public imported by this one.

The public dependency list is a subset of the dependency list.

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

const FileDescriptor * public_dependency (int index)

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.

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

int weak_dependency_count ()

The number of files that are imported for weak fields.

The weak dependency list is a subset of the dependency list.

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

const FileDescriptor * weak_dependency (int index)

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.

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

int message_type_count ()

Number of top-level message types defined in this file. (This does not

include nested types.)

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

const Descriptor * message_type (int index)

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.

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

int enum_type_count ()

Number of top-level enum types defined in this file. (This does not

include nested types.)

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

const EnumDescriptor * enum_type (int index)

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.

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

int service_count ()

Number of services defined in this file.

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

const ServiceDescriptor * service (int index)

Gets a service, where 0

<

= index

<

service_count().

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

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

int extension_count ()

Number of extensions defined at file scope. (This does not include

extensions nested within message types.)

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

const FieldDescriptor * extension (int index)

Gets an extension's descriptor, where 0

<

= index

<

extension_count().

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

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

const FileOptions & options ()

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

descriptor.proto, and any available extensions of that message.

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

const Descriptor * FindMessageTypeByName (absl::string_view name)

Find a top-level message type by name (not full_name). Returns nullptr if

not found.

const EnumDescriptor * FindEnumTypeByName (absl::string_view name)

Find a top-level enum type by name. Returns nullptr if not found.

const EnumValueDescriptor * FindEnumValueByName (absl::string_view name)

Find an enum value defined in any top-level enum by name. Returns nullptr

if not found.

const ServiceDescriptor * FindServiceByName (absl::string_view name)

Find a service definition by name. Returns nullptr if not found.

const FieldDescriptor * FindExtensionByName (absl::string_view name)

Find a top-level extension definition by name. Returns nullptr if not

found.

const FieldDescriptor * FindExtensionByLowercaseName (absl::string_view name)

Similar to FindExtensionByName(), but searches by lowercased-name. See

Descriptor::FindFieldByLowercaseName().

const FieldDescriptor * FindExtensionByCamelcaseName (absl::string_view name)

Similar to FindExtensionByName(), but searches by camelcased-name. See

Descriptor::FindFieldByCamelcaseName().

void CopyTo (FileDescriptorProto * proto)

See Descriptor::CopyTo().

Notes:

- This method does NOT copy source code information since it is relatively

large and rarely needed. See CopySourceCodeInfoTo() below.

void CopySourceCodeInfoTo (FileDescriptorProto * proto)

Write the source code information of this FileDescriptor into the given

FileDescriptorProto. See CopyTo() above.

void CopyJsonNameTo (FileDescriptorProto * proto)

Fill the json_name field of FieldDescriptorProto for all fields. Can only

be called after CopyTo().

void CopyHeadingTo (FileDescriptorProto * proto)

Fills in the file-level settings of this file (e.g. edition, package,

file options) to `proto`.

std::string DebugString ()

See Descriptor::DebugString().

std::string DebugStringWithOptions (const DebugStringOptions & options)

See Descriptor::DebugStringWithOptions().

bool is_placeholder ()

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

only be the case if this descriptor comes from a DescriptorPool

with AllowUnknownDependencies() set.

Defined at line 2636 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 file declaration (namely, the empty path).

bool GetSourceLocation (const std::vector<int> & path, SourceLocation * out_location)

Updates |*out_location| to the source location of the complete

extent of the declaration or declaration-part denoted by |path|.

Returns false and leaves |*out_location| unchanged iff location

information was not available. (See SourceCodeInfo for

description of path encoding.)

Friends

class ServiceDescriptor
class MethodDescriptor
class EnumValueDescriptor
class EnumDescriptor
class OneofDescriptor
class LazyDescriptor
class FieldDescriptor
class Descriptor
class DescriptorPool
class DescriptorBuilder
class InternalFeatureHelper
class FileDescriptorLegacy
class Symbol
template <typename Sink>
void FileDescriptor (Sink & sinkconst FileDescriptor & d)