src/google/protobuf/descriptor_database.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 
36 
37 #include <set>
38 
41 
44 
45 namespace google {
46 namespace protobuf {
47 
48 namespace {
49 void RecordMessageNames(const DescriptorProto& desc_proto,
50  const std::string& prefix,
51  std::set<std::string>* output) {
52  GOOGLE_CHECK(desc_proto.has_name());
53  std::string full_name = prefix.empty()
54  ? desc_proto.name()
55  : StrCat(prefix, ".", desc_proto.name());
56  output->insert(full_name);
57 
58  for (const auto& d : desc_proto.nested_type()) {
59  RecordMessageNames(d, full_name, output);
60  }
61 }
62 
63 void RecordMessageNames(const FileDescriptorProto& file_proto,
64  std::set<std::string>* output) {
65  for (const auto& d : file_proto.message_type()) {
66  RecordMessageNames(d, file_proto.package(), output);
67  }
68 }
69 
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)) {
75  return false;
76  }
77  std::set<std::string> set;
78  FileDescriptorProto file_proto;
79  for (const auto& f : file_names) {
80  file_proto.Clear();
81  if (!db->FindFileByName(f, &file_proto)) {
82  GOOGLE_LOG(ERROR) << "File not found in database (unexpected): " << f;
83  return false;
84  }
85  callback(file_proto, &set);
86  }
87  output->insert(output->end(), set.begin(), set.end());
88  return true;
89 }
90 } // namespace
91 
93 
94 bool DescriptorDatabase::FindAllPackageNames(std::vector<std::string>* output) {
95  return ForAllFileProtos(
96  this,
97  [](const FileDescriptorProto& file_proto, std::set<std::string>* set) {
98  set->insert(file_proto.package());
99  },
100  output);
101 }
102 
103 bool DescriptorDatabase::FindAllMessageNames(std::vector<std::string>* output) {
104  return ForAllFileProtos(
105  this,
106  [](const FileDescriptorProto& file_proto, std::set<std::string>* set) {
107  RecordMessageNames(file_proto, set);
108  },
109  output);
110 }
111 
112 // ===================================================================
113 
114 template <typename Value>
116  const FileDescriptorProto& file, Value value) {
117  if (!InsertIfNotPresent(&by_name_, file.name(), value)) {
118  GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name();
119  return false;
120  }
121 
122  // We must be careful here -- calling file.package() if file.has_package() is
123  // false could access an uninitialized static-storage variable if we are being
124  // run at startup time.
125  std::string path = file.has_package() ? file.package() : std::string();
126  if (!path.empty()) path += '.';
127 
128  for (int i = 0; i < file.message_type_size(); i++) {
129  if (!AddSymbol(path + file.message_type(i).name(), value)) return false;
130  if (!AddNestedExtensions(file.name(), file.message_type(i), value))
131  return false;
132  }
133  for (int i = 0; i < file.enum_type_size(); i++) {
134  if (!AddSymbol(path + file.enum_type(i).name(), value)) return false;
135  }
136  for (int i = 0; i < file.extension_size(); i++) {
137  if (!AddSymbol(path + file.extension(i).name(), value)) return false;
138  if (!AddExtension(file.name(), file.extension(i), value)) return false;
139  }
140  for (int i = 0; i < file.service_size(); i++) {
141  if (!AddSymbol(path + file.service(i).name(), value)) return false;
142  }
143 
144  return true;
145 }
146 
147 template <typename Value>
149  const std::string& name, Value value) {
150  // We need to make sure not to violate our map invariant.
151 
152  // If the symbol name is invalid it could break our lookup algorithm (which
153  // relies on the fact that '.' sorts before all other characters that are
154  // valid in symbol names).
155  if (!ValidateSymbolName(name)) {
156  GOOGLE_LOG(ERROR) << "Invalid symbol name: " << name;
157  return false;
158  }
159 
160  // Try to look up the symbol to make sure a super-symbol doesn't already
161  // exist.
162  typename std::map<std::string, Value>::iterator iter =
163  FindLastLessOrEqual(name);
164 
165  if (iter == by_symbol_.end()) {
166  // Apparently the map is currently empty. Just insert and be done with it.
167  by_symbol_.insert(
169  return true;
170  }
171 
172  if (IsSubSymbol(iter->first, name)) {
173  GOOGLE_LOG(ERROR) << "Symbol name \"" << name
174  << "\" conflicts with the existing "
175  "symbol \""
176  << iter->first << "\".";
177  return false;
178  }
179 
180  // OK, that worked. Now we have to make sure that no symbol in the map is
181  // a sub-symbol of the one we are inserting. The only symbol which could
182  // be so is the first symbol that is greater than the new symbol. Since
183  // |iter| points at the last symbol that is less than or equal, we just have
184  // to increment it.
185  ++iter;
186 
187  if (iter != by_symbol_.end() && IsSubSymbol(name, iter->first)) {
188  GOOGLE_LOG(ERROR) << "Symbol name \"" << name
189  << "\" conflicts with the existing "
190  "symbol \""
191  << iter->first << "\".";
192  return false;
193  }
194 
195  // OK, no conflicts.
196 
197  // Insert the new symbol using the iterator as a hint, the new entry will
198  // appear immediately before the one the iterator is pointing at.
199  by_symbol_.insert(
201 
202  return true;
203 }
204 
205 template <typename Value>
207  const std::string& filename, const DescriptorProto& message_type,
208  Value value) {
209  for (int i = 0; i < message_type.nested_type_size(); i++) {
210  if (!AddNestedExtensions(filename, message_type.nested_type(i), value))
211  return false;
212  }
213  for (int i = 0; i < message_type.extension_size(); i++) {
214  if (!AddExtension(filename, message_type.extension(i), value)) return false;
215  }
216  return true;
217 }
218 
219 template <typename Value>
221  const std::string& filename, const FieldDescriptorProto& field,
222  Value value) {
223  if (!field.extendee().empty() && field.extendee()[0] == '.') {
224  // The extension is fully-qualified. We can use it as a lookup key in
225  // the by_symbol_ table.
226  if (!InsertIfNotPresent(
227  &by_extension_,
228  std::make_pair(field.extendee().substr(1), field.number()),
229  value)) {
230  GOOGLE_LOG(ERROR) << "Extension conflicts with extension already in database: "
231  "extend "
232  << field.extendee() << " { " << field.name() << " = "
233  << field.number() << " } from:" << filename;
234  return false;
235  }
236  } else {
237  // Not fully-qualified. We can't really do anything here, unfortunately.
238  // We don't consider this an error, though, because the descriptor is
239  // valid.
240  }
241  return true;
242 }
243 
244 template <typename Value>
246  const std::string& filename) {
247  return FindWithDefault(by_name_, filename, Value());
248 }
249 
250 template <typename Value>
252  const std::string& name) {
253  typename std::map<std::string, Value>::iterator iter =
254  FindLastLessOrEqual(name);
255 
256  return (iter != by_symbol_.end() && IsSubSymbol(iter->first, name))
257  ? iter->second
258  : Value();
259 }
260 
261 template <typename Value>
263  const std::string& containing_type, int field_number) {
264  return FindWithDefault(
265  by_extension_, std::make_pair(containing_type, field_number), Value());
266 }
267 
268 template <typename Value>
270  const std::string& containing_type, std::vector<int>* output) {
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;
274 
275  for (; it != by_extension_.end() && it->first.first == containing_type;
276  ++it) {
277  output->push_back(it->first.second);
278  success = true;
279  }
280 
281  return success;
282 }
283 
284 template <typename Value>
286  std::vector<std::string>* output) {
287  output->resize(by_name_.size());
288  int i = 0;
289  for (const auto& kv : by_name_) {
290  (*output)[i] = kv.first;
291  i++;
292  }
293 }
294 
295 template <typename Value>
296 typename std::map<std::string, Value>::iterator
298  const std::string& name) {
299  // Find the last key in the map which sorts less than or equal to the
300  // symbol name. Since upper_bound() returns the *first* key that sorts
301  // *greater* than the input, we want the element immediately before that.
302  typename std::map<std::string, Value>::iterator iter =
303  by_symbol_.upper_bound(name);
304  if (iter != by_symbol_.begin()) --iter;
305  return iter;
306 }
307 
308 template <typename Value>
310  const std::string& sub_symbol, const std::string& super_symbol) {
311  return sub_symbol == super_symbol ||
312  (HasPrefixString(super_symbol, sub_symbol) &&
313  super_symbol[sub_symbol.size()] == '.');
314 }
315 
316 template <typename Value>
318  const std::string& name) {
319  for (int i = 0; i < name.size(); i++) {
320  // I don't trust ctype.h due to locales. :(
321  if (name[i] != '.' && name[i] != '_' && (name[i] < '0' || name[i] > '9') &&
322  (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) {
323  return false;
324  }
325  }
326  return true;
327 }
328 
329 // -------------------------------------------------------------------
330 
334 }
335 
338  new_file->CopyFrom(file);
339  return AddAndOwn(new_file);
340 }
341 
343  files_to_delete_.push_back(file);
344  return index_.AddFile(*file, file);
345 }
346 
349  return MaybeCopy(index_.FindFile(filename), output);
350 }
351 
353  const std::string& symbol_name, FileDescriptorProto* output) {
354  return MaybeCopy(index_.FindSymbol(symbol_name), output);
355 }
356 
358  const std::string& containing_type, int field_number,
360  return MaybeCopy(index_.FindExtension(containing_type, field_number), output);
361 }
362 
364  const std::string& extendee_type, std::vector<int>* output) {
365  return index_.FindAllExtensionNumbers(extendee_type, output);
366 }
367 
368 
370  std::vector<std::string>* output) {
372  return true;
373 }
374 
377  if (file == NULL) return false;
378  output->CopyFrom(*file);
379  return true;
380 }
381 
382 // -------------------------------------------------------------------
383 
386  for (int i = 0; i < files_to_delete_.size(); i++) {
387  operator delete(files_to_delete_[i]);
388  }
389 }
390 
391 bool EncodedDescriptorDatabase::Add(const void* encoded_file_descriptor,
392  int size) {
393  FileDescriptorProto file;
394  if (file.ParseFromArray(encoded_file_descriptor, size)) {
395  return index_.AddFile(file, std::make_pair(encoded_file_descriptor, size));
396  } else {
397  GOOGLE_LOG(ERROR) << "Invalid file descriptor data passed to "
398  "EncodedDescriptorDatabase::Add().";
399  return false;
400  }
401 }
402 
403 bool EncodedDescriptorDatabase::AddCopy(const void* encoded_file_descriptor,
404  int size) {
405  void* copy = operator new(size);
406  memcpy(copy, encoded_file_descriptor, size);
407  files_to_delete_.push_back(copy);
408  return Add(copy, size);
409 }
410 
413  return MaybeParse(index_.FindFile(filename), output);
414 }
415 
417  const std::string& symbol_name, FileDescriptorProto* output) {
418  return MaybeParse(index_.FindSymbol(symbol_name), output);
419 }
420 
422  const std::string& symbol_name, std::string* output) {
423  std::pair<const void*, int> encoded_file = index_.FindSymbol(symbol_name);
424  if (encoded_file.first == NULL) return false;
425 
426  // Optimization: The name should be the first field in the encoded message.
427  // Try to just read it directly.
428  io::CodedInputStream input(reinterpret_cast<const uint8*>(encoded_file.first),
429  encoded_file.second);
430 
431  const uint32 kNameTag = internal::WireFormatLite::MakeTag(
434 
435  if (input.ReadTagNoLastTag() == kNameTag) {
436  // Success!
438  } else {
439  // Slow path. Parse whole message.
440  FileDescriptorProto file_proto;
441  if (!file_proto.ParseFromArray(encoded_file.first, encoded_file.second)) {
442  return false;
443  }
444  *output = file_proto.name();
445  return true;
446  }
447 }
448 
450  const std::string& containing_type, int field_number,
452  return MaybeParse(index_.FindExtension(containing_type, field_number),
453  output);
454 }
455 
457  const std::string& extendee_type, std::vector<int>* output) {
458  return index_.FindAllExtensionNumbers(extendee_type, output);
459 }
460 
462  std::vector<std::string>* output) {
464  return true;
465 }
466 
468  std::pair<const void*, int> encoded_file, FileDescriptorProto* output) {
469  if (encoded_file.first == NULL) return false;
470  return output->ParseFromArray(encoded_file.first, encoded_file.second);
471 }
472 
473 // ===================================================================
474 
476  : pool_(pool) {}
478 
481  const FileDescriptor* file = pool_.FindFileByName(filename);
482  if (file == NULL) return false;
483  output->Clear();
484  file->CopyTo(output);
485  return true;
486 }
487 
489  const std::string& symbol_name, FileDescriptorProto* output) {
490  const FileDescriptor* file = pool_.FindFileContainingSymbol(symbol_name);
491  if (file == NULL) return false;
492  output->Clear();
493  file->CopyTo(output);
494  return true;
495 }
496 
498  const std::string& containing_type, int field_number,
500  const Descriptor* extendee = pool_.FindMessageTypeByName(containing_type);
501  if (extendee == NULL) return false;
502 
503  const FieldDescriptor* extension =
504  pool_.FindExtensionByNumber(extendee, field_number);
505  if (extension == NULL) return false;
506 
507  output->Clear();
509  return true;
510 }
511 
513  const std::string& extendee_type, std::vector<int>* output) {
514  const Descriptor* extendee = pool_.FindMessageTypeByName(extendee_type);
515  if (extendee == NULL) return false;
516 
517  std::vector<const FieldDescriptor*> extensions;
518  pool_.FindAllExtensions(extendee, &extensions);
519 
520  for (int i = 0; i < extensions.size(); ++i) {
521  output->push_back(extensions[i]->number());
522  }
523 
524  return true;
525 }
526 
527 // ===================================================================
528 
530  DescriptorDatabase* source1, DescriptorDatabase* source2) {
531  sources_.push_back(source1);
532  sources_.push_back(source2);
533 }
535  const std::vector<DescriptorDatabase*>& sources)
536  : sources_(sources) {}
538 
541  for (int i = 0; i < sources_.size(); i++) {
542  if (sources_[i]->FindFileByName(filename, output)) {
543  return true;
544  }
545  }
546  return false;
547 }
548 
550  const std::string& symbol_name, FileDescriptorProto* output) {
551  for (int i = 0; i < sources_.size(); i++) {
552  if (sources_[i]->FindFileContainingSymbol(symbol_name, output)) {
553  // The symbol was found in source i. However, if one of the previous
554  // sources defines a file with the same name (which presumably doesn't
555  // contain the symbol, since it wasn't found in that source), then we
556  // must hide it from the caller.
557  FileDescriptorProto temp;
558  for (int j = 0; j < i; j++) {
559  if (sources_[j]->FindFileByName(output->name(), &temp)) {
560  // Found conflicting file in a previous source.
561  return false;
562  }
563  }
564  return true;
565  }
566  }
567  return false;
568 }
569 
571  const std::string& containing_type, int field_number,
573  for (int i = 0; i < sources_.size(); i++) {
574  if (sources_[i]->FindFileContainingExtension(containing_type, field_number,
575  output)) {
576  // The symbol was found in source i. However, if one of the previous
577  // sources defines a file with the same name (which presumably doesn't
578  // contain the symbol, since it wasn't found in that source), then we
579  // must hide it from the caller.
580  FileDescriptorProto temp;
581  for (int j = 0; j < i; j++) {
582  if (sources_[j]->FindFileByName(output->name(), &temp)) {
583  // Found conflicting file in a previous source.
584  return false;
585  }
586  }
587  return true;
588  }
589  }
590  return false;
591 }
592 
594  const std::string& extendee_type, std::vector<int>* output) {
595  std::set<int> merged_results;
596  std::vector<int> results;
597  bool success = false;
598 
599  for (int i = 0; i < sources_.size(); i++) {
600  if (sources_[i]->FindAllExtensionNumbers(extendee_type, &results)) {
601  std::copy(results.begin(), results.end(),
602  std::insert_iterator<std::set<int> >(merged_results,
603  merged_results.begin()));
604  success = true;
605  }
606  results.clear();
607  }
608 
609  std::copy(merged_results.begin(), merged_results.end(),
610  std::insert_iterator<std::vector<int> >(*output, output->end()));
611 
612  return success;
613 }
614 
615 
616 } // namespace protobuf
617 } // namespace google
FileDescriptorProto::name
const std::string & name() const
Definition: descriptor.pb.h:6576
google::protobuf::DescriptorPool::FindFileByName
const FileDescriptor * FindFileByName(const std::string &name) const
Definition: src/google/protobuf/descriptor.cc:1389
google::protobuf::FindWithDefault
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)
Definition: map_util.h:123
google::protobuf::DescriptorPoolDatabase::DescriptorPoolDatabase
DescriptorPoolDatabase(const DescriptorPool &pool)
Definition: src/google/protobuf/descriptor_database.cc:475
name
GLuint const GLchar * name
Definition: glcorearb.h:3055
google::protobuf::SimpleDescriptorDatabase::~SimpleDescriptorDatabase
~SimpleDescriptorDatabase() override
Definition: src/google/protobuf/descriptor_database.cc:332
map_util.h
google::protobuf::FieldDescriptor
Definition: src/google/protobuf/descriptor.h:515
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::FindAllExtensionNumbers
bool FindAllExtensionNumbers(const std::string &containing_type, std::vector< int > *output)
Definition: src/google/protobuf/descriptor_database.cc:269
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: src/google/protobuf/descriptor.h:2001
NULL
NULL
Definition: test_security_zap.cpp:405
google::protobuf::SimpleDescriptorDatabase::index_
DescriptorIndex< const FileDescriptorProto * > index_
Definition: src/google/protobuf/descriptor_database.h:286
google::protobuf::DescriptorPoolDatabase::FindFileContainingSymbol
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:488
FileDescriptorProto::extension
const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto & extension(int index) const
Definition: descriptor.pb.h:6959
google::protobuf::EncodedDescriptorDatabase::MaybeParse
bool MaybeParse(std::pair< const void *, int > encoded_file, FileDescriptorProto *output)
Definition: src/google/protobuf/descriptor_database.cc:467
google::protobuf::DescriptorPoolDatabase::FindFileByName
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:479
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: strutil.cc:1480
input
std::string input
Definition: tokenizer_unittest.cc:197
google::protobuf::EncodedDescriptorDatabase::FindFileContainingSymbol
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:416
google::protobuf::uint8
uint8_t uint8
Definition: protobuf/src/google/protobuf/stubs/port.h:153
FieldDescriptorProto
Definition: descriptor.pb.h:1678
google::protobuf::SimpleDescriptorDatabase::FindFileContainingExtension
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:357
google::protobuf::EncodedDescriptorDatabase::FindFileContainingExtension
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:449
google::protobuf::EncodedDescriptorDatabase::~EncodedDescriptorDatabase
~EncodedDescriptorDatabase() override
Definition: src/google/protobuf/descriptor_database.cc:385
google::protobuf::uint32
uint32_t uint32
Definition: protobuf/src/google/protobuf/stubs/port.h:155
google::protobuf::SimpleDescriptorDatabase::MaybeCopy
bool MaybeCopy(const FileDescriptorProto *file, FileDescriptorProto *output)
Definition: src/google/protobuf/descriptor_database.cc:375
google::protobuf::EncodedDescriptorDatabase::EncodedDescriptorDatabase
EncodedDescriptorDatabase()
Definition: src/google/protobuf/descriptor_database.cc:384
FileDescriptorProto::service_size
int service_size() const
Definition: descriptor.pb.h:6914
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
Value
Definition: struct.pb.h:304
descriptor_database.h
google::protobuf::EncodedDescriptorDatabase::Add
bool Add(const void *encoded_file_descriptor, int size)
Definition: src/google/protobuf/descriptor_database.cc:391
google::protobuf::DescriptorPoolDatabase::~DescriptorPoolDatabase
~DescriptorPoolDatabase() override
Definition: src/google/protobuf/descriptor_database.cc:477
google::protobuf::MergedDescriptorDatabase::FindAllExtensionNumbers
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
Definition: src/google/protobuf/descriptor_database.cc:593
google::protobuf::DescriptorPool::FindFileContainingSymbol
const FileDescriptor * FindFileContainingSymbol(const std::string &symbol_name) const
Definition: src/google/protobuf/descriptor.cc:1409
google::protobuf::EncodedDescriptorDatabase::index_
SimpleDescriptorDatabase::DescriptorIndex< std::pair< const void *, int > > index_
Definition: src/google/protobuf/descriptor_database.h:336
FileDescriptorProto::service
const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto & service(int index) const
Definition: descriptor.pb.h:6929
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::FindFile
Value FindFile(const std::string &filename)
Definition: src/google/protobuf/descriptor_database.cc:245
FileDescriptorProto::message_type_size
int message_type_size() const
Definition: descriptor.pb.h:6854
message_type
zend_class_entry * message_type
Definition: php/ext/google/protobuf/message.c:45
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::AddFile
bool AddFile(const FileDescriptorProto &file, Value value)
Definition: src/google/protobuf/descriptor_database.cc:115
google::protobuf::EncodedDescriptorDatabase::FindNameOfFileContainingSymbol
bool FindNameOfFileContainingSymbol(const std::string &symbol_name, std::string *output)
Definition: src/google/protobuf/descriptor_database.cc:421
google::protobuf::DescriptorPoolDatabase::pool_
const DescriptorPool & pool_
Definition: src/google/protobuf/descriptor_database.h:365
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::AddSymbol
bool AddSymbol(const std::string &name, Value value)
Definition: src/google/protobuf/descriptor_database.cc:148
FileDescriptorProto::enum_type
const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto & enum_type(int index) const
Definition: descriptor.pb.h:6899
google::protobuf::EncodedDescriptorDatabase::FindFileByName
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:411
strutil.h
path
GLsizei const GLchar ** path
Definition: glcorearb.h:3658
google::protobuf::MergedDescriptorDatabase::MergedDescriptorDatabase
MergedDescriptorDatabase(DescriptorDatabase *source1, DescriptorDatabase *source2)
Definition: src/google/protobuf/descriptor_database.cc:529
benchmarks.python.py_benchmark.results
list results
Definition: py_benchmark.py:145
prefix
static const char prefix[]
Definition: test_pair_ipc.cpp:26
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::FindExtension
Value FindExtension(const std::string &containing_type, int field_number)
Definition: src/google/protobuf/descriptor_database.cc:262
google::protobuf.internal::WireFormatLite::ReadString
static bool ReadString(io::CodedInputStream *input, std::string *value)
Definition: wire_format_lite.h:878
sources
GLsizei GLenum * sources
Definition: glcorearb.h:4177
google::protobuf::DescriptorPool
Definition: src/google/protobuf/descriptor.h:1539
google::protobuf::MergedDescriptorDatabase::FindFileByName
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:539
google::protobuf::SimpleDescriptorDatabase::FindFileByName
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:347
google::protobuf::STLDeleteElements
void STLDeleteElements(T *container)
Definition: stl_util.h:99
google::protobuf::EnumValueDescriptor::file
const FileDescriptor * file() const
Definition: src/google/protobuf/descriptor.h:2115
google::protobuf::FieldDescriptor::number
int number() const
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: logging.h:146
FileDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: descriptor.pb.h:648
size
#define size
Definition: glcorearb.h:2944
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::FindAllFileNames
void FindAllFileNames(std::vector< std::string > *output)
Definition: src/google/protobuf/descriptor_database.cc:285
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::FindLastLessOrEqual
std::map< std::string, Value >::iterator FindLastLessOrEqual(const std::string &name)
Definition: src/google/protobuf/descriptor_database.cc:297
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::FindSymbol
Value FindSymbol(const std::string &name)
Definition: src/google/protobuf/descriptor_database.cc:251
google::protobuf.internal::WireFormatLite::MakeTag
constexpr static uint32 MakeTag(int field_number, WireType type)
Definition: wire_format_lite.h:768
FileDescriptorProto
Definition: descriptor.pb.h:501
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::AddExtension
bool AddExtension(const std::string &filename, const FieldDescriptorProto &field, Value value)
Definition: src/google/protobuf/descriptor_database.cc:220
google::protobuf::DescriptorPoolDatabase::FindAllExtensionNumbers
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
Definition: src/google/protobuf/descriptor_database.cc:512
FileDescriptorProto::Clear
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final
Definition: descriptor.pb.cc:1824
google::protobuf::EncodedDescriptorDatabase::files_to_delete_
std::vector< void * > files_to_delete_
Definition: src/google/protobuf/descriptor_database.h:337
google::protobuf::HasPrefixString
bool HasPrefixString(const string &str, const string &prefix)
Definition: strutil.h:115
field
const FieldDescriptor * field
Definition: parser_unittest.cc:2694
google::protobuf::DescriptorDatabase::~DescriptorDatabase
virtual ~DescriptorDatabase()
Definition: src/google/protobuf/descriptor_database.cc:92
google::protobuf::ERROR
static const LogLevel ERROR
Definition: protobuf/src/google/protobuf/testing/googletest.h:70
FileDescriptorProto::message_type
const PROTOBUF_NAMESPACE_ID::DescriptorProto & message_type(int index) const
Definition: descriptor.pb.h:6869
google::protobuf.internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED
@ WIRETYPE_LENGTH_DELIMITED
Definition: wire_format_lite.h:104
google::protobuf::FileDescriptor::CopyTo
void CopyTo(FileDescriptorProto *proto) const
Definition: src/google/protobuf/descriptor.cc:2010
google::protobuf::DescriptorDatabase
Definition: src/google/protobuf/descriptor_database.h:71
google::protobuf::DescriptorDatabase::FindAllMessageNames
bool FindAllMessageNames(std::vector< std::string > *output)
Definition: src/google/protobuf/descriptor_database.cc:103
GOOGLE_CHECK
#define GOOGLE_CHECK(EXPRESSION)
Definition: logging.h:153
pool
InternalDescriptorPool * pool
Definition: php/ext/google/protobuf/protobuf.h:798
i
int i
Definition: gmock-matchers_test.cc:764
google::protobuf::DescriptorPool::FindExtensionByNumber
const FieldDescriptor * FindExtensionByNumber(const Descriptor *extendee, int number) const
Definition: src/google/protobuf/descriptor.cc:1488
FileDescriptorProto::CopyFrom
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message &from) final
Definition: descriptor.pb.cc:2608
google::protobuf::DescriptorDatabase::FindAllPackageNames
bool FindAllPackageNames(std::vector< std::string > *output)
Definition: src/google/protobuf/descriptor_database.cc:94
google::protobuf::SimpleDescriptorDatabase::FindFileContainingSymbol
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:352
google::protobuf::FieldDescriptor::name
const std::string & name() const
google::protobuf::SimpleDescriptorDatabase::files_to_delete_
std::vector< const FileDescriptorProto * > files_to_delete_
Definition: src/google/protobuf/descriptor_database.h:287
google::protobuf::SimpleDescriptorDatabase::AddAndOwn
bool AddAndOwn(const FileDescriptorProto *file)
Definition: src/google/protobuf/descriptor_database.cc:342
DescriptorProto::nested_type
const PROTOBUF_NAMESPACE_ID::DescriptorProto & nested_type(int index) const
Definition: descriptor.pb.h:7473
FileDescriptorProto::extension_size
int extension_size() const
Definition: descriptor.pb.h:6944
value_type
zend_class_entry * value_type
Definition: php/ext/google/protobuf/message.c:2546
size
GLsizeiptr size
Definition: glcorearb.h:2943
stl_util.h
google::protobuf::MergedDescriptorDatabase::FindFileContainingSymbol
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:549
google::protobuf::SimpleDescriptorDatabase::FindAllFileNames
bool FindAllFileNames(std::vector< std::string > *output) override
Definition: src/google/protobuf/descriptor_database.cc:369
google::protobuf::EncodedDescriptorDatabase::AddCopy
bool AddCopy(const void *encoded_file_descriptor, int size)
Definition: src/google/protobuf/descriptor_database.cc:403
google::protobuf::io::CodedInputStream
Definition: coded_stream.h:173
cpp.gmock_class.set
set
Definition: gmock_class.py:44
DescriptorProto
Definition: descriptor.pb.h:1203
google::protobuf::Descriptor
Definition: src/google/protobuf/descriptor.h:231
google::protobuf::EncodedDescriptorDatabase::FindAllFileNames
bool FindAllFileNames(std::vector< std::string > *output) override
Definition: src/google/protobuf/descriptor_database.cc:461
google::protobuf::SimpleDescriptorDatabase::FindAllExtensionNumbers
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
Definition: src/google/protobuf/descriptor_database.cc:363
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::AddNestedExtensions
bool AddNestedExtensions(const std::string &filename, const DescriptorProto &message_type, Value value)
Definition: src/google/protobuf/descriptor_database.cc:206
pool_
DescriptorPool pool_
Definition: parser_unittest.cc:183
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::IsSubSymbol
bool IsSubSymbol(const std::string &sub_symbol, const std::string &super_symbol)
Definition: src/google/protobuf/descriptor_database.cc:309
google::protobuf::FileDescriptor
Definition: src/google/protobuf/descriptor.h:1320
google::protobuf::DescriptorPool::FindAllExtensions
void FindAllExtensions(const Descriptor *extendee, std::vector< const FieldDescriptor * > *out) const
Definition: src/google/protobuf/descriptor.cc:1549
google::protobuf::DescriptorPoolDatabase::FindFileContainingExtension
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:497
f
GLfloat f
Definition: glcorearb.h:3964
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
DescriptorProto::name
const std::string & name() const
Definition: descriptor.pb.h:7325
FileDescriptorProto::package
const std::string & package() const
Definition: descriptor.pb.h:6656
descriptor.pb.h
google::protobuf::SimpleDescriptorDatabase::SimpleDescriptorDatabase
SimpleDescriptorDatabase()
Definition: src/google/protobuf/descriptor_database.cc:331
output
const upb_json_parsermethod const upb_symtab upb_sink * output
Definition: ruby/ext/google/protobuf_c/upb.h:10503
DescriptorProto::has_name
bool has_name() const
Definition: descriptor.pb.h:7318
google::protobuf::MergedDescriptorDatabase::FindFileContainingExtension
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
Definition: src/google/protobuf/descriptor_database.cc:570
FileDescriptorProto::enum_type_size
int enum_type_size() const
Definition: descriptor.pb.h:6884
number
double number
Definition: cJSON.h:326
google::protobuf::MergedDescriptorDatabase::sources_
std::vector< DescriptorDatabase * > sources_
Definition: src/google/protobuf/descriptor_database.h:398
it
MapIter it
Definition: php/ext/google/protobuf/map.c:205
google::protobuf::InsertIfNotPresent
bool InsertIfNotPresent(Collection *const collection, const typename Collection::value_type &vt)
Definition: map_util.h:321
google
Definition: data_proto2_to_proto3_util.h:11
google::protobuf::descriptor_unittest::AddExtension
FieldDescriptorProto * AddExtension(FileDescriptorProto *file, const std::string &extendee, const std::string &name, int number, FieldDescriptorProto::Label label, FieldDescriptorProto::Type type)
Definition: descriptor_unittest.cc:120
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex::ValidateSymbolName
bool ValidateSymbolName(const std::string &name)
Definition: src/google/protobuf/descriptor_database.cc:317
google::protobuf::EncodedDescriptorDatabase::FindAllExtensionNumbers
bool FindAllExtensionNumbers(const std::string &extendee_type, std::vector< int > *output) override
Definition: src/google/protobuf/descriptor_database.cc:456
google::protobuf::MergedDescriptorDatabase::~MergedDescriptorDatabase
~MergedDescriptorDatabase() override
Definition: src/google/protobuf/descriptor_database.cc:537
google::protobuf::SimpleDescriptorDatabase::Add
bool Add(const FileDescriptorProto &file)
Definition: src/google/protobuf/descriptor_database.cc:336
Value
struct Value Value
Definition: php/ext/google/protobuf/protobuf.h:667
google::protobuf::DescriptorPool::FindMessageTypeByName
const Descriptor * FindMessageTypeByName(const std::string &name) const
Definition: src/google/protobuf/descriptor.cc:1430


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:50