Generate field number constants. Patch from Michael Poole.

pull/3335/head
kenton@google.com 16 years ago
parent eb26a1efde
commit cfa2d8aa87
  1. 9
      CHANGES.txt
  2. 1
      CONTRIBUTORS.txt
  3. 27
      java/src/test/java/com/google/protobuf/GeneratedMessageTest.java
  4. 41
      python/google/protobuf/internal/reflection_test.py
  5. 12
      python/google/protobuf/reflection.py
  6. 28
      src/google/protobuf/compiler/cpp/cpp_extension.cc
  7. 30
      src/google/protobuf/compiler/cpp/cpp_helpers.cc
  8. 4
      src/google/protobuf/compiler/cpp/cpp_helpers.h
  9. 17
      src/google/protobuf/compiler/cpp/cpp_message.cc
  10. 4
      src/google/protobuf/compiler/cpp/cpp_string_field.cc
  11. 4
      src/google/protobuf/compiler/java/java_extension.cc
  12. 6
      src/google/protobuf/compiler/java/java_helpers.cc
  13. 4
      src/google/protobuf/compiler/java/java_helpers.h
  14. 3
      src/google/protobuf/compiler/java/java_message.cc
  15. 5
      src/google/protobuf/compiler/python/python_generator.cc
  16. 125
      src/google/protobuf/descriptor.pb.cc
  17. 62
      src/google/protobuf/descriptor.pb.h
  18. 30
      src/google/protobuf/message_unittest.cc

@ -8,6 +8,15 @@
this blob, the individual values are encoded the same way they would
be normally except without a tag before each value (thus, they are
tightly "packed").
* For each field, the generated code contains an integer constant assigned
to the field number. For example, the .proto file:
message Foo { optional int bar_baz = 123; }
would generate the following constants, all with the integer value 123:
C++: Foo::kBarBazFieldNumber
Java: Foo.BAR_BAZ_FIELD_NUMBER
Python: Foo.BAR_BAZ_FIELD_NUMBER
Constants are also generated for extensions, with the same naming scheme.
These constants may be used as switch cases.
protoc
* --error_format=msvs option causes errors to be printed in Visual Studio

@ -62,3 +62,4 @@ Patch contributors:
Michael Poole <mdpoole@troilus.org>
* Fixed warnings about generated constructors not explicitly initializing
all fields (only present with certain compiler settings).
* Added generation of field number constants.

@ -488,4 +488,31 @@ public class GeneratedMessageTest extends TestCase {
TestAllTypes message = builder.build();
TestUtil.assertAllFieldsSet(message.toBuilder().build());
}
public void testFieldConstantValues() throws Exception {
assertEquals(TestAllTypes.NestedMessage.BB_FIELD_NUMBER, 1);
assertEquals(TestAllTypes.OPTIONAL_INT32_FIELD_NUMBER, 1);
assertEquals(TestAllTypes.OPTIONALGROUP_FIELD_NUMBER, 16);
assertEquals(TestAllTypes.OPTIONAL_NESTED_MESSAGE_FIELD_NUMBER, 18);
assertEquals(TestAllTypes.OPTIONAL_NESTED_ENUM_FIELD_NUMBER, 21);
assertEquals(TestAllTypes.REPEATED_INT32_FIELD_NUMBER, 31);
assertEquals(TestAllTypes.REPEATEDGROUP_FIELD_NUMBER, 46);
assertEquals(TestAllTypes.REPEATED_NESTED_MESSAGE_FIELD_NUMBER, 48);
assertEquals(TestAllTypes.REPEATED_NESTED_ENUM_FIELD_NUMBER, 51);
}
public void testExtensionConstantValues() throws Exception {
assertEquals(UnittestProto.TestRequired.SINGLE_FIELD_NUMBER, 1000);
assertEquals(UnittestProto.TestRequired.MULTI_FIELD_NUMBER, 1001);
assertEquals(UnittestProto.OPTIONAL_INT32_EXTENSION_FIELD_NUMBER, 1);
assertEquals(UnittestProto.OPTIONALGROUP_EXTENSION_FIELD_NUMBER, 16);
assertEquals(
UnittestProto.OPTIONAL_NESTED_MESSAGE_EXTENSION_FIELD_NUMBER, 18);
assertEquals(UnittestProto.OPTIONAL_NESTED_ENUM_EXTENSION_FIELD_NUMBER, 21);
assertEquals(UnittestProto.REPEATED_INT32_EXTENSION_FIELD_NUMBER, 31);
assertEquals(UnittestProto.REPEATEDGROUP_EXTENSION_FIELD_NUMBER, 46);
assertEquals(
UnittestProto.REPEATED_NESTED_MESSAGE_EXTENSION_FIELD_NUMBER, 48);
assertEquals(UnittestProto.REPEATED_NESTED_ENUM_EXTENSION_FIELD_NUMBER, 51);
}
}

@ -1787,6 +1787,47 @@ class SerializationTest(unittest.TestCase):
self.assertEqual(1000.0, d.ReadDouble())
self.assertTrue(d.EndOfStream())
def testFieldNumbers(self):
proto = unittest_pb2.TestAllTypes()
self.assertEqual(unittest_pb2.TestAllTypes.NestedMessage.BB_FIELD_NUMBER, 1)
self.assertEqual(unittest_pb2.TestAllTypes.OPTIONAL_INT32_FIELD_NUMBER, 1)
self.assertEqual(unittest_pb2.TestAllTypes.OPTIONALGROUP_FIELD_NUMBER, 16)
self.assertEqual(
unittest_pb2.TestAllTypes.OPTIONAL_NESTED_MESSAGE_FIELD_NUMBER, 18)
self.assertEqual(
unittest_pb2.TestAllTypes.OPTIONAL_NESTED_ENUM_FIELD_NUMBER, 21)
self.assertEqual(unittest_pb2.TestAllTypes.REPEATED_INT32_FIELD_NUMBER, 31)
self.assertEqual(unittest_pb2.TestAllTypes.REPEATEDGROUP_FIELD_NUMBER, 46)
self.assertEqual(
unittest_pb2.TestAllTypes.REPEATED_NESTED_MESSAGE_FIELD_NUMBER, 48)
self.assertEqual(
unittest_pb2.TestAllTypes.REPEATED_NESTED_ENUM_FIELD_NUMBER, 51)
def testExtensionFieldNumbers(self):
self.assertEqual(unittest_pb2.TestRequired.single.number, 1000)
self.assertEqual(unittest_pb2.TestRequired.SINGLE_FIELD_NUMBER, 1000)
self.assertEqual(unittest_pb2.TestRequired.multi.number, 1001)
self.assertEqual(unittest_pb2.TestRequired.MULTI_FIELD_NUMBER, 1001)
self.assertEqual(unittest_pb2.optional_int32_extension.number, 1)
self.assertEqual(unittest_pb2.OPTIONAL_INT32_EXTENSION_FIELD_NUMBER, 1)
self.assertEqual(unittest_pb2.optionalgroup_extension.number, 16)
self.assertEqual(unittest_pb2.OPTIONALGROUP_EXTENSION_FIELD_NUMBER, 16)
self.assertEqual(unittest_pb2.optional_nested_message_extension.number, 18)
self.assertEqual(
unittest_pb2.OPTIONAL_NESTED_MESSAGE_EXTENSION_FIELD_NUMBER, 18)
self.assertEqual(unittest_pb2.optional_nested_enum_extension.number, 21)
self.assertEqual(unittest_pb2.OPTIONAL_NESTED_ENUM_EXTENSION_FIELD_NUMBER,
21)
self.assertEqual(unittest_pb2.repeated_int32_extension.number, 31)
self.assertEqual(unittest_pb2.REPEATED_INT32_EXTENSION_FIELD_NUMBER, 31)
self.assertEqual(unittest_pb2.repeatedgroup_extension.number, 46)
self.assertEqual(unittest_pb2.REPEATEDGROUP_EXTENSION_FIELD_NUMBER, 46)
self.assertEqual(unittest_pb2.repeated_nested_message_extension.number, 48)
self.assertEqual(
unittest_pb2.REPEATED_NESTED_MESSAGE_EXTENSION_FIELD_NUMBER, 48)
self.assertEqual(unittest_pb2.repeated_nested_enum_extension.number, 51)
self.assertEqual(unittest_pb2.REPEATED_NESTED_ENUM_EXTENSION_FIELD_NUMBER,
51)
class OptionsTest(unittest.TestCase):

@ -149,6 +149,7 @@ class GeneratedProtocolMessageType(type):
_AddEnumValues(descriptor, cls)
_AddInitMethod(descriptor, cls)
_AddPropertiesForFields(descriptor, cls)
_AddPropertiesForExtensions(descriptor, cls)
_AddStaticMethods(cls)
_AddMessageMethods(descriptor, cls)
_AddPrivateHelperMethods(cls)
@ -331,6 +332,9 @@ def _AddPropertiesForField(field, cls):
# handle specially here.
assert _FieldDescriptor.MAX_CPPTYPE == 10
constant_name = field.name.upper() + "_FIELD_NUMBER"
setattr(cls, constant_name, field.number)
if field.label == _FieldDescriptor.LABEL_REPEATED:
_AddPropertiesForRepeatedField(field, cls)
elif field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
@ -455,6 +459,14 @@ def _AddPropertiesForNonRepeatedCompositeField(field, cls):
setattr(cls, property_name, property(getter, setter, doc=doc))
def _AddPropertiesForExtensions(descriptor, cls):
"""Adds properties for all fields in this protocol message type."""
extension_dict = descriptor.extensions_by_name
for extension_name, extension_field in extension_dict.iteritems():
constant_name = extension_name.upper() + "_FIELD_NUMBER"
setattr(cls, constant_name, extension_field.number)
def _AddStaticMethods(cls):
# TODO(robinson): This probably needs to be thread-safe(?)
def RegisterExtension(extension_handle):

@ -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

@ -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");

@ -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) {

@ -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);

@ -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");
}
}

@ -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"

@ -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:

@ -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,

@ -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");
}

@ -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");

@ -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_(),

@ -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);

@ -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(

Loading…
Cancel
Save