Go to the documentation of this file.
51 std::set<std::string>*
output) {
59 RecordMessageNames(d, full_name,
output);
64 std::set<std::string>*
output) {
70 template <
typename Fn>
71 bool ForAllFileProtos(DescriptorDatabase* db, Fn callback,
72 std::vector<std::string>*
output) {
73 std::vector<std::string> file_names;
74 if (!db->FindAllFileNames(&file_names)) {
77 std::set<std::string>
set;
79 for (
const auto&
f : file_names) {
81 if (!db->FindFileByName(
f, &file_proto)) {
85 callback(file_proto, &
set);
95 return ForAllFileProtos(
104 return ForAllFileProtos(
107 RecordMessageNames(file_proto,
set);
114 template <
typename Value>
147 template <
typename Value>
155 if (!ValidateSymbolName(
name)) {
162 typename std::map<std::string, Value>::iterator iter =
163 FindLastLessOrEqual(
name);
165 if (iter == by_symbol_.end()) {
172 if (IsSubSymbol(iter->first,
name)) {
174 <<
"\" conflicts with the existing "
176 << iter->first <<
"\".";
187 if (iter != by_symbol_.end() && IsSubSymbol(
name, iter->first)) {
189 <<
"\" conflicts with the existing "
191 << iter->first <<
"\".";
205 template <
typename Value>
219 template <
typename Value>
223 if (!
field.extendee().empty() &&
field.extendee()[0] ==
'.') {
230 GOOGLE_LOG(
ERROR) <<
"Extension conflicts with extension already in database: "
244 template <
typename Value>
250 template <
typename Value>
253 typename std::map<std::string, Value>::iterator iter =
254 FindLastLessOrEqual(
name);
256 return (iter != by_symbol_.end() && IsSubSymbol(iter->first,
name))
261 template <
typename Value>
263 const std::string& containing_type,
int field_number) {
265 by_extension_, std::make_pair(containing_type, field_number),
Value());
268 template <
typename Value>
271 typename std::map<std::pair<std::string, int>,
Value>::const_iterator
it =
272 by_extension_.lower_bound(std::make_pair(containing_type, 0));
273 bool success =
false;
275 for (;
it != by_extension_.end() &&
it->first.first == containing_type;
277 output->push_back(
it->first.second);
284 template <
typename Value>
286 std::vector<std::string>*
output) {
287 output->resize(by_name_.size());
289 for (
const auto& kv : by_name_) {
290 (*output)[
i] = kv.first;
295 template <
typename Value>
296 typename std::map<std::string, Value>::iterator
302 typename std::map<std::string, Value>::iterator iter =
303 by_symbol_.upper_bound(
name);
304 if (iter != by_symbol_.begin()) --iter;
308 template <
typename Value>
311 return sub_symbol == super_symbol ||
313 super_symbol[sub_symbol.size()] ==
'.');
316 template <
typename Value>
319 for (
int i = 0;
i <
name.size();
i++) {
358 const std::string& containing_type,
int field_number,
370 std::vector<std::string>*
output) {
377 if (file ==
NULL)
return false;
394 if (file.ParseFromArray(encoded_file_descriptor,
size)) {
398 "EncodedDescriptorDatabase::Add().";
405 void* copy =
operator new(
size);
406 memcpy(copy, encoded_file_descriptor,
size);
424 if (encoded_file.first ==
NULL)
return false;
429 encoded_file.second);
435 if (
input.ReadTagNoLastTag() == kNameTag) {
441 if (!file_proto.ParseFromArray(encoded_file.first, encoded_file.second)) {
450 const std::string& containing_type,
int field_number,
462 std::vector<std::string>*
output) {
469 if (encoded_file.first ==
NULL)
return false;
470 return output->ParseFromArray(encoded_file.first, encoded_file.second);
482 if (file ==
NULL)
return false;
491 if (file ==
NULL)
return false;
498 const std::string& containing_type,
int field_number,
501 if (extendee ==
NULL)
return false;
515 if (extendee ==
NULL)
return false;
517 std::vector<const FieldDescriptor*> extensions;
520 for (
int i = 0;
i < extensions.size(); ++
i) {
535 const std::vector<DescriptorDatabase*>&
sources)
558 for (
int j = 0; j <
i; j++) {
571 const std::string& containing_type,
int field_number,
581 for (
int j = 0; j <
i; j++) {
595 std::set<int> merged_results;
597 bool success =
false;
602 std::insert_iterator<std::set<int> >(merged_results,
603 merged_results.begin()));
609 std::copy(merged_results.begin(), merged_results.end(),
610 std::insert_iterator<std::vector<int> >(*
output,
output->end()));
const std::string & name() const
const FileDescriptor * FindFileByName(const std::string &name) const
const Collection::value_type::second_type & FindWithDefault(const Collection &collection, const typename Collection::value_type::first_type &key, const typename Collection::value_type::second_type &value)
DescriptorPoolDatabase(const DescriptorPool &pool)
GLuint const GLchar * name
~SimpleDescriptorDatabase() override
bool FindAllExtensionNumbers(const std::string &containing_type, std::vector< int > *output)
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
DescriptorIndex< const FileDescriptorProto * > index_
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto & extension(int index) const
bool MaybeParse(std::pair< const void *, int > encoded_file, FileDescriptorProto *output)
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
string StrCat(const AlphaNum &a, const AlphaNum &b)
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
~EncodedDescriptorDatabase() override
bool MaybeCopy(const FileDescriptorProto *file, FileDescriptorProto *output)
EncodedDescriptorDatabase()
GLsizei const GLchar *const * string
bool Add(const void *encoded_file_descriptor, int size)
~DescriptorPoolDatabase() override
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
const FileDescriptor * FindFileContainingSymbol(const std::string &symbol_name) const
SimpleDescriptorDatabase::DescriptorIndex< std::pair< const void *, int > > index_
const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto & service(int index) const
Value FindFile(const std::string &filename)
int message_type_size() const
zend_class_entry * message_type
bool AddFile(const FileDescriptorProto &file, Value value)
bool FindNameOfFileContainingSymbol(const std::string &symbol_name, std::string *output)
const DescriptorPool & pool_
bool AddSymbol(const std::string &name, Value value)
const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto & enum_type(int index) const
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
GLsizei const GLchar ** path
MergedDescriptorDatabase(DescriptorDatabase *source1, DescriptorDatabase *source2)
static const char prefix[]
Value FindExtension(const std::string &containing_type, int field_number)
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
void STLDeleteElements(T *container)
const FileDescriptor * file() const
#define GOOGLE_LOG(LEVEL)
void FindAllFileNames(std::vector< std::string > *output)
std::map< std::string, Value >::iterator FindLastLessOrEqual(const std::string &name)
Value FindSymbol(const std::string &name)
bool AddExtension(const std::string &filename, const FieldDescriptorProto &field, Value value)
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final
std::vector< void * > files_to_delete_
bool HasPrefixString(const string &str, const string &prefix)
const FieldDescriptor * field
virtual ~DescriptorDatabase()
static const LogLevel ERROR
const PROTOBUF_NAMESPACE_ID::DescriptorProto & message_type(int index) const
void CopyTo(FileDescriptorProto *proto) const
bool FindAllMessageNames(std::vector< std::string > *output)
#define GOOGLE_CHECK(EXPRESSION)
InternalDescriptorPool * pool
const FieldDescriptor * FindExtensionByNumber(const Descriptor *extendee, int number) const
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message &from) final
bool FindAllPackageNames(std::vector< std::string > *output)
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
const std::string & name() const
std::vector< const FileDescriptorProto * > files_to_delete_
bool AddAndOwn(const FileDescriptorProto *file)
const PROTOBUF_NAMESPACE_ID::DescriptorProto & nested_type(int index) const
int extension_size() const
zend_class_entry * value_type
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
bool FindAllFileNames(std::vector< std::string > *output) override
bool AddCopy(const void *encoded_file_descriptor, int size)
bool FindAllFileNames(std::vector< std::string > *output) override
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
bool AddNestedExtensions(const std::string &filename, const DescriptorProto &message_type, Value value)
bool IsSubSymbol(const std::string &sub_symbol, const std::string &super_symbol)
void FindAllExtensions(const Descriptor *extendee, std::vector< const FieldDescriptor * > *out) const
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
GLsizei const GLfloat * value
const std::string & name() const
const std::string & package() const
SimpleDescriptorDatabase()
const upb_json_parsermethod const upb_symtab upb_sink * output
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
int enum_type_size() const
std::vector< DescriptorDatabase * > sources_
bool InsertIfNotPresent(Collection *const collection, const typename Collection::value_type &vt)
FieldDescriptorProto * AddExtension(FileDescriptorProto *file, const std::string &extendee, const std::string &name, int number, FieldDescriptorProto::Label label, FieldDescriptorProto::Type type)
bool ValidateSymbolName(const std::string &name)
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
~MergedDescriptorDatabase() override
bool Add(const FileDescriptorProto &file)
const Descriptor * FindMessageTypeByName(const std::string &name) const
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:50