diff options
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_extension.cc | 28 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_helpers.cc | 30 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_helpers.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_message.cc | 17 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_string_field.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/compiler/java/java_extension.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/compiler/java/java_helpers.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/compiler/java/java_helpers.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/compiler/java/java_message.cc | 3 | ||||
-rw-r--r-- | src/google/protobuf/compiler/python/python_generator.cc | 5 | ||||
-rw-r--r-- | src/google/protobuf/descriptor.pb.cc | 125 | ||||
-rw-r--r-- | src/google/protobuf/descriptor.pb.h | 62 | ||||
-rw-r--r-- | src/google/protobuf/message_unittest.cc | 30 |
13 files changed, 285 insertions, 37 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_extension.cc b/src/google/protobuf/compiler/cpp/cpp_extension.cc index 0dd8420d..3f212b93 100644 --- a/src/google/protobuf/compiler/cpp/cpp_extension.cc +++ b/src/google/protobuf/compiler/cpp/cpp_extension.cc @@ -77,9 +77,11 @@ ExtensionGenerator::~ExtensionGenerator() {} void ExtensionGenerator::GenerateDeclaration(io::Printer* printer) { map<string, string> vars; - vars["extendee" ] = ClassName(descriptor_->containing_type(), true); - vars["type_traits"] = type_traits_; - vars["name" ] = descriptor_->name(); + vars["extendee" ] = ClassName(descriptor_->containing_type(), true); + vars["number" ] = SimpleItoa(descriptor_->number()); + vars["type_traits" ] = type_traits_; + vars["name" ] = descriptor_->name(); + vars["constant_name"] = FieldConstantName(descriptor_); // If this is a class member, it needs to be declared "static". Otherwise, // it needs to be "extern". @@ -91,24 +93,34 @@ void ExtensionGenerator::GenerateDeclaration(io::Printer* printer) { } printer->Print(vars, + "static const int $constant_name$ = $number$;\n" "$qualifier$ ::google::protobuf::internal::ExtensionIdentifier< $extendee$,\n" " ::google::protobuf::internal::$type_traits$ > $name$;\n"); } void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { map<string, string> vars; - vars["extendee" ] = ClassName(descriptor_->containing_type(), true); - vars["number" ] = SimpleItoa(descriptor_->number()); - vars["type_traits"] = type_traits_; - vars["name" ] = descriptor_->name(); + vars["extendee" ] = ClassName(descriptor_->containing_type(), true); + vars["type_traits" ] = type_traits_; + vars["name" ] = descriptor_->name(); + vars["constant_name"] = FieldConstantName(descriptor_); // If this is a class member, it needs to be declared in its class scope. vars["scope"] = (descriptor_->extension_scope() == NULL) ? "" : ClassName(descriptor_->extension_scope(), false) + "::"; + // Likewise, class members need to declare the field constant variable. + if (descriptor_->extension_scope() != NULL) { + printer->Print(vars, + "#ifndef _MSC_VER\n" + "const int $scope$$constant_name$;\n" + "#endif\n"); + } + printer->Print(vars, "::google::protobuf::internal::ExtensionIdentifier< $extendee$,\n" - " ::google::protobuf::internal::$type_traits$ > $scope$$name$($number$);\n"); + " ::google::protobuf::internal::$type_traits$ > $scope$$name$(" + "$constant_name$);\n"); } } // namespace cpp diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc index 11122883..d536bea4 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -77,6 +77,31 @@ hash_set<string> MakeKeywordsMap() { hash_set<string> kKeywords = MakeKeywordsMap(); +string UnderscoresToCamelCase(const string& input, bool cap_next_letter) { + string result; + // Note: I distrust ctype.h due to locales. + for (int i = 0; i < input.size(); i++) { + if ('a' <= input[i] && input[i] <= 'z') { + if (cap_next_letter) { + result += input[i] + ('A' - 'a'); + } else { + result += input[i]; + } + cap_next_letter = false; + } else if ('A' <= input[i] && input[i] <= 'Z') { + // Capital letters are left as-is. + result += input[i]; + cap_next_letter = false; + } else if ('0' <= input[i] && input[i] <= '9') { + result += input[i]; + cap_next_letter = true; + } else { + cap_next_letter = true; + } + } + return result; +} + } // namespace const char kThickSeparator[] = @@ -124,6 +149,11 @@ string FieldName(const FieldDescriptor* field) { return result; } +string FieldConstantName(const FieldDescriptor *field) { + string field_name = UnderscoresToCamelCase(field->name(), true); + return "k" + field_name + "FieldNumber"; +} + string StripProto(const string& filename) { if (HasSuffixString(filename, ".protodevel")) { return StripSuffixString(filename, ".protodevel"); diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index 80c2f2ee..30c6e7d0 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -65,6 +65,10 @@ string ClassName(const EnumDescriptor* enum_descriptor, bool qualified); // anyway, so normally this just returns field->name(). string FieldName(const FieldDescriptor* field); +// Get the unqualified name that should be used for a field's field +// number constant. +string FieldConstantName(const FieldDescriptor *field); + // Returns the scope where the field was defined (for extensions, this is // different from the message type to which the field applies). inline const Descriptor* FieldScope(const FieldDescriptor* field) { diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index d2f76803..2ec49234 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -204,6 +204,8 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) { map<string, string> vars; vars["name"] = FieldName(field); + vars["constant_name"] = FieldConstantName(field); + vars["number"] = SimpleItoa(field->number()); if (field->is_repeated()) { printer->Print(vars, "inline int $name$_size() const;\n"); @@ -212,6 +214,7 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) { } printer->Print(vars, "inline void clear_$name$();\n"); + printer->Print(vars, "static const int $constant_name$ = $number$;\n"); // Generate type-specific accessor declarations. field_generators_.get(field).GenerateAccessorDeclarations(printer); @@ -665,9 +668,21 @@ GenerateClassMethods(io::Printer* printer) { for (int i = 0; i < descriptor_->field_count(); i++) { field_generators_.get(descriptor_->field(i)) .GenerateNonInlineAccessorDefinitions(printer); - printer->Print("\n"); } + // Generate field number constants. + printer->Print("#ifndef _MSC_VER\n"); + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor *field = descriptor_->field(i); + printer->Print( + "const int $classname$::$constant_name$;\n", + "classname", ClassName(FieldScope(field), false), + "constant_name", FieldConstantName(field)); + } + printer->Print( + "#endif // !_MSC_VER\n" + "\n"); + // Define extension identifiers. for (int i = 0; i < descriptor_->extension_count(); i++) { extension_generators_[i]->GenerateDefinition(printer); diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 51c5c6f5..8e10e9b0 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -180,10 +180,10 @@ void StringFieldGenerator:: GenerateNonInlineAccessorDefinitions(io::Printer* printer) const { if (descriptor_->default_value_string().empty()) { printer->Print(variables_, - "const ::std::string $classname$::_default_$name$_;"); + "const ::std::string $classname$::_default_$name$_;\n"); } else { printer->Print(variables_, - "const ::std::string $classname$::_default_$name$_($default$);"); + "const ::std::string $classname$::_default_$name$_($default$);\n"); } } diff --git a/src/google/protobuf/compiler/java/java_extension.cc b/src/google/protobuf/compiler/java/java_extension.cc index 8f6500b5..302dcea4 100644 --- a/src/google/protobuf/compiler/java/java_extension.cc +++ b/src/google/protobuf/compiler/java/java_extension.cc @@ -57,6 +57,8 @@ void ExtensionGenerator::Generate(io::Printer* printer) { map<string, string> vars; vars["name"] = UnderscoresToCamelCase(descriptor_); vars["containing_type"] = ClassName(descriptor_->containing_type()); + vars["number"] = SimpleItoa(descriptor_->number()); + vars["constant_name"] = FieldConstantName(descriptor_); JavaType java_type = GetJavaType(descriptor_); string singular_type; @@ -72,6 +74,8 @@ void ExtensionGenerator::Generate(io::Printer* printer) { break; } + printer->Print(vars, + "public static final int $constant_name$ = $number$;\n"); if (descriptor_->is_repeated()) { printer->Print(vars, "public static\n" diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc index c1994352..6a107650 100644 --- a/src/google/protobuf/compiler/java/java_helpers.cc +++ b/src/google/protobuf/compiler/java/java_helpers.cc @@ -171,6 +171,12 @@ string ClassName(const FileDescriptor* descriptor) { return result; } +string FieldConstantName(const FieldDescriptor *field) { + string name = field->name() + "_FIELD_NUMBER"; + UpperString(&name); + return name; +} + JavaType GetJavaType(FieldDescriptor::Type field_type) { switch (field_type) { case FieldDescriptor::TYPE_INT32: diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h index 43f2add0..de3f883b 100644 --- a/src/google/protobuf/compiler/java/java_helpers.h +++ b/src/google/protobuf/compiler/java/java_helpers.h @@ -88,6 +88,10 @@ inline string ExtensionIdentifierName(const FieldDescriptor* descriptor) { } string ClassName(const FileDescriptor* descriptor); +// Get the unqualified name that should be used for a field's field +// number constant. +string FieldConstantName(const FieldDescriptor *field); + enum JavaType { JAVATYPE_INT, JAVATYPE_LONG, diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc index 9a4b2f79..c2e0c115 100644 --- a/src/google/protobuf/compiler/java/java_message.cc +++ b/src/google/protobuf/compiler/java/java_message.cc @@ -311,6 +311,9 @@ void MessageGenerator::Generate(io::Printer* printer) { // Fields for (int i = 0; i < descriptor_->field_count(); i++) { PrintFieldComment(printer, descriptor_->field(i)); + printer->Print("public static final int $constant_name$ = $number$;\n", + "constant_name", FieldConstantName(descriptor_->field(i)), + "number", SimpleItoa(descriptor_->field(i)->number())); field_generators_.get(descriptor_->field(i)).GenerateMembers(printer); printer->Print("\n"); } diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc index ca69fd4c..d301f015 100644 --- a/src/google/protobuf/compiler/python/python_generator.cc +++ b/src/google/protobuf/compiler/python/python_generator.cc @@ -319,6 +319,11 @@ void Generator::PrintTopLevelExtensions() const { const bool is_extension = true; for (int i = 0; i < file_->extension_count(); ++i) { const FieldDescriptor& extension_field = *file_->extension(i); + string constant_name = extension_field.name() + "_FIELD_NUMBER"; + UpperString(&constant_name); + printer_->Print("$constant_name$ = $number$\n", + "constant_name", constant_name, + "number", SimpleItoa(extension_field.number())); printer_->Print("$name$ = ", "name", extension_field.name()); PrintFieldDescriptor(extension_field, is_extension); printer_->Print("\n"); diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 16b44424..8d1b7e3e 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -557,6 +557,9 @@ struct StaticDescriptorInitializer_google_2fprotobuf_2fdescriptor_2eproto { // =================================================================== +#ifndef _MSC_VER +const int FileDescriptorSet::kFileFieldNumber; +#endif // !_MSC_VER FileDescriptorSet::FileDescriptorSet() : ::google::protobuf::Message(), @@ -736,11 +739,16 @@ const ::google::protobuf::Reflection* FileDescriptorSet::GetReflection() const { const ::std::string FileDescriptorProto::_default_name_; const ::std::string FileDescriptorProto::_default_package_; - - - - - +#ifndef _MSC_VER +const int FileDescriptorProto::kNameFieldNumber; +const int FileDescriptorProto::kPackageFieldNumber; +const int FileDescriptorProto::kDependencyFieldNumber; +const int FileDescriptorProto::kMessageTypeFieldNumber; +const int FileDescriptorProto::kEnumTypeFieldNumber; +const int FileDescriptorProto::kServiceFieldNumber; +const int FileDescriptorProto::kExtensionFieldNumber; +const int FileDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER FileDescriptorProto::FileDescriptorProto() : ::google::protobuf::Message(), @@ -1172,7 +1180,10 @@ const ::google::protobuf::Reflection* FileDescriptorProto::GetReflection() const // =================================================================== - +#ifndef _MSC_VER +const int DescriptorProto_ExtensionRange::kStartFieldNumber; +const int DescriptorProto_ExtensionRange::kEndFieldNumber; +#endif // !_MSC_VER DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange() : ::google::protobuf::Message(), @@ -1387,11 +1398,15 @@ const ::google::protobuf::Reflection* DescriptorProto_ExtensionRange::GetReflect // ------------------------------------------------------------------- const ::std::string DescriptorProto::_default_name_; - - - - - +#ifndef _MSC_VER +const int DescriptorProto::kNameFieldNumber; +const int DescriptorProto::kFieldFieldNumber; +const int DescriptorProto::kExtensionFieldNumber; +const int DescriptorProto::kNestedTypeFieldNumber; +const int DescriptorProto::kEnumTypeFieldNumber; +const int DescriptorProto::kExtensionRangeFieldNumber; +const int DescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER DescriptorProto::DescriptorProto() : ::google::protobuf::Message(), @@ -1862,12 +1877,19 @@ const FieldDescriptorProto_Label FieldDescriptorProto::Label_MIN; const FieldDescriptorProto_Label FieldDescriptorProto::Label_MAX; #endif // _MSC_VER const ::std::string FieldDescriptorProto::_default_name_; - - - const ::std::string FieldDescriptorProto::_default_type_name_; const ::std::string FieldDescriptorProto::_default_extendee_; const ::std::string FieldDescriptorProto::_default_default_value_; +#ifndef _MSC_VER +const int FieldDescriptorProto::kNameFieldNumber; +const int FieldDescriptorProto::kNumberFieldNumber; +const int FieldDescriptorProto::kLabelFieldNumber; +const int FieldDescriptorProto::kTypeFieldNumber; +const int FieldDescriptorProto::kTypeNameFieldNumber; +const int FieldDescriptorProto::kExtendeeFieldNumber; +const int FieldDescriptorProto::kDefaultValueFieldNumber; +const int FieldDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER FieldDescriptorProto::FieldDescriptorProto() : ::google::protobuf::Message(), @@ -2308,7 +2330,11 @@ const ::google::protobuf::Reflection* FieldDescriptorProto::GetReflection() cons // =================================================================== const ::std::string EnumDescriptorProto::_default_name_; - +#ifndef _MSC_VER +const int EnumDescriptorProto::kNameFieldNumber; +const int EnumDescriptorProto::kValueFieldNumber; +const int EnumDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER EnumDescriptorProto::EnumDescriptorProto() : ::google::protobuf::Message(), @@ -2568,7 +2594,11 @@ const ::google::protobuf::Reflection* EnumDescriptorProto::GetReflection() const // =================================================================== const ::std::string EnumValueDescriptorProto::_default_name_; - +#ifndef _MSC_VER +const int EnumValueDescriptorProto::kNameFieldNumber; +const int EnumValueDescriptorProto::kNumberFieldNumber; +const int EnumValueDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER EnumValueDescriptorProto::EnumValueDescriptorProto() : ::google::protobuf::Message(), @@ -2826,7 +2856,11 @@ const ::google::protobuf::Reflection* EnumValueDescriptorProto::GetReflection() // =================================================================== const ::std::string ServiceDescriptorProto::_default_name_; - +#ifndef _MSC_VER +const int ServiceDescriptorProto::kNameFieldNumber; +const int ServiceDescriptorProto::kMethodFieldNumber; +const int ServiceDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER ServiceDescriptorProto::ServiceDescriptorProto() : ::google::protobuf::Message(), @@ -3088,6 +3122,12 @@ const ::google::protobuf::Reflection* ServiceDescriptorProto::GetReflection() co const ::std::string MethodDescriptorProto::_default_name_; const ::std::string MethodDescriptorProto::_default_input_type_; const ::std::string MethodDescriptorProto::_default_output_type_; +#ifndef _MSC_VER +const int MethodDescriptorProto::kNameFieldNumber; +const int MethodDescriptorProto::kInputTypeFieldNumber; +const int MethodDescriptorProto::kOutputTypeFieldNumber; +const int MethodDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER MethodDescriptorProto::MethodDescriptorProto() : ::google::protobuf::Message(), @@ -3407,8 +3447,13 @@ const FileOptions_OptimizeMode FileOptions::OptimizeMode_MAX; #endif // _MSC_VER const ::std::string FileOptions::_default_java_package_; const ::std::string FileOptions::_default_java_outer_classname_; - - +#ifndef _MSC_VER +const int FileOptions::kJavaPackageFieldNumber; +const int FileOptions::kJavaOuterClassnameFieldNumber; +const int FileOptions::kJavaMultipleFilesFieldNumber; +const int FileOptions::kOptimizeForFieldNumber; +const int FileOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER FileOptions::FileOptions() : ::google::protobuf::Message(), @@ -3752,7 +3797,10 @@ const ::google::protobuf::Reflection* FileOptions::GetReflection() const { // =================================================================== - +#ifndef _MSC_VER +const int MessageOptions::kMessageSetWireFormatFieldNumber; +const int MessageOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER MessageOptions::MessageOptions() : ::google::protobuf::Message(), @@ -4006,9 +4054,13 @@ const FieldOptions_CType FieldOptions::STRING_PIECE; const FieldOptions_CType FieldOptions::CType_MIN; const FieldOptions_CType FieldOptions::CType_MAX; #endif // _MSC_VER - - const ::std::string FieldOptions::_default_experimental_map_key_; +#ifndef _MSC_VER +const int FieldOptions::kCtypeFieldNumber; +const int FieldOptions::kPackedFieldNumber; +const int FieldOptions::kExperimentalMapKeyFieldNumber; +const int FieldOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER FieldOptions::FieldOptions() : ::google::protobuf::Message(), @@ -4315,6 +4367,9 @@ const ::google::protobuf::Reflection* FieldOptions::GetReflection() const { // =================================================================== +#ifndef _MSC_VER +const int EnumOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER EnumOptions::EnumOptions() : ::google::protobuf::Message(), @@ -4512,6 +4567,9 @@ const ::google::protobuf::Reflection* EnumOptions::GetReflection() const { // =================================================================== +#ifndef _MSC_VER +const int EnumValueOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER EnumValueOptions::EnumValueOptions() : ::google::protobuf::Message(), @@ -4709,6 +4767,9 @@ const ::google::protobuf::Reflection* EnumValueOptions::GetReflection() const { // =================================================================== +#ifndef _MSC_VER +const int ServiceOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER ServiceOptions::ServiceOptions() : ::google::protobuf::Message(), @@ -4906,6 +4967,9 @@ const ::google::protobuf::Reflection* ServiceOptions::GetReflection() const { // =================================================================== +#ifndef _MSC_VER +const int MethodOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER MethodOptions::MethodOptions() : ::google::protobuf::Message(), @@ -5104,6 +5168,10 @@ const ::google::protobuf::Reflection* MethodOptions::GetReflection() const { // =================================================================== const ::std::string UninterpretedOption_NamePart::_default_name_part_; +#ifndef _MSC_VER +const int UninterpretedOption_NamePart::kNamePartFieldNumber; +const int UninterpretedOption_NamePart::kIsExtensionFieldNumber; +#endif // !_MSC_VER UninterpretedOption_NamePart::UninterpretedOption_NamePart() : ::google::protobuf::Message(), @@ -5320,12 +5388,17 @@ const ::google::protobuf::Reflection* UninterpretedOption_NamePart::GetReflectio // ------------------------------------------------------------------- - const ::std::string UninterpretedOption::_default_identifier_value_; - - - const ::std::string UninterpretedOption::_default_string_value_; +#ifndef _MSC_VER +const int UninterpretedOption::kNameFieldNumber; +const int UninterpretedOption::kIdentifierValueFieldNumber; +const int UninterpretedOption::kPositiveIntValueFieldNumber; +const int UninterpretedOption::kNegativeIntValueFieldNumber; +const int UninterpretedOption::kDoubleValueFieldNumber; +const int UninterpretedOption::kStringValueFieldNumber; +#endif // !_MSC_VER + UninterpretedOption::UninterpretedOption() : ::google::protobuf::Message(), _unknown_fields_(), diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index e5077aae..c073db51 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -158,6 +158,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message // repeated .google.protobuf.FileDescriptorProto file = 1; inline int file_size() const; inline void clear_file(); + static const int kFileFieldNumber = 1; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& file() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* mutable_file(); inline const ::google::protobuf::FileDescriptorProto& file(int index) const; @@ -243,6 +244,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -251,6 +253,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // optional string package = 2; inline bool has_package() const; inline void clear_package(); + static const int kPackageFieldNumber = 2; inline const ::std::string& package() const; inline void set_package(const ::std::string& value); inline void set_package(const char* value); @@ -259,6 +262,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // repeated string dependency = 3; inline int dependency_size() const; inline void clear_dependency(); + static const int kDependencyFieldNumber = 3; inline const ::google::protobuf::RepeatedPtrField< ::std::string>& dependency() const; inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_dependency(); inline const ::std::string& dependency(int index) const; @@ -272,6 +276,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // repeated .google.protobuf.DescriptorProto message_type = 4; inline int message_type_size() const; inline void clear_message_type(); + static const int kMessageTypeFieldNumber = 4; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& message_type() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* mutable_message_type(); inline const ::google::protobuf::DescriptorProto& message_type(int index) const; @@ -281,6 +286,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; inline int enum_type_size() const; inline void clear_enum_type(); + static const int kEnumTypeFieldNumber = 5; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& enum_type() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* mutable_enum_type(); inline const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const; @@ -290,6 +296,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // repeated .google.protobuf.ServiceDescriptorProto service = 6; inline int service_size() const; inline void clear_service(); + static const int kServiceFieldNumber = 6; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >& service() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >* mutable_service(); inline const ::google::protobuf::ServiceDescriptorProto& service(int index) const; @@ -299,6 +306,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // repeated .google.protobuf.FieldDescriptorProto extension = 7; inline int extension_size() const; inline void clear_extension(); + static const int kExtensionFieldNumber = 7; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& extension() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* mutable_extension(); inline const ::google::protobuf::FieldDescriptorProto& extension(int index) const; @@ -308,6 +316,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag // optional .google.protobuf.FileOptions options = 8; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 8; inline const ::google::protobuf::FileOptions& options() const; inline ::google::protobuf::FileOptions* mutable_options(); @@ -399,12 +408,14 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto // optional int32 start = 1; inline bool has_start() const; inline void clear_start(); + static const int kStartFieldNumber = 1; inline ::google::protobuf::int32 start() const; inline void set_start(::google::protobuf::int32 value); // optional int32 end = 2; inline bool has_end() const; inline void clear_end(); + static const int kEndFieldNumber = 2; inline ::google::protobuf::int32 end() const; inline void set_end(::google::protobuf::int32 value); @@ -490,6 +501,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -498,6 +510,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // repeated .google.protobuf.FieldDescriptorProto field = 2; inline int field_size() const; inline void clear_field(); + static const int kFieldFieldNumber = 2; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& field() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* mutable_field(); inline const ::google::protobuf::FieldDescriptorProto& field(int index) const; @@ -507,6 +520,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // repeated .google.protobuf.FieldDescriptorProto extension = 6; inline int extension_size() const; inline void clear_extension(); + static const int kExtensionFieldNumber = 6; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& extension() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* mutable_extension(); inline const ::google::protobuf::FieldDescriptorProto& extension(int index) const; @@ -516,6 +530,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // repeated .google.protobuf.DescriptorProto nested_type = 3; inline int nested_type_size() const; inline void clear_nested_type(); + static const int kNestedTypeFieldNumber = 3; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& nested_type() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* mutable_nested_type(); inline const ::google::protobuf::DescriptorProto& nested_type(int index) const; @@ -525,6 +540,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; inline int enum_type_size() const; inline void clear_enum_type(); + static const int kEnumTypeFieldNumber = 4; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& enum_type() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* mutable_enum_type(); inline const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const; @@ -534,6 +550,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; inline int extension_range_size() const; inline void clear_extension_range(); + static const int kExtensionRangeFieldNumber = 5; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >& extension_range() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >* mutable_extension_range(); inline const ::google::protobuf::DescriptorProto_ExtensionRange& extension_range(int index) const; @@ -543,6 +560,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { // optional .google.protobuf.MessageOptions options = 7; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 7; inline const ::google::protobuf::MessageOptions& options() const; inline ::google::protobuf::MessageOptions* mutable_options(); @@ -679,6 +697,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -687,24 +706,28 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa // optional int32 number = 3; inline bool has_number() const; inline void clear_number(); + static const int kNumberFieldNumber = 3; inline ::google::protobuf::int32 number() const; inline void set_number(::google::protobuf::int32 value); // optional .google.protobuf.FieldDescriptorProto.Label label = 4; inline bool has_label() const; inline void clear_label(); + static const int kLabelFieldNumber = 4; inline ::google::protobuf::FieldDescriptorProto_Label label() const; inline void set_label(::google::protobuf::FieldDescriptorProto_Label value); // optional .google.protobuf.FieldDescriptorProto.Type type = 5; inline bool has_type() const; inline void clear_type(); + static const int kTypeFieldNumber = 5; inline ::google::protobuf::FieldDescriptorProto_Type type() const; inline void set_type(::google::protobuf::FieldDescriptorProto_Type value); // optional string type_name = 6; inline bool has_type_name() const; inline void clear_type_name(); + static const int kTypeNameFieldNumber = 6; inline const ::std::string& type_name() const; inline void set_type_name(const ::std::string& value); inline void set_type_name(const char* value); @@ -713,6 +736,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa // optional string extendee = 2; inline bool has_extendee() const; inline void clear_extendee(); + static const int kExtendeeFieldNumber = 2; inline const ::std::string& extendee() const; inline void set_extendee(const ::std::string& value); inline void set_extendee(const char* value); @@ -721,6 +745,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa // optional string default_value = 7; inline bool has_default_value() const; inline void clear_default_value(); + static const int kDefaultValueFieldNumber = 7; inline const ::std::string& default_value() const; inline void set_default_value(const ::std::string& value); inline void set_default_value(const char* value); @@ -729,6 +754,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa // optional .google.protobuf.FieldOptions options = 8; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 8; inline const ::google::protobuf::FieldOptions& options() const; inline ::google::protobuf::FieldOptions* mutable_options(); @@ -822,6 +848,7 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -830,6 +857,7 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag // repeated .google.protobuf.EnumValueDescriptorProto value = 2; inline int value_size() const; inline void clear_value(); + static const int kValueFieldNumber = 2; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >& value() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >* mutable_value(); inline const ::google::protobuf::EnumValueDescriptorProto& value(int index) const; @@ -839,6 +867,7 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag // optional .google.protobuf.EnumOptions options = 3; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 3; inline const ::google::protobuf::EnumOptions& options() const; inline ::google::protobuf::EnumOptions* mutable_options(); @@ -924,6 +953,7 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -932,12 +962,14 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M // optional int32 number = 2; inline bool has_number() const; inline void clear_number(); + static const int kNumberFieldNumber = 2; inline ::google::protobuf::int32 number() const; inline void set_number(::google::protobuf::int32 value); // optional .google.protobuf.EnumValueOptions options = 3; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 3; inline const ::google::protobuf::EnumValueOptions& options() const; inline ::google::protobuf::EnumValueOptions* mutable_options(); @@ -1023,6 +1055,7 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -1031,6 +1064,7 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes // repeated .google.protobuf.MethodDescriptorProto method = 2; inline int method_size() const; inline void clear_method(); + static const int kMethodFieldNumber = 2; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >& method() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >* mutable_method(); inline const ::google::protobuf::MethodDescriptorProto& method(int index) const; @@ -1040,6 +1074,7 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes // optional .google.protobuf.ServiceOptions options = 3; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 3; inline const ::google::protobuf::ServiceOptions& options() const; inline ::google::protobuf::ServiceOptions* mutable_options(); @@ -1125,6 +1160,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess // optional string name = 1; inline bool has_name() const; inline void clear_name(); + static const int kNameFieldNumber = 1; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); @@ -1133,6 +1169,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess // optional string input_type = 2; inline bool has_input_type() const; inline void clear_input_type(); + static const int kInputTypeFieldNumber = 2; inline const ::std::string& input_type() const; inline void set_input_type(const ::std::string& value); inline void set_input_type(const char* value); @@ -1141,6 +1178,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess // optional string output_type = 3; inline bool has_output_type() const; inline void clear_output_type(); + static const int kOutputTypeFieldNumber = 3; inline const ::std::string& output_type() const; inline void set_output_type(const ::std::string& value); inline void set_output_type(const char* value); @@ -1149,6 +1187,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess // optional .google.protobuf.MethodOptions options = 4; inline bool has_options() const; inline void clear_options(); + static const int kOptionsFieldNumber = 4; inline const ::google::protobuf::MethodOptions& options() const; inline ::google::protobuf::MethodOptions* mutable_options(); @@ -1252,6 +1291,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { // optional string java_package = 1; inline bool has_java_package() const; inline void clear_java_package(); + static const int kJavaPackageFieldNumber = 1; inline const ::std::string& java_package() const; inline void set_java_package(const ::std::string& value); inline void set_java_package(const char* value); @@ -1260,6 +1300,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { // optional string java_outer_classname = 8; inline bool has_java_outer_classname() const; inline void clear_java_outer_classname(); + static const int kJavaOuterClassnameFieldNumber = 8; inline const ::std::string& java_outer_classname() const; inline void set_java_outer_classname(const ::std::string& value); inline void set_java_outer_classname(const char* value); @@ -1268,18 +1309,21 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { // optional bool java_multiple_files = 10 [default = false]; inline bool has_java_multiple_files() const; inline void clear_java_multiple_files(); + static const int kJavaMultipleFilesFieldNumber = 10; inline bool java_multiple_files() const; inline void set_java_multiple_files(bool value); // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = CODE_SIZE]; inline bool has_optimize_for() const; inline void clear_optimize_for(); + static const int kOptimizeForFieldNumber = 9; inline ::google::protobuf::FileOptions_OptimizeMode optimize_for() const; inline void set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value); // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -1453,12 +1497,14 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message { // optional bool message_set_wire_format = 1 [default = false]; inline bool has_message_set_wire_format() const; inline void clear_message_set_wire_format(); + static const int kMessageSetWireFormatFieldNumber = 1; inline bool message_set_wire_format() const; inline void set_message_set_wire_format(bool value); // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -1642,18 +1688,21 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message { // optional .google.protobuf.FieldOptions.CType ctype = 1; inline bool has_ctype() const; inline void clear_ctype(); + static const int kCtypeFieldNumber = 1; inline ::google::protobuf::FieldOptions_CType ctype() const; inline void set_ctype(::google::protobuf::FieldOptions_CType value); // optional bool packed = 2; inline bool has_packed() const; inline void clear_packed(); + static const int kPackedFieldNumber = 2; inline bool packed() const; inline void set_packed(bool value); // optional string experimental_map_key = 9; inline bool has_experimental_map_key() const; inline void clear_experimental_map_key(); + static const int kExperimentalMapKeyFieldNumber = 9; inline const ::std::string& experimental_map_key() const; inline void set_experimental_map_key(const ::std::string& value); inline void set_experimental_map_key(const char* value); @@ -1662,6 +1711,7 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -1833,6 +1883,7 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -2000,6 +2051,7 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -2167,6 +2219,7 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -2334,6 +2387,7 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& uninterpreted_option() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* mutable_uninterpreted_option(); inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; @@ -2501,6 +2555,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu // required string name_part = 1; inline bool has_name_part() const; inline void clear_name_part(); + static const int kNamePartFieldNumber = 1; inline const ::std::string& name_part() const; inline void set_name_part(const ::std::string& value); inline void set_name_part(const char* value); @@ -2509,6 +2564,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu // required bool is_extension = 2; inline bool has_is_extension() const; inline void clear_is_extension(); + static const int kIsExtensionFieldNumber = 2; inline bool is_extension() const; inline void set_is_extension(bool value); @@ -2595,6 +2651,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; inline int name_size() const; inline void clear_name(); + static const int kNameFieldNumber = 2; inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >& name() const; inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >* mutable_name(); inline const ::google::protobuf::UninterpretedOption_NamePart& name(int index) const; @@ -2604,6 +2661,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag // optional string identifier_value = 3; inline bool has_identifier_value() const; inline void clear_identifier_value(); + static const int kIdentifierValueFieldNumber = 3; inline const ::std::string& identifier_value() const; inline void set_identifier_value(const ::std::string& value); inline void set_identifier_value(const char* value); @@ -2612,24 +2670,28 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag // optional uint64 positive_int_value = 4; inline bool has_positive_int_value() const; inline void clear_positive_int_value(); + static const int kPositiveIntValueFieldNumber = 4; inline ::google::protobuf::uint64 positive_int_value() const; inline void set_positive_int_value(::google::protobuf::uint64 value); // optional int64 negative_int_value = 5; inline bool has_negative_int_value() const; inline void clear_negative_int_value(); + static const int kNegativeIntValueFieldNumber = 5; inline ::google::protobuf::int64 negative_int_value() const; inline void set_negative_int_value(::google::protobuf::int64 value); // optional double double_value = 6; inline bool has_double_value() const; inline void clear_double_value(); + static const int kDoubleValueFieldNumber = 6; inline double double_value() const; inline void set_double_value(double value); // optional bytes string_value = 7; inline bool has_string_value() const; inline void clear_string_value(); + static const int kStringValueFieldNumber = 7; inline const ::std::string& string_value() const; inline void set_string_value(const ::std::string& value); inline void set_string_value(const char* value); diff --git a/src/google/protobuf/message_unittest.cc b/src/google/protobuf/message_unittest.cc index 46e68446..d0592de0 100644 --- a/src/google/protobuf/message_unittest.cc +++ b/src/google/protobuf/message_unittest.cc @@ -248,6 +248,36 @@ TEST(MessageTest, ParseFailsOnInvalidMessageEnd) { EXPECT_FALSE(message.ParseFromArray("\014", 1)); } +TEST(MessageTest, FieldConstantValues) { + unittest::TestRequired message; + EXPECT_EQ(protobuf_unittest::TestAllTypes_NestedMessage::kBbFieldNumber, 1); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kOptionalInt32FieldNumber, 1); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kOptionalgroupFieldNumber, 16); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kOptionalNestedMessageFieldNumber, + 18); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kOptionalNestedEnumFieldNumber, + 21); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kRepeatedInt32FieldNumber, 31); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kRepeatedgroupFieldNumber, 46); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kRepeatedNestedMessageFieldNumber, + 48); + EXPECT_EQ(protobuf_unittest::TestAllTypes::kRepeatedNestedEnumFieldNumber, + 51); +} + +TEST(MessageTest, ExtensionConstantValues) { + EXPECT_EQ(protobuf_unittest::TestRequired::kSingleFieldNumber, 1000); + EXPECT_EQ(protobuf_unittest::TestRequired::kMultiFieldNumber, 1001); + EXPECT_EQ(protobuf_unittest::kOptionalInt32ExtensionFieldNumber, 1); + EXPECT_EQ(protobuf_unittest::kOptionalgroupExtensionFieldNumber, 16); + EXPECT_EQ(protobuf_unittest::kOptionalNestedMessageExtensionFieldNumber, 18); + EXPECT_EQ(protobuf_unittest::kOptionalNestedEnumExtensionFieldNumber, 21); + EXPECT_EQ(protobuf_unittest::kRepeatedInt32ExtensionFieldNumber, 31); + EXPECT_EQ(protobuf_unittest::kRepeatedgroupExtensionFieldNumber, 46); + EXPECT_EQ(protobuf_unittest::kRepeatedNestedMessageExtensionFieldNumber, 48); + EXPECT_EQ(protobuf_unittest::kRepeatedNestedEnumExtensionFieldNumber, 51); +} + TEST(MessageFactoryTest, GeneratedFactoryLookup) { EXPECT_EQ( MessageFactory::generated_factory()->GetPrototype( |