src/google/protobuf/descriptor.h
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 //
35 // This file contains classes which describe a type of protocol message.
36 // You can use a message's descriptor to learn at runtime what fields
37 // it contains and what the types of those fields are. The Message
38 // interface also allows you to dynamically access and modify individual
39 // fields by passing the FieldDescriptor of the field you are interested
40 // in.
41 //
42 // Most users will not care about descriptors, because they will write
43 // code specific to certain protocol types and will simply use the classes
44 // generated by the protocol compiler directly. Advanced users who want
45 // to operate on arbitrary types (not known at compile time) may want to
46 // read descriptors in order to learn about the contents of a message.
47 // A very small number of users will want to construct their own
48 // Descriptors, either because they are implementing Message manually or
49 // because they are writing something like the protocol compiler.
50 //
51 // For an example of how you might use descriptors, see the code example
52 // at the top of message.h.
53 
54 #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__
55 #define GOOGLE_PROTOBUF_DESCRIPTOR_H__
56 
57 #include <memory>
58 #include <set>
59 #include <string>
60 #include <vector>
64 
65 #include <google/protobuf/port_def.inc>
66 
67 // TYPE_BOOL is defined in the MacOS's ConditionalMacros.h.
68 #ifdef TYPE_BOOL
69 #undef TYPE_BOOL
70 #endif // TYPE_BOOL
71 
72 #ifdef SWIG
73 #define PROTOBUF_EXPORT
74 #endif
75 
76 
77 namespace google {
78 namespace protobuf {
79 
80 // Defined in this file.
81 class Descriptor;
82 class FieldDescriptor;
83 class OneofDescriptor;
84 class EnumDescriptor;
86 class ServiceDescriptor;
87 class MethodDescriptor;
88 class FileDescriptor;
89 class DescriptorDatabase;
90 class DescriptorPool;
91 
92 // Defined in descriptor.proto
93 class DescriptorProto;
101 class FileDescriptorProto;
102 class MessageOptions;
103 class FieldOptions;
104 class OneofOptions;
105 class EnumOptions;
106 class EnumValueOptions;
108 class ServiceOptions;
109 class MethodOptions;
110 class FileOptions;
111 class UninterpretedOption;
112 class SourceCodeInfo;
113 
114 // Defined in message.h
115 class Message;
116 class Reflection;
117 
118 // Defined in descriptor.cc
119 class DescriptorBuilder;
120 class FileDescriptorTables;
121 struct Symbol;
122 
123 // Defined in unknown_field_set.h.
124 class UnknownField;
125 
126 // Defined in command_line_interface.cc
127 namespace compiler {
128 class CommandLineInterface;
129 namespace cpp {
130 // Defined in helpers.h
131 class Formatter;
132 } // namespace cpp
133 } // namespace compiler
134 
135 namespace descriptor_unittest {
136 class DescriptorTest;
137 } // namespace descriptor_unittest
138 
139 // Defined in printer.h
140 namespace io {
141 class Printer;
142 } // namespace io
143 
144 // NB, all indices are zero-based.
147  int end_line;
150 
151  // Doc comments found at the source location.
152  // See the comments in SourceCodeInfo.Location (descriptor.proto) for details.
155  std::vector<std::string> leading_detached_comments;
156 };
157 
158 // Options when generating machine-parsable output from a descriptor with
159 // DebugString().
161  // include original user comments as recorded in SourceLocation entries. N.B.
162  // that this must be |false| by default: several other pieces of code (for
163  // example, the C++ code generation for fields in the proto compiler) rely on
164  // DebugString() output being unobstructed by user comments.
166  // If true, elide the braced body in the debug string.
169 
174  }
175 };
176 
177 // A class to handle the simplest cases of a lazily linked descriptor
178 // for a message type that isn't built at the time of cross linking,
179 // which is needed when a pool has lazily_build_dependencies_ set.
180 // Must be instantiated as mutable in a descriptor.
181 namespace internal {
182 class PROTOBUF_EXPORT LazyDescriptor {
183  public:
184  // Init function to be called at init time of a descriptor containing
185  // a LazyDescriptor.
186  void Init() {
187  descriptor_ = nullptr;
188  name_ = nullptr;
189  once_ = nullptr;
190  file_ = nullptr;
191  }
192 
193  // Sets the value of the descriptor if it is known during the descriptor
194  // building process. Not thread safe, should only be called during the
195  // descriptor build process. Should not be called after SetLazy has been
196  // called.
197  void Set(const Descriptor* descriptor);
198 
199  // Sets the information needed to lazily cross link the descriptor at a later
200  // time, SetLazy is not thread safe, should be called only once at descriptor
201  // build time if the symbol wasn't found and building of the file containing
202  // that type is delayed because lazily_build_dependencies_ is set on the pool.
203  // Should not be called after Set() has been called.
204  void SetLazy(const std::string& name, const FileDescriptor* file);
205 
206  // Returns the current value of the descriptor, thread-safe. If SetLazy(...)
207  // has been called, will do a one-time cross link of the type specified,
208  // building the descriptor file that contains the type if necessary.
209  inline const Descriptor* Get() {
210  Once();
211  return descriptor_;
212  }
213 
214  private:
215  static void OnceStatic(LazyDescriptor* lazy);
216  void OnceInternal();
217  void Once();
218 
223 };
224 } // namespace internal
225 
226 // Describes a type of protocol message, or a particular group within a
227 // message. To obtain the Descriptor for a given message object, call
228 // Message::GetDescriptor(). Generated message classes also have a
229 // static method called descriptor() which returns the type's descriptor.
230 // Use DescriptorPool to construct your own descriptors.
231 class PROTOBUF_EXPORT Descriptor {
232  public:
234 
235  // The name of the message type, not including its scope.
236  const std::string& name() const;
237 
238  // The fully-qualified name of the message type, scope delimited by
239  // periods. For example, message type "Foo" which is declared in package
240  // "bar" has full name "bar.Foo". If a type "Baz" is nested within
241  // Foo, Baz's full_name is "bar.Foo.Baz". To get only the part that
242  // comes after the last '.', use name().
243  const std::string& full_name() const;
244 
245  // Index of this descriptor within the file or containing type's message
246  // type array.
247  int index() const;
248 
249  // The .proto file in which this message type was defined. Never nullptr.
250  const FileDescriptor* file() const;
251 
252  // If this Descriptor describes a nested type, this returns the type
253  // in which it is nested. Otherwise, returns nullptr.
254  const Descriptor* containing_type() const;
255 
256  // Get options for this message type. These are specified in the .proto file
257  // by placing lines like "option foo = 1234;" in the message definition.
258  // Allowed options are defined by MessageOptions in descriptor.proto, and any
259  // available extensions of that message.
260  const MessageOptions& options() const;
261 
262  // Write the contents of this Descriptor into the given DescriptorProto.
263  // The target DescriptorProto must be clear before calling this; if it
264  // isn't, the result may be garbage.
265  void CopyTo(DescriptorProto* proto) const;
266 
267  // Write the contents of this decriptor in a human-readable form. Output
268  // will be suitable for re-parsing.
269  std::string DebugString() const;
270 
271  // Similar to DebugString(), but additionally takes options (e.g.,
272  // include original user comments in output).
273  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
274 
275  // Returns true if this is a placeholder for an unknown type. This will
276  // only be the case if this descriptor comes from a DescriptorPool
277  // with AllowUnknownDependencies() set.
278  bool is_placeholder() const;
279 
280  // Field stuff -----------------------------------------------------
281 
282  // The number of fields in this message type.
283  int field_count() const;
284  // Gets a field by index, where 0 <= index < field_count().
285  // These are returned in the order they were defined in the .proto file.
286  const FieldDescriptor* field(int index) const;
287 
288  // Looks up a field by declared tag number. Returns nullptr if no such field
289  // exists.
290  const FieldDescriptor* FindFieldByNumber(int number) const;
291  // Looks up a field by name. Returns nullptr if no such field exists.
292  const FieldDescriptor* FindFieldByName(const std::string& name) const;
293 
294  // Looks up a field by lowercased name (as returned by lowercase_name()).
295  // This lookup may be ambiguous if multiple field names differ only by case,
296  // in which case the field returned is chosen arbitrarily from the matches.
297  const FieldDescriptor* FindFieldByLowercaseName(
298  const std::string& lowercase_name) const;
299 
300  // Looks up a field by camel-case name (as returned by camelcase_name()).
301  // This lookup may be ambiguous if multiple field names differ in a way that
302  // leads them to have identical camel-case names, in which case the field
303  // returned is chosen arbitrarily from the matches.
304  const FieldDescriptor* FindFieldByCamelcaseName(
305  const std::string& camelcase_name) const;
306 
307  // The number of oneofs in this message type.
308  int oneof_decl_count() const;
309  // Get a oneof by index, where 0 <= index < oneof_decl_count().
310  // These are returned in the order they were defined in the .proto file.
311  const OneofDescriptor* oneof_decl(int index) const;
312 
313  // Looks up a oneof by name. Returns nullptr if no such oneof exists.
314  const OneofDescriptor* FindOneofByName(const std::string& name) const;
315 
316  // Nested type stuff -----------------------------------------------
317 
318  // The number of nested types in this message type.
319  int nested_type_count() const;
320  // Gets a nested type by index, where 0 <= index < nested_type_count().
321  // These are returned in the order they were defined in the .proto file.
322  const Descriptor* nested_type(int index) const;
323 
324  // Looks up a nested type by name. Returns nullptr if no such nested type
325  // exists.
326  const Descriptor* FindNestedTypeByName(const std::string& name) const;
327 
328  // Enum stuff ------------------------------------------------------
329 
330  // The number of enum types in this message type.
331  int enum_type_count() const;
332  // Gets an enum type by index, where 0 <= index < enum_type_count().
333  // These are returned in the order they were defined in the .proto file.
334  const EnumDescriptor* enum_type(int index) const;
335 
336  // Looks up an enum type by name. Returns nullptr if no such enum type
337  // exists.
338  const EnumDescriptor* FindEnumTypeByName(const std::string& name) const;
339 
340  // Looks up an enum value by name, among all enum types in this message.
341  // Returns nullptr if no such value exists.
342  const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const;
343 
344  // Extensions ------------------------------------------------------
345 
346  // A range of field numbers which are designated for third-party
347  // extensions.
348  struct ExtensionRange {
350 
352 
353  // See Descriptor::CopyTo().
354  void CopyTo(DescriptorProto_ExtensionRange* proto) const;
355 
356  int start; // inclusive
357  int end; // exclusive
358 
360  };
361 
362  // The number of extension ranges in this message type.
363  int extension_range_count() const;
364  // Gets an extension range by index, where 0 <= index <
365  // extension_range_count(). These are returned in the order they were defined
366  // in the .proto file.
367  const ExtensionRange* extension_range(int index) const;
368 
369  // Returns true if the number is in one of the extension ranges.
370  bool IsExtensionNumber(int number) const;
371 
372  // Returns nullptr if no extension range contains the given number.
373  const ExtensionRange* FindExtensionRangeContainingNumber(int number) const;
374 
375  // The number of extensions -- extending *other* messages -- that were
376  // defined nested within this message type's scope.
377  int extension_count() const;
378  // Get an extension by index, where 0 <= index < extension_count().
379  // These are returned in the order they were defined in the .proto file.
380  const FieldDescriptor* extension(int index) const;
381 
382  // Looks up a named extension (which extends some *other* message type)
383  // defined within this message type's scope.
385 
386  // Similar to FindFieldByLowercaseName(), but finds extensions defined within
387  // this message type's scope.
388  const FieldDescriptor* FindExtensionByLowercaseName(
389  const std::string& name) const;
390 
391  // Similar to FindFieldByCamelcaseName(), but finds extensions defined within
392  // this message type's scope.
393  const FieldDescriptor* FindExtensionByCamelcaseName(
394  const std::string& name) const;
395 
396  // Reserved fields -------------------------------------------------
397 
398  // A range of reserved field numbers.
399  struct ReservedRange {
400  int start; // inclusive
401  int end; // exclusive
402  };
403 
404  // The number of reserved ranges in this message type.
405  int reserved_range_count() const;
406  // Gets an reserved range by index, where 0 <= index <
407  // reserved_range_count(). These are returned in the order they were defined
408  // in the .proto file.
409  const ReservedRange* reserved_range(int index) const;
410 
411  // Returns true if the number is in one of the reserved ranges.
412  bool IsReservedNumber(int number) const;
413 
414  // Returns nullptr if no reserved range contains the given number.
415  const ReservedRange* FindReservedRangeContainingNumber(int number) const;
416 
417  // The number of reserved field names in this message type.
418  int reserved_name_count() const;
419 
420  // Gets a reserved name by index, where 0 <= index < reserved_name_count().
421  const std::string& reserved_name(int index) const;
422 
423  // Returns true if the field name is reserved.
424  bool IsReservedName(const std::string& name) const;
425 
426  // Source Location ---------------------------------------------------
427 
428  // Updates |*out_location| to the source location of the complete
429  // extent of this message declaration. Returns false and leaves
430  // |*out_location| unchanged iff location information was not available.
431  bool GetSourceLocation(SourceLocation* out_location) const;
432 
433  private:
435 
436  // Allows tests to test CopyTo(proto, true).
438 
439  // Allows access to GetLocationPath for annotations.
440  friend class io::Printer;
442 
443  // Fill the json_name field of FieldDescriptorProto.
444  void CopyJsonNameTo(DescriptorProto* proto) const;
445 
446  // Internal version of DebugString; controls the level of indenting for
447  // correct depth. Takes |options| to control debug-string options, and
448  // |include_opening_clause| to indicate whether the "message ... " part of the
449  // clause has already been generated (this varies depending on context).
450  void DebugString(int depth, std::string* contents,
452  bool include_opening_clause) const;
453 
454  // Walks up the descriptor tree to generate the source location path
455  // to this descriptor from the file root.
456  void GetLocationPath(std::vector<int>* output) const;
457 
463 
464  // These arrays are separated from their sizes to minimize padding on 64-bit.
473 
482 
483  // True if this is a placeholder for an unknown type.
485  // True if this is a placeholder and the type name wasn't fully-qualified.
487 
488  // IMPORTANT: If you add a new field, make sure to search for all instances
489  // of Allocate<Descriptor>() and AllocateArray<Descriptor>() in descriptor.cc
490  // and update them to initialize the field.
491 
492  // Must be constructed using DescriptorPool.
494  friend class DescriptorBuilder;
495  friend class DescriptorPool;
496  friend class EnumDescriptor;
497  friend class FieldDescriptor;
498  friend class OneofDescriptor;
499  friend class MethodDescriptor;
500  friend class FileDescriptor;
502 };
503 
504 
505 // Describes a single field of a message. To get the descriptor for a given
506 // field, first get the Descriptor for the message in which it is defined,
507 // then call Descriptor::FindFieldByName(). To get a FieldDescriptor for
508 // an extension, do one of the following:
509 // - Get the Descriptor or FileDescriptor for its containing scope, then
510 // call Descriptor::FindExtensionByName() or
511 // FileDescriptor::FindExtensionByName().
512 // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber() or
513 // DescriptorPool::FindExtensionByPrintableName().
514 // Use DescriptorPool to construct your own descriptors.
515 class PROTOBUF_EXPORT FieldDescriptor {
516  public:
518 
519  // Identifies a field type. 0 is reserved for errors. The order is weird
520  // for historical reasons. Types 12 and up are new in proto2.
521  enum Type {
522  TYPE_DOUBLE = 1, // double, exactly eight bytes on the wire.
523  TYPE_FLOAT = 2, // float, exactly four bytes on the wire.
524  TYPE_INT64 = 3, // int64, varint on the wire. Negative numbers
525  // take 10 bytes. Use TYPE_SINT64 if negative
526  // values are likely.
527  TYPE_UINT64 = 4, // uint64, varint on the wire.
528  TYPE_INT32 = 5, // int32, varint on the wire. Negative numbers
529  // take 10 bytes. Use TYPE_SINT32 if negative
530  // values are likely.
531  TYPE_FIXED64 = 6, // uint64, exactly eight bytes on the wire.
532  TYPE_FIXED32 = 7, // uint32, exactly four bytes on the wire.
533  TYPE_BOOL = 8, // bool, varint on the wire.
534  TYPE_STRING = 9, // UTF-8 text.
535  TYPE_GROUP = 10, // Tag-delimited message. Deprecated.
536  TYPE_MESSAGE = 11, // Length-delimited message.
537 
538  TYPE_BYTES = 12, // Arbitrary byte array.
539  TYPE_UINT32 = 13, // uint32, varint on the wire
540  TYPE_ENUM = 14, // Enum, varint on the wire
541  TYPE_SFIXED32 = 15, // int32, exactly four bytes on the wire
542  TYPE_SFIXED64 = 16, // int64, exactly eight bytes on the wire
543  TYPE_SINT32 = 17, // int32, ZigZag-encoded varint on the wire
544  TYPE_SINT64 = 18, // int64, ZigZag-encoded varint on the wire
545 
546  MAX_TYPE = 18, // Constant useful for defining lookup tables
547  // indexed by Type.
548  };
549 
550  // Specifies the C++ data type used to represent the field. There is a
551  // fixed mapping from Type to CppType where each Type maps to exactly one
552  // CppType. 0 is reserved for errors.
553  enum CppType {
554  CPPTYPE_INT32 = 1, // TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32
555  CPPTYPE_INT64 = 2, // TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64
556  CPPTYPE_UINT32 = 3, // TYPE_UINT32, TYPE_FIXED32
557  CPPTYPE_UINT64 = 4, // TYPE_UINT64, TYPE_FIXED64
558  CPPTYPE_DOUBLE = 5, // TYPE_DOUBLE
559  CPPTYPE_FLOAT = 6, // TYPE_FLOAT
560  CPPTYPE_BOOL = 7, // TYPE_BOOL
561  CPPTYPE_ENUM = 8, // TYPE_ENUM
562  CPPTYPE_STRING = 9, // TYPE_STRING, TYPE_BYTES
563  CPPTYPE_MESSAGE = 10, // TYPE_MESSAGE, TYPE_GROUP
564 
565  MAX_CPPTYPE = 10, // Constant useful for defining lookup tables
566  // indexed by CppType.
567  };
568 
569  // Identifies whether the field is optional, required, or repeated. 0 is
570  // reserved for errors.
571  enum Label {
572  LABEL_OPTIONAL = 1, // optional
573  LABEL_REQUIRED = 2, // required
574  LABEL_REPEATED = 3, // repeated
575 
576  MAX_LABEL = 3, // Constant useful for defining lookup tables
577  // indexed by Label.
578  };
579 
580  // Valid field numbers are positive integers up to kMaxNumber.
581  static const int kMaxNumber = (1 << 29) - 1;
582 
583  // First field number reserved for the protocol buffer library implementation.
584  // Users may not declare fields that use reserved numbers.
585  static const int kFirstReservedNumber = 19000;
586  // Last field number reserved for the protocol buffer library implementation.
587  // Users may not declare fields that use reserved numbers.
588  static const int kLastReservedNumber = 19999;
589 
590  const std::string& name() const; // Name of this field within the message.
591  const std::string& full_name() const; // Fully-qualified name of the field.
592  const std::string& json_name() const; // JSON name of this field.
593  const FileDescriptor* file() const; // File in which this field was defined.
594  bool is_extension() const; // Is this an extension field?
595  int number() const; // Declared tag number.
596 
597  // Same as name() except converted to lower-case. This (and especially the
598  // FindFieldByLowercaseName() method) can be useful when parsing formats
599  // which prefer to use lowercase naming style. (Although, technically
600  // field names should be lowercased anyway according to the protobuf style
601  // guide, so this only makes a difference when dealing with old .proto files
602  // which do not follow the guide.)
603  const std::string& lowercase_name() const;
604 
605  // Same as name() except converted to camel-case. In this conversion, any
606  // time an underscore appears in the name, it is removed and the next
607  // letter is capitalized. Furthermore, the first letter of the name is
608  // lower-cased. Examples:
609  // FooBar -> fooBar
610  // foo_bar -> fooBar
611  // fooBar -> fooBar
612  // This (and especially the FindFieldByCamelcaseName() method) can be useful
613  // when parsing formats which prefer to use camel-case naming style.
614  const std::string& camelcase_name() const;
615 
616  Type type() const; // Declared type of this field.
617  const char* type_name() const; // Name of the declared type.
618  CppType cpp_type() const; // C++ type of this field.
619  const char* cpp_type_name() const; // Name of the C++ type.
620  Label label() const; // optional/required/repeated
621 
622  bool is_required() const; // shorthand for label() == LABEL_REQUIRED
623  bool is_optional() const; // shorthand for label() == LABEL_OPTIONAL
624  bool is_repeated() const; // shorthand for label() == LABEL_REPEATED
625  bool is_packable() const; // shorthand for is_repeated() &&
626  // IsTypePackable(type())
627  bool is_packed() const; // shorthand for is_packable() &&
628  // options().packed()
629  bool is_map() const; // shorthand for type() == TYPE_MESSAGE &&
630  // message_type()->options().map_entry()
631 
632  // Index of this field within the message's field array, or the file or
633  // extension scope's extensions array.
634  int index() const;
635 
636  // Does this field have an explicitly-declared default value?
637  bool has_default_value() const;
638 
639  // Whether the user has specified the json_name field option in the .proto
640  // file.
641  bool has_json_name() const;
642 
643  // Get the field default value if cpp_type() == CPPTYPE_INT32. If no
644  // explicit default was defined, the default is 0.
645  int32 default_value_int32() const;
646  // Get the field default value if cpp_type() == CPPTYPE_INT64. If no
647  // explicit default was defined, the default is 0.
648  int64 default_value_int64() const;
649  // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no
650  // explicit default was defined, the default is 0.
651  uint32 default_value_uint32() const;
652  // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no
653  // explicit default was defined, the default is 0.
654  uint64 default_value_uint64() const;
655  // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no
656  // explicit default was defined, the default is 0.0.
657  float default_value_float() const;
658  // Get the field default value if cpp_type() == CPPTYPE_DOUBLE. If no
659  // explicit default was defined, the default is 0.0.
660  double default_value_double() const;
661  // Get the field default value if cpp_type() == CPPTYPE_BOOL. If no
662  // explicit default was defined, the default is false.
663  bool default_value_bool() const;
664  // Get the field default value if cpp_type() == CPPTYPE_ENUM. If no
665  // explicit default was defined, the default is the first value defined
666  // in the enum type (all enum types are required to have at least one value).
667  // This never returns nullptr.
668  const EnumValueDescriptor* default_value_enum() const;
669  // Get the field default value if cpp_type() == CPPTYPE_STRING. If no
670  // explicit default was defined, the default is the empty string.
671  const std::string& default_value_string() const;
672 
673  // The Descriptor for the message of which this is a field. For extensions,
674  // this is the extended type. Never nullptr.
675  const Descriptor* containing_type() const;
676 
677  // If the field is a member of a oneof, this is the one, otherwise this is
678  // nullptr.
679  const OneofDescriptor* containing_oneof() const;
680 
681  // If the field is a member of a oneof, returns the index in that oneof.
682  int index_in_oneof() const;
683 
684  // An extension may be declared within the scope of another message. If this
685  // field is an extension (is_extension() is true), then extension_scope()
686  // returns that message, or nullptr if the extension was declared at global
687  // scope. If this is not an extension, extension_scope() is undefined (may
688  // assert-fail).
689  const Descriptor* extension_scope() const;
690 
691  // If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the
692  // message or the group type. Otherwise, returns null.
693  const Descriptor* message_type() const;
694  // If type is TYPE_ENUM, returns a descriptor for the enum. Otherwise,
695  // returns null.
696  const EnumDescriptor* enum_type() const;
697 
698  // Get the FieldOptions for this field. This includes things listed in
699  // square brackets after the field definition. E.g., the field:
700  // optional string text = 1 [ctype=CORD];
701  // has the "ctype" option set. Allowed options are defined by FieldOptions in
702  // descriptor.proto, and any available extensions of that message.
703  const FieldOptions& options() const;
704 
705  // See Descriptor::CopyTo().
706  void CopyTo(FieldDescriptorProto* proto) const;
707 
708  // See Descriptor::DebugString().
709  std::string DebugString() const;
710 
711  // See Descriptor::DebugStringWithOptions().
712  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
713 
714  // Helper method to get the CppType for a particular Type.
715  static CppType TypeToCppType(Type type);
716 
717  // Helper method to get the name of a Type.
718  static const char* TypeName(Type type);
719 
720  // Helper method to get the name of a CppType.
721  static const char* CppTypeName(CppType cpp_type);
722 
723  // Return true iff [packed = true] is valid for fields of this type.
724  static inline bool IsTypePackable(Type field_type);
725 
726  // Returns full_name() except if the field is a MessageSet extension,
727  // in which case it returns the full_name() of the containing message type
728  // for backwards compatibility with proto1.
729  //
730  // A MessageSet extension is defined as an optional message extension
731  // whose containing type has the message_set_wire_format option set.
732  // This should be true of extensions of google.protobuf.bridge.MessageSet;
733  // by convention, such extensions are named "message_set_extension".
734  //
735  // The opposite operation (looking up an extension's FieldDescriptor given
736  // its printable name) can be accomplished with
737  // message->file()->pool()->FindExtensionByPrintableName(message, name)
738  // where the extension extends "message".
739  const std::string& PrintableNameForExtension() const;
740 
741  // Source Location ---------------------------------------------------
742 
743  // Updates |*out_location| to the source location of the complete
744  // extent of this field declaration. Returns false and leaves
745  // |*out_location| unchanged iff location information was not available.
746  bool GetSourceLocation(SourceLocation* out_location) const;
747 
748  private:
750 
751  // Allows access to GetLocationPath for annotations.
752  friend class io::Printer;
754 
755  // Fill the json_name field of FieldDescriptorProto.
756  void CopyJsonNameTo(FieldDescriptorProto* proto) const;
757 
758  // See Descriptor::DebugString().
759  enum PrintLabelFlag { PRINT_LABEL, OMIT_LABEL };
760  void DebugString(int depth, PrintLabelFlag print_label_flag,
761  std::string* contents,
762  const DebugStringOptions& options) const;
763 
764  // formats the default value appropriately and returns it as a string.
765  // Must have a default value to call this. If quote_string_type is true, then
766  // types of CPPTYPE_STRING whill be surrounded by quotes and CEscaped.
767  std::string DefaultValueAsString(bool quote_string_type) const;
768 
769  // Helper function that returns the field type name for DebugString.
770  std::string FieldTypeNameDebugString() const;
771 
772  // Walks up the descriptor tree to generate the source location path
773  // to this descriptor from the file root.
774  void GetLocationPath(std::vector<int>* output) const;
775 
776  // Returns true if this is a map message type.
777  bool is_map_message_type() const;
778 
783  // If has_json_name_ is true, it's the value specified by the user.
784  // Otherwise, it has the same value as camelcase_name_.
788  static void TypeOnceInit(const FieldDescriptor* to_init);
789  void InternalTypeOnceInit() const;
790  mutable Type type_;
793  // Whether the user has specified the json_name field option in the .proto
794  // file.
797  int number_;
802  mutable const Descriptor* message_type_;
803  mutable const EnumDescriptor* enum_type_;
807  // IMPORTANT: If you add a new field, make sure to search for all instances
808  // of Allocate<FieldDescriptor>() and AllocateArray<FieldDescriptor>() in
809  // descriptor.cc and update them to initialize the field.
810 
811  union {
819 
822  };
823 
824  static const CppType kTypeToCppTypeMap[MAX_TYPE + 1];
825 
826  static const char* const kTypeToName[MAX_TYPE + 1];
827 
828  static const char* const kCppTypeToName[MAX_CPPTYPE + 1];
829 
830  static const char* const kLabelToName[MAX_LABEL + 1];
831 
832  // Must be constructed using DescriptorPool.
834  friend class DescriptorBuilder;
835  friend class FileDescriptor;
836  friend class Descriptor;
837  friend class OneofDescriptor;
839 };
840 
841 
842 // Describes a oneof defined in a message type.
843 class PROTOBUF_EXPORT OneofDescriptor {
844  public:
846 
847  const std::string& name() const; // Name of this oneof.
848  const std::string& full_name() const; // Fully-qualified name of the oneof.
849 
850  // Index of this oneof within the message's oneof array.
851  int index() const;
852 
853  // The .proto file in which this oneof was defined. Never nullptr.
854  const FileDescriptor* file() const;
855  // The Descriptor for the message containing this oneof.
856  const Descriptor* containing_type() const;
857 
858  // The number of (non-extension) fields which are members of this oneof.
859  int field_count() const;
860  // Get a member of this oneof, in the order in which they were declared in the
861  // .proto file. Does not include extensions.
862  const FieldDescriptor* field(int index) const;
863 
864  const OneofOptions& options() const;
865 
866  // See Descriptor::CopyTo().
867  void CopyTo(OneofDescriptorProto* proto) const;
868 
869  // See Descriptor::DebugString().
870  std::string DebugString() const;
871 
872  // See Descriptor::DebugStringWithOptions().
873  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
874 
875  // Source Location ---------------------------------------------------
876 
877  // Updates |*out_location| to the source location of the complete
878  // extent of this oneof declaration. Returns false and leaves
879  // |*out_location| unchanged iff location information was not available.
880  bool GetSourceLocation(SourceLocation* out_location) const;
881 
882  private:
884 
885  // Allows access to GetLocationPath for annotations.
886  friend class io::Printer;
888 
889  // See Descriptor::DebugString().
890  void DebugString(int depth, std::string* contents,
891  const DebugStringOptions& options) const;
892 
893  // Walks up the descriptor tree to generate the source location path
894  // to this descriptor from the file root.
895  void GetLocationPath(std::vector<int>* output) const;
896 
903 
904  // IMPORTANT: If you add a new field, make sure to search for all instances
905  // of Allocate<OneofDescriptor>() and AllocateArray<OneofDescriptor>()
906  // in descriptor.cc and update them to initialize the field.
907 
908  // Must be constructed using DescriptorPool.
910  friend class DescriptorBuilder;
911  friend class Descriptor;
913 };
914 
915 // Describes an enum type defined in a .proto file. To get the EnumDescriptor
916 // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool
917 // to construct your own descriptors.
918 class PROTOBUF_EXPORT EnumDescriptor {
919  public:
921 
922  // The name of this enum type in the containing scope.
923  const std::string& name() const;
924 
925  // The fully-qualified name of the enum type, scope delimited by periods.
926  const std::string& full_name() const;
927 
928  // Index of this enum within the file or containing message's enum array.
929  int index() const;
930 
931  // The .proto file in which this enum type was defined. Never nullptr.
932  const FileDescriptor* file() const;
933 
934  // The number of values for this EnumDescriptor. Guaranteed to be greater
935  // than zero.
936  int value_count() const;
937  // Gets a value by index, where 0 <= index < value_count().
938  // These are returned in the order they were defined in the .proto file.
939  const EnumValueDescriptor* value(int index) const;
940 
941  // Looks up a value by name. Returns nullptr if no such value exists.
942  const EnumValueDescriptor* FindValueByName(const std::string& name) const;
943  // Looks up a value by number. Returns nullptr if no such value exists. If
944  // multiple values have this number, the first one defined is returned.
945  const EnumValueDescriptor* FindValueByNumber(int number) const;
946 
947  // If this enum type is nested in a message type, this is that message type.
948  // Otherwise, nullptr.
949  const Descriptor* containing_type() const;
950 
951  // Get options for this enum type. These are specified in the .proto file by
952  // placing lines like "option foo = 1234;" in the enum definition. Allowed
953  // options are defined by EnumOptions in descriptor.proto, and any available
954  // extensions of that message.
955  const EnumOptions& options() const;
956 
957  // See Descriptor::CopyTo().
958  void CopyTo(EnumDescriptorProto* proto) const;
959 
960  // See Descriptor::DebugString().
961  std::string DebugString() const;
962 
963  // See Descriptor::DebugStringWithOptions().
964  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
965 
966  // Returns true if this is a placeholder for an unknown enum. This will
967  // only be the case if this descriptor comes from a DescriptorPool
968  // with AllowUnknownDependencies() set.
969  bool is_placeholder() const;
970 
971  // Reserved fields -------------------------------------------------
972 
973  // A range of reserved field numbers.
974  struct ReservedRange {
975  int start; // inclusive
976  int end; // inclusive
977  };
978 
979  // The number of reserved ranges in this message type.
980  int reserved_range_count() const;
981  // Gets an reserved range by index, where 0 <= index <
982  // reserved_range_count(). These are returned in the order they were defined
983  // in the .proto file.
984  const EnumDescriptor::ReservedRange* reserved_range(int index) const;
985 
986  // Returns true if the number is in one of the reserved ranges.
987  bool IsReservedNumber(int number) const;
988 
989  // Returns nullptr if no reserved range contains the given number.
990  const EnumDescriptor::ReservedRange* FindReservedRangeContainingNumber(
991  int number) const;
992 
993  // The number of reserved field names in this message type.
994  int reserved_name_count() const;
995 
996  // Gets a reserved name by index, where 0 <= index < reserved_name_count().
997  const std::string& reserved_name(int index) const;
998 
999  // Returns true if the field name is reserved.
1000  bool IsReservedName(const std::string& name) const;
1001 
1002  // Source Location ---------------------------------------------------
1003 
1004  // Updates |*out_location| to the source location of the complete
1005  // extent of this enum declaration. Returns false and leaves
1006  // |*out_location| unchanged iff location information was not available.
1007  bool GetSourceLocation(SourceLocation* out_location) const;
1008 
1009  private:
1011 
1012  // Allows access to GetLocationPath for annotations.
1013  friend class io::Printer;
1015 
1016  // Looks up a value by number. If the value does not exist, dynamically
1017  // creates a new EnumValueDescriptor for that value, assuming that it was
1018  // unknown. If a new descriptor is created, this is done in a thread-safe way,
1019  // and future calls will return the same value descriptor pointer.
1020  //
1021  // This is private but is used by Reflection (which is friended below) to
1022  // return a valid EnumValueDescriptor from GetEnum() when this feature is
1023  // enabled.
1024  const EnumValueDescriptor* FindValueByNumberCreatingIfUnknown(
1025  int number) const;
1026 
1027  // See Descriptor::DebugString().
1028  void DebugString(int depth, std::string* contents,
1029  const DebugStringOptions& options) const;
1030 
1031  // Walks up the descriptor tree to generate the source location path
1032  // to this descriptor from the file root.
1033  void GetLocationPath(std::vector<int>* output) const;
1034 
1040 
1041  // True if this is a placeholder for an unknown type.
1043  // True if this is a placeholder and the type name wasn't fully-qualified.
1045 
1048 
1051  EnumDescriptor::ReservedRange* reserved_ranges_;
1053 
1054  // IMPORTANT: If you add a new field, make sure to search for all instances
1055  // of Allocate<EnumDescriptor>() and AllocateArray<EnumDescriptor>() in
1056  // descriptor.cc and update them to initialize the field.
1057 
1058  // Must be constructed using DescriptorPool.
1060  friend class DescriptorBuilder;
1061  friend class Descriptor;
1062  friend class FieldDescriptor;
1063  friend class EnumValueDescriptor;
1064  friend class FileDescriptor;
1065  friend class DescriptorPool;
1066  friend class Reflection;
1068 };
1069 
1070 // Describes an individual enum constant of a particular type. To get the
1071 // EnumValueDescriptor for a given enum value, first get the EnumDescriptor
1072 // for its type, then use EnumDescriptor::FindValueByName() or
1073 // EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct
1074 // your own descriptors.
1075 class PROTOBUF_EXPORT EnumValueDescriptor {
1076  public:
1078 
1079  const std::string& name() const; // Name of this enum constant.
1080  int index() const; // Index within the enums's Descriptor.
1081  int number() const; // Numeric value of this enum constant.
1082 
1083  // The full_name of an enum value is a sibling symbol of the enum type.
1084  // e.g. the full name of FieldDescriptorProto::TYPE_INT32 is actually
1085  // "google.protobuf.FieldDescriptorProto.TYPE_INT32", NOT
1086  // "google.protobuf.FieldDescriptorProto.Type.TYPE_INT32". This is to conform
1087  // with C++ scoping rules for enums.
1088  const std::string& full_name() const;
1089 
1090  // The .proto file in which this value was defined. Never nullptr.
1091  const FileDescriptor* file() const;
1092  // The type of this value. Never nullptr.
1093  const EnumDescriptor* type() const;
1094 
1095  // Get options for this enum value. These are specified in the .proto file by
1096  // adding text like "[foo = 1234]" after an enum value definition. Allowed
1097  // options are defined by EnumValueOptions in descriptor.proto, and any
1098  // available extensions of that message.
1099  const EnumValueOptions& options() const;
1100 
1101  // See Descriptor::CopyTo().
1102  void CopyTo(EnumValueDescriptorProto* proto) const;
1103 
1104  // See Descriptor::DebugString().
1105  std::string DebugString() const;
1106 
1107  // See Descriptor::DebugStringWithOptions().
1108  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
1109 
1110  // Source Location ---------------------------------------------------
1111 
1112  // Updates |*out_location| to the source location of the complete
1113  // extent of this enum value declaration. Returns false and leaves
1114  // |*out_location| unchanged iff location information was not available.
1115  bool GetSourceLocation(SourceLocation* out_location) const;
1116 
1117  private:
1119 
1120  // Allows access to GetLocationPath for annotations.
1121  friend class io::Printer;
1123 
1124  // See Descriptor::DebugString().
1125  void DebugString(int depth, std::string* contents,
1126  const DebugStringOptions& options) const;
1127 
1128  // Walks up the descriptor tree to generate the source location path
1129  // to this descriptor from the file root.
1130  void GetLocationPath(std::vector<int>* output) const;
1131 
1134  int number_;
1137  // IMPORTANT: If you add a new field, make sure to search for all instances
1138  // of Allocate<EnumValueDescriptor>() and AllocateArray<EnumValueDescriptor>()
1139  // in descriptor.cc and update them to initialize the field.
1140 
1141  // Must be constructed using DescriptorPool.
1143  friend class DescriptorBuilder;
1144  friend class EnumDescriptor;
1145  friend class DescriptorPool;
1146  friend class FileDescriptorTables;
1148 };
1149 
1150 // Describes an RPC service. Use DescriptorPool to construct your own
1151 // descriptors.
1152 class PROTOBUF_EXPORT ServiceDescriptor {
1153  public:
1155 
1156  // The name of the service, not including its containing scope.
1157  const std::string& name() const;
1158  // The fully-qualified name of the service, scope delimited by periods.
1159  const std::string& full_name() const;
1160  // Index of this service within the file's services array.
1161  int index() const;
1162 
1163  // The .proto file in which this service was defined. Never nullptr.
1164  const FileDescriptor* file() const;
1165 
1166  // Get options for this service type. These are specified in the .proto file
1167  // by placing lines like "option foo = 1234;" in the service definition.
1168  // Allowed options are defined by ServiceOptions in descriptor.proto, and any
1169  // available extensions of that message.
1170  const ServiceOptions& options() const;
1171 
1172  // The number of methods this service defines.
1173  int method_count() const;
1174  // Gets a MethodDescriptor by index, where 0 <= index < method_count().
1175  // These are returned in the order they were defined in the .proto file.
1176  const MethodDescriptor* method(int index) const;
1177 
1178  // Look up a MethodDescriptor by name.
1179  const MethodDescriptor* FindMethodByName(const std::string& name) const;
1180  // See Descriptor::CopyTo().
1181  void CopyTo(ServiceDescriptorProto* proto) const;
1182 
1183  // See Descriptor::DebugString().
1184  std::string DebugString() const;
1185 
1186  // See Descriptor::DebugStringWithOptions().
1187  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
1188 
1189  // Source Location ---------------------------------------------------
1190 
1191  // Updates |*out_location| to the source location of the complete
1192  // extent of this service declaration. Returns false and leaves
1193  // |*out_location| unchanged iff location information was not available.
1194  bool GetSourceLocation(SourceLocation* out_location) const;
1195 
1196  private:
1198 
1199  // Allows access to GetLocationPath for annotations.
1200  friend class io::Printer;
1202 
1203  // See Descriptor::DebugString().
1204  void DebugString(std::string* contents,
1205  const DebugStringOptions& options) const;
1206 
1207  // Walks up the descriptor tree to generate the source location path
1208  // to this descriptor from the file root.
1209  void GetLocationPath(std::vector<int>* output) const;
1210 
1217  // IMPORTANT: If you add a new field, make sure to search for all instances
1218  // of Allocate<ServiceDescriptor>() and AllocateArray<ServiceDescriptor>() in
1219  // descriptor.cc and update them to initialize the field.
1220 
1221  // Must be constructed using DescriptorPool.
1223  friend class DescriptorBuilder;
1224  friend class FileDescriptor;
1225  friend class MethodDescriptor;
1227 };
1228 
1229 
1230 // Describes an individual service method. To obtain a MethodDescriptor given
1231 // a service, first get its ServiceDescriptor, then call
1232 // ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your
1233 // own descriptors.
1234 class PROTOBUF_EXPORT MethodDescriptor {
1235  public:
1237 
1238  // Name of this method, not including containing scope.
1239  const std::string& name() const;
1240  // The fully-qualified name of the method, scope delimited by periods.
1241  const std::string& full_name() const;
1242  // Index within the service's Descriptor.
1243  int index() const;
1244 
1245  // The .proto file in which this method was defined. Never nullptr.
1246  const FileDescriptor* file() const;
1247  // Gets the service to which this method belongs. Never nullptr.
1248  const ServiceDescriptor* service() const;
1249 
1250  // Gets the type of protocol message which this method accepts as input.
1251  const Descriptor* input_type() const;
1252  // Gets the type of protocol message which this message produces as output.
1253  const Descriptor* output_type() const;
1254 
1255  // Gets whether the client streams multiple requests.
1256  bool client_streaming() const;
1257  // Gets whether the server streams multiple responses.
1258  bool server_streaming() const;
1259 
1260  // Get options for this method. These are specified in the .proto file by
1261  // placing lines like "option foo = 1234;" in curly-braces after a method
1262  // declaration. Allowed options are defined by MethodOptions in
1263  // descriptor.proto, and any available extensions of that message.
1264  const MethodOptions& options() const;
1265 
1266  // See Descriptor::CopyTo().
1267  void CopyTo(MethodDescriptorProto* proto) const;
1268 
1269  // See Descriptor::DebugString().
1270  std::string DebugString() const;
1271 
1272  // See Descriptor::DebugStringWithOptions().
1273  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
1274 
1275  // Source Location ---------------------------------------------------
1276 
1277  // Updates |*out_location| to the source location of the complete
1278  // extent of this method declaration. Returns false and leaves
1279  // |*out_location| unchanged iff location information was not available.
1280  bool GetSourceLocation(SourceLocation* out_location) const;
1281 
1282  private:
1284 
1285  // Allows access to GetLocationPath for annotations.
1286  friend class io::Printer;
1288 
1289  // See Descriptor::DebugString().
1290  void DebugString(int depth, std::string* contents,
1291  const DebugStringOptions& options) const;
1292 
1293  // Walks up the descriptor tree to generate the source location path
1294  // to this descriptor from the file root.
1295  void GetLocationPath(std::vector<int>* output) const;
1296 
1305  // IMPORTANT: If you add a new field, make sure to search for all instances
1306  // of Allocate<MethodDescriptor>() and AllocateArray<MethodDescriptor>() in
1307  // descriptor.cc and update them to initialize the field.
1308 
1309  // Must be constructed using DescriptorPool.
1311  friend class DescriptorBuilder;
1312  friend class ServiceDescriptor;
1314 };
1315 
1316 
1317 // Describes a whole .proto file. To get the FileDescriptor for a compiled-in
1318 // file, get the descriptor for something defined in that file and call
1319 // descriptor->file(). Use DescriptorPool to construct your own descriptors.
1320 class PROTOBUF_EXPORT FileDescriptor {
1321  public:
1323 
1324  // The filename, relative to the source tree.
1325  // e.g. "foo/bar/baz.proto"
1326  const std::string& name() const;
1327 
1328  // The package, e.g. "google.protobuf.compiler".
1329  const std::string& package() const;
1330 
1331  // The DescriptorPool in which this FileDescriptor and all its contents were
1332  // allocated. Never nullptr.
1333  const DescriptorPool* pool() const;
1334 
1335  // The number of files imported by this one.
1336  int dependency_count() const;
1337  // Gets an imported file by index, where 0 <= index < dependency_count().
1338  // These are returned in the order they were defined in the .proto file.
1339  const FileDescriptor* dependency(int index) const;
1340 
1341  // The number of files public imported by this one.
1342  // The public dependency list is a subset of the dependency list.
1343  int public_dependency_count() const;
1344  // Gets a public imported file by index, where 0 <= index <
1345  // public_dependency_count().
1346  // These are returned in the order they were defined in the .proto file.
1347  const FileDescriptor* public_dependency(int index) const;
1348 
1349  // The number of files that are imported for weak fields.
1350  // The weak dependency list is a subset of the dependency list.
1351  int weak_dependency_count() const;
1352  // Gets a weak imported file by index, where 0 <= index <
1353  // weak_dependency_count().
1354  // These are returned in the order they were defined in the .proto file.
1355  const FileDescriptor* weak_dependency(int index) const;
1356 
1357  // Number of top-level message types defined in this file. (This does not
1358  // include nested types.)
1359  int message_type_count() const;
1360  // Gets a top-level message type, where 0 <= index < message_type_count().
1361  // These are returned in the order they were defined in the .proto file.
1362  const Descriptor* message_type(int index) const;
1363 
1364  // Number of top-level enum types defined in this file. (This does not
1365  // include nested types.)
1366  int enum_type_count() const;
1367  // Gets a top-level enum type, where 0 <= index < enum_type_count().
1368  // These are returned in the order they were defined in the .proto file.
1369  const EnumDescriptor* enum_type(int index) const;
1370 
1371  // Number of services defined in this file.
1372  int service_count() const;
1373  // Gets a service, where 0 <= index < service_count().
1374  // These are returned in the order they were defined in the .proto file.
1375  const ServiceDescriptor* service(int index) const;
1376 
1377  // Number of extensions defined at file scope. (This does not include
1378  // extensions nested within message types.)
1379  int extension_count() const;
1380  // Gets an extension's descriptor, where 0 <= index < extension_count().
1381  // These are returned in the order they were defined in the .proto file.
1382  const FieldDescriptor* extension(int index) const;
1383 
1384  // Get options for this file. These are specified in the .proto file by
1385  // placing lines like "option foo = 1234;" at the top level, outside of any
1386  // other definitions. Allowed options are defined by FileOptions in
1387  // descriptor.proto, and any available extensions of that message.
1388  const FileOptions& options() const;
1389 
1390  // Syntax of this file.
1391  enum Syntax {
1392  SYNTAX_UNKNOWN = 0,
1395  };
1396  Syntax syntax() const;
1397  static const char* SyntaxName(Syntax syntax);
1398 
1399  // Find a top-level message type by name. Returns nullptr if not found.
1400  const Descriptor* FindMessageTypeByName(const std::string& name) const;
1401  // Find a top-level enum type by name. Returns nullptr if not found.
1402  const EnumDescriptor* FindEnumTypeByName(const std::string& name) const;
1403  // Find an enum value defined in any top-level enum by name. Returns nullptr
1404  // if not found.
1405  const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const;
1406  // Find a service definition by name. Returns nullptr if not found.
1407  const ServiceDescriptor* FindServiceByName(const std::string& name) const;
1408  // Find a top-level extension definition by name. Returns nullptr if not
1409  // found.
1410  const FieldDescriptor* FindExtensionByName(const std::string& name) const;
1411  // Similar to FindExtensionByName(), but searches by lowercased-name. See
1412  // Descriptor::FindFieldByLowercaseName().
1413  const FieldDescriptor* FindExtensionByLowercaseName(
1414  const std::string& name) const;
1415  // Similar to FindExtensionByName(), but searches by camelcased-name. See
1416  // Descriptor::FindFieldByCamelcaseName().
1417  const FieldDescriptor* FindExtensionByCamelcaseName(
1418  const std::string& name) const;
1419 
1420  // See Descriptor::CopyTo().
1421  // Notes:
1422  // - This method does NOT copy source code information since it is relatively
1423  // large and rarely needed. See CopySourceCodeInfoTo() below.
1424  void CopyTo(FileDescriptorProto* proto) const;
1425  // Write the source code information of this FileDescriptor into the given
1426  // FileDescriptorProto. See CopyTo() above.
1427  void CopySourceCodeInfoTo(FileDescriptorProto* proto) const;
1428  // Fill the json_name field of FieldDescriptorProto for all fields. Can only
1429  // be called after CopyTo().
1430  void CopyJsonNameTo(FileDescriptorProto* proto) const;
1431 
1432  // See Descriptor::DebugString().
1433  std::string DebugString() const;
1434 
1435  // See Descriptor::DebugStringWithOptions().
1436  std::string DebugStringWithOptions(const DebugStringOptions& options) const;
1437 
1438  // Returns true if this is a placeholder for an unknown file. This will
1439  // only be the case if this descriptor comes from a DescriptorPool
1440  // with AllowUnknownDependencies() set.
1441  bool is_placeholder() const;
1442 
1443  // Updates |*out_location| to the source location of the complete extent of
1444  // this file declaration (namely, the empty path).
1445  bool GetSourceLocation(SourceLocation* out_location) const;
1446 
1447  // Updates |*out_location| to the source location of the complete
1448  // extent of the declaration or declaration-part denoted by |path|.
1449  // Returns false and leaves |*out_location| unchanged iff location
1450  // information was not available. (See SourceCodeInfo for
1451  // description of path encoding.)
1452  bool GetSourceLocation(const std::vector<int>& path,
1453  SourceLocation* out_location) const;
1454 
1455  private:
1457 
1462  static void DependenciesOnceInit(const FileDescriptor* to_init);
1463  void InternalDependenciesOnceInit() const;
1464 
1465  // These are arranged to minimze padding on 64-bit.
1475 
1476  // Indicates the FileDescriptor is completed building. Used to verify
1477  // that type accessor functions that can possibly build a dependent file
1478  // aren't called during the process of building the file.
1480 
1490 
1493 
1494  // IMPORTANT: If you add a new field, make sure to search for all instances
1495  // of Allocate<FileDescriptor>() and AllocateArray<FileDescriptor>() in
1496  // descriptor.cc and update them to initialize the field.
1497 
1499  friend class DescriptorBuilder;
1500  friend class DescriptorPool;
1501  friend class Descriptor;
1502  friend class FieldDescriptor;
1504  friend class OneofDescriptor;
1505  friend class EnumDescriptor;
1506  friend class EnumValueDescriptor;
1507  friend class MethodDescriptor;
1508  friend class ServiceDescriptor;
1510 };
1511 
1512 
1513 // ===================================================================
1514 
1515 // Used to construct descriptors.
1516 //
1517 // Normally you won't want to build your own descriptors. Message classes
1518 // constructed by the protocol compiler will provide them for you. However,
1519 // if you are implementing Message on your own, or if you are writing a
1520 // program which can operate on totally arbitrary types and needs to load
1521 // them from some sort of database, you might need to.
1522 //
1523 // Since Descriptors are composed of a whole lot of cross-linked bits of
1524 // data that would be a pain to put together manually, the
1525 // DescriptorPool class is provided to make the process easier. It can
1526 // take a FileDescriptorProto (defined in descriptor.proto), validate it,
1527 // and convert it to a set of nicely cross-linked Descriptors.
1528 //
1529 // DescriptorPool also helps with memory management. Descriptors are
1530 // composed of many objects containing static data and pointers to each
1531 // other. In all likelihood, when it comes time to delete this data,
1532 // you'll want to delete it all at once. In fact, it is not uncommon to
1533 // have a whole pool of descriptors all cross-linked with each other which
1534 // you wish to delete all at once. This class represents such a pool, and
1535 // handles the memory management for you.
1536 //
1537 // You can also search for descriptors within a DescriptorPool by name, and
1538 // extensions by number.
1539 class PROTOBUF_EXPORT DescriptorPool {
1540  public:
1541  // Create a normal, empty DescriptorPool.
1542  DescriptorPool();
1543 
1544  // Constructs a DescriptorPool that, when it can't find something among the
1545  // descriptors already in the pool, looks for it in the given
1546  // DescriptorDatabase.
1547  // Notes:
1548  // - If a DescriptorPool is constructed this way, its BuildFile*() methods
1549  // must not be called (they will assert-fail). The only way to populate
1550  // the pool with descriptors is to call the Find*By*() methods.
1551  // - The Find*By*() methods may block the calling thread if the
1552  // DescriptorDatabase blocks. This in turn means that parsing messages
1553  // may block if they need to look up extensions.
1554  // - The Find*By*() methods will use mutexes for thread-safety, thus making
1555  // them slower even when they don't have to fall back to the database.
1556  // In fact, even the Find*By*() methods of descriptor objects owned by
1557  // this pool will be slower, since they will have to obtain locks too.
1558  // - An ErrorCollector may optionally be given to collect validation errors
1559  // in files loaded from the database. If not given, errors will be printed
1560  // to GOOGLE_LOG(ERROR). Remember that files are built on-demand, so this
1561  // ErrorCollector may be called from any thread that calls one of the
1562  // Find*By*() methods.
1563  // - The DescriptorDatabase must not be mutated during the lifetime of
1564  // the DescriptorPool. Even if the client takes care to avoid data races,
1565  // changes to the content of the DescriptorDatabase may not be reflected
1566  // in subsequent lookups in the DescriptorPool.
1567  class ErrorCollector;
1568  explicit DescriptorPool(DescriptorDatabase* fallback_database,
1569  ErrorCollector* error_collector = nullptr);
1570 
1571  ~DescriptorPool();
1572 
1573  // Get a pointer to the generated pool. Generated protocol message classes
1574  // which are compiled into the binary will allocate their descriptors in
1575  // this pool. Do not add your own descriptors to this pool.
1576  static const DescriptorPool* generated_pool();
1577 
1578 
1579  // Find a FileDescriptor in the pool by file name. Returns nullptr if not
1580  // found.
1581  const FileDescriptor* FindFileByName(const std::string& name) const;
1582 
1583  // Find the FileDescriptor in the pool which defines the given symbol.
1584  // If any of the Find*ByName() methods below would succeed, then this is
1585  // equivalent to calling that method and calling the result's file() method.
1586  // Otherwise this returns nullptr.
1588  const std::string& symbol_name) const;
1589 
1590  // Looking up descriptors ------------------------------------------
1591  // These find descriptors by fully-qualified name. These will find both
1592  // top-level descriptors and nested descriptors. They return nullptr if not
1593  // found.
1594 
1595  const Descriptor* FindMessageTypeByName(const std::string& name) const;
1596  const FieldDescriptor* FindFieldByName(const std::string& name) const;
1597  const FieldDescriptor* FindExtensionByName(const std::string& name) const;
1598  const OneofDescriptor* FindOneofByName(const std::string& name) const;
1599  const EnumDescriptor* FindEnumTypeByName(const std::string& name) const;
1600  const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const;
1601  const ServiceDescriptor* FindServiceByName(const std::string& name) const;
1602  const MethodDescriptor* FindMethodByName(const std::string& name) const;
1603 
1604  // Finds an extension of the given type by number. The extendee must be
1605  // a member of this DescriptorPool or one of its underlays.
1606  const FieldDescriptor* FindExtensionByNumber(const Descriptor* extendee,
1607  int number) const;
1608 
1609  // Finds an extension of the given type by its printable name.
1610  // See comments above PrintableNameForExtension() for the definition of
1611  // "printable name". The extendee must be a member of this DescriptorPool
1612  // or one of its underlays. Returns nullptr if there is no known message
1613  // extension with the given printable name.
1614  const FieldDescriptor* FindExtensionByPrintableName(
1615  const Descriptor* extendee, const std::string& printable_name) const;
1616 
1617  // Finds extensions of extendee. The extensions will be appended to
1618  // out in an undefined order. Only extensions defined directly in
1619  // this DescriptorPool or one of its underlays are guaranteed to be
1620  // found: extensions defined in the fallback database might not be found
1621  // depending on the database implementation.
1622  void FindAllExtensions(const Descriptor* extendee,
1623  std::vector<const FieldDescriptor*>* out) const;
1624 
1625  // Building descriptors --------------------------------------------
1626 
1627  // When converting a FileDescriptorProto to a FileDescriptor, various
1628  // errors might be detected in the input. The caller may handle these
1629  // programmatically by implementing an ErrorCollector.
1630  class PROTOBUF_EXPORT ErrorCollector {
1631  public:
1632  inline ErrorCollector() {}
1633  virtual ~ErrorCollector();
1634 
1635  // These constants specify what exact part of the construct is broken.
1636  // This is useful e.g. for mapping the error back to an exact location
1637  // in a .proto file.
1639  NAME, // the symbol name, or the package name for files
1640  NUMBER, // field or extension range number
1641  TYPE, // field type
1642  EXTENDEE, // field extendee
1643  DEFAULT_VALUE, // field default value
1644  INPUT_TYPE, // method input type
1645  OUTPUT_TYPE, // method output type
1646  OPTION_NAME, // name in assignment
1647  OPTION_VALUE, // value in option assignment
1648  IMPORT, // import error
1649  OTHER // some other problem
1650  };
1651 
1652  // Reports an error in the FileDescriptorProto. Use this function if the
1653  // problem occurred should interrupt building the FileDescriptorProto.
1654  virtual void AddError(
1655  const std::string& filename, // File name in which the error occurred.
1656  const std::string& element_name, // Full name of the erroneous element.
1657  const Message* descriptor, // Descriptor of the erroneous element.
1658  ErrorLocation location, // One of the location constants, above.
1659  const std::string& message // Human-readable error message.
1660  ) = 0;
1661 
1662  // Reports a warning in the FileDescriptorProto. Use this function if the
1663  // problem occurred should NOT interrupt building the FileDescriptorProto.
1664  virtual void AddWarning(
1665  const std::string& /*filename*/, // File name in which the error
1666  // occurred.
1667  const std::string& /*element_name*/, // Full name of the erroneous
1668  // element.
1669  const Message* /*descriptor*/, // Descriptor of the erroneous element.
1670  ErrorLocation /*location*/, // One of the location constants, above.
1671  const std::string& /*message*/ // Human-readable error message.
1672  ) {}
1673 
1674  private:
1676  };
1677 
1678  // Convert the FileDescriptorProto to real descriptors and place them in
1679  // this DescriptorPool. All dependencies of the file must already be in
1680  // the pool. Returns the resulting FileDescriptor, or nullptr if there were
1681  // problems with the input (e.g. the message was invalid, or dependencies
1682  // were missing). Details about the errors are written to GOOGLE_LOG(ERROR).
1683  const FileDescriptor* BuildFile(const FileDescriptorProto& proto);
1684 
1685  // Same as BuildFile() except errors are sent to the given ErrorCollector.
1686  const FileDescriptor* BuildFileCollectingErrors(
1687  const FileDescriptorProto& proto, ErrorCollector* error_collector);
1688 
1689  // By default, it is an error if a FileDescriptorProto contains references
1690  // to types or other files that are not found in the DescriptorPool (or its
1691  // backing DescriptorDatabase, if any). If you call
1692  // AllowUnknownDependencies(), however, then unknown types and files
1693  // will be replaced by placeholder descriptors (which can be identified by
1694  // the is_placeholder() method). This can allow you to
1695  // perform some useful operations with a .proto file even if you do not
1696  // have access to other .proto files on which it depends. However, some
1697  // heuristics must be used to fill in the gaps in information, and these
1698  // can lead to descriptors which are inaccurate. For example, the
1699  // DescriptorPool may be forced to guess whether an unknown type is a message
1700  // or an enum, as well as what package it resides in. Furthermore,
1701  // placeholder types will not be discoverable via FindMessageTypeByName()
1702  // and similar methods, which could confuse some descriptor-based algorithms.
1703  // Generally, the results of this option should be handled with extreme care.
1704  void AllowUnknownDependencies() { allow_unknown_ = true; }
1705 
1706  // By default, weak imports are allowed to be missing, in which case we will
1707  // use a placeholder for the dependency and convert the field to be an Empty
1708  // message field. If you call EnforceWeakDependencies(true), however, the
1709  // DescriptorPool will report a import not found error.
1710  void EnforceWeakDependencies(bool enforce) { enforce_weak_ = enforce; }
1711 
1712  // Internal stuff --------------------------------------------------
1713  // These methods MUST NOT be called from outside the proto2 library.
1714  // These methods may contain hidden pitfalls and may be removed in a
1715  // future library version.
1716 
1717  // Create a DescriptorPool which is overlaid on top of some other pool.
1718  // If you search for a descriptor in the overlay and it is not found, the
1719  // underlay will be searched as a backup. If the underlay has its own
1720  // underlay, that will be searched next, and so on. This also means that
1721  // files built in the overlay will be cross-linked with the underlay's
1722  // descriptors if necessary. The underlay remains property of the caller;
1723  // it must remain valid for the lifetime of the newly-constructed pool.
1724  //
1725  // Example: Say you want to parse a .proto file at runtime in order to use
1726  // its type with a DynamicMessage. Say this .proto file has dependencies,
1727  // but you know that all the dependencies will be things that are already
1728  // compiled into the binary. For ease of use, you'd like to load the types
1729  // right out of generated_pool() rather than have to parse redundant copies
1730  // of all these .protos and runtime. But, you don't want to add the parsed
1731  // types directly into generated_pool(): this is not allowed, and would be
1732  // bad design anyway. So, instead, you could use generated_pool() as an
1733  // underlay for a new DescriptorPool in which you add only the new file.
1734  //
1735  // WARNING: Use of underlays can lead to many subtle gotchas. Instead,
1736  // try to formulate what you want to do in terms of DescriptorDatabases.
1737  explicit DescriptorPool(const DescriptorPool* underlay);
1738 
1739  // Called by generated classes at init time to add their descriptors to
1740  // generated_pool. Do NOT call this in your own code! filename must be a
1741  // permanent string (e.g. a string literal).
1742  static void InternalAddGeneratedFile(const void* encoded_file_descriptor,
1743  int size);
1744 
1745  // Disallow [enforce_utf8 = false] in .proto files.
1746  void DisallowEnforceUtf8() { disallow_enforce_utf8_ = true; }
1747 
1748 
1749  // For internal use only: Gets a non-const pointer to the generated pool.
1750  // This is called at static-initialization time only, so thread-safety is
1751  // not a concern. If both an underlay and a fallback database are present,
1752  // the underlay takes precedence.
1753  static DescriptorPool* internal_generated_pool();
1754 
1755  // For internal use only: Changes the behavior of BuildFile() such that it
1756  // allows the file to make reference to message types declared in other files
1757  // which it did not officially declare as dependencies.
1758  void InternalDontEnforceDependencies();
1759 
1760  // For internal use only: Enables lazy building of dependencies of a file.
1761  // Delay the building of dependencies of a file descriptor until absolutely
1762  // necessary, like when message_type() is called on a field that is defined
1763  // in that dependency's file. This will cause functional issues if a proto
1764  // or one of it's dependencies has errors. Should only be enabled for the
1765  // generated_pool_ (because no descriptor build errors are guaranteed by
1766  // the compilation generation process), testing, or if a lack of descriptor
1767  // build errors can be guaranteed for a pool.
1769  lazily_build_dependencies_ = true;
1770  // This needs to be set when lazily building dependencies, as it breaks
1771  // dependency checking.
1772  InternalDontEnforceDependencies();
1773  }
1774 
1775  // For internal use only.
1776  void internal_set_underlay(const DescriptorPool* underlay) {
1777  underlay_ = underlay;
1778  }
1779 
1780  // For internal (unit test) use only: Returns true if a FileDescriptor has
1781  // been constructed for the given file, false otherwise. Useful for testing
1782  // lazy descriptor initialization behavior.
1783  bool InternalIsFileLoaded(const std::string& filename) const;
1784 
1785  // Add a file to unused_import_track_files_. DescriptorBuilder will log
1786  // warnings for those files if there is any unused import.
1787  void AddUnusedImportTrackFile(const std::string& file_name);
1788  void ClearUnusedImportTrackFiles();
1789 
1790  private:
1791  friend class Descriptor;
1793  friend class FieldDescriptor;
1794  friend class EnumDescriptor;
1795  friend class ServiceDescriptor;
1796  friend class MethodDescriptor;
1797  friend class FileDescriptor;
1798  friend class StreamDescriptor;
1799  friend class DescriptorBuilder;
1800  friend class FileDescriptorTables;
1801 
1802  // Return true if the given name is a sub-symbol of any non-package
1803  // descriptor that already exists in the descriptor pool. (The full
1804  // definition of such types is already known.)
1805  bool IsSubSymbolOfBuiltType(const std::string& name) const;
1806 
1807  // Tries to find something in the fallback database and link in the
1808  // corresponding proto file. Returns true if successful, in which case
1809  // the caller should search for the thing again. These are declared
1810  // const because they are called by (semantically) const methods.
1811  bool TryFindFileInFallbackDatabase(const std::string& name) const;
1812  bool TryFindSymbolInFallbackDatabase(const std::string& name) const;
1813  bool TryFindExtensionInFallbackDatabase(const Descriptor* containing_type,
1814  int field_number) const;
1815 
1816  // Like BuildFile() but called internally when the file has been loaded from
1817  // fallback_database_. Declared const because it is called by (semantically)
1818  // const methods.
1819  const FileDescriptor* BuildFileFromDatabase(
1820  const FileDescriptorProto& proto) const;
1821 
1822  // Helper for when lazily_build_dependencies_ is set, can look up a symbol
1823  // after the file's descriptor is built, and can build the file where that
1824  // symbol is defined if necessary. Will create a placeholder if the type
1825  // doesn't exist in the fallback database, or the file doesn't build
1826  // successfully.
1827  Symbol CrossLinkOnDemandHelper(const std::string& name,
1828  bool expecting_enum) const;
1829 
1830  // Create a placeholder FileDescriptor of the specified name
1831  FileDescriptor* NewPlaceholderFile(const std::string& name) const;
1832  FileDescriptor* NewPlaceholderFileWithMutexHeld(
1833  const std::string& name) const;
1834 
1838  PLACEHOLDER_EXTENDABLE_MESSAGE
1839  };
1840  // Create a placeholder Descriptor of the specified name
1841  Symbol NewPlaceholder(const std::string& name,
1842  PlaceholderType placeholder_type) const;
1843  Symbol NewPlaceholderWithMutexHeld(const std::string& name,
1844  PlaceholderType placeholder_type) const;
1845 
1846  // If fallback_database_ is nullptr, this is nullptr. Otherwise, this is a
1847  // mutex which must be locked while accessing tables_.
1848  internal::WrappedMutex* mutex_;
1849 
1850  // See constructor.
1854 
1855  // This class contains a lot of hash maps with complicated types that
1856  // we'd like to keep out of the header.
1857  class Tables;
1858  std::unique_ptr<Tables> tables_;
1859 
1865  std::set<std::string> unused_import_track_files_;
1866 
1868 };
1869 
1870 
1871 // inline methods ====================================================
1872 
1873 // These macros makes this repetitive code more readable.
1874 #define PROTOBUF_DEFINE_ACCESSOR(CLASS, FIELD, TYPE) \
1875  inline TYPE CLASS::FIELD() const { return FIELD##_; }
1876 
1877 // Strings fields are stored as pointers but returned as const references.
1878 #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \
1879  inline const std::string& CLASS::FIELD() const { return *FIELD##_; }
1880 
1881 // Arrays take an index parameter, obviously.
1882 #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \
1883  inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; }
1884 
1885 #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \
1886  inline const TYPE& CLASS::options() const { return *options_; }
1887 
1891 PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*)
1892 
1893 PROTOBUF_DEFINE_ACCESSOR(Descriptor, field_count, int)
1894 PROTOBUF_DEFINE_ACCESSOR(Descriptor, oneof_decl_count, int)
1895 PROTOBUF_DEFINE_ACCESSOR(Descriptor, nested_type_count, int)
1896 PROTOBUF_DEFINE_ACCESSOR(Descriptor, enum_type_count, int)
1897 
1902 
1903 PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_range_count, int)
1904 PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_count, int)
1906  const Descriptor::ExtensionRange*)
1908 
1909 PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_range_count, int)
1911  const Descriptor::ReservedRange*)
1912 PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_name_count, int)
1913 
1915 PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool)
1916 
1924 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool)
1927 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof,
1929 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int)
1932 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool)
1933 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool)
1934 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32, int32)
1935 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64, int64)
1936 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32)
1937 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64)
1938 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float)
1939 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double)
1940 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool)
1941 PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string)
1942 
1946 PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int)
1948 
1953 PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int)
1957 PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool)
1958 PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_range_count, int)
1960  const EnumDescriptor::ReservedRange*)
1961 PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int)
1962 
1968 
1972 PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int)
1976 
1981 PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool)
1982 PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, server_streaming, bool)
1983 
1987 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, dependency_count, int)
1988 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, public_dependency_count, int)
1989 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, weak_dependency_count, int)
1990 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int)
1991 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int)
1992 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int)
1993 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int)
1995 PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, is_placeholder, bool)
1996 
2003 
2004 #undef PROTOBUF_DEFINE_ACCESSOR
2005 #undef PROTOBUF_DEFINE_STRING_ACCESSOR
2006 #undef PROTOBUF_DEFINE_ARRAY_ACCESSOR
2007 
2008 // A few accessors differ from the macros...
2009 
2010 inline bool Descriptor::IsExtensionNumber(int number) const {
2011  return FindExtensionRangeContainingNumber(number) != nullptr;
2012 }
2013 
2014 inline bool Descriptor::IsReservedNumber(int number) const {
2015  return FindReservedRangeContainingNumber(number) != nullptr;
2016 }
2017 
2018 inline bool Descriptor::IsReservedName(const std::string& name) const {
2019  for (int i = 0; i < reserved_name_count(); i++) {
2020  if (name == reserved_name(i)) {
2021  return true;
2022  }
2023  }
2024  return false;
2025 }
2026 
2027 // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because reserved_names_ is actually
2028 // an array of pointers rather than the usual array of objects.
2029 inline const std::string& Descriptor::reserved_name(int index) const {
2030  return *reserved_names_[index];
2031 }
2032 
2034  return FindReservedRangeContainingNumber(number) != nullptr;
2035 }
2036 
2038  for (int i = 0; i < reserved_name_count(); i++) {
2039  if (name == reserved_name(i)) {
2040  return true;
2041  }
2042  }
2043  return false;
2044 }
2045 
2046 // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because reserved_names_ is actually
2047 // an array of pointers rather than the usual array of objects.
2049  return *reserved_names_[index];
2050 }
2051 
2053  if (type_once_) {
2055  }
2056  return type_;
2057 }
2058 
2059 inline bool FieldDescriptor::is_required() const {
2060  return label() == LABEL_REQUIRED;
2061 }
2062 
2063 inline bool FieldDescriptor::is_optional() const {
2064  return label() == LABEL_OPTIONAL;
2065 }
2066 
2067 inline bool FieldDescriptor::is_repeated() const {
2068  return label() == LABEL_REPEATED;
2069 }
2070 
2071 inline bool FieldDescriptor::is_packable() const {
2072  return is_repeated() && IsTypePackable(type());
2073 }
2074 
2075 inline bool FieldDescriptor::is_map() const {
2076  return type() == TYPE_MESSAGE && is_map_message_type();
2077 }
2078 
2079 // To save space, index() is computed by looking at the descriptor's position
2080 // in the parent's array of children.
2081 inline int FieldDescriptor::index() const {
2082  if (!is_extension_) {
2083  return static_cast<int>(this - containing_type()->fields_);
2084  } else if (extension_scope_ != nullptr) {
2085  return static_cast<int>(this - extension_scope_->extensions_);
2086  } else {
2087  return static_cast<int>(this - file_->extensions_);
2088  }
2089 }
2090 
2091 inline int Descriptor::index() const {
2092  if (containing_type_ == nullptr) {
2093  return static_cast<int>(this - file_->message_types_);
2094  } else {
2095  return static_cast<int>(this - containing_type_->nested_types_);
2096  }
2097 }
2098 
2099 inline const FileDescriptor* OneofDescriptor::file() const {
2100  return containing_type()->file();
2101 }
2102 
2103 inline int OneofDescriptor::index() const {
2104  return static_cast<int>(this - containing_type_->oneof_decls_);
2105 }
2106 
2107 inline int EnumDescriptor::index() const {
2108  if (containing_type_ == nullptr) {
2109  return static_cast<int>(this - file_->enum_types_);
2110  } else {
2111  return static_cast<int>(this - containing_type_->enum_types_);
2112  }
2113 }
2114 
2116  return type()->file();
2117 }
2118 
2119 inline int EnumValueDescriptor::index() const {
2120  return static_cast<int>(this - type_->values_);
2121 }
2122 
2123 inline int ServiceDescriptor::index() const {
2124  return static_cast<int>(this - file_->services_);
2125 }
2126 
2128  return service()->file();
2129 }
2130 
2131 inline int MethodDescriptor::index() const {
2132  return static_cast<int>(this - service_->methods_);
2133 }
2134 
2135 inline const char* FieldDescriptor::type_name() const {
2136  return kTypeToName[type()];
2137 }
2138 
2140  return kTypeToCppTypeMap[type()];
2141 }
2142 
2143 inline const char* FieldDescriptor::cpp_type_name() const {
2145 }
2146 
2148  return kTypeToCppTypeMap[type];
2149 }
2150 
2151 inline const char* FieldDescriptor::TypeName(Type type) {
2152  return kTypeToName[type];
2153 }
2154 
2156  return kCppTypeToName[cpp_type];
2157 }
2158 
2164 }
2165 
2167  int index) const {
2169 }
2170 
2173 }
2174 
2176 
2177 // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array
2178 // of pointers rather than the usual array of objects.
2180  return fields_[index];
2181 }
2182 
2183 } // namespace protobuf
2184 } // namespace google
2185 
2186 #include <google/protobuf/port_undef.inc>
2187 
2188 #endif // GOOGLE_PROTOBUF_DESCRIPTOR_H__
google::protobuf::FieldDescriptor::Label
Label
Definition: src/google/protobuf/descriptor.h:571
google::protobuf::OneofDescriptor::OptionsType
OneofOptions OptionsType
Definition: src/google/protobuf/descriptor.h:883
google::protobuf::FieldDescriptor::default_value_bool_
bool default_value_bool_
Definition: src/google/protobuf/descriptor.h:818
google::protobuf::ServiceDescriptor::Proto
ServiceDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:1154
google::protobuf::FieldDescriptor::Type
Type
Definition: src/google/protobuf/descriptor.h:521
google::protobuf::EnumDescriptor::is_unqualified_placeholder_
bool is_unqualified_placeholder_
Definition: src/google/protobuf/descriptor.h:1044
google::protobuf::FieldDescriptor::options_
const FieldOptions * options_
Definition: src/google/protobuf/descriptor.h:804
google::protobuf::python::cdescriptor_pool::FindEnumTypeByName
PyObject * FindEnumTypeByName(PyDescriptorPool *self, PyObject *arg)
Definition: descriptor_pool.cc:318
google::protobuf::Descriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:459
google::protobuf::MethodDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2131
google::protobuf::MethodDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:1297
google::protobuf::EnumValueDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:1132
name
GLuint const GLchar * name
Definition: glcorearb.h:3055
google::protobuf.internal::LazyDescriptor::Init
void Init()
Definition: src/google/protobuf/descriptor.h:186
google::protobuf::FileDescriptor::dependencies_
const FileDescriptor ** dependencies_
Definition: src/google/protobuf/descriptor.h:1481
google::protobuf::python::cdescriptor_pool::FindOneofByName
PyObject * FindOneofByName(PyDescriptorPool *self, PyObject *arg)
Definition: descriptor_pool.cc:339
SYNTAX_PROTO3
@ SYNTAX_PROTO3
Definition: type.pb.h:157
google::protobuf::EnumValueDescriptor::type
const EnumDescriptor * type() const
google::protobuf::value
const Descriptor::ReservedRange value
Definition: src/google/protobuf/descriptor.h:1954
google::protobuf::FieldDescriptor::containing_type_
const Descriptor * containing_type_
Definition: src/google/protobuf/descriptor.h:799
google::protobuf::Descriptor::reserved_name
const std::string & reserved_name(int index) const
Definition: src/google/protobuf/descriptor.h:2029
google::protobuf::FieldDescriptor::containing_oneof_
const OneofDescriptor * containing_oneof_
Definition: src/google/protobuf/descriptor.h:800
google::protobuf::FieldDescriptor
Definition: src/google/protobuf/descriptor.h:515
google::protobuf.internal::LazyDescriptor::file_
const FileDescriptor * file_
Definition: src/google/protobuf/descriptor.h:222
google::protobuf::FieldDescriptor::type_
Type type_
Definition: src/google/protobuf/descriptor.h:790
google::protobuf::DescriptorPool::PlaceholderType
PlaceholderType
Definition: src/google/protobuf/descriptor.h:1835
google::protobuf::Descriptor::field_count_
int field_count_
Definition: src/google/protobuf/descriptor.h:474
google::protobuf::FieldDescriptor::kCppTypeToName
static const char *const kCppTypeToName[MAX_CPPTYPE+1]
Definition: src/google/protobuf/descriptor.h:828
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: macros.h:40
google::protobuf::Descriptor::IsExtensionNumber
bool IsExtensionNumber(int number) const
Definition: src/google/protobuf/descriptor.h:2010
benchmarks.python.py_benchmark.const
const
Definition: py_benchmark.py:14
google::protobuf::FieldDescriptor::enum_type_
const EnumDescriptor * enum_type_
Definition: src/google/protobuf/descriptor.h:803
google::protobuf::FileDescriptor::services_
ServiceDescriptor * services_
Definition: src/google/protobuf/descriptor.h:1487
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: src/google/protobuf/descriptor.h:2001
google::protobuf::ServiceDescriptor::OptionsType
ServiceOptions OptionsType
Definition: src/google/protobuf/descriptor.h:1197
google::protobuf::Descriptor::ExtensionRange
Definition: src/google/protobuf/descriptor.h:348
google::protobuf::python::cdescriptor_pool::FindFileByName
static PyObject * FindFileByName(PyObject *self, PyObject *arg)
Definition: descriptor_pool.cc:258
google::protobuf::FieldDescriptor::lowercase_name_
const std::string * lowercase_name_
Definition: src/google/protobuf/descriptor.h:781
google::protobuf::EnumValueDescriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:1133
google::protobuf::int64
int64_t int64
Definition: protobuf/src/google/protobuf/stubs/port.h:151
google::protobuf::Descriptor::options_
const MessageOptions * options_
Definition: src/google/protobuf/descriptor.h:462
google::protobuf::MethodDescriptor::client_streaming_
bool client_streaming_
Definition: src/google/protobuf/descriptor.h:1303
field_type
zend_class_entry * field_type
Definition: php/ext/google/protobuf/message.c:2028
google::protobuf::FileDescriptor::tables_
const FileDescriptorTables * tables_
Definition: src/google/protobuf/descriptor.h:1491
google::protobuf::FieldDescriptor::label
Label label() const
google::protobuf::EnumDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2107
google::protobuf::EnumDescriptor::IsReservedNumber
bool IsReservedNumber(int number) const
Definition: src/google/protobuf/descriptor.h:2033
options
Message * options
Definition: src/google/protobuf/descriptor.cc:3119
google::protobuf::EnumDescriptor::values_
EnumValueDescriptor * values_
Definition: src/google/protobuf/descriptor.h:1047
google::protobuf::PROTOBUF_DEFINE_ARRAY_ACCESSOR
PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension_range, const Descriptor::ExtensionRange *) PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor
google::protobuf::Descriptor::is_placeholder_
bool is_placeholder_
Definition: src/google/protobuf/descriptor.h:484
FieldOptions
Definition: descriptor.pb.h:4059
google::protobuf::SourceLocation::start_column
int start_column
Definition: src/google/protobuf/descriptor.h:148
google::protobuf::ServiceDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2123
google::protobuf::FieldDescriptor::FieldDescriptor
FieldDescriptor()
Definition: src/google/protobuf/descriptor.h:833
google::protobuf::EnumDescriptor::file_
const FileDescriptor * file_
Definition: src/google/protobuf/descriptor.h:1037
google::protobuf::DescriptorPool::ErrorCollector::OUTPUT_TYPE
@ OUTPUT_TYPE
Definition: src/google/protobuf/descriptor.h:1645
google::protobuf::FieldDescriptor::TYPE_BYTES
@ TYPE_BYTES
Definition: src/google/protobuf/descriptor.h:538
google::protobuf::DescriptorPool::ErrorCollector
Definition: src/google/protobuf/descriptor.h:1630
UninterpretedOption
Definition: descriptor.pb.h:5466
FileOptions
Definition: descriptor.pb.h:3343
FieldDescriptorProto
Definition: descriptor.pb.h:1678
FileDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:125
label
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:4316
google::protobuf::FieldDescriptor::type_name
const char * type_name() const
Definition: src/google/protobuf/descriptor.h:2135
google::protobuf::uint32
uint32_t uint32
Definition: protobuf/src/google/protobuf/stubs/port.h:155
google::protobuf::DescriptorPool::Tables
Definition: src/google/protobuf/descriptor.cc:520
google::protobuf.internal::call_once
void call_once(Args &&... args)
Definition: once.h:45
google::protobuf::Descriptor::extensions_
FieldDescriptor * extensions_
Definition: src/google/protobuf/descriptor.h:470
google::protobuf::FieldDescriptor::containing_type
const Descriptor * containing_type() const
ServiceDescriptorProto
Definition: descriptor.pb.h:2886
google::protobuf::MethodDescriptor::Proto
MethodDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:1236
google::protobuf::EnumDescriptor::EnumDescriptor
EnumDescriptor()
Definition: src/google/protobuf/descriptor.h:1059
google::protobuf::DescriptorPool::ErrorCollector::TYPE
@ TYPE
Definition: src/google/protobuf/descriptor.h:1641
google::protobuf::ServiceDescriptor::method_count_
int method_count_
Definition: src/google/protobuf/descriptor.h:1216
google::protobuf::ServiceDescriptor::methods_
MethodDescriptor * methods_
Definition: src/google/protobuf/descriptor.h:1215
google::protobuf::Descriptor::ExtensionRange::Proto
DescriptorProto_ExtensionRange Proto
Definition: src/google/protobuf/descriptor.h:349
google::protobuf::MethodDescriptor::file
const FileDescriptor * file() const
Definition: src/google/protobuf/descriptor.h:2127
google::protobuf::Descriptor::nested_type_count_
int nested_type_count_
Definition: src/google/protobuf/descriptor.h:476
google::protobuf::DescriptorPool::mutex_
internal::WrappedMutex * mutex_
Definition: src/google/protobuf/descriptor.h:1848
google::protobuf::OneofDescriptor
Definition: src/google/protobuf/descriptor.h:843
MethodDescriptorProto
Definition: descriptor.pb.h:3090
google::protobuf::Descriptor::extension_ranges_
ExtensionRange * extension_ranges_
Definition: src/google/protobuf/descriptor.h:469
google::protobuf::DebugStringOptions::include_comments
bool include_comments
Definition: src/google/protobuf/descriptor.h:165
google::protobuf::FileDescriptor::dependency_count_
int dependency_count_
Definition: src/google/protobuf/descriptor.h:1466
google::protobuf::DescriptorPool::internal_set_underlay
void internal_set_underlay(const DescriptorPool *underlay)
Definition: src/google/protobuf/descriptor.h:1776
google::protobuf::OneofDescriptor::file
const FileDescriptor * file() const
Definition: src/google/protobuf/descriptor.h:2099
google::protobuf::FieldDescriptor::is_extension_
bool is_extension_
Definition: src/google/protobuf/descriptor.h:796
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
google::protobuf::OneofDescriptor::fields_
const FieldDescriptor ** fields_
Definition: src/google/protobuf/descriptor.h:901
google::protobuf::ServiceDescriptor::options_
const ServiceOptions * options_
Definition: src/google/protobuf/descriptor.h:1214
google::protobuf::SourceLocation
Definition: src/google/protobuf/descriptor.h:145
google::protobuf::FieldDescriptor::default_value_enum_name_
const std::string * default_value_enum_name_
Definition: src/google/protobuf/descriptor.h:806
google::protobuf::Descriptor::reserved_names_
const std::string ** reserved_names_
Definition: src/google/protobuf/descriptor.h:472
google::protobuf::EnumValueDescriptor::EnumValueDescriptor
EnumValueDescriptor()
Definition: src/google/protobuf/descriptor.h:1142
google::protobuf::DescriptorPool::EnforceWeakDependencies
void EnforceWeakDependencies(bool enforce)
Definition: src/google/protobuf/descriptor.h:1710
google::protobuf::OneofDescriptor::options_
const OneofOptions * options_
Definition: src/google/protobuf/descriptor.h:902
google::protobuf::FileDescriptor::pool_
const DescriptorPool * pool_
Definition: src/google/protobuf/descriptor.h:1460
enum_type
zend_class_entry * enum_type
Definition: php/ext/google/protobuf/message.c:1904
google::protobuf::Reflection
Definition: src/google/protobuf/message.h:400
google::protobuf::SourceLocation::trailing_comments
std::string trailing_comments
Definition: src/google/protobuf/descriptor.h:154
descriptor
Descriptor * descriptor
Definition: php/ext/google/protobuf/protobuf.h:936
google::protobuf::MethodDescriptor::server_streaming_
bool server_streaming_
Definition: src/google/protobuf/descriptor.h:1304
google::protobuf::FieldDescriptor::default_value_enum_
const EnumValueDescriptor * default_value_enum_
Definition: src/google/protobuf/descriptor.h:820
google::protobuf::Descriptor::OptionsType
MessageOptions OptionsType
Definition: src/google/protobuf/descriptor.h:434
google::protobuf::OneofDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:897
google::protobuf::FieldDescriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:780
google::protobuf::Descriptor::ExtensionRange::OptionsType
ExtensionRangeOptions OptionsType
Definition: src/google/protobuf/descriptor.h:351
google::protobuf::MethodDescriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:1298
google::protobuf::Descriptor::extension_range_count_
int extension_range_count_
Definition: src/google/protobuf/descriptor.h:478
google::protobuf::DescriptorPool::InternalSetLazilyBuildDependencies
void InternalSetLazilyBuildDependencies()
Definition: src/google/protobuf/descriptor.h:1768
google::protobuf::DescriptorPool::PLACEHOLDER_ENUM
@ PLACEHOLDER_ENUM
Definition: src/google/protobuf/descriptor.h:1837
ExtensionRangeOptions
Definition: descriptor.pb.h:1507
google::protobuf::python::cdescriptor_pool::FindServiceByName
static PyObject * FindServiceByName(PyObject *self, PyObject *arg)
Definition: descriptor_pool.cc:360
google::protobuf::FileDescriptor::syntax_
Syntax syntax_
Definition: src/google/protobuf/descriptor.h:1473
google::protobuf::Descriptor::nested_types_
Descriptor * nested_types_
Definition: src/google/protobuf/descriptor.h:467
EnumValueDescriptorProto
Definition: descriptor.pb.h:2687
google::protobuf::OneofDescriptor::field
const FieldDescriptor * field(int index) const
Definition: src/google/protobuf/descriptor.h:2179
Descriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:113
google::protobuf::FileDescriptor::public_dependencies_
int * public_dependencies_
Definition: src/google/protobuf/descriptor.h:1483
EnumOptions
Definition: descriptor.pb.h:4513
google::protobuf::FileDescriptor::message_type_count_
int message_type_count_
Definition: src/google/protobuf/descriptor.h:1469
google::protobuf::FieldDescriptor::default_value_int64_
int64 default_value_int64_
Definition: src/google/protobuf/descriptor.h:813
google::protobuf::FileDescriptor::syntax
Syntax syntax() const
Definition: src/google/protobuf/descriptor.h:2175
google::protobuf::EnumDescriptor::is_placeholder_
bool is_placeholder_
Definition: src/google/protobuf/descriptor.h:1042
google::protobuf::FieldDescriptor::PrintLabelFlag
PrintLabelFlag
Definition: src/google/protobuf/descriptor.h:759
google::protobuf.internal::LazyDescriptor::descriptor_
const Descriptor * descriptor_
Definition: src/google/protobuf/descriptor.h:219
google::protobuf::SourceLocation::leading_comments
std::string leading_comments
Definition: src/google/protobuf/descriptor.h:153
google::protobuf::FileDescriptor::dependencies_names_
const std::string ** dependencies_names_
Definition: src/google/protobuf/descriptor.h:1482
google::protobuf::FieldDescriptor::is_required
bool is_required() const
Definition: src/google/protobuf/descriptor.h:2059
FieldDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:129
google::protobuf::Descriptor::ExtensionRange::options_
const ExtensionRangeOptions * options_
Definition: src/google/protobuf/descriptor.h:359
google::protobuf::FileDescriptor::source_code_info_
const SourceCodeInfo * source_code_info_
Definition: src/google/protobuf/descriptor.h:1492
google::protobuf::EnumValueDescriptor::OptionsType
EnumValueOptions OptionsType
Definition: src/google/protobuf/descriptor.h:1118
message_type
zend_class_entry * message_type
Definition: php/ext/google/protobuf/message.c:45
google::protobuf::DescriptorPool::ErrorCollector::IMPORT
@ IMPORT
Definition: src/google/protobuf/descriptor.h:1648
google::protobuf::ServiceDescriptor
Definition: src/google/protobuf/descriptor.h:1152
google::protobuf::python::cdescriptor_pool::FindFileContainingSymbol
static PyObject * FindFileContainingSymbol(PyObject *self, PyObject *arg)
Definition: descriptor_pool.cc:400
google::protobuf.internal::LazyDescriptor::once_
internal::once_flag * once_
Definition: src/google/protobuf/descriptor.h:221
google::protobuf::int32
int32_t int32
Definition: protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf::python::cdescriptor_pool::FindExtensionByNumber
static PyObject * FindExtensionByNumber(PyObject *self, PyObject *args)
Definition: descriptor_pool.cc:420
google::protobuf::FieldDescriptor::cpp_type_name
const char * cpp_type_name() const
Definition: src/google/protobuf/descriptor.h:2143
google::protobuf::Descriptor::oneof_decl_count_
int oneof_decl_count_
Definition: src/google/protobuf/descriptor.h:475
google::protobuf::OneofDescriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:898
google::protobuf::SourceLocation::start_line
int start_line
Definition: src/google/protobuf/descriptor.h:146
google::protobuf::EnumDescriptor::Proto
EnumDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:920
google::protobuf::python::service_descriptor::FindMethodByName
static PyObject * FindMethodByName(PyBaseDescriptor *self, PyObject *arg)
Definition: python/google/protobuf/pyext/descriptor.cc:1685
DescriptorProto_ExtensionRange
Definition: descriptor.pb.h:848
google::protobuf::Descriptor::fields_
FieldDescriptor * fields_
Definition: src/google/protobuf/descriptor.h:465
package
string package
google::protobuf::Descriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:458
google::protobuf::FieldDescriptor::LABEL_REQUIRED
@ LABEL_REQUIRED
Definition: src/google/protobuf/descriptor.h:573
google::protobuf::FieldDescriptor::type_once_
internal::once_flag * type_once_
Definition: src/google/protobuf/descriptor.h:787
google::protobuf::FileDescriptor::enum_types_
EnumDescriptor * enum_types_
Definition: src/google/protobuf/descriptor.h:1486
google::protobuf::FieldDescriptor::default_value_string_
const std::string * default_value_string_
Definition: src/google/protobuf/descriptor.h:821
google::protobuf::Descriptor::enum_types_
EnumDescriptor * enum_types_
Definition: src/google/protobuf/descriptor.h:468
google::protobuf::Descriptor::ReservedRange::end
int end
Definition: src/google/protobuf/descriptor.h:401
google::protobuf::ServiceDescriptor::file_
const FileDescriptor * file_
Definition: src/google/protobuf/descriptor.h:1213
google::protobuf::EnumValueDescriptor::type_
const EnumDescriptor * type_
Definition: src/google/protobuf/descriptor.h:1135
google::protobuf::OneofDescriptor::containing_type_
const Descriptor * containing_type_
Definition: src/google/protobuf/descriptor.h:899
google::protobuf::FieldDescriptor::TypeOnceInit
static void TypeOnceInit(const FieldDescriptor *to_init)
Definition: src/google/protobuf/descriptor.cc:7221
google::protobuf::DescriptorPool::ErrorCollector::ErrorCollector
ErrorCollector()
Definition: src/google/protobuf/descriptor.h:1632
Type
Definition: type.pb.h:182
google::protobuf::EnumDescriptor::FindReservedRangeContainingNumber
const EnumDescriptor::ReservedRange * FindReservedRangeContainingNumber(int number) const
Definition: src/google/protobuf/descriptor.cc:1839
google::protobuf::FieldDescriptor::default_value_uint64_
uint64 default_value_uint64_
Definition: src/google/protobuf/descriptor.h:815
google::protobuf::FieldDescriptor::TypeName
static const char * TypeName(Type type)
Definition: src/google/protobuf/descriptor.h:2151
google::protobuf.internal::once_flag
std::once_flag once_flag
Definition: once.h:43
google::protobuf::python::cdescriptor_pool::FindFieldByName
PyObject * FindFieldByName(PyDescriptorPool *self, PyObject *arg)
Definition: descriptor_pool.cc:275
path
GLsizei const GLchar ** path
Definition: glcorearb.h:3658
google::protobuf::EnumDescriptor::value_count_
int value_count_
Definition: src/google/protobuf/descriptor.h:1046
google::protobuf::EnumValueDescriptor::number_
int number_
Definition: src/google/protobuf/descriptor.h:1134
google::protobuf::FieldDescriptor::is_packable
bool is_packable() const
Definition: src/google/protobuf/descriptor.h:2071
google::protobuf::python::cdescriptor_pool::FindExtensionByName
PyObject * FindExtensionByName(PyDescriptorPool *self, PyObject *arg)
Definition: descriptor_pool.cc:296
generated_pool
InternalDescriptorPool * generated_pool
Definition: def.c:582
google::protobuf::DescriptorPool::underlay_
const DescriptorPool * underlay_
Definition: src/google/protobuf/descriptor.h:1853
google::protobuf::reserved_range
reserved_range
Definition: src/google/protobuf/descriptor.h:1910
google::protobuf::DescriptorPool::ErrorCollector::NUMBER
@ NUMBER
Definition: src/google/protobuf/descriptor.h:1640
google::protobuf::MethodDescriptor::service_
const ServiceDescriptor * service_
Definition: src/google/protobuf/descriptor.h:1299
google::protobuf::DescriptorPool::PLACEHOLDER_MESSAGE
@ PLACEHOLDER_MESSAGE
Definition: src/google/protobuf/descriptor.h:1836
google::protobuf::DebugStringOptions::elide_group_body
bool elide_group_body
Definition: src/google/protobuf/descriptor.h:167
google::protobuf::OneofDescriptor::Proto
OneofDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:845
google::protobuf::FieldDescriptor::IsTypePackable
static bool IsTypePackable(Type field_type)
Definition: src/google/protobuf/descriptor.h:2159
google::protobuf::EnumDescriptor::file
const FileDescriptor * file() const
google::protobuf::EnumDescriptor::IsReservedName
bool IsReservedName(const std::string &name) const
Definition: src/google/protobuf/descriptor.h:2037
google::protobuf::DescriptorPool::ErrorCollector::ErrorLocation
ErrorLocation
Definition: src/google/protobuf/descriptor.h:1638
PROTOBUF_DEFINE_STRING_ACCESSOR
#define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD)
Definition: src/google/protobuf/descriptor.h:1878
google::protobuf::DescriptorPool
Definition: src/google/protobuf/descriptor.h:1539
google::protobuf::FieldDescriptor::number_
int number_
Definition: src/google/protobuf/descriptor.h:797
MessageOptions
Definition: descriptor.pb.h:3856
google::protobuf::DescriptorPool::fallback_database_
DescriptorDatabase * fallback_database_
Definition: src/google/protobuf/descriptor.h:1851
google::protobuf::Descriptor::FindReservedRangeContainingNumber
const ReservedRange * FindReservedRangeContainingNumber(int number) const
Definition: src/google/protobuf/descriptor.cc:1827
google::protobuf.internal::LazyDescriptor::Get
const Descriptor * Get()
Definition: src/google/protobuf/descriptor.h:209
google::protobuf::DescriptorPool::default_error_collector_
ErrorCollector * default_error_collector_
Definition: src/google/protobuf/descriptor.h:1852
google::protobuf::DescriptorPool::allow_unknown_
bool allow_unknown_
Definition: src/google/protobuf/descriptor.h:1862
google::protobuf::EnumValueDescriptor::file
const FileDescriptor * file() const
Definition: src/google/protobuf/descriptor.h:2115
google::protobuf::FileDescriptor::package_
const std::string * package_
Definition: src/google/protobuf/descriptor.h:1459
google::protobuf::FileDescriptor::Proto
FileDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:1322
google::protobuf::MethodDescriptor::OptionsType
MethodOptions OptionsType
Definition: src/google/protobuf/descriptor.h:1283
EnumValueDescriptor
struct EnumValueDescriptor EnumValueDescriptor
Definition: php/ext/google/protobuf/protobuf.h:634
google::protobuf::DescriptorPool::ErrorCollector::INPUT_TYPE
@ INPUT_TYPE
Definition: src/google/protobuf/descriptor.h:1644
google::protobuf::MethodDescriptor::service
const ServiceDescriptor * service() const
google::protobuf::DescriptorPool::enforce_dependencies_
bool enforce_dependencies_
Definition: src/google/protobuf/descriptor.h:1860
google::protobuf::uint64
uint64_t uint64
Definition: protobuf/src/google/protobuf/stubs/port.h:156
google::protobuf::FieldDescriptor::CppTypeName
static const char * CppTypeName(CppType cpp_type)
Definition: src/google/protobuf/descriptor.h:2155
google::protobuf::Descriptor::Proto
DescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:233
google::protobuf::Descriptor::is_unqualified_placeholder_
bool is_unqualified_placeholder_
Definition: src/google/protobuf/descriptor.h:486
google::protobuf::Descriptor::ReservedRange::start
int start
Definition: src/google/protobuf/descriptor.h:400
google::protobuf::EnumDescriptor::ReservedRange::start
int start
Definition: src/google/protobuf/descriptor.h:975
google::protobuf::FieldDescriptor::TYPE_STRING
@ TYPE_STRING
Definition: src/google/protobuf/descriptor.h:534
google::protobuf::FileDescriptor::finished_building_
bool finished_building_
Definition: src/google/protobuf/descriptor.h:1479
google::protobuf::FileDescriptor::service_count_
int service_count_
Definition: src/google/protobuf/descriptor.h:1471
google::protobuf::FieldDescriptor::default_value_uint32_
uint32 default_value_uint32_
Definition: src/google/protobuf/descriptor.h:814
cpp
Definition: third_party/googletest/googlemock/scripts/generator/cpp/__init__.py:1
google::protobuf::DescriptorPool::tables_
std::unique_ptr< Tables > tables_
Definition: src/google/protobuf/descriptor.h:1857
FileDescriptorProto
Definition: descriptor.pb.h:501
google::protobuf::OneofDescriptor::OneofDescriptor
OneofDescriptor()
Definition: src/google/protobuf/descriptor.h:909
google::protobuf::FieldDescriptor::label_
Label label_
Definition: src/google/protobuf/descriptor.h:791
name_
string name_
Definition: googletest.cc:182
google::protobuf::ServiceDescriptor::file
const FileDescriptor * file() const
EnumDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:137
google::protobuf::Descriptor::file_
const FileDescriptor * file_
Definition: src/google/protobuf/descriptor.h:460
google::protobuf::FieldDescriptor::has_default_value_
bool has_default_value_
Definition: src/google/protobuf/descriptor.h:792
google::protobuf::DebugStringOptions
Definition: src/google/protobuf/descriptor.h:160
google::protobuf::MethodDescriptor
Definition: src/google/protobuf/descriptor.h:1234
field
const FieldDescriptor * field
Definition: parser_unittest.cc:2694
google::protobuf::EnumDescriptor::ReservedRange
Definition: src/google/protobuf/descriptor.h:974
google::protobuf::SourceLocation::end_line
int end_line
Definition: src/google/protobuf/descriptor.h:147
ServiceOptions
Definition: descriptor.pb.h:4879
google::protobuf::DescriptorPool::ErrorCollector::NAME
@ NAME
Definition: src/google/protobuf/descriptor.h:1639
google::protobuf::FileDescriptor::weak_dependency
const FileDescriptor * weak_dependency(int index) const
Definition: src/google/protobuf/descriptor.h:2171
depth
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:2859
google::protobuf::Descriptor::reserved_ranges_
ReservedRange * reserved_ranges_
Definition: src/google/protobuf/descriptor.h:471
google::protobuf::FieldDescriptor::file_
const FileDescriptor * file_
Definition: src/google/protobuf/descriptor.h:786
google::protobuf::DescriptorDatabase
Definition: src/google/protobuf/descriptor_database.h:71
location
GLint location
Definition: glcorearb.h:3074
google::protobuf::DescriptorPool::AllowUnknownDependencies
void AllowUnknownDependencies()
Definition: src/google/protobuf/descriptor.h:1704
google::protobuf::FieldDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:779
google::protobuf::DescriptorPool::DisallowEnforceUtf8
void DisallowEnforceUtf8()
Definition: src/google/protobuf/descriptor.h:1746
google::protobuf::io::Printer
Definition: printer.h:181
pool
InternalDescriptorPool * pool
Definition: php/ext/google/protobuf/protobuf.h:798
google::protobuf::OneofDescriptor::field_count_
int field_count_
Definition: src/google/protobuf/descriptor.h:900
google::protobuf::Descriptor::reserved_range_count_
int reserved_range_count_
Definition: src/google/protobuf/descriptor.h:480
google::protobuf::EnumDescriptor::reserved_ranges_
EnumDescriptor::ReservedRange * reserved_ranges_
Definition: src/google/protobuf/descriptor.h:1051
i
int i
Definition: gmock-matchers_test.cc:764
google::protobuf::Descriptor::oneof_decls_
OneofDescriptor * oneof_decls_
Definition: src/google/protobuf/descriptor.h:466
google::protobuf::Descriptor::containing_type_
const Descriptor * containing_type_
Definition: src/google/protobuf/descriptor.h:461
google::protobuf::EnumDescriptor::OptionsType
EnumOptions OptionsType
Definition: src/google/protobuf/descriptor.h:1010
google::protobuf::EnumDescriptor::containing_type_
const Descriptor * containing_type_
Definition: src/google/protobuf/descriptor.h:1038
google::protobuf::FileDescriptor::dependencies_once_
internal::once_flag * dependencies_once_
Definition: src/google/protobuf/descriptor.h:1461
google::protobuf::FieldDescriptor::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: src/google/protobuf/descriptor.h:536
google::protobuf::DebugStringOptions::elide_oneof_body
bool elide_oneof_body
Definition: src/google/protobuf/descriptor.h:168
SYNTAX_PROTO2
@ SYNTAX_PROTO2
Definition: type.pb.h:156
google::protobuf::EnumDescriptor::reserved_range_count_
int reserved_range_count_
Definition: src/google/protobuf/descriptor.h:1049
google::protobuf::FileDescriptor::enum_type_count_
int enum_type_count_
Definition: src/google/protobuf/descriptor.h:1470
google::protobuf::FileDescriptor::is_placeholder_
bool is_placeholder_
Definition: src/google/protobuf/descriptor.h:1474
google::protobuf::FieldDescriptor::camelcase_name_
const std::string * camelcase_name_
Definition: src/google/protobuf/descriptor.h:782
google::protobuf::FieldDescriptor::has_json_name_
bool has_json_name_
Definition: src/google/protobuf/descriptor.h:795
google::protobuf::Descriptor::ExtensionRange::end
int end
Definition: src/google/protobuf/descriptor.h:357
type
GLenum type
Definition: glcorearb.h:2695
google::protobuf::Message
Definition: src/google/protobuf/message.h:205
google::protobuf::DescriptorPool::ErrorCollector::AddWarning
virtual void AddWarning(const std::string &, const std::string &, const Message *, ErrorLocation, const std::string &)
Definition: src/google/protobuf/descriptor.h:1664
google::protobuf::FieldDescriptor::type
Type type() const
Definition: src/google/protobuf/descriptor.h:2052
PROTOBUF_DEFINE_OPTIONS_ACCESSOR
#define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE)
Definition: src/google/protobuf/descriptor.h:1885
google::protobuf::EnumDescriptor::options_
const EnumOptions * options_
Definition: src/google/protobuf/descriptor.h:1039
google::protobuf::FieldDescriptor::default_value_double_
double default_value_double_
Definition: src/google/protobuf/descriptor.h:817
google::protobuf::Descriptor::extension_count_
int extension_count_
Definition: src/google/protobuf/descriptor.h:479
google::protobuf::Descriptor::ReservedRange
Definition: src/google/protobuf/descriptor.h:399
google::protobuf::DescriptorPool::lazily_build_dependencies_
bool lazily_build_dependencies_
Definition: src/google/protobuf/descriptor.h:1861
common.h
OneofDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:133
google::protobuf::DebugStringOptions::DebugStringOptions
DebugStringOptions()
Definition: src/google/protobuf/descriptor.h:170
google::protobuf::FileDescriptor::extension_count_
int extension_count_
Definition: src/google/protobuf/descriptor.h:1472
google::protobuf::FileDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:1458
google::protobuf::Descriptor::reserved_name_count
int reserved_name_count() const
EnumDescriptorProto
Definition: descriptor.pb.h:2449
google::protobuf::FieldDescriptor::extension_scope_
const Descriptor * extension_scope_
Definition: src/google/protobuf/descriptor.h:801
EnumValueOptions
Definition: descriptor.pb.h:4700
google::protobuf::FileDescriptor::weak_dependency_count_
int weak_dependency_count_
Definition: src/google/protobuf/descriptor.h:1468
google::protobuf::EnumDescriptor::ReservedRange::end
int end
Definition: src/google/protobuf/descriptor.h:976
google::protobuf::Symbol
Definition: src/google/protobuf/descriptor.cc:79
google::protobuf.internal::LazyDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:220
google::protobuf::FileDescriptor::dependency
const FileDescriptor * dependency(int index) const
Definition: src/google/protobuf/descriptor.cc:7271
google::protobuf::FieldDescriptor::kTypeToName
static const char *const kTypeToName[MAX_TYPE+1]
Definition: src/google/protobuf/descriptor.h:826
google::protobuf::DescriptorPool::ErrorCollector::EXTENDEE
@ EXTENDEE
Definition: src/google/protobuf/descriptor.h:1642
size
GLsizeiptr size
Definition: glcorearb.h:2943
google::protobuf::EnumDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:1035
google::protobuf::FileDescriptor::extensions_
FieldDescriptor * extensions_
Definition: src/google/protobuf/descriptor.h:1488
google::protobuf::OneofDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2103
google::protobuf::FieldDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2081
google::protobuf::EnumValueDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2119
google::protobuf::FileDescriptor::options_
const FileOptions * options_
Definition: src/google/protobuf/descriptor.h:1489
google::protobuf::FileDescriptor::message_types_
Descriptor * message_types_
Definition: src/google/protobuf/descriptor.h:1485
SourceCodeInfo
Definition: descriptor.pb.h:5977
once.h
google::protobuf::Descriptor::enum_type_count_
int enum_type_count_
Definition: src/google/protobuf/descriptor.h:477
google::protobuf::DescriptorPool::disallow_enforce_utf8_
bool disallow_enforce_utf8_
Definition: src/google/protobuf/descriptor.h:1864
google::protobuf::FieldDescriptor::message_type_
const Descriptor * message_type_
Definition: src/google/protobuf/descriptor.h:802
google::protobuf::SourceLocation::end_column
int end_column
Definition: src/google/protobuf/descriptor.h:149
google::protobuf::Descriptor::file
const FileDescriptor * file() const
OneofDescriptorProto
Definition: descriptor.pb.h:2087
DescriptorProto
Definition: descriptor.pb.h:1203
google::protobuf::EnumValueDescriptor
Definition: src/google/protobuf/descriptor.h:1075
google::protobuf::python::cdescriptor_pool::FindAllExtensions
static PyObject * FindAllExtensions(PyObject *self, PyObject *arg)
Definition: descriptor_pool.cc:453
google::protobuf::Descriptor
Definition: src/google/protobuf/descriptor.h:231
google::protobuf::Descriptor::IsReservedName
bool IsReservedName(const std::string &name) const
Definition: src/google/protobuf/descriptor.h:2018
google::protobuf::FieldDescriptor::TYPE_GROUP
@ TYPE_GROUP
Definition: src/google/protobuf/descriptor.h:535
OneofOptions
Definition: descriptor.pb.h:4342
google::protobuf::EnumValueDescriptor::Proto
EnumValueDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:1077
google::protobuf::EnumDescriptor::reserved_name
const std::string & reserved_name(int index) const
Definition: src/google/protobuf/descriptor.h:2048
google::protobuf::EnumDescriptor::reserved_name_count
int reserved_name_count() const
google::protobuf::DescriptorPool::unused_import_track_files_
std::set< std::string > unused_import_track_files_
Definition: src/google/protobuf/descriptor.h:1865
google::protobuf::ServiceDescriptor::name_
const std::string * name_
Definition: src/google/protobuf/descriptor.h:1211
element_name
std::string element_name
Definition: src/google/protobuf/descriptor.cc:3116
google::protobuf::ServiceDescriptor::ServiceDescriptor
ServiceDescriptor()
Definition: src/google/protobuf/descriptor.h:1222
mutex.h
google::protobuf::Descriptor::Descriptor
Descriptor()
Definition: src/google/protobuf/descriptor.h:493
google::protobuf::FileDescriptor
Definition: src/google/protobuf/descriptor.h:1320
google::protobuf.internal::LazyDescriptor
Definition: src/google/protobuf/descriptor.h:182
google::protobuf::DescriptorPool::ErrorCollector::DEFAULT_VALUE
@ DEFAULT_VALUE
Definition: src/google/protobuf/descriptor.h:1643
google::protobuf::FileDescriptor::weak_dependencies_
int * weak_dependencies_
Definition: src/google/protobuf/descriptor.h:1484
google::protobuf.internal.wire_format.IsTypePackable
def IsTypePackable(field_type)
Definition: wire_format.py:259
google::protobuf::compiler::php::TypeName
std::string TypeName(FieldDescriptor *field)
google::protobuf::FileDescriptorTables
Definition: src/google/protobuf/descriptor.cc:705
google::protobuf::FieldDescriptor::Proto
FieldDescriptorProto Proto
Definition: src/google/protobuf/descriptor.h:517
google::protobuf::FieldDescriptor::LABEL_REPEATED
@ LABEL_REPEATED
Definition: src/google/protobuf/descriptor.h:574
internal
Definition: any.pb.h:40
google::protobuf::FieldDescriptor::is_map_message_type
bool is_map_message_type() const
Definition: src/google/protobuf/descriptor.cc:1957
google::protobuf::DescriptorBuilder
Definition: src/google/protobuf/descriptor.cc:3124
google::protobuf::SourceLocation::leading_detached_comments
std::vector< std::string > leading_detached_comments
Definition: src/google/protobuf/descriptor.h:155
google::protobuf::FieldDescriptor::LABEL_OPTIONAL
@ LABEL_OPTIONAL
Definition: src/google/protobuf/descriptor.h:572
google::protobuf::Descriptor::IsReservedNumber
bool IsReservedNumber(int number) const
Definition: src/google/protobuf/descriptor.h:2014
google::protobuf::FieldDescriptor::is_optional
bool is_optional() const
Definition: src/google/protobuf/descriptor.h:2063
google::protobuf::FileDescriptor::public_dependency_count_
int public_dependency_count_
Definition: src/google/protobuf/descriptor.h:1467
google::protobuf::EnumDescriptor::reserved_name_count_
int reserved_name_count_
Definition: src/google/protobuf/descriptor.h:1050
google::protobuf::EnumDescriptor::reserved_names_
const std::string ** reserved_names_
Definition: src/google/protobuf/descriptor.h:1052
google::protobuf::FieldDescriptor::default_value_int32_
int32 default_value_int32_
Definition: src/google/protobuf/descriptor.h:812
google::protobuf::PROTOBUF_DEFINE_ACCESSOR
const Descriptor::ReservedRange * PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof, const OneofDescriptor *) PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
descriptor_
const Descriptor * descriptor_
Definition: field_comparator_test.cc:56
Syntax
Syntax
Definition: type.pb.h:155
google::protobuf::DescriptorPool::enforce_weak_
bool enforce_weak_
Definition: src/google/protobuf/descriptor.h:1863
output
const upb_json_parsermethod const upb_symtab upb_sink * output
Definition: ruby/ext/google/protobuf_c/upb.h:10503
google::protobuf::FieldDescriptor::TypeToCppType
static CppType TypeToCppType(Type type)
Definition: src/google/protobuf/descriptor.h:2147
google::protobuf::MethodDescriptor::MethodDescriptor
MethodDescriptor()
Definition: src/google/protobuf/descriptor.h:1310
google::protobuf::FieldDescriptor::json_name_
const std::string * json_name_
Definition: src/google/protobuf/descriptor.h:785
google::protobuf::FieldDescriptor::kTypeToCppTypeMap
static const CppType kTypeToCppTypeMap[MAX_TYPE+1]
Definition: src/google/protobuf/descriptor.h:824
google::protobuf::EnumDescriptor
Definition: src/google/protobuf/descriptor.h:918
false
#define false
Definition: cJSON.c:70
DescriptorPool
Definition: ruby/ext/google/protobuf_c/protobuf.h:109
google::protobuf::Descriptor::ExtensionRange::start
int start
Definition: src/google/protobuf/descriptor.h:356
DescriptorPool
struct DescriptorPool DescriptorPool
Definition: php/ext/google/protobuf/protobuf.h:629
google::protobuf::EnumDescriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:1036
index
GLuint index
Definition: glcorearb.h:3055
google::protobuf::FileDescriptor::public_dependency
const FileDescriptor * public_dependency(int index) const
Definition: src/google/protobuf/descriptor.h:2166
MethodOptions
Definition: descriptor.pb.h:5058
google::protobuf::MethodDescriptor::output_type_
internal::LazyDescriptor output_type_
Definition: src/google/protobuf/descriptor.h:1301
google::protobuf::FieldDescriptor::type_name_
const std::string * type_name_
Definition: src/google/protobuf/descriptor.h:805
google::protobuf::ServiceDescriptor::full_name_
const std::string * full_name_
Definition: src/google/protobuf/descriptor.h:1212
google::protobuf::EnumValueDescriptor::options_
const EnumValueOptions * options_
Definition: src/google/protobuf/descriptor.h:1136
google::protobuf::DescriptorPool::ErrorCollector::OPTION_NAME
@ OPTION_NAME
Definition: src/google/protobuf/descriptor.h:1646
google::protobuf::OneofDescriptor::containing_type
const Descriptor * containing_type() const
google::protobuf::FieldDescriptor::is_repeated
bool is_repeated() const
Definition: src/google/protobuf/descriptor.h:2067
file_
FileDescriptorProto * file_
Definition: annotation_test_util.cc:68
google::protobuf::DescriptorPool::ErrorCollector::OPTION_VALUE
@ OPTION_VALUE
Definition: src/google/protobuf/descriptor.h:1647
google::protobuf::Descriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2091
google::protobuf::Descriptor::reserved_name_count_
int reserved_name_count_
Definition: src/google/protobuf/descriptor.h:481
google::protobuf::FieldDescriptor::index_in_oneof_
int index_in_oneof_
Definition: src/google/protobuf/descriptor.h:798
google::protobuf::FieldDescriptor::default_value_float_
float default_value_float_
Definition: src/google/protobuf/descriptor.h:816
google::protobuf::FieldDescriptor::cpp_type
CppType cpp_type() const
Definition: src/google/protobuf/descriptor.h:2139
google::protobuf::Descriptor::FindExtensionRangeContainingNumber
const ExtensionRange * FindExtensionRangeContainingNumber(int number) const
Definition: src/google/protobuf/descriptor.cc:1815
number
double number
Definition: cJSON.h:326
google::protobuf::MethodDescriptor::options_
const MethodOptions * options_
Definition: src/google/protobuf/descriptor.h:1302
google::protobuf::FieldDescriptor::CppType
CppType
Definition: src/google/protobuf/descriptor.h:553
compiler
Definition: plugin.pb.cc:22
google
Definition: data_proto2_to_proto3_util.h:11
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
google::protobuf::compiler::cpp::Formatter
Definition: cpp_helpers.h:637
google::protobuf::FileDescriptor::Syntax
Syntax
Definition: src/google/protobuf/descriptor.h:1391
google::protobuf::method
const Descriptor::ReservedRange const EnumValueDescriptor method
Definition: src/google/protobuf/descriptor.h:1973
google::protobuf.internal::cpp_type
FieldDescriptor::CppType cpp_type(FieldType type)
Definition: extension_set_heavy.cc:133
google::protobuf::FileDescriptor::OptionsType
FileOptions OptionsType
Definition: src/google/protobuf/descriptor.h:1456
google::protobuf::descriptor_unittest::DescriptorTest
Definition: descriptor_unittest.cc:614
google::protobuf::FileDescriptor::FileDescriptor
FileDescriptor()
Definition: src/google/protobuf/descriptor.h:1498
google::protobuf::MethodDescriptor::input_type_
internal::LazyDescriptor input_type_
Definition: src/google/protobuf/descriptor.h:1300
google::protobuf::FieldDescriptor::is_map
bool is_map() const
Definition: src/google/protobuf/descriptor.h:2075
google::protobuf::FieldDescriptor::OptionsType
FieldOptions OptionsType
Definition: src/google/protobuf/descriptor.h:749


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