class SimpleDescriptorDatabase
Defined at line 140 of file ../../third_party/protobuf/src/google/protobuf/descriptor_database.h
A DescriptorDatabase into which you can insert files manually.
FindFileContainingSymbol() is fully-implemented. When you add a file, its
symbols will be indexed for this purpose. Note that the implementation
may return false positives, but only if it isn't possible for the symbol
to be defined in any other file. In particular, if a file defines a symbol
"Foo", then searching for "Foo.[anything]" will match that file. This way,
the database does not need to aggressively index all children of a symbol.
FindFileContainingExtension() is mostly-implemented. It works if and only
if the original FieldDescriptorProto defining the extension has a
fully-qualified type name in its "extendee" field (i.e. starts with a '.').
If the extendee is a relative name, SimpleDescriptorDatabase will not
attempt to resolve the type, so it will not know what type the extension is
extending. Therefore, calling FindFileContainingExtension() with the
extension's containing type will never actually find that extension. Note
that this is an unlikely problem, as all FileDescriptorProtos created by the
protocol compiler (as well as ones created by calling
FileDescriptor::CopyTo()) will always use fully-qualified names for all
types. You only need to worry if you are constructing FileDescriptorProtos
yourself, or are calling compiler::Parser directly.
Public Methods
void SimpleDescriptorDatabase ()
void SimpleDescriptorDatabase (const SimpleDescriptorDatabase & )
Defined at line 143 of file ../../third_party/protobuf/src/google/protobuf/descriptor_database.h
SimpleDescriptorDatabase & operator= (const SimpleDescriptorDatabase & )
Defined at line 144 of file ../../third_party/protobuf/src/google/protobuf/descriptor_database.h
void ~SimpleDescriptorDatabase ()
bool Add (const FileDescriptorProto & file)
Adds the FileDescriptorProto to the database, making a copy. The object
can be deleted after Add() returns. Returns false if the file conflicted
with a file already in the database, in which case an error will have
been written to ABSL_LOG(ERROR).
bool AddAndOwn (const FileDescriptorProto * file)
Adds the FileDescriptorProto to the database and takes ownership of it.
bool AddUnowned (const FileDescriptorProto * file)
Adds the FileDescriptorProto to the database and not take ownership of it.
The owner must ensure file outlives the SimpleDescriptorDatabase.
bool FindFileByName (const std::string & filename, FileDescriptorProto * output)
implements DescriptorDatabase -----------------------------------
bool FindFileContainingSymbol (const std::string & symbol_name, FileDescriptorProto * output)
bool FindFileContainingExtension (const std::string & containing_type, int field_number, FileDescriptorProto * output)
bool FindAllExtensionNumbers (const std::string & extendee_type, std::vector<int> * output)
bool FindAllFileNames (std::vector<std::string> * output)