54 #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__
55 #define GOOGLE_PROTOBUF_DESCRIPTOR_H__
68 class FieldDescriptor;
69 class OneofDescriptor;
71 class EnumValueDescriptor;
72 class ServiceDescriptor;
73 class MethodDescriptor;
75 class DescriptorDatabase;
79 class DescriptorProto;
80 class FieldDescriptorProto;
81 class OneofDescriptorProto;
82 class EnumDescriptorProto;
83 class EnumValueDescriptorProto;
84 class ServiceDescriptorProto;
85 class MethodDescriptorProto;
86 class FileDescriptorProto;
90 class EnumValueOptions;
94 class UninterpretedOption;
101 class DescriptorBuilder;
102 class FileDescriptorTables;
129 const string& name()
const;
136 const string& full_name()
const;
163 string DebugString()
const;
168 bool is_placeholder()
const;
173 int field_count()
const;
188 const string& lowercase_name)
const;
195 const string& camelcase_name)
const;
198 int oneof_decl_count()
const;
209 int nested_type_count()
const;
212 const Descriptor* nested_type(
int index)
const;
216 const Descriptor* FindNestedTypeByName(
const string& name)
const;
221 int enum_type_count()
const;
227 const EnumDescriptor* FindEnumTypeByName(
const string& name)
const;
243 int extension_range_count()
const;
250 bool IsExtensionNumber(
int number)
const;
253 const ExtensionRange* FindExtensionRangeContainingNumber(
int number)
const;
257 int extension_count()
const;
268 const FieldDescriptor* FindExtensionByLowercaseName(
const string& name)
const;
272 const FieldDescriptor* FindExtensionByCamelcaseName(
const string& name)
const;
286 void DebugString(
int depth,
string *contents)
const;
290 void GetLocationPath(vector<int>*
output)
const;
321 friend class DescriptorBuilder;
388 CPPTYPE_MESSAGE = 10,
406 static const int kMaxNumber = (1 << 29) - 1;
410 static const int kFirstReservedNumber = 19000;
413 static const int kLastReservedNumber = 19999;
415 const string& name()
const;
416 const string& full_name()
const;
418 bool is_extension()
const;
427 const string& lowercase_name()
const;
438 const string& camelcase_name()
const;
441 const char* type_name()
const;
443 const char* cpp_type_name()
const;
446 bool is_required()
const;
447 bool is_optional()
const;
448 bool is_repeated()
const;
449 bool is_packable()
const;
451 bool is_packed()
const;
459 bool has_default_value()
const;
463 int32 default_value_int32()
const;
466 int64 default_value_int64()
const;
469 uint32 default_value_uint32()
const;
472 uint64 default_value_uint64()
const;
475 float default_value_float()
const;
478 double default_value_double()
const;
481 bool default_value_bool()
const;
489 const string& default_value_string()
const;
500 int index_in_oneof()
const;
534 string DebugString()
const;
540 static const char* TypeName(
Type type);
543 static const char* CppTypeName(
CppType cpp_type);
546 static inline bool IsTypePackable(
Type field_type);
560 void DebugString(
int depth, PrintLabelFlag print_label_flag,
561 string* contents)
const;
566 string DefaultValueAsString(
bool quote_string_type)
const;
570 void GetLocationPath(vector<int>*
output)
const;
607 static const CppType kTypeToCppTypeMap[MAX_TYPE + 1];
609 static const char *
const kTypeToName[MAX_TYPE + 1];
611 static const char *
const kCppTypeToName[MAX_CPPTYPE + 1];
613 static const char *
const kLabelToName[MAX_LABEL + 1];
617 friend class DescriptorBuilder;
627 const string& name()
const;
628 const string& full_name()
const;
637 int field_count()
const;
646 string DebugString()
const;
657 void DebugString(
int depth,
string* contents)
const;
661 void GetLocationPath(vector<int>*
output)
const;
675 friend class DescriptorBuilder;
686 const string& name()
const;
689 const string& full_name()
const;
699 int value_count()
const;
724 string DebugString()
const;
729 bool is_placeholder()
const;
742 void DebugString(
int depth,
string *contents)
const;
746 void GetLocationPath(vector<int>*
output)
const;
767 friend class DescriptorBuilder;
782 const string& name()
const;
791 const string& full_name()
const;
807 string DebugString()
const;
820 void DebugString(
int depth,
string *contents)
const;
824 void GetLocationPath(vector<int>*
output)
const;
837 friend class DescriptorBuilder;
849 const string& name()
const;
851 const string& full_name()
const;
866 int method_count()
const;
877 string DebugString()
const;
890 void DebugString(
string *contents)
const;
894 void GetLocationPath(vector<int>*
output)
const;
908 friend class DescriptorBuilder;
921 const string& name()
const;
923 const string& full_name()
const;
946 string DebugString()
const;
959 void DebugString(
int depth,
string *contents)
const;
963 void GetLocationPath(vector<int>*
output)
const;
977 friend class DescriptorBuilder;
990 const string& name()
const;
993 const string& package()
const;
1000 int dependency_count()
const;
1007 int public_dependency_count()
const;
1015 int weak_dependency_count()
const;
1023 int message_type_count()
const;
1026 const Descriptor* message_type(
int index)
const;
1030 int enum_type_count()
const;
1036 int service_count()
const;
1043 int extension_count()
const;
1056 const Descriptor* FindMessageTypeByName(
const string& name)
const;
1058 const EnumDescriptor* FindEnumTypeByName(
const string& name)
const;
1068 const FieldDescriptor* FindExtensionByLowercaseName(
const string& name)
const;
1071 const FieldDescriptor* FindExtensionByCamelcaseName(
const string& name)
const;
1083 string DebugString()
const;
1088 bool is_placeholder()
const;
1098 bool GetSourceLocation(
const vector<int>& path,
1130 friend class DescriptorBuilder;
1215 const string& symbol_name)
const;
1222 const Descriptor* FindMessageTypeByName(
const string& name)
const;
1226 const EnumDescriptor* FindEnumTypeByName(
const string& name)
const;
1241 void FindAllExtensions(
const Descriptor* extendee,
1242 vector<const FieldDescriptor*>* out)
const;
1272 virtual void AddError(
1273 const string& filename,
1274 const string& element_name,
1276 ErrorLocation location,
1277 const string& message
1304 ErrorCollector* error_collector);
1359 static void InternalAddGeneratedFile(
1360 const void* encoded_file_descriptor,
int size);
1372 void InternalDontEnforceDependencies();
1376 underlay_ = underlay;
1382 bool InternalIsFileLoaded(
const string& filename)
const;
1387 void AddUnusedImportTrackFile(
const string& file_name);
1388 void ClearUnusedImportTrackFiles();
1396 friend class DescriptorBuilder;
1401 bool IsSubSymbolOfBuiltType(
const string& name)
const;
1407 bool TryFindFileInFallbackDatabase(
const string& name)
const;
1408 bool TryFindSymbolInFallbackDatabase(
const string& name)
const;
1409 bool TryFindExtensionInFallbackDatabase(
const Descriptor* containing_type,
1443 #define PROTOBUF_DEFINE_ACCESSOR(CLASS, FIELD, TYPE) \
1444 inline TYPE CLASS::FIELD() const { return FIELD##_; }
1447 #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \
1448 inline const string& CLASS::FIELD() const { return *FIELD##_; }
1451 #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \
1452 inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; }
1454 #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \
1455 inline const TYPE& CLASS::options() const { return *options_; }
1475 const Descriptor::ExtensionRange*)
1498 const FieldDescriptor*)
1563 const ServiceDescriptor*)
1565 const FieldDescriptor*)
1567 #undef PROTOBUF_DEFINE_ACCESSOR
1568 #undef PROTOBUF_DEFINE_STRING_ACCESSOR
1569 #undef PROTOBUF_DEFINE_ARRAY_ACCESSOR
1691 #endif // GOOGLE_PROTOBUF_DESCRIPTOR_H__
const EnumValueDescriptor * default_value_enum_
Definition: descriptor.h:603
static bool IsTypePackable(Type field_type)
Definition: descriptor.h:1661
EnumDescriptor * enum_types_
Definition: descriptor.h:310
Definition: descriptor.h:1264
const string * name_
Definition: descriptor.h:1103
const ExtensionRange * FindExtensionRangeContainingNumber(int number) const
int public_dependency_count_
Definition: descriptor.h:1108
const FieldDescriptor * PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions)
Definition: descriptor.h:1259
OneofDescriptor * oneof_decls_
Definition: descriptor.h:306
Definition: descriptor.h:918
void internal_set_underlay(const DescriptorPool *underlay)
Definition: descriptor.h:1375
double default_value_double_
Definition: descriptor.h:600
int message_type_count_
Definition: descriptor.h:1112
void EnforceWeakDependencies(bool enforce)
Definition: descriptor.h:1327
const DescriptorPool * pool_
Definition: descriptor.h:1105
uint32 default_value_uint32_
Definition: descriptor.h:597
bool is_placeholder_
Definition: descriptor.h:755
const string * camelcase_name_
Definition: descriptor.h:575
const string * name_
Definition: descriptor.h:292
PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension_range, const Descriptor::ExtensionRange *) PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor
bool is_repeated() const
Definition: descriptor.h:1585
const EnumValueOptions * options_
Definition: descriptor.h:830
const string * name_
Definition: descriptor.h:896
Definition: descriptor.pb.h:1502
EnumValueDescriptor()
Definition: descriptor.h:836
FileDescriptor()
Definition: descriptor.h:1129
Definition: descriptor.pb.h:2132
std::set< string > unused_import_track_files_
Definition: descriptor.h:1435
Definition: descriptor.h:1263
CppType cpp_type() const
Definition: descriptor.h:1641
ErrorCollector()
Definition: descriptor.h:1251
const Descriptor * containing_type_
Definition: descriptor.h:295
Definition: descriptor.h:1258
int end
Definition: descriptor.h:239
int * public_dependencies_
Definition: descriptor.h:1109
Definition: descriptor.h:1266
const string * lowercase_name_
Definition: descriptor.h:574
const string * full_name_
Definition: descriptor.h:897
const MessageOptions * options_
Definition: descriptor.h:296
Definition: descriptor.pb.h:1052
const FileDescriptor * weak_dependency(int index) const
Definition: descriptor.h:1677
const FileDescriptor * file_
Definition: descriptor.h:294
PrintLabelFlag
Definition: descriptor.h:559
const Descriptor * containing_type_
Definition: descriptor.h:582
Label
Definition: descriptor.h:396
FileOptions OptionsType
Definition: descriptor.h:1101
EnumValueDescriptor * values_
Definition: descriptor.h:760
Definition: descriptor.pb.h:2797
bool is_packable() const
Definition: descriptor.h:1589
const FileDescriptor * dependency(int index) const
Definition: descriptor.h:1668
FieldDescriptor * fields_
Definition: descriptor.h:304
Definition: descriptor.h:126
scoped_ptr< Tables > tables_
Definition: descriptor.h:1429
Type type_
Definition: descriptor.h:578
EnumDescriptor * enum_types_
Definition: descriptor.h:1115
static const char * TypeName(Type type)
Definition: descriptor.h:1653
Definition: PreparedStatement.h:47
Definition: descriptor.h:237
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: descriptor.h:683
bool has_default_value_
Definition: descriptor.h:593
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: common.h:89
const Descriptor * containing_type_
Definition: descriptor.h:665
bool is_required() const
Definition: descriptor.h:1577
int number_
Definition: descriptor.h:828
bool is_extendable_
Definition: descriptor.h:666
bool default_value_bool_
Definition: descriptor.h:601
Definition: descriptor.h:363
int service_count_
Definition: descriptor.h:1116
Definition: descriptor.h:1261
ErrorCollector * default_error_collector_
Definition: descriptor.h:1424
Definition: PreparedStatement.h:56
float default_value_float_
Definition: descriptor.h:599
Definition: descriptor.h:780
Definition: descriptor.h:846
Definition: PreparedStatement.h:58
EnumDescriptor()
Definition: descriptor.h:766
MethodDescriptor * methods_
Definition: descriptor.h:901
const EnumDescriptor * enum_type_
Definition: descriptor.h:586
const string * full_name_
Definition: descriptor.h:827
const Descriptor * message_type_
Definition: descriptor.h:585
Descriptor * nested_types_
Definition: descriptor.h:308
bool is_optional() const
Definition: descriptor.h:1581
Definition: message.h:165
int index() const
Definition: descriptor.h:1605
int index() const
Definition: descriptor.h:1613
const string * name_
Definition: descriptor.h:748
FieldDescriptor()
Definition: descriptor.h:616
const string * package_
Definition: descriptor.h:1104
Definition: descriptor.h:361
Definition: descriptor.h:1249
Definition: descriptor.pb.h:1161
Definition: descriptor.pb.h:1267
EnumValueOptions OptionsType
Definition: descriptor.h:817
int32_t int32
Definition: common.h:172
virtual void AddWarning(const string &, const string &, const Message *, ErrorLocation, const string &)
Definition: descriptor.h:1282
const string * name_
Definition: descriptor.h:965
Definition: descriptor.pb.h:2322
const string * name_
Definition: descriptor.h:572
MethodDescriptor()
Definition: descriptor.h:976
int extension_count_
Definition: descriptor.h:1118
const EnumDescriptor * type_
Definition: descriptor.h:829
Definition: descriptor.h:1167
const FieldDescriptor ** fields_
Definition: descriptor.h:668
const FieldDescriptor * field(int index) const
Definition: descriptor.h:1684
bool is_unqualified_placeholder_
Definition: descriptor.h:301
int field_count_
Definition: descriptor.h:667
const string * default_value_string_
Definition: descriptor.h:604
Definition: descriptor.pb.h:2027
Descriptor * message_types_
Definition: descriptor.h:1113
const SourceCodeInfo * source_code_info_
Definition: descriptor.h:1124
OneofDescriptor()
Definition: descriptor.h:674
int enum_type_count_
Definition: descriptor.h:309
const FileDescriptor * file_
Definition: descriptor.h:898
const Descriptor * containing_type_
Definition: descriptor.h:751
FieldOptions OptionsType
Definition: descriptor.h:556
experimental_map_key
Definition: descriptor.h:1497
const string * name_
Definition: descriptor.h:826
int method_count_
Definition: descriptor.h:900
static const char *const kTypeToName[MAX_TYPE+1]
Definition: descriptor.h:609
bool is_placeholder_
Definition: descriptor.h:299
static CppType TypeToCppType(Type type)
Definition: descriptor.h:1649
FieldDescriptor * extensions_
Definition: descriptor.h:1120
EnumOptions OptionsType
Definition: descriptor.h:739
static const char * CppTypeName(CppType cpp_type)
Definition: descriptor.h:1657
const ServiceOptions * options_
Definition: descriptor.h:899
Definition: descriptor.pb.h:722
string leading_comments
Definition: descriptor.h:117
const Descriptor * output_type_
Definition: descriptor.h:969
Definition: descriptor.h:359
Descriptor()
Definition: descriptor.h:320
Definition: descriptor.pb.h:546
const string * full_name_
Definition: descriptor.h:573
Label label_
Definition: descriptor.h:579
uint32_t uint32
Definition: common.h:177
ExtensionRange * extension_ranges_
Definition: descriptor.h:312
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof, const OneofDescriptor *) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor
int index() const
Definition: descriptor.h:1633
const DescriptorPool * underlay_
Definition: descriptor.h:1425
const ServiceDescriptor * service_
Definition: descriptor.h:967
Definition: descriptor.pb.h:1376
const FileDescriptor * public_dependency(int index) const
Definition: descriptor.h:1672
const FileOptions * options_
Definition: descriptor.h:1121
int nested_type_count_
Definition: descriptor.h:307
int number_
Definition: descriptor.h:577
const OneofDescriptor * containing_oneof_
Definition: descriptor.h:583
uint64_t uint64
Definition: common.h:178
const FileDescriptor * file_
Definition: descriptor.h:750
MessageOptions OptionsType
Definition: descriptor.h:282
bool IsExtensionNumber(int number) const
Definition: descriptor.h:1573
int * weak_dependencies_
Definition: descriptor.h:1111
Definition: descriptor.pb.h:968
DescriptorDatabase * fallback_database_
Definition: descriptor.h:1423
Mutex * mutex_
Definition: descriptor.h:1420
const MethodOptions * options_
Definition: descriptor.h:970
Definition: descriptor.h:398
string trailing_comments
Definition: descriptor.h:118
bool enforce_dependencies_
Definition: descriptor.h:1432
int extension_range_count_
Definition: descriptor.h:311
static const char *const kCppTypeToName[MAX_CPPTYPE+1]
Definition: descriptor.h:611
MethodOptions OptionsType
Definition: descriptor.h:956
bool enforce_weak_
Definition: descriptor.h:1434
ServiceDescriptor()
Definition: descriptor.h:907
const Descriptor * input_type_
Definition: descriptor.h:968
int start_line
Definition: descriptor.h:109
#define LIBPROTOBUF_EXPORT
Definition: common.h:105
bool allow_unknown_
Definition: descriptor.h:1433
Definition: descriptor.h:1262
Definition: descriptor.h:399
int index() const
Definition: descriptor.h:1617
Definition: descriptor_database.h:65
void AllowUnknownDependencies()
Definition: descriptor.h:1321
const string * full_name_
Definition: descriptor.h:966
CppType
Definition: descriptor.h:378
int64_t int64
Definition: common.h:173
int index() const
Definition: descriptor.h:1629
bool is_extension_
Definition: descriptor.h:580
Definition: descriptor.h:625
const string * name_
Definition: descriptor.h:663
ServiceOptions
Definition: descriptor.h:1539
Definition: descriptor.h:360
Definition: descriptor.h:342
const FileDescriptor * file_
Definition: descriptor.h:576
int field_count_
Definition: descriptor.h:303
int start
Definition: descriptor.h:238
ErrorLocation
Definition: descriptor.h:1257
const FileDescriptor ** dependencies_
Definition: descriptor.h:1107
int start_column
Definition: descriptor.h:111
const string * full_name_
Definition: descriptor.h:293
Definition: BnetFileGenerator.h:47
const char * type_name() const
Definition: descriptor.h:1637
const FieldDescriptor value
Definition: descriptor.h:1522
int64 default_value_int64_
Definition: descriptor.h:596
Definition: descriptor.pb.h:1852
int index() const
Definition: descriptor.h:1625
int oneof_decl_count_
Definition: descriptor.h:305
int index_in_oneof_
Definition: descriptor.h:581
const string * full_name_
Definition: descriptor.h:664
#define const
Definition: zconf.h:217
int weak_dependency_count_
Definition: descriptor.h:1110
#define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD)
Definition: descriptor.h:1447
extension
Definition: descriptor.h:1476
int extension_count_
Definition: descriptor.h:313
int value_count_
Definition: descriptor.h:759
int end_line
Definition: descriptor.h:110
Definition: descriptor.pb.h:239
Type
Type of JSON value.
Definition: rapidjson.h:642
Definition: PreparedStatement.h:57
Definition: descriptor.h:986
FieldDescriptor * extensions_
Definition: descriptor.h:314
int enum_type_count_
Definition: descriptor.h:1114
bool is_placeholder_
Definition: descriptor.h:1119
int end_column
Definition: descriptor.h:112
Type
Definition: descriptor.h:346
const Descriptor * extension_scope_
Definition: descriptor.h:584
const FieldOptions * options_
Definition: descriptor.h:588
Definition: descriptor.h:1265
Definition: descriptor.h:108
Definition: descriptor.h:1260
bool is_unqualified_placeholder_
Definition: descriptor.h:757
int index() const
Definition: descriptor.h:1595
const string * full_name_
Definition: descriptor.h:749
static const CppType kTypeToCppTypeMap[MAX_TYPE+1]
Definition: descriptor.h:607
uint64 default_value_uint64_
Definition: descriptor.h:598
Definition: descriptor.pb.h:1737
const FileDescriptorTables * tables_
Definition: descriptor.h:1123
const FieldDescriptor * experimental_map_key_
Definition: descriptor.h:587
const EnumOptions * options_
Definition: descriptor.h:752
ServiceOptions OptionsType
Definition: descriptor.h:887
int dependency_count_
Definition: descriptor.h:1106
ServiceDescriptor * services_
Definition: descriptor.h:1117
Definition: descriptor.pb.h:2227
Definition: descriptor.h:397
int32 default_value_int32_
Definition: descriptor.h:595
const char * cpp_type_name() const
Definition: descriptor.h:1645