diff options
author | Chaoren Lin <chaorenl@google.com> | 2015-08-19 15:45:19 -0700 |
---|---|---|
committer | Chaoren Lin <chaorenl@google.com> | 2015-08-19 15:59:30 -0700 |
commit | 6f86893361c46dec51fd26bcd2049050b498f80a (patch) | |
tree | a3bca1e76ef29786f7a32c89f91b05890e83e501 | |
parent | dc48e5bc03f1343e2328976faa63141d7f151e30 (diff) | |
download | darwin-x86-studio-master-dev.tar.gz |
Adding binaries for 2.6.1studio-master-dev_before_27917934studio-master-dev_before_26911779studio-4.1.1studio-4.1.0studio-4.0.0studio-3.4.0studio-3.2.1studio-3.1.2studio-3.0studio-2.3studio-2.0-rc1studio-2.0studio-1.5studio-1.4gradle_3.4.0gradle_3.1.2gradle_3.0.0gradle_2.3.0gradle_2.0.0studio-master-devmirror-goog-studio-master-dev
Change-Id: If5b653abe9e23298064c2a3a84883a4929491baa
73 files changed, 3700 insertions, 788 deletions
Binary files differ diff --git a/build-common.sh b/build-common.sh index 7b3a9aa..14c7cca 100755 --- a/build-common.sh +++ b/build-common.sh @@ -44,10 +44,9 @@ Darwin) # VS2013 x64 Native Tools Command Prompt case "$MSVS" in 2013) - export PATH="$PATH_PREFIX/c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/":"$PATH_PREFIX/c/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/":"$PATH" - export INCLUDE="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\INCLUDE;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\ATLMFC\\INCLUDE;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt;" - export LIB="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\LIB\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\ATLMFC\\LIB\\amd64;C:\\Program Files (x86)\\Windows Kits\\8.1\\lib\\winv6.3\\um\\x64;" - export LIBPATH="C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\LIB\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\ATLMFC\\LIB\\amd64;C:\\Program Files (x86)\\Windows Kits\\8.1\\References\\CommonConfiguration\\Neutral;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1\\ExtensionSDKs\\Microsoft.VCLibs\\12.0\\References\\CommonConfiguration\\neutral;" + devenv() { + cmd /c "${VS120COMNTOOLS}VsDevCmd.bat" '&' devenv.com "$@" + } INSTALL_VER=${VER}_${MSVS} ;; *) diff --git a/build-protobuf.sh b/build-protobuf.sh index 4b16392..ffcf59f 100755 --- a/build-protobuf.sh +++ b/build-protobuf.sh @@ -3,13 +3,12 @@ # https://android.googlesource.com/platform/external/lldb-utils # # Download & build protobuf on the local machine -# works on Linux -# TODO: get it working on Windows and OS X +# works on Linux, OS X, and Windows (Cygwin) # leaves output in /tmp/prebuilts/libprotobuf/$OS-x86 # requires autoconf, automake, libtool, chrpath PROJ=libprotobuf -VER=2.5.0 +VER=2.6.1 source $(dirname "$0")/build-common.sh build-common.sh @@ -29,14 +28,14 @@ make install case "$OS" in linux) - for TARGET in $INSTALL/{bin/protoc,lib/libprotoc.so.8}; do + for TARGET in $INSTALL/{bin/protoc,lib/libprotoc.so}; do chrpath -r '$ORIGIN/../lib' $TARGET done ;; darwin) - for LIB in lib/libproto{c,buf{,-lite}}.8.dylib; do + for LIB in lib/libproto{c,buf{,-lite}}.9.dylib; do install_name_tool -id @executable_path/../$LIB $INSTALL/$LIB - for TARGET in $INSTALL/{bin/protoc,lib/libprotoc.8.dylib}; do + for TARGET in $INSTALL/{bin/protoc,lib/libprotoc.dylib}; do ABSOLUTE=$INSTALL/$LIB RELATIVE=@executable_path/../$LIB install_name_tool -change $ABSOLUTE $RELATIVE $TARGET @@ -45,4 +44,6 @@ case "$OS" in ;; esac +rm -rf $INSTALL/lib/{*.la,pkgconfig} + commit_and_push diff --git a/include/google/protobuf/compiler/code_generator.h b/include/google/protobuf/compiler/code_generator.h index 252f68d..321a8cc 100644 --- a/include/google/protobuf/compiler/code_generator.h +++ b/include/google/protobuf/compiler/code_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -104,6 +104,9 @@ class LIBPROTOC_EXPORT GeneratorContext { // contain "." or ".." components. virtual io::ZeroCopyOutputStream* Open(const string& filename) = 0; + // Similar to Open() but the output will be appended to the file if exists + virtual io::ZeroCopyOutputStream* OpenForAppend(const string& filename); + // Creates a ZeroCopyOutputStream which will insert code into the given file // at the given insertion point. See plugin.proto (plugin.pb.h) for more // information on insertion points. The default implementation diff --git a/include/google/protobuf/compiler/command_line_interface.h b/include/google/protobuf/compiler/command_line_interface.h index 86ea9bd..47f2891 100644 --- a/include/google/protobuf/compiler/command_line_interface.h +++ b/include/google/protobuf/compiler/command_line_interface.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -48,8 +48,9 @@ namespace google { namespace protobuf { -class FileDescriptor; // descriptor.h +class Descriptor; // descriptor.h class DescriptorPool; // descriptor.h +class FileDescriptor; // descriptor.h class FileDescriptorProto; // descriptor.pb.h template<typename T> class RepeatedPtrField; // repeated_field.h @@ -259,6 +260,22 @@ class LIBPROTOC_EXPORT CommandLineInterface { set<const FileDescriptor*>* already_seen, RepeatedPtrField<FileDescriptorProto>* output); + // Implements the --print_free_field_numbers. This function prints free field + // numbers into stdout for the message and it's nested message types in + // post-order, i.e. nested types first. Printed range are left-right + // inclusive, i.e. [a, b]. + // + // Groups: + // For historical reasons, groups are considered to share the same + // field number space with the parent message, thus it will not print free + // field numbers for groups. The field numbers used in the groups are + // excluded in the free field numbers of the parent message. + // + // Extension Ranges: + // Extension ranges are considered ocuppied field numbers and they will not be + // listed as free numbers in the output. + void PrintFreeFieldNumbers(const Descriptor* descriptor); + // ----------------------------------------------------------------- // The name of the executable as invoked (i.e. argv[0]). @@ -295,11 +312,19 @@ class LIBPROTOC_EXPORT CommandLineInterface { enum Mode { MODE_COMPILE, // Normal mode: parse .proto files and compile them. MODE_ENCODE, // --encode: read text from stdin, write binary to stdout. - MODE_DECODE // --decode: read binary from stdin, write text to stdout. + MODE_DECODE, // --decode: read binary from stdin, write text to stdout. + MODE_PRINT, // Print mode: print info of the given .proto files and exit. }; Mode mode_; + enum PrintMode { + PRINT_NONE, // Not in MODE_PRINT + PRINT_FREE_FIELDS, // --print_free_fields + }; + + PrintMode print_mode_; + enum ErrorFormat { ERROR_FORMAT_GCC, // GCC error output format (default). ERROR_FORMAT_MSVS // Visual Studio output (--error_format=msvs). diff --git a/include/google/protobuf/compiler/cpp/cpp_generator.h b/include/google/protobuf/compiler/cpp/cpp_generator.h index a90e84d..3d517cf 100644 --- a/include/google/protobuf/compiler/cpp/cpp_generator.h +++ b/include/google/protobuf/compiler/cpp/cpp_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/compiler/importer.h b/include/google/protobuf/compiler/importer.h index 7a62fa0..f010fd0 100644 --- a/include/google/protobuf/compiler/importer.h +++ b/include/google/protobuf/compiler/importer.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -166,6 +166,9 @@ class LIBPROTOBUF_EXPORT Importer { return &pool_; } + void AddUnusedImportTrackFile(const string& file_name); + void ClearUnusedImportTrackFiles(); + private: SourceTreeDescriptorDatabase database_; DescriptorPool pool_; @@ -204,6 +207,13 @@ class LIBPROTOBUF_EXPORT SourceTree { // contain "." or ".." components. virtual io::ZeroCopyInputStream* Open(const string& filename) = 0; + // If Open() returns NULL, calling this method immediately will return an + // description of the error. + // Subclasses should implement this method and return a meaningful value for + // better error reporting. + // TODO(xiaofeng): change this to a pure virtual function. + virtual string GetLastErrorMessage(); + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SourceTree); }; @@ -273,7 +283,9 @@ class LIBPROTOBUF_EXPORT DiskSourceTree : public SourceTree { bool VirtualFileToDiskFile(const string& virtual_file, string* disk_file); // implements SourceTree ------------------------------------------- - io::ZeroCopyInputStream* Open(const string& filename); + virtual io::ZeroCopyInputStream* Open(const string& filename); + + virtual string GetLastErrorMessage(); private: struct Mapping { @@ -285,6 +297,7 @@ class LIBPROTOBUF_EXPORT DiskSourceTree : public SourceTree { : virtual_path(virtual_path_param), disk_path(disk_path_param) {} }; vector<Mapping> mappings_; + string last_error_message_; // Like Open(), but returns the on-disk path in disk_file if disk_file is // non-NULL and the file could be successfully opened. diff --git a/include/google/protobuf/compiler/java/java_generator.h b/include/google/protobuf/compiler/java/java_generator.h index 888b8d8..47f76be 100644 --- a/include/google/protobuf/compiler/java/java_generator.h +++ b/include/google/protobuf/compiler/java/java_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/compiler/parser.h b/include/google/protobuf/compiler/parser.h index cfd3649..d0a2359 100644 --- a/include/google/protobuf/compiler/parser.h +++ b/include/google/protobuf/compiler/parser.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -40,7 +40,6 @@ #include <map> #include <string> #include <utility> -#include <google/protobuf/stubs/common.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/repeated_field.h> @@ -233,6 +232,9 @@ class LIBPROTOBUF_EXPORT Parser { // location to the given token instead. void StartAt(const io::Tokenizer::Token& token); + // Start at the same location as some other LocationRecorder. + void StartAt(const LocationRecorder& other); + // By default the location is considered to end at the previous token at // the time the LocationRecorder is destroyed. EndAt() sets the end // location to the given token instead. @@ -284,38 +286,50 @@ class LIBPROTOBUF_EXPORT Parser { // Parse various language high-level language construrcts. bool ParseMessageDefinition(DescriptorProto* message, - const LocationRecorder& message_location); + const LocationRecorder& message_location, + const FileDescriptorProto* containing_file); bool ParseEnumDefinition(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location); + const LocationRecorder& enum_location, + const FileDescriptorProto* containing_file); bool ParseServiceDefinition(ServiceDescriptorProto* service, - const LocationRecorder& service_location); + const LocationRecorder& service_location, + const FileDescriptorProto* containing_file); bool ParsePackage(FileDescriptorProto* file, - const LocationRecorder& root_location); + const LocationRecorder& root_location, + const FileDescriptorProto* containing_file); bool ParseImport(RepeatedPtrField<string>* dependency, RepeatedField<int32>* public_dependency, RepeatedField<int32>* weak_dependency, - const LocationRecorder& root_location); + const LocationRecorder& root_location, + const FileDescriptorProto* containing_file); bool ParseOption(Message* options, - const LocationRecorder& options_location); + const LocationRecorder& options_location, + const FileDescriptorProto* containing_file); // These methods parse the contents of a message, enum, or service type and // add them to the given object. They consume the entire block including // the beginning and ending brace. bool ParseMessageBlock(DescriptorProto* message, - const LocationRecorder& message_location); + const LocationRecorder& message_location, + const FileDescriptorProto* containing_file); bool ParseEnumBlock(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location); + const LocationRecorder& enum_location, + const FileDescriptorProto* containing_file); bool ParseServiceBlock(ServiceDescriptorProto* service, - const LocationRecorder& service_location); + const LocationRecorder& service_location, + const FileDescriptorProto* containing_file); // Parse one statement within a message, enum, or service block, inclunding // final semicolon. bool ParseMessageStatement(DescriptorProto* message, - const LocationRecorder& message_location); + const LocationRecorder& message_location, + const FileDescriptorProto* containing_file); bool ParseEnumStatement(EnumDescriptorProto* message, - const LocationRecorder& enum_location); + const LocationRecorder& enum_location, + const FileDescriptorProto* containing_file); bool ParseServiceStatement(ServiceDescriptorProto* message, - const LocationRecorder& service_location); + const LocationRecorder& service_location, + const FileDescriptorProto* containing_file); // Parse a field of a message. If the field is a group, its type will be // added to "messages". @@ -329,11 +343,22 @@ class LIBPROTOBUF_EXPORT Parser { RepeatedPtrField<DescriptorProto>* messages, const LocationRecorder& parent_location, int location_field_number_for_nested_type, - const LocationRecorder& field_location); + const LocationRecorder& field_location, + const FileDescriptorProto* containing_file); + + // Like ParseMessageField() but expects the label has already been filled in + // by the caller. + bool ParseMessageFieldNoLabel(FieldDescriptorProto* field, + RepeatedPtrField<DescriptorProto>* messages, + const LocationRecorder& parent_location, + int location_field_number_for_nested_type, + const LocationRecorder& field_location, + const FileDescriptorProto* containing_file); // Parse an "extensions" declaration. bool ParseExtensions(DescriptorProto* message, - const LocationRecorder& extensions_location); + const LocationRecorder& extensions_location, + const FileDescriptorProto* containing_file); // Parse an "extend" declaration. (See also comments for // ParseMessageField().) @@ -341,30 +366,46 @@ class LIBPROTOBUF_EXPORT Parser { RepeatedPtrField<DescriptorProto>* messages, const LocationRecorder& parent_location, int location_field_number_for_nested_type, - const LocationRecorder& extend_location); + const LocationRecorder& extend_location, + const FileDescriptorProto* containing_file); + + // Parse a "oneof" declaration. The caller is responsible for setting + // oneof_decl->label() since it will have had to parse the label before it + // knew it was parsing a oneof. + bool ParseOneof(OneofDescriptorProto* oneof_decl, + DescriptorProto* containing_type, + int oneof_index, + const LocationRecorder& oneof_location, + const LocationRecorder& containing_type_location, + const FileDescriptorProto* containing_file); // Parse a single enum value within an enum block. bool ParseEnumConstant(EnumValueDescriptorProto* enum_value, - const LocationRecorder& enum_value_location); + const LocationRecorder& enum_value_location, + const FileDescriptorProto* containing_file); // Parse enum constant options, i.e. the list in square brackets at the end // of the enum constant value definition. bool ParseEnumConstantOptions(EnumValueDescriptorProto* value, - const LocationRecorder& enum_value_location); + const LocationRecorder& enum_value_location, + const FileDescriptorProto* containing_file); // Parse a single method within a service definition. bool ParseServiceMethod(MethodDescriptorProto* method, - const LocationRecorder& method_location); + const LocationRecorder& method_location, + const FileDescriptorProto* containing_file); // Parse options of a single method or stream. bool ParseOptions(const LocationRecorder& parent_location, + const FileDescriptorProto* containing_file, const int optionsFieldNumber, Message* mutable_options); // Parse "required", "optional", or "repeated" and fill in "label" // with the value. - bool ParseLabel(FieldDescriptorProto::Label* label); + bool ParseLabel(FieldDescriptorProto::Label* label, + const FileDescriptorProto* containing_file); // Parse a type name and fill in "type" (if it is a primitive) or // "type_name" (if it is not) with the type parsed. @@ -377,12 +418,14 @@ class LIBPROTOBUF_EXPORT Parser { // Parses field options, i.e. the stuff in square brackets at the end // of a field definition. Also parses default value. bool ParseFieldOptions(FieldDescriptorProto* field, - const LocationRecorder& field_location); + const LocationRecorder& field_location, + const FileDescriptorProto* containing_file); // Parse the "default" option. This needs special handling because its // type is the field's type. bool ParseDefaultAssignment(FieldDescriptorProto* field, - const LocationRecorder& field_location); + const LocationRecorder& field_location, + const FileDescriptorProto* containing_file); enum OptionStyle { OPTION_ASSIGNMENT, // just "name = value" @@ -394,6 +437,7 @@ class LIBPROTOBUF_EXPORT Parser { // is set to the parsed value. bool ParseOption(Message* options, const LocationRecorder& options_location, + const FileDescriptorProto* containing_file, OptionStyle style); // Parses a single part of a multipart option name. A multipart name consists @@ -401,7 +445,8 @@ class LIBPROTOBUF_EXPORT Parser { // of identifiers separated by dots and enclosed in parentheses. E.g., // "foo.(bar.baz).qux". bool ParseOptionNamePart(UninterpretedOption* uninterpreted_option, - const LocationRecorder& part_location); + const LocationRecorder& part_location, + const FileDescriptorProto* containing_file); // Parses a string surrounded by balanced braces. Strips off the outer // braces and stores the enclosed string in *value. diff --git a/include/google/protobuf/compiler/plugin.h b/include/google/protobuf/compiler/plugin.h index 6fa2de1..679f9bd 100644 --- a/include/google/protobuf/compiler/plugin.h +++ b/include/google/protobuf/compiler/plugin.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/compiler/plugin.pb.h b/include/google/protobuf/compiler/plugin.pb.h index 68cc21c..65634da 100644 --- a/include/google/protobuf/compiler/plugin.pb.h +++ b/include/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 2005000 +#if GOOGLE_PROTOBUF_VERSION < 2006000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -89,7 +89,6 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -143,13 +142,11 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::std::string> file_to_generate_; ::std::string* parameter_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > proto_file_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - friend void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); @@ -206,7 +203,6 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -260,13 +256,11 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::std::string* insertion_point_; ::std::string* content_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - friend void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); @@ -323,7 +317,6 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -363,12 +356,10 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* error_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File > file_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - friend void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); @@ -391,39 +382,49 @@ inline void CodeGeneratorRequest::clear_file_to_generate() { file_to_generate_.Clear(); } inline const ::std::string& CodeGeneratorRequest::file_to_generate(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return file_to_generate_.Get(index); } inline ::std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return file_to_generate_.Mutable(index); } inline void CodeGeneratorRequest::set_file_to_generate(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) file_to_generate_.Mutable(index)->assign(value); } inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* value) { file_to_generate_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* value, size_t size) { file_to_generate_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline ::std::string* CodeGeneratorRequest::add_file_to_generate() { return file_to_generate_.Add(); } inline void CodeGeneratorRequest::add_file_to_generate(const ::std::string& value) { file_to_generate_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline void CodeGeneratorRequest::add_file_to_generate(const char* value) { file_to_generate_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline void CodeGeneratorRequest::add_file_to_generate(const char* value, size_t size) { file_to_generate_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline const ::google::protobuf::RepeatedPtrField< ::std::string>& CodeGeneratorRequest::file_to_generate() const { + // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return file_to_generate_; } inline ::google::protobuf::RepeatedPtrField< ::std::string>* CodeGeneratorRequest::mutable_file_to_generate() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return &file_to_generate_; } @@ -438,54 +439,59 @@ inline void CodeGeneratorRequest::clear_has_parameter() { _has_bits_[0] &= ~0x00000002u; } inline void CodeGeneratorRequest::clear_parameter() { - if (parameter_ != &::google::protobuf::internal::kEmptyString) { + if (parameter_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parameter_->clear(); } clear_has_parameter(); } inline const ::std::string& CodeGeneratorRequest::parameter() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter) return *parameter_; } inline void CodeGeneratorRequest::set_parameter(const ::std::string& value) { set_has_parameter(); - if (parameter_ == &::google::protobuf::internal::kEmptyString) { + if (parameter_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parameter_ = new ::std::string; } parameter_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter) } inline void CodeGeneratorRequest::set_parameter(const char* value) { set_has_parameter(); - if (parameter_ == &::google::protobuf::internal::kEmptyString) { + if (parameter_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parameter_ = new ::std::string; } parameter_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.parameter) } inline void CodeGeneratorRequest::set_parameter(const char* value, size_t size) { set_has_parameter(); - if (parameter_ == &::google::protobuf::internal::kEmptyString) { + if (parameter_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parameter_ = new ::std::string; } parameter_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.parameter) } inline ::std::string* CodeGeneratorRequest::mutable_parameter() { set_has_parameter(); - if (parameter_ == &::google::protobuf::internal::kEmptyString) { + if (parameter_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parameter_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter) return parameter_; } inline ::std::string* CodeGeneratorRequest::release_parameter() { clear_has_parameter(); - if (parameter_ == &::google::protobuf::internal::kEmptyString) { + if (parameter_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = parameter_; - parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* parameter) { - if (parameter_ != &::google::protobuf::internal::kEmptyString) { + if (parameter_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete parameter_; } if (parameter) { @@ -493,8 +499,9 @@ inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* paramet parameter_ = parameter; } else { clear_has_parameter(); - parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter) } // repeated .google.protobuf.FileDescriptorProto proto_file = 15; @@ -505,20 +512,25 @@ inline void CodeGeneratorRequest::clear_proto_file() { proto_file_.Clear(); } inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Get(index); } inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Mutable(index); } inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { + // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& CodeGeneratorRequest::proto_file() const { + // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* CodeGeneratorRequest::mutable_proto_file() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return &proto_file_; } @@ -537,54 +549,59 @@ inline void CodeGeneratorResponse_File::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void CodeGeneratorResponse_File::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& CodeGeneratorResponse_File::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name) return *name_; } inline void CodeGeneratorResponse_File::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name) } inline void CodeGeneratorResponse_File::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.name) } inline void CodeGeneratorResponse_File::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.name) } inline ::std::string* CodeGeneratorResponse_File::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name) return name_; } inline ::std::string* CodeGeneratorResponse_File::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void CodeGeneratorResponse_File::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -592,8 +609,9 @@ inline void CodeGeneratorResponse_File::set_allocated_name(::std::string* name) name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name) } // optional string insertion_point = 2; @@ -607,54 +625,59 @@ inline void CodeGeneratorResponse_File::clear_has_insertion_point() { _has_bits_[0] &= ~0x00000002u; } inline void CodeGeneratorResponse_File::clear_insertion_point() { - if (insertion_point_ != &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { insertion_point_->clear(); } clear_has_insertion_point(); } inline const ::std::string& CodeGeneratorResponse_File::insertion_point() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) return *insertion_point_; } inline void CodeGeneratorResponse_File::set_insertion_point(const ::std::string& value) { set_has_insertion_point(); - if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { insertion_point_ = new ::std::string; } insertion_point_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } inline void CodeGeneratorResponse_File::set_insertion_point(const char* value) { set_has_insertion_point(); - if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { insertion_point_ = new ::std::string; } insertion_point_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } inline void CodeGeneratorResponse_File::set_insertion_point(const char* value, size_t size) { set_has_insertion_point(); - if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { insertion_point_ = new ::std::string; } insertion_point_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } inline ::std::string* CodeGeneratorResponse_File::mutable_insertion_point() { set_has_insertion_point(); - if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { insertion_point_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) return insertion_point_; } inline ::std::string* CodeGeneratorResponse_File::release_insertion_point() { clear_has_insertion_point(); - if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = insertion_point_; - insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::string* insertion_point) { - if (insertion_point_ != &::google::protobuf::internal::kEmptyString) { + if (insertion_point_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete insertion_point_; } if (insertion_point) { @@ -662,8 +685,9 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::str insertion_point_ = insertion_point; } else { clear_has_insertion_point(); - insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } // optional string content = 15; @@ -677,54 +701,59 @@ inline void CodeGeneratorResponse_File::clear_has_content() { _has_bits_[0] &= ~0x00000004u; } inline void CodeGeneratorResponse_File::clear_content() { - if (content_ != &::google::protobuf::internal::kEmptyString) { + if (content_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { content_->clear(); } clear_has_content(); } inline const ::std::string& CodeGeneratorResponse_File::content() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content) return *content_; } inline void CodeGeneratorResponse_File::set_content(const ::std::string& value) { set_has_content(); - if (content_ == &::google::protobuf::internal::kEmptyString) { + if (content_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { content_ = new ::std::string; } content_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content) } inline void CodeGeneratorResponse_File::set_content(const char* value) { set_has_content(); - if (content_ == &::google::protobuf::internal::kEmptyString) { + if (content_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { content_ = new ::std::string; } content_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.content) } inline void CodeGeneratorResponse_File::set_content(const char* value, size_t size) { set_has_content(); - if (content_ == &::google::protobuf::internal::kEmptyString) { + if (content_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { content_ = new ::std::string; } content_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.content) } inline ::std::string* CodeGeneratorResponse_File::mutable_content() { set_has_content(); - if (content_ == &::google::protobuf::internal::kEmptyString) { + if (content_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { content_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content) return content_; } inline ::std::string* CodeGeneratorResponse_File::release_content() { clear_has_content(); - if (content_ == &::google::protobuf::internal::kEmptyString) { + if (content_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = content_; - content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + content_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void CodeGeneratorResponse_File::set_allocated_content(::std::string* content) { - if (content_ != &::google::protobuf::internal::kEmptyString) { + if (content_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete content_; } if (content) { @@ -732,8 +761,9 @@ inline void CodeGeneratorResponse_File::set_allocated_content(::std::string* con content_ = content; } else { clear_has_content(); - content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + content_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content) } // ------------------------------------------------------------------- @@ -751,54 +781,59 @@ inline void CodeGeneratorResponse::clear_has_error() { _has_bits_[0] &= ~0x00000001u; } inline void CodeGeneratorResponse::clear_error() { - if (error_ != &::google::protobuf::internal::kEmptyString) { + if (error_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { error_->clear(); } clear_has_error(); } inline const ::std::string& CodeGeneratorResponse::error() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error) return *error_; } inline void CodeGeneratorResponse::set_error(const ::std::string& value) { set_has_error(); - if (error_ == &::google::protobuf::internal::kEmptyString) { + if (error_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { error_ = new ::std::string; } error_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error) } inline void CodeGeneratorResponse::set_error(const char* value) { set_has_error(); - if (error_ == &::google::protobuf::internal::kEmptyString) { + if (error_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { error_ = new ::std::string; } error_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.error) } inline void CodeGeneratorResponse::set_error(const char* value, size_t size) { set_has_error(); - if (error_ == &::google::protobuf::internal::kEmptyString) { + if (error_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { error_ = new ::std::string; } error_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.error) } inline ::std::string* CodeGeneratorResponse::mutable_error() { set_has_error(); - if (error_ == &::google::protobuf::internal::kEmptyString) { + if (error_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { error_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error) return error_; } inline ::std::string* CodeGeneratorResponse::release_error() { clear_has_error(); - if (error_ == &::google::protobuf::internal::kEmptyString) { + if (error_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = error_; - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + error_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void CodeGeneratorResponse::set_allocated_error(::std::string* error) { - if (error_ != &::google::protobuf::internal::kEmptyString) { + if (error_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete error_; } if (error) { @@ -806,8 +841,9 @@ inline void CodeGeneratorResponse::set_allocated_error(::std::string* error) { error_ = error; } else { clear_has_error(); - error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + error_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error) } // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; @@ -818,20 +854,25 @@ inline void CodeGeneratorResponse::clear_file() { file_.Clear(); } inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) return file_.Get(index); } inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) return file_.Mutable(index); } inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { + // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) return file_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >& CodeGeneratorResponse::file() const { + // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file) return file_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >* CodeGeneratorResponse::mutable_file() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) return &file_; } diff --git a/include/google/protobuf/compiler/plugin.proto b/include/google/protobuf/compiler/plugin.proto index 77b888f..b65379d 100644 --- a/include/google/protobuf/compiler/plugin.proto +++ b/include/google/protobuf/compiler/plugin.proto @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/compiler/python/python_generator.h b/include/google/protobuf/compiler/python/python_generator.h index a3f22ce..f86e9ea 100644 --- a/include/google/protobuf/compiler/python/python_generator.h +++ b/include/google/protobuf/compiler/python/python_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -94,8 +94,11 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator { void PrintNestedDescriptors(const Descriptor& containing_descriptor) const; void PrintMessages() const; - void PrintMessage(const Descriptor& message_descriptor) const; - void PrintNestedMessages(const Descriptor& containing_descriptor) const; + void PrintMessage(const Descriptor& message_descriptor, const string& prefix, + vector<string>* to_register) const; + void PrintNestedMessages(const Descriptor& containing_descriptor, + const string& prefix, + vector<string>* to_register) const; void FixForeignFieldsInDescriptors() const; void FixForeignFieldsInDescriptor( @@ -105,6 +108,8 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator { const FieldDescriptor& field, const string& python_dict_name) const; void AddMessageToFileDescriptor(const Descriptor& descriptor) const; + void AddEnumToFileDescriptor(const EnumDescriptor& descriptor) const; + void AddExtensionToFileDescriptor(const FieldDescriptor& descriptor) const; string FieldReferencingExpression(const Descriptor* containing_type, const FieldDescriptor& field, const string& python_dict_name) const; diff --git a/include/google/protobuf/descriptor.h b/include/google/protobuf/descriptor.h index 33e3af7..67afc77 100644 --- a/include/google/protobuf/descriptor.h +++ b/include/google/protobuf/descriptor.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -54,14 +54,11 @@ #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__ #define GOOGLE_PROTOBUF_DESCRIPTOR_H__ +#include <set> #include <string> #include <vector> #include <google/protobuf/stubs/common.h> -// TYPE_BOOL is defined in the MacOS's ConditionalMacros.h. -#ifdef TYPE_BOOL -#undef TYPE_BOOL -#endif // TYPE_BOOL namespace google { namespace protobuf { @@ -69,6 +66,7 @@ namespace protobuf { // Defined in this file. class Descriptor; class FieldDescriptor; +class OneofDescriptor; class EnumDescriptor; class EnumValueDescriptor; class ServiceDescriptor; @@ -80,6 +78,7 @@ class DescriptorPool; // Defined in descriptor.proto class DescriptorProto; class FieldDescriptorProto; +class OneofDescriptorProto; class EnumDescriptorProto; class EnumValueDescriptorProto; class ServiceDescriptorProto; @@ -163,6 +162,11 @@ class LIBPROTOBUF_EXPORT Descriptor { // will be suitable for re-parsing. string DebugString() const; + // Returns true if this is a placeholder for an unknown type. This will + // only be the case if this descriptor comes from a DescriptorPool + // with AllowUnknownDependencies() set. + bool is_placeholder() const; + // Field stuff ----------------------------------------------------- // The number of fields in this message type. @@ -190,6 +194,15 @@ class LIBPROTOBUF_EXPORT Descriptor { const FieldDescriptor* FindFieldByCamelcaseName( const string& camelcase_name) const; + // The number of oneofs in this message type. + int oneof_decl_count() const; + // Get a oneof by index, where 0 <= index < oneof_decl_count(). + // These are returned in the order they were defined in the .proto file. + const OneofDescriptor* oneof_decl(int index) const; + + // Looks up a oneof by name. Returns NULL if no such oneof exists. + const OneofDescriptor* FindOneofByName(const string& name) const; + // Nested type stuff ----------------------------------------------- // The number of nested types in this message type. @@ -236,6 +249,9 @@ class LIBPROTOBUF_EXPORT Descriptor { // Returns true if the number is in one of the extension ranges. bool IsExtensionNumber(int number) const; + // Returns NULL if no extension range contains the given number. + const ExtensionRange* FindExtensionRangeContainingNumber(int number) const; + // The number of extensions -- extending *other* messages -- that were // defined nested within this message type's scope. int extension_count() const; @@ -286,6 +302,8 @@ class LIBPROTOBUF_EXPORT Descriptor { int field_count_; FieldDescriptor* fields_; + int oneof_decl_count_; + OneofDescriptor* oneof_decls_; int nested_type_count_; Descriptor* nested_types_; int enum_type_count_; @@ -303,6 +321,7 @@ class LIBPROTOBUF_EXPORT Descriptor { friend class DescriptorBuilder; friend class EnumDescriptor; friend class FieldDescriptor; + friend class OneofDescriptor; friend class MethodDescriptor; friend class FileDescriptor; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Descriptor); @@ -473,6 +492,13 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { // this is the extended type. Never NULL. const Descriptor* containing_type() const; + // If the field is a member of a oneof, this is the one, otherwise this is + // NULL. + const OneofDescriptor* containing_oneof() const; + + // If the field is a member of a oneof, returns the index in that oneof. + int index_in_oneof() const; + // An extension may be declared within the scope of another message. If this // field is an extension (is_extension() is true), then extension_scope() // returns that message, or NULL if the extension was declared at global @@ -481,10 +507,10 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { const Descriptor* extension_scope() const; // If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the - // message or the group type. Otherwise, undefined. + // message or the group type. Otherwise, returns null. const Descriptor* message_type() const; // If type is TYPE_ENUM, returns a descriptor for the enum. Otherwise, - // undefined. + // returns null. const EnumDescriptor* enum_type() const; // EXPERIMENTAL; DO NOT USE. @@ -510,6 +536,12 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { // Helper method to get the CppType for a particular Type. static CppType TypeToCppType(Type type); + // Helper method to get the name of a Type. + static const char* TypeName(Type type); + + // Helper method to get the name of a CppType. + static const char* CppTypeName(CppType cpp_type); + // Return true iff [packed = true] is valid for fields of this type. static inline bool IsTypePackable(Type field_type); @@ -524,7 +556,9 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { typedef FieldOptions OptionsType; // See Descriptor::DebugString(). - void DebugString(int depth, string *contents) const; + enum PrintLabelFlag { PRINT_LABEL, OMIT_LABEL }; + void DebugString(int depth, PrintLabelFlag print_label_flag, + string* contents) const; // formats the default value appropriately and returns it as a string. // Must have a default value to call this. If quote_string_type is true, then @@ -544,7 +578,9 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { Type type_; Label label_; bool is_extension_; + int index_in_oneof_; const Descriptor* containing_type_; + const OneofDescriptor* containing_oneof_; const Descriptor* extension_scope_; const Descriptor* message_type_; const EnumDescriptor* enum_type_; @@ -581,9 +617,66 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { friend class DescriptorBuilder; friend class FileDescriptor; friend class Descriptor; + friend class OneofDescriptor; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldDescriptor); }; +// Describes a oneof defined in a message type. +class LIBPROTOBUF_EXPORT OneofDescriptor { + public: + const string& name() const; // Name of this oneof. + const string& full_name() const; // Fully-qualified name of the oneof. + + // Index of this oneof within the message's oneof array. + int index() const; + + // The Descriptor for the message containing this oneof. + const Descriptor* containing_type() const; + + // The number of (non-extension) fields which are members of this oneof. + int field_count() const; + // Get a member of this oneof, in the order in which they were declared in the + // .proto file. Does not include extensions. + const FieldDescriptor* field(int index) const; + + // See Descriptor::CopyTo(). + void CopyTo(OneofDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + // Source Location --------------------------------------------------- + + // Updates |*out_location| to the source location of the complete + // extent of this oneof declaration. Returns false and leaves + // |*out_location| unchanged iff location information was not available. + bool GetSourceLocation(SourceLocation* out_location) const; + + private: + // See Descriptor::DebugString(). + void DebugString(int depth, string* contents) const; + + // Walks up the descriptor tree to generate the source location path + // to this descriptor from the file root. + void GetLocationPath(vector<int>* output) const; + + const string* name_; + const string* full_name_; + const Descriptor* containing_type_; + bool is_extendable_; + int field_count_; + const FieldDescriptor** fields_; + // IMPORTANT: If you add a new field, make sure to search for all instances + // of Allocate<OneofDescriptor>() and AllocateArray<OneofDescriptor>() + // in descriptor.cc and update them to initialize the field. + + // Must be constructed using DescriptorPool. + OneofDescriptor() {} + friend class DescriptorBuilder; + friend class Descriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofDescriptor); +}; + // Describes an enum type defined in a .proto file. To get the EnumDescriptor // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool // to construct your own descriptors. @@ -630,6 +723,11 @@ class LIBPROTOBUF_EXPORT EnumDescriptor { // See Descriptor::DebugString(). string DebugString() const; + // Returns true if this is a placeholder for an unknown enum. This will + // only be the case if this descriptor comes from a DescriptorPool + // with AllowUnknownDependencies() set. + bool is_placeholder() const; + // Source Location --------------------------------------------------- // Updates |*out_location| to the source location of the complete @@ -984,6 +1082,11 @@ class LIBPROTOBUF_EXPORT FileDescriptor { // See Descriptor::DebugString(). string DebugString() const; + // Returns true if this is a placeholder for an unknown file. This will + // only be the case if this descriptor comes from a DescriptorPool + // with AllowUnknownDependencies() set. + bool is_placeholder() const; + private: // Source Location --------------------------------------------------- @@ -1013,6 +1116,7 @@ class LIBPROTOBUF_EXPORT FileDescriptor { int service_count_; ServiceDescriptor* services_; int extension_count_; + bool is_placeholder_; FieldDescriptor* extensions_; const FileOptions* options_; @@ -1026,6 +1130,7 @@ class LIBPROTOBUF_EXPORT FileDescriptor { friend class DescriptorBuilder; friend class Descriptor; friend class FieldDescriptor; + friend class OneofDescriptor; friend class EnumDescriptor; friend class EnumValueDescriptor; friend class MethodDescriptor; @@ -1083,6 +1188,10 @@ class LIBPROTOBUF_EXPORT DescriptorPool { // to GOOGLE_LOG(ERROR). Remember that files are built on-demand, so this // ErrorCollector may be called from any thread that calls one of the // Find*By*() methods. + // - The DescriptorDatabase must not be mutated during the lifetime of + // the DescriptorPool. Even if the client takes care to avoid data races, + // changes to the content of the DescriptorDatabase may not be reflected + // in subsequent lookups in the DescriptorPool. class ErrorCollector; explicit DescriptorPool(DescriptorDatabase* fallback_database, ErrorCollector* error_collector = NULL); @@ -1113,6 +1222,7 @@ class LIBPROTOBUF_EXPORT DescriptorPool { const Descriptor* FindMessageTypeByName(const string& name) const; const FieldDescriptor* FindFieldByName(const string& name) const; const FieldDescriptor* FindExtensionByName(const string& name) const; + const OneofDescriptor* FindOneofByName(const string& name) const; const EnumDescriptor* FindEnumTypeByName(const string& name) const; const EnumValueDescriptor* FindEnumValueByName(const string& name) const; const ServiceDescriptor* FindServiceByName(const string& name) const; @@ -1157,7 +1267,8 @@ class LIBPROTOBUF_EXPORT DescriptorPool { OTHER // some other problem }; - // Reports an error in the FileDescriptorProto. + // Reports an error in the FileDescriptorProto. Use this function if the + // problem occured should interrupt building the FileDescriptorProto. virtual void AddError( const string& filename, // File name in which the error occurred. const string& element_name, // Full name of the erroneous element. @@ -1166,6 +1277,16 @@ class LIBPROTOBUF_EXPORT DescriptorPool { const string& message // Human-readable error message. ) = 0; + // Reports a warning in the FileDescriptorProto. Use this function if the + // problem occured should NOT interrupt building the FileDescriptorProto. + virtual void AddWarning( + const string& filename, // File name in which the error occurred. + const string& element_name, // Full name of the erroneous element. + const Message* descriptor, // Descriptor of the erroneous element. + ErrorLocation location, // One of the location constants, above. + const string& message // Human-readable error message. + ) {} + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector); }; @@ -1186,7 +1307,8 @@ class LIBPROTOBUF_EXPORT DescriptorPool { // to types or other files that are not found in the DescriptorPool (or its // backing DescriptorDatabase, if any). If you call // AllowUnknownDependencies(), however, then unknown types and files - // will be replaced by placeholder descriptors. This can allow you to + // will be replaced by placeholder descriptors (which can be identified by + // the is_placeholder() method). This can allow you to // perform some useful operations with a .proto file even if you do not // have access to other .proto files on which it depends. However, some // heuristics must be used to fill in the gaps in information, and these @@ -1195,10 +1317,15 @@ class LIBPROTOBUF_EXPORT DescriptorPool { // or an enum, as well as what package it resides in. Furthermore, // placeholder types will not be discoverable via FindMessageTypeByName() // and similar methods, which could confuse some descriptor-based algorithms. - // Generally, the results of this option should only be relied upon for - // debugging purposes. + // Generally, the results of this option should be handled with extreme care. void AllowUnknownDependencies() { allow_unknown_ = true; } + // By default, weak imports are allowed to be missing, in which case we will + // use a placeholder for the dependency and convert the field to be an Empty + // message field. If you call EnforceWeakDependencies(true), however, the + // DescriptorPool will report a import not found error. + void EnforceWeakDependencies(bool enforce) { enforce_weak_ = enforce; } + // Internal stuff -------------------------------------------------- // These methods MUST NOT be called from outside the proto2 library. // These methods may contain hidden pitfalls and may be removed in a @@ -1254,6 +1381,12 @@ class LIBPROTOBUF_EXPORT DescriptorPool { // lazy descriptor initialization behavior. bool InternalIsFileLoaded(const string& filename) const; + + // Add a file to unused_import_track_files_. DescriptorBuilder will log + // warnings for those files if there is any unused import. + void AddUnusedImportTrackFile(const string& file_name); + void ClearUnusedImportTrackFiles(); + private: friend class Descriptor; friend class FieldDescriptor; @@ -1298,6 +1431,8 @@ class LIBPROTOBUF_EXPORT DescriptorPool { bool enforce_dependencies_; bool allow_unknown_; + bool enforce_weak_; + std::set<string> unused_import_track_files_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorPool); }; @@ -1325,10 +1460,12 @@ PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, field_count, int) +PROTOBUF_DEFINE_ACCESSOR(Descriptor, oneof_decl_count, int) PROTOBUF_DEFINE_ACCESSOR(Descriptor, nested_type_count, int) PROTOBUF_DEFINE_ACCESSOR(Descriptor, enum_type_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, field, const FieldDescriptor*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, oneof_decl, const OneofDescriptor*) PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, nested_type, const Descriptor*) PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, enum_type, const EnumDescriptor*) @@ -1338,7 +1475,8 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension_range, const Descriptor::ExtensionRange*) PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension, const FieldDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions); +PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name) @@ -1350,6 +1488,9 @@ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, type, FieldDescriptor::Type) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof, + const OneofDescriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, message_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, enum_type, const EnumDescriptor*) @@ -1368,6 +1509,11 @@ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_enum, const EnumValueDescriptor*) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) +PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name) +PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name) +PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int) + PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*) @@ -1375,7 +1521,8 @@ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value, const EnumValueDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions); +PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name) @@ -1389,14 +1536,14 @@ PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, const MethodDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions); PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, input_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, output_type, const Descriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions); PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, package) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, pool, const DescriptorPool*) @@ -1407,7 +1554,8 @@ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions); +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, is_placeholder, bool) PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, message_type, const Descriptor*) PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, enum_type, const EnumDescriptor*) @@ -1422,6 +1570,10 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, extension, // A few accessors differ from the macros... +inline bool Descriptor::IsExtensionNumber(int number) const { + return FindExtensionRangeContainingNumber(number) != NULL; +} + inline bool FieldDescriptor::is_required() const { return label() == LABEL_REQUIRED; } @@ -1442,40 +1594,44 @@ inline bool FieldDescriptor::is_packable() const { // in the parent's array of children. inline int FieldDescriptor::index() const { if (!is_extension_) { - return this - containing_type_->fields_; + return static_cast<int>(this - containing_type_->fields_); } else if (extension_scope_ != NULL) { - return this - extension_scope_->extensions_; + return static_cast<int>(this - extension_scope_->extensions_); } else { - return this - file_->extensions_; + return static_cast<int>(this - file_->extensions_); } } inline int Descriptor::index() const { if (containing_type_ == NULL) { - return this - file_->message_types_; + return static_cast<int>(this - file_->message_types_); } else { - return this - containing_type_->nested_types_; + return static_cast<int>(this - containing_type_->nested_types_); } } +inline int OneofDescriptor::index() const { + return static_cast<int>(this - containing_type_->oneof_decls_); +} + inline int EnumDescriptor::index() const { if (containing_type_ == NULL) { - return this - file_->enum_types_; + return static_cast<int>(this - file_->enum_types_); } else { - return this - containing_type_->enum_types_; + return static_cast<int>(this - containing_type_->enum_types_); } } inline int EnumValueDescriptor::index() const { - return this - type_->values_; + return static_cast<int>(this - type_->values_); } inline int ServiceDescriptor::index() const { - return this - file_->services_; + return static_cast<int>(this - file_->services_); } inline int MethodDescriptor::index() const { - return this - service_->methods_; + return static_cast<int>(this - service_->methods_); } inline const char* FieldDescriptor::type_name() const { @@ -1494,6 +1650,14 @@ inline FieldDescriptor::CppType FieldDescriptor::TypeToCppType(Type type) { return kTypeToCppTypeMap[type]; } +inline const char* FieldDescriptor::TypeName(Type type) { + return kTypeToName[type]; +} + +inline const char* FieldDescriptor::CppTypeName(CppType cpp_type) { + return kCppTypeToName[cpp_type]; +} + inline bool FieldDescriptor::IsTypePackable(Type field_type) { return (field_type != FieldDescriptor::TYPE_STRING && field_type != FieldDescriptor::TYPE_GROUP && @@ -1515,6 +1679,12 @@ inline const FileDescriptor* FileDescriptor::weak_dependency( return dependencies_[weak_dependencies_[index]]; } +// Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array +// of pointers rather than the usual array of objects. +inline const FieldDescriptor* OneofDescriptor::field(int index) const { + return fields_[index]; +} + } // namespace protobuf } // namespace google diff --git a/include/google/protobuf/descriptor.pb.h b/include/google/protobuf/descriptor.pb.h index 07cf807..4552181 100644 --- a/include/google/protobuf/descriptor.pb.h +++ b/include/google/protobuf/descriptor.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 2005000 +#if GOOGLE_PROTOBUF_VERSION < 2006000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -40,6 +40,7 @@ class FileDescriptorProto; class DescriptorProto; class DescriptorProto_ExtensionRange; class FieldDescriptorProto; +class OneofDescriptorProto; class EnumDescriptorProto; class EnumValueDescriptorProto; class ServiceDescriptorProto; @@ -200,7 +201,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -224,11 +224,9 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message ::google::protobuf::UnknownFieldSet _unknown_fields_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_; - + ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - + ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -285,7 +283,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -435,6 +432,8 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::std::string* package_; ::google::protobuf::RepeatedPtrField< ::std::string> dependency_; @@ -446,10 +445,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > extension_; ::google::protobuf::FileOptions* options_; ::google::protobuf::SourceCodeInfo* source_code_info_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(11 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -506,7 +501,6 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -536,12 +530,10 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::int32 start_; ::google::protobuf::int32 end_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -598,7 +590,6 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -679,6 +670,18 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >* mutable_extension_range(); + // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + inline int oneof_decl_size() const; + inline void clear_oneof_decl(); + static const int kOneofDeclFieldNumber = 8; + inline const ::google::protobuf::OneofDescriptorProto& oneof_decl(int index) const; + inline ::google::protobuf::OneofDescriptorProto* mutable_oneof_decl(int index); + inline ::google::protobuf::OneofDescriptorProto* add_oneof_decl(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >& + oneof_decl() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >* + mutable_oneof_decl(); + // optional .google.protobuf.MessageOptions options = 7; inline bool has_options() const; inline void clear_options(); @@ -697,17 +700,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > field_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > extension_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto > nested_type_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto > enum_type_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange > extension_range_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto > oneof_decl_; ::google::protobuf::MessageOptions* options_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -764,7 +766,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -905,6 +906,13 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa inline ::std::string* release_default_value(); inline void set_allocated_default_value(::std::string* default_value); + // optional int32 oneof_index = 9; + inline bool has_oneof_index() const; + inline void clear_oneof_index(); + static const int kOneofIndexFieldNumber = 9; + inline ::google::protobuf::int32 oneof_index() const; + inline void set_oneof_index(::google::protobuf::int32 value); + // optional .google.protobuf.FieldOptions options = 8; inline bool has_options() const; inline void clear_options(); @@ -930,29 +938,114 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa inline void clear_has_extendee(); inline void set_has_default_value(); inline void clear_has_default_value(); + inline void set_has_oneof_index(); + inline void clear_has_oneof_index(); inline void set_has_options(); inline void clear_has_options(); ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::google::protobuf::int32 number_; int label_; ::std::string* type_name_; ::std::string* extendee_; + int type_; + ::google::protobuf::int32 oneof_index_; ::std::string* default_value_; ::google::protobuf::FieldOptions* options_; - int type_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32]; + void InitAsDefaultInstance(); + static FieldDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Message { + public: + OneofDescriptorProto(); + virtual ~OneofDescriptorProto(); + + OneofDescriptorProto(const OneofDescriptorProto& from); + + inline OneofDescriptorProto& operator=(const OneofDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const OneofDescriptorProto& default_instance(); + + void Swap(OneofDescriptorProto* other); + + // implements Message ---------------------------------------------- + + OneofDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const OneofDescriptorProto& from); + void MergeFrom(const OneofDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // 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); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + inline void set_allocated_name(::std::string* name); + + // @@protoc_insertion_point(class_scope:google.protobuf.OneofDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::std::string* name_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); void InitAsDefaultInstance(); - static FieldDescriptorProto* default_instance_; + static OneofDescriptorProto* default_instance_; }; // ------------------------------------------------------------------- @@ -1003,7 +1096,6 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1052,13 +1144,11 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto > value_; ::google::protobuf::EnumOptions* options_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1115,7 +1205,6 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1161,13 +1250,11 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::google::protobuf::EnumValueOptions* options_; ::google::protobuf::int32 number_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1224,7 +1311,6 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1273,13 +1359,11 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto > method_; ::google::protobuf::ServiceOptions* options_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1336,7 +1420,6 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1401,14 +1484,12 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_; ::std::string* input_type_; ::std::string* output_type_; ::google::protobuf::MethodOptions* options_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1465,7 +1546,6 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1535,6 +1615,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { inline bool java_generate_equals_and_hash() const; inline void set_java_generate_equals_and_hash(bool value); + // optional bool java_string_check_utf8 = 27 [default = false]; + inline bool has_java_string_check_utf8() const; + inline void clear_java_string_check_utf8(); + static const int kJavaStringCheckUtf8FieldNumber = 27; + inline bool java_string_check_utf8() const; + inline void set_java_string_check_utf8(bool value); + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; inline bool has_optimize_for() const; inline void clear_optimize_for(); @@ -1575,6 +1662,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { inline bool py_generic_services() const; inline void set_py_generic_services(bool value); + // optional bool deprecated = 23 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 23; + inline bool deprecated() const; + inline void set_deprecated(bool value); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); @@ -1598,6 +1692,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { inline void clear_has_java_multiple_files(); inline void set_has_java_generate_equals_and_hash(); inline void clear_has_java_generate_equals_and_hash(); + inline void set_has_java_string_check_utf8(); + inline void clear_has_java_string_check_utf8(); inline void set_has_optimize_for(); inline void clear_has_optimize_for(); inline void set_has_go_package(); @@ -1608,25 +1704,27 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { inline void clear_has_java_generic_services(); inline void set_has_py_generic_services(); inline void clear_has_py_generic_services(); + inline void set_has_deprecated(); + inline void clear_has_deprecated(); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* java_package_; ::std::string* java_outer_classname_; - int optimize_for_; bool java_multiple_files_; bool java_generate_equals_and_hash_; + bool java_string_check_utf8_; bool cc_generic_services_; - bool java_generic_services_; + int optimize_for_; ::std::string* go_package_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + bool java_generic_services_; bool py_generic_services_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(10 + 31) / 32]; - + bool deprecated_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1683,7 +1781,6 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1704,6 +1801,13 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message { inline bool no_standard_descriptor_accessor() const; inline void set_no_standard_descriptor_accessor(bool value); + // optional bool deprecated = 3 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 3; + inline bool deprecated() const; + inline void set_deprecated(bool value); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); @@ -1723,18 +1827,19 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message { inline void clear_has_message_set_wire_format(); inline void set_has_no_standard_descriptor_accessor(); inline void clear_has_no_standard_descriptor_accessor(); + inline void set_has_deprecated(); + inline void clear_has_deprecated(); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool message_set_wire_format_; bool no_standard_descriptor_accessor_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - + bool deprecated_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1791,7 +1896,6 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1902,6 +2006,8 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message { ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; int ctype_; bool packed_; bool lazy_; @@ -1909,10 +2015,6 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message { bool weak_; ::std::string* experimental_map_key_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -1969,20 +2071,26 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- - // optional bool allow_alias = 2 [default = true]; + // optional bool allow_alias = 2; inline bool has_allow_alias() const; inline void clear_allow_alias(); static const int kAllowAliasFieldNumber = 2; inline bool allow_alias() const; inline void set_allow_alias(bool value); + // optional bool deprecated = 3 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 3; + inline bool deprecated() const; + inline void set_deprecated(bool value); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); @@ -2000,17 +2108,18 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message { private: inline void set_has_allow_alias(); inline void clear_has_allow_alias(); + inline void set_has_deprecated(); + inline void clear_has_deprecated(); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool allow_alias_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - + bool deprecated_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2067,13 +2176,19 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- + // optional bool deprecated = 1 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 1; + inline bool deprecated() const; + inline void set_deprecated(bool value); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); @@ -2089,16 +2204,17 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message { GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumValueOptions) // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueOptions) private: + inline void set_has_deprecated(); + inline void clear_has_deprecated(); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::UnknownFieldSet _unknown_fields_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - + ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + bool deprecated_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2155,13 +2271,19 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- + // optional bool deprecated = 33 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 33; + inline bool deprecated() const; + inline void set_deprecated(bool value); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); @@ -2177,16 +2299,17 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message { GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ServiceOptions) // @@protoc_insertion_point(class_scope:google.protobuf.ServiceOptions) private: + inline void set_has_deprecated(); + inline void clear_has_deprecated(); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::UnknownFieldSet _unknown_fields_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - + ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + bool deprecated_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2243,13 +2366,19 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- + // optional bool deprecated = 33 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 33; + inline bool deprecated() const; + inline void set_deprecated(bool value); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int uninterpreted_option_size() const; inline void clear_uninterpreted_option(); @@ -2265,16 +2394,17 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message { GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MethodOptions) // @@protoc_insertion_point(class_scope:google.protobuf.MethodOptions) private: + inline void set_has_deprecated(); + inline void clear_has_deprecated(); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::UnknownFieldSet _unknown_fields_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - + ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + bool deprecated_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2331,7 +2461,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -2366,12 +2495,10 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::std::string* name_part_; bool is_extension_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2428,7 +2555,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -2523,6 +2649,8 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart > name_; ::std::string* identifier_value_; ::google::protobuf::uint64 positive_int_value_; @@ -2530,10 +2658,6 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag double double_value_; ::std::string* string_value_; ::std::string* aggregate_value_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2590,7 +2714,6 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -2654,16 +2777,14 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me ::google::protobuf::UnknownFieldSet _unknown_fields_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_; mutable int _path_cached_byte_size_; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > span_; mutable int _span_cached_byte_size_; ::std::string* leading_comments_; ::std::string* trailing_comments_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2720,7 +2841,6 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message { void SharedDtor(); void SetCachedSize(int size) const; public: - ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -2746,11 +2866,9 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message { ::google::protobuf::UnknownFieldSet _unknown_fields_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location > location_; - + ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - + ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location > location_; friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); @@ -2773,20 +2891,25 @@ inline void FileDescriptorSet::clear_file() { file_.Clear(); } inline const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file) return file_.Get(index); } inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file) return file_.Mutable(index); } inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() { + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file) return file_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& FileDescriptorSet::file() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorSet.file) return file_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* FileDescriptorSet::mutable_file() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file) return &file_; } @@ -2805,54 +2928,59 @@ inline void FileDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void FileDescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& FileDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name) return *name_; } inline void FileDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name) } inline void FileDescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.name) } inline void FileDescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name) } inline ::std::string* FileDescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name) return name_; } inline ::std::string* FileDescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FileDescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -2860,8 +2988,9 @@ inline void FileDescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name) } // optional string package = 2; @@ -2875,54 +3004,59 @@ inline void FileDescriptorProto::clear_has_package() { _has_bits_[0] &= ~0x00000002u; } inline void FileDescriptorProto::clear_package() { - if (package_ != &::google::protobuf::internal::kEmptyString) { + if (package_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { package_->clear(); } clear_has_package(); } inline const ::std::string& FileDescriptorProto::package() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package) return *package_; } inline void FileDescriptorProto::set_package(const ::std::string& value) { set_has_package(); - if (package_ == &::google::protobuf::internal::kEmptyString) { + if (package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { package_ = new ::std::string; } package_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package) } inline void FileDescriptorProto::set_package(const char* value) { set_has_package(); - if (package_ == &::google::protobuf::internal::kEmptyString) { + if (package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { package_ = new ::std::string; } package_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.package) } inline void FileDescriptorProto::set_package(const char* value, size_t size) { set_has_package(); - if (package_ == &::google::protobuf::internal::kEmptyString) { + if (package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { package_ = new ::std::string; } package_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package) } inline ::std::string* FileDescriptorProto::mutable_package() { set_has_package(); - if (package_ == &::google::protobuf::internal::kEmptyString) { + if (package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { package_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package) return package_; } inline ::std::string* FileDescriptorProto::release_package() { clear_has_package(); - if (package_ == &::google::protobuf::internal::kEmptyString) { + if (package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = package_; - package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + package_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FileDescriptorProto::set_allocated_package(::std::string* package) { - if (package_ != &::google::protobuf::internal::kEmptyString) { + if (package_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete package_; } if (package) { @@ -2930,8 +3064,9 @@ inline void FileDescriptorProto::set_allocated_package(::std::string* package) { package_ = package; } else { clear_has_package(); - package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + package_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package) } // repeated string dependency = 3; @@ -2942,39 +3077,49 @@ inline void FileDescriptorProto::clear_dependency() { dependency_.Clear(); } inline const ::std::string& FileDescriptorProto::dependency(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency) return dependency_.Get(index); } inline ::std::string* FileDescriptorProto::mutable_dependency(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency) return dependency_.Mutable(index); } inline void FileDescriptorProto::set_dependency(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency) dependency_.Mutable(index)->assign(value); } inline void FileDescriptorProto::set_dependency(int index, const char* value) { dependency_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.dependency) } inline void FileDescriptorProto::set_dependency(int index, const char* value, size_t size) { dependency_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.dependency) } inline ::std::string* FileDescriptorProto::add_dependency() { return dependency_.Add(); } inline void FileDescriptorProto::add_dependency(const ::std::string& value) { dependency_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency) } inline void FileDescriptorProto::add_dependency(const char* value) { dependency_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.FileDescriptorProto.dependency) } inline void FileDescriptorProto::add_dependency(const char* value, size_t size) { dependency_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.FileDescriptorProto.dependency) } inline const ::google::protobuf::RepeatedPtrField< ::std::string>& FileDescriptorProto::dependency() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.dependency) return dependency_; } inline ::google::protobuf::RepeatedPtrField< ::std::string>* FileDescriptorProto::mutable_dependency() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.dependency) return &dependency_; } @@ -2986,20 +3131,25 @@ inline void FileDescriptorProto::clear_public_dependency() { public_dependency_.Clear(); } inline ::google::protobuf::int32 FileDescriptorProto::public_dependency(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency) return public_dependency_.Get(index); } inline void FileDescriptorProto::set_public_dependency(int index, ::google::protobuf::int32 value) { public_dependency_.Set(index, value); + // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency) } inline void FileDescriptorProto::add_public_dependency(::google::protobuf::int32 value) { public_dependency_.Add(value); + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency) } inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& FileDescriptorProto::public_dependency() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency) return public_dependency_; } inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* FileDescriptorProto::mutable_public_dependency() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency) return &public_dependency_; } @@ -3011,20 +3161,25 @@ inline void FileDescriptorProto::clear_weak_dependency() { weak_dependency_.Clear(); } inline ::google::protobuf::int32 FileDescriptorProto::weak_dependency(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency) return weak_dependency_.Get(index); } inline void FileDescriptorProto::set_weak_dependency(int index, ::google::protobuf::int32 value) { weak_dependency_.Set(index, value); + // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency) } inline void FileDescriptorProto::add_weak_dependency(::google::protobuf::int32 value) { weak_dependency_.Add(value); + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency) } inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& FileDescriptorProto::weak_dependency() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency) return weak_dependency_; } inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* FileDescriptorProto::mutable_weak_dependency() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency) return &weak_dependency_; } @@ -3036,20 +3191,25 @@ inline void FileDescriptorProto::clear_message_type() { message_type_.Clear(); } inline const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_type(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type) return message_type_.Get(index); } inline ::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type) return message_type_.Mutable(index); } inline ::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() { + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type) return message_type_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& FileDescriptorProto::message_type() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.message_type) return message_type_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* FileDescriptorProto::mutable_message_type() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type) return &message_type_; } @@ -3061,20 +3221,25 @@ inline void FileDescriptorProto::clear_enum_type() { enum_type_.Clear(); } inline const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type) return enum_type_.Get(index); } inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type) return enum_type_.Mutable(index); } inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() { + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type) return enum_type_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& FileDescriptorProto::enum_type() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.enum_type) return enum_type_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* FileDescriptorProto::mutable_enum_type() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type) return &enum_type_; } @@ -3086,20 +3251,25 @@ inline void FileDescriptorProto::clear_service() { service_.Clear(); } inline const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service) return service_.Get(index); } inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service) return service_.Mutable(index); } inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() { + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service) return service_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >& FileDescriptorProto::service() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.service) return service_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >* FileDescriptorProto::mutable_service() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service) return &service_; } @@ -3111,20 +3281,25 @@ inline void FileDescriptorProto::clear_extension() { extension_.Clear(); } inline const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension) return extension_.Get(index); } inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension) return extension_.Mutable(index); } inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() { + // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension) return extension_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& FileDescriptorProto::extension() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.extension) return extension_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* FileDescriptorProto::mutable_extension() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension) return &extension_; } @@ -3143,11 +3318,13 @@ inline void FileDescriptorProto::clear_options() { clear_has_options(); } inline const ::google::protobuf::FileOptions& FileDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::FileOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) return options_; } inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() { @@ -3164,6 +3341,7 @@ inline void FileDescriptorProto::set_allocated_options(::google::protobuf::FileO } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.options) } // optional .google.protobuf.SourceCodeInfo source_code_info = 9; @@ -3181,11 +3359,13 @@ inline void FileDescriptorProto::clear_source_code_info() { clear_has_source_code_info(); } inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info) return source_code_info_ != NULL ? *source_code_info_ : *default_instance_->source_code_info_; } inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { set_has_source_code_info(); if (source_code_info_ == NULL) source_code_info_ = new ::google::protobuf::SourceCodeInfo; + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) return source_code_info_; } inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { @@ -3202,6 +3382,7 @@ inline void FileDescriptorProto::set_allocated_source_code_info(::google::protob } else { clear_has_source_code_info(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.source_code_info) } // ------------------------------------------------------------------- @@ -3223,11 +3404,13 @@ inline void DescriptorProto_ExtensionRange::clear_start() { clear_has_start(); } inline ::google::protobuf::int32 DescriptorProto_ExtensionRange::start() const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start) return start_; } inline void DescriptorProto_ExtensionRange::set_start(::google::protobuf::int32 value) { set_has_start(); start_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start) } // optional int32 end = 2; @@ -3245,11 +3428,13 @@ inline void DescriptorProto_ExtensionRange::clear_end() { clear_has_end(); } inline ::google::protobuf::int32 DescriptorProto_ExtensionRange::end() const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end) return end_; } inline void DescriptorProto_ExtensionRange::set_end(::google::protobuf::int32 value) { set_has_end(); end_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end) } // ------------------------------------------------------------------- @@ -3267,54 +3452,59 @@ inline void DescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void DescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& DescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name) return *name_; } inline void DescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name) } inline void DescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.name) } inline void DescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name) } inline ::std::string* DescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name) return name_; } inline ::std::string* DescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void DescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -3322,8 +3512,9 @@ inline void DescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name) } // repeated .google.protobuf.FieldDescriptorProto field = 2; @@ -3334,20 +3525,25 @@ inline void DescriptorProto::clear_field() { field_.Clear(); } inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field) return field_.Get(index); } inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field) return field_.Mutable(index); } inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() { + // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field) return field_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& DescriptorProto::field() const { + // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.field) return field_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* DescriptorProto::mutable_field() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field) return &field_; } @@ -3359,20 +3555,25 @@ inline void DescriptorProto::clear_extension() { extension_.Clear(); } inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension) return extension_.Get(index); } inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension) return extension_.Mutable(index); } inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() { + // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension) return extension_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& DescriptorProto::extension() const { + // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension) return extension_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* DescriptorProto::mutable_extension() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension) return &extension_; } @@ -3384,20 +3585,25 @@ inline void DescriptorProto::clear_nested_type() { nested_type_.Clear(); } inline const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type) return nested_type_.Get(index); } inline ::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type) return nested_type_.Mutable(index); } inline ::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() { + // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type) return nested_type_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& DescriptorProto::nested_type() const { + // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.nested_type) return nested_type_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* DescriptorProto::mutable_nested_type() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type) return &nested_type_; } @@ -3409,20 +3615,25 @@ inline void DescriptorProto::clear_enum_type() { enum_type_.Clear(); } inline const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type) return enum_type_.Get(index); } inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type) return enum_type_.Mutable(index); } inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() { + // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type) return enum_type_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& DescriptorProto::enum_type() const { + // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.enum_type) return enum_type_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* DescriptorProto::mutable_enum_type() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type) return &enum_type_; } @@ -3434,43 +3645,80 @@ inline void DescriptorProto::clear_extension_range() { extension_range_.Clear(); } inline const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range) return extension_range_.Get(index); } inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension_range) return extension_range_.Mutable(index); } inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() { + // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range) return extension_range_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >& DescriptorProto::extension_range() const { + // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension_range) return extension_range_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >* DescriptorProto::mutable_extension_range() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range) return &extension_range_; } +// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; +inline int DescriptorProto::oneof_decl_size() const { + return oneof_decl_.size(); +} +inline void DescriptorProto::clear_oneof_decl() { + oneof_decl_.Clear(); +} +inline const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl) + return oneof_decl_.Get(index); +} +inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl) + return oneof_decl_.Mutable(index); +} +inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() { + // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl) + return oneof_decl_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >& +DescriptorProto::oneof_decl() const { + // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.oneof_decl) + return oneof_decl_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >* +DescriptorProto::mutable_oneof_decl() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl) + return &oneof_decl_; +} + // optional .google.protobuf.MessageOptions options = 7; inline bool DescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000040u) != 0; + return (_has_bits_[0] & 0x00000080u) != 0; } inline void DescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000080u; } inline void DescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000080u; } inline void DescriptorProto::clear_options() { if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear(); clear_has_options(); } inline const ::google::protobuf::MessageOptions& DescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::MessageOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) return options_; } inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() { @@ -3487,6 +3735,7 @@ inline void DescriptorProto::set_allocated_options(::google::protobuf::MessageOp } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.options) } // ------------------------------------------------------------------- @@ -3504,54 +3753,59 @@ inline void FieldDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void FieldDescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& FieldDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name) return *name_; } inline void FieldDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name) } inline void FieldDescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.name) } inline void FieldDescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name) } inline ::std::string* FieldDescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name) return name_; } inline ::std::string* FieldDescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FieldDescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -3559,8 +3813,9 @@ inline void FieldDescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name) } // optional int32 number = 3; @@ -3578,11 +3833,13 @@ inline void FieldDescriptorProto::clear_number() { clear_has_number(); } inline ::google::protobuf::int32 FieldDescriptorProto::number() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number) return number_; } inline void FieldDescriptorProto::set_number(::google::protobuf::int32 value) { set_has_number(); number_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number) } // optional .google.protobuf.FieldDescriptorProto.Label label = 4; @@ -3600,12 +3857,14 @@ inline void FieldDescriptorProto::clear_label() { clear_has_label(); } inline ::google::protobuf::FieldDescriptorProto_Label FieldDescriptorProto::label() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.label) return static_cast< ::google::protobuf::FieldDescriptorProto_Label >(label_); } inline void FieldDescriptorProto::set_label(::google::protobuf::FieldDescriptorProto_Label value) { assert(::google::protobuf::FieldDescriptorProto_Label_IsValid(value)); set_has_label(); label_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.label) } // optional .google.protobuf.FieldDescriptorProto.Type type = 5; @@ -3623,12 +3882,14 @@ inline void FieldDescriptorProto::clear_type() { clear_has_type(); } inline ::google::protobuf::FieldDescriptorProto_Type FieldDescriptorProto::type() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type) return static_cast< ::google::protobuf::FieldDescriptorProto_Type >(type_); } inline void FieldDescriptorProto::set_type(::google::protobuf::FieldDescriptorProto_Type value) { assert(::google::protobuf::FieldDescriptorProto_Type_IsValid(value)); set_has_type(); type_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type) } // optional string type_name = 6; @@ -3642,54 +3903,59 @@ inline void FieldDescriptorProto::clear_has_type_name() { _has_bits_[0] &= ~0x00000010u; } inline void FieldDescriptorProto::clear_type_name() { - if (type_name_ != &::google::protobuf::internal::kEmptyString) { + if (type_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { type_name_->clear(); } clear_has_type_name(); } inline const ::std::string& FieldDescriptorProto::type_name() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name) return *type_name_; } inline void FieldDescriptorProto::set_type_name(const ::std::string& value) { set_has_type_name(); - if (type_name_ == &::google::protobuf::internal::kEmptyString) { + if (type_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { type_name_ = new ::std::string; } type_name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name) } inline void FieldDescriptorProto::set_type_name(const char* value) { set_has_type_name(); - if (type_name_ == &::google::protobuf::internal::kEmptyString) { + if (type_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { type_name_ = new ::std::string; } type_name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.type_name) } inline void FieldDescriptorProto::set_type_name(const char* value, size_t size) { set_has_type_name(); - if (type_name_ == &::google::protobuf::internal::kEmptyString) { + if (type_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { type_name_ = new ::std::string; } type_name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name) } inline ::std::string* FieldDescriptorProto::mutable_type_name() { set_has_type_name(); - if (type_name_ == &::google::protobuf::internal::kEmptyString) { + if (type_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { type_name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name) return type_name_; } inline ::std::string* FieldDescriptorProto::release_type_name() { clear_has_type_name(); - if (type_name_ == &::google::protobuf::internal::kEmptyString) { + if (type_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = type_name_; - type_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + type_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FieldDescriptorProto::set_allocated_type_name(::std::string* type_name) { - if (type_name_ != &::google::protobuf::internal::kEmptyString) { + if (type_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete type_name_; } if (type_name) { @@ -3697,8 +3963,9 @@ inline void FieldDescriptorProto::set_allocated_type_name(::std::string* type_na type_name_ = type_name; } else { clear_has_type_name(); - type_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + type_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name) } // optional string extendee = 2; @@ -3712,54 +3979,59 @@ inline void FieldDescriptorProto::clear_has_extendee() { _has_bits_[0] &= ~0x00000020u; } inline void FieldDescriptorProto::clear_extendee() { - if (extendee_ != &::google::protobuf::internal::kEmptyString) { + if (extendee_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { extendee_->clear(); } clear_has_extendee(); } inline const ::std::string& FieldDescriptorProto::extendee() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee) return *extendee_; } inline void FieldDescriptorProto::set_extendee(const ::std::string& value) { set_has_extendee(); - if (extendee_ == &::google::protobuf::internal::kEmptyString) { + if (extendee_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { extendee_ = new ::std::string; } extendee_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee) } inline void FieldDescriptorProto::set_extendee(const char* value) { set_has_extendee(); - if (extendee_ == &::google::protobuf::internal::kEmptyString) { + if (extendee_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { extendee_ = new ::std::string; } extendee_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.extendee) } inline void FieldDescriptorProto::set_extendee(const char* value, size_t size) { set_has_extendee(); - if (extendee_ == &::google::protobuf::internal::kEmptyString) { + if (extendee_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { extendee_ = new ::std::string; } extendee_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee) } inline ::std::string* FieldDescriptorProto::mutable_extendee() { set_has_extendee(); - if (extendee_ == &::google::protobuf::internal::kEmptyString) { + if (extendee_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { extendee_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee) return extendee_; } inline ::std::string* FieldDescriptorProto::release_extendee() { clear_has_extendee(); - if (extendee_ == &::google::protobuf::internal::kEmptyString) { + if (extendee_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = extendee_; - extendee_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + extendee_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee) { - if (extendee_ != &::google::protobuf::internal::kEmptyString) { + if (extendee_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete extendee_; } if (extendee) { @@ -3767,8 +4039,9 @@ inline void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee extendee_ = extendee; } else { clear_has_extendee(); - extendee_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + extendee_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee) } // optional string default_value = 7; @@ -3782,54 +4055,59 @@ inline void FieldDescriptorProto::clear_has_default_value() { _has_bits_[0] &= ~0x00000040u; } inline void FieldDescriptorProto::clear_default_value() { - if (default_value_ != &::google::protobuf::internal::kEmptyString) { + if (default_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { default_value_->clear(); } clear_has_default_value(); } inline const ::std::string& FieldDescriptorProto::default_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value) return *default_value_; } inline void FieldDescriptorProto::set_default_value(const ::std::string& value) { set_has_default_value(); - if (default_value_ == &::google::protobuf::internal::kEmptyString) { + if (default_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { default_value_ = new ::std::string; } default_value_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value) } inline void FieldDescriptorProto::set_default_value(const char* value) { set_has_default_value(); - if (default_value_ == &::google::protobuf::internal::kEmptyString) { + if (default_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { default_value_ = new ::std::string; } default_value_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.default_value) } inline void FieldDescriptorProto::set_default_value(const char* value, size_t size) { set_has_default_value(); - if (default_value_ == &::google::protobuf::internal::kEmptyString) { + if (default_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { default_value_ = new ::std::string; } default_value_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value) } inline ::std::string* FieldDescriptorProto::mutable_default_value() { set_has_default_value(); - if (default_value_ == &::google::protobuf::internal::kEmptyString) { + if (default_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { default_value_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value) return default_value_; } inline ::std::string* FieldDescriptorProto::release_default_value() { clear_has_default_value(); - if (default_value_ == &::google::protobuf::internal::kEmptyString) { + if (default_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = default_value_; - default_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + default_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FieldDescriptorProto::set_allocated_default_value(::std::string* default_value) { - if (default_value_ != &::google::protobuf::internal::kEmptyString) { + if (default_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete default_value_; } if (default_value) { @@ -3837,30 +4115,57 @@ inline void FieldDescriptorProto::set_allocated_default_value(::std::string* def default_value_ = default_value; } else { clear_has_default_value(); - default_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + default_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value) +} + +// optional int32 oneof_index = 9; +inline bool FieldDescriptorProto::has_oneof_index() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void FieldDescriptorProto::set_has_oneof_index() { + _has_bits_[0] |= 0x00000080u; +} +inline void FieldDescriptorProto::clear_has_oneof_index() { + _has_bits_[0] &= ~0x00000080u; +} +inline void FieldDescriptorProto::clear_oneof_index() { + oneof_index_ = 0; + clear_has_oneof_index(); +} +inline ::google::protobuf::int32 FieldDescriptorProto::oneof_index() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index) + return oneof_index_; +} +inline void FieldDescriptorProto::set_oneof_index(::google::protobuf::int32 value) { + set_has_oneof_index(); + oneof_index_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index) } // optional .google.protobuf.FieldOptions options = 8; inline bool FieldDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000080u) != 0; + return (_has_bits_[0] & 0x00000100u) != 0; } inline void FieldDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000080u; + _has_bits_[0] |= 0x00000100u; } inline void FieldDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000080u; + _has_bits_[0] &= ~0x00000100u; } inline void FieldDescriptorProto::clear_options() { if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear(); clear_has_options(); } inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::FieldOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) return options_; } inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() { @@ -3877,6 +4182,87 @@ inline void FieldDescriptorProto::set_allocated_options(::google::protobuf::Fiel } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.options) +} + +// ------------------------------------------------------------------- + +// OneofDescriptorProto + +// optional string name = 1; +inline bool OneofDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void OneofDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void OneofDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void OneofDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& OneofDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name) + return *name_; +} +inline void OneofDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + name_ = new ::std::string; + } + name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name) +} +inline void OneofDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + name_ = new ::std::string; + } + name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.OneofDescriptorProto.name) +} +inline void OneofDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name) +} +inline ::std::string* OneofDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + name_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name) + return name_; +} +inline ::std::string* OneofDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void OneofDescriptorProto::set_allocated_name(::std::string* name) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete name_; + } + if (name) { + set_has_name(); + name_ = name; + } else { + clear_has_name(); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name) } // ------------------------------------------------------------------- @@ -3894,54 +4280,59 @@ inline void EnumDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void EnumDescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& EnumDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name) return *name_; } inline void EnumDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name) } inline void EnumDescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.name) } inline void EnumDescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name) } inline ::std::string* EnumDescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name) return name_; } inline ::std::string* EnumDescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void EnumDescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -3949,8 +4340,9 @@ inline void EnumDescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name) } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; @@ -3961,20 +4353,25 @@ inline void EnumDescriptorProto::clear_value() { value_.Clear(); } inline const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value) return value_.Get(index); } inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value) return value_.Mutable(index); } inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() { + // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value) return value_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >& EnumDescriptorProto::value() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.value) return value_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >* EnumDescriptorProto::mutable_value() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value) return &value_; } @@ -3993,11 +4390,13 @@ inline void EnumDescriptorProto::clear_options() { clear_has_options(); } inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::EnumOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) return options_; } inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() { @@ -4014,6 +4413,7 @@ inline void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumO } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.options) } // ------------------------------------------------------------------- @@ -4031,54 +4431,59 @@ inline void EnumValueDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void EnumValueDescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& EnumValueDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name) return *name_; } inline void EnumValueDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name) } inline void EnumValueDescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValueDescriptorProto.name) } inline void EnumValueDescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name) } inline ::std::string* EnumValueDescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name) return name_; } inline ::std::string* EnumValueDescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void EnumValueDescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -4086,8 +4491,9 @@ inline void EnumValueDescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name) } // optional int32 number = 2; @@ -4105,11 +4511,13 @@ inline void EnumValueDescriptorProto::clear_number() { clear_has_number(); } inline ::google::protobuf::int32 EnumValueDescriptorProto::number() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number) return number_; } inline void EnumValueDescriptorProto::set_number(::google::protobuf::int32 value) { set_has_number(); number_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number) } // optional .google.protobuf.EnumValueOptions options = 3; @@ -4127,11 +4535,13 @@ inline void EnumValueDescriptorProto::clear_options() { clear_has_options(); } inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::EnumValueOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) return options_; } inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() { @@ -4148,6 +4558,7 @@ inline void EnumValueDescriptorProto::set_allocated_options(::google::protobuf:: } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.options) } // ------------------------------------------------------------------- @@ -4165,54 +4576,59 @@ inline void ServiceDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void ServiceDescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& ServiceDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name) return *name_; } inline void ServiceDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name) } inline void ServiceDescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.ServiceDescriptorProto.name) } inline void ServiceDescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name) } inline ::std::string* ServiceDescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name) return name_; } inline ::std::string* ServiceDescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void ServiceDescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -4220,8 +4636,9 @@ inline void ServiceDescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name) } // repeated .google.protobuf.MethodDescriptorProto method = 2; @@ -4232,20 +4649,25 @@ inline void ServiceDescriptorProto::clear_method() { method_.Clear(); } inline const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method) return method_.Get(index); } inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method) return method_.Mutable(index); } inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() { + // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method) return method_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >& ServiceDescriptorProto::method() const { + // @@protoc_insertion_point(field_list:google.protobuf.ServiceDescriptorProto.method) return method_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >* ServiceDescriptorProto::mutable_method() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method) return &method_; } @@ -4264,11 +4686,13 @@ inline void ServiceDescriptorProto::clear_options() { clear_has_options(); } inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::ServiceOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) return options_; } inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() { @@ -4285,6 +4709,7 @@ inline void ServiceDescriptorProto::set_allocated_options(::google::protobuf::Se } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.options) } // ------------------------------------------------------------------- @@ -4302,54 +4727,59 @@ inline void MethodDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void MethodDescriptorProto::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& MethodDescriptorProto::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name) return *name_; } inline void MethodDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name) } inline void MethodDescriptorProto::set_name(const char* value) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.name) } inline void MethodDescriptorProto::set_name(const char* value, size_t size) { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name) } inline ::std::string* MethodDescriptorProto::mutable_name() { set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name) return name_; } inline ::std::string* MethodDescriptorProto::release_name() { clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { + if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void MethodDescriptorProto::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::kEmptyString) { + if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { @@ -4357,8 +4787,9 @@ inline void MethodDescriptorProto::set_allocated_name(::std::string* name) { name_ = name; } else { clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name) } // optional string input_type = 2; @@ -4372,54 +4803,59 @@ inline void MethodDescriptorProto::clear_has_input_type() { _has_bits_[0] &= ~0x00000002u; } inline void MethodDescriptorProto::clear_input_type() { - if (input_type_ != &::google::protobuf::internal::kEmptyString) { + if (input_type_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { input_type_->clear(); } clear_has_input_type(); } inline const ::std::string& MethodDescriptorProto::input_type() const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type) return *input_type_; } inline void MethodDescriptorProto::set_input_type(const ::std::string& value) { set_has_input_type(); - if (input_type_ == &::google::protobuf::internal::kEmptyString) { + if (input_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { input_type_ = new ::std::string; } input_type_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type) } inline void MethodDescriptorProto::set_input_type(const char* value) { set_has_input_type(); - if (input_type_ == &::google::protobuf::internal::kEmptyString) { + if (input_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { input_type_ = new ::std::string; } input_type_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.input_type) } inline void MethodDescriptorProto::set_input_type(const char* value, size_t size) { set_has_input_type(); - if (input_type_ == &::google::protobuf::internal::kEmptyString) { + if (input_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { input_type_ = new ::std::string; } input_type_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type) } inline ::std::string* MethodDescriptorProto::mutable_input_type() { set_has_input_type(); - if (input_type_ == &::google::protobuf::internal::kEmptyString) { + if (input_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { input_type_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type) return input_type_; } inline ::std::string* MethodDescriptorProto::release_input_type() { clear_has_input_type(); - if (input_type_ == &::google::protobuf::internal::kEmptyString) { + if (input_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = input_type_; - input_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + input_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void MethodDescriptorProto::set_allocated_input_type(::std::string* input_type) { - if (input_type_ != &::google::protobuf::internal::kEmptyString) { + if (input_type_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete input_type_; } if (input_type) { @@ -4427,8 +4863,9 @@ inline void MethodDescriptorProto::set_allocated_input_type(::std::string* input input_type_ = input_type; } else { clear_has_input_type(); - input_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + input_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type) } // optional string output_type = 3; @@ -4442,54 +4879,59 @@ inline void MethodDescriptorProto::clear_has_output_type() { _has_bits_[0] &= ~0x00000004u; } inline void MethodDescriptorProto::clear_output_type() { - if (output_type_ != &::google::protobuf::internal::kEmptyString) { + if (output_type_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { output_type_->clear(); } clear_has_output_type(); } inline const ::std::string& MethodDescriptorProto::output_type() const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type) return *output_type_; } inline void MethodDescriptorProto::set_output_type(const ::std::string& value) { set_has_output_type(); - if (output_type_ == &::google::protobuf::internal::kEmptyString) { + if (output_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { output_type_ = new ::std::string; } output_type_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type) } inline void MethodDescriptorProto::set_output_type(const char* value) { set_has_output_type(); - if (output_type_ == &::google::protobuf::internal::kEmptyString) { + if (output_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { output_type_ = new ::std::string; } output_type_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.output_type) } inline void MethodDescriptorProto::set_output_type(const char* value, size_t size) { set_has_output_type(); - if (output_type_ == &::google::protobuf::internal::kEmptyString) { + if (output_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { output_type_ = new ::std::string; } output_type_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type) } inline ::std::string* MethodDescriptorProto::mutable_output_type() { set_has_output_type(); - if (output_type_ == &::google::protobuf::internal::kEmptyString) { + if (output_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { output_type_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type) return output_type_; } inline ::std::string* MethodDescriptorProto::release_output_type() { clear_has_output_type(); - if (output_type_ == &::google::protobuf::internal::kEmptyString) { + if (output_type_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = output_type_; - output_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + output_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void MethodDescriptorProto::set_allocated_output_type(::std::string* output_type) { - if (output_type_ != &::google::protobuf::internal::kEmptyString) { + if (output_type_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete output_type_; } if (output_type) { @@ -4497,8 +4939,9 @@ inline void MethodDescriptorProto::set_allocated_output_type(::std::string* outp output_type_ = output_type; } else { clear_has_output_type(); - output_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + output_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type) } // optional .google.protobuf.MethodOptions options = 4; @@ -4516,11 +4959,13 @@ inline void MethodDescriptorProto::clear_options() { clear_has_options(); } inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options) return options_ != NULL ? *options_ : *default_instance_->options_; } inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() { set_has_options(); if (options_ == NULL) options_ = new ::google::protobuf::MethodOptions; + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) return options_; } inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() { @@ -4537,6 +4982,7 @@ inline void MethodDescriptorProto::set_allocated_options(::google::protobuf::Met } else { clear_has_options(); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.options) } // ------------------------------------------------------------------- @@ -4554,54 +5000,59 @@ inline void FileOptions::clear_has_java_package() { _has_bits_[0] &= ~0x00000001u; } inline void FileOptions::clear_java_package() { - if (java_package_ != &::google::protobuf::internal::kEmptyString) { + if (java_package_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_package_->clear(); } clear_has_java_package(); } inline const ::std::string& FileOptions::java_package() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package) return *java_package_; } inline void FileOptions::set_java_package(const ::std::string& value) { set_has_java_package(); - if (java_package_ == &::google::protobuf::internal::kEmptyString) { + if (java_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_package_ = new ::std::string; } java_package_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package) } inline void FileOptions::set_java_package(const char* value) { set_has_java_package(); - if (java_package_ == &::google::protobuf::internal::kEmptyString) { + if (java_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_package_ = new ::std::string; } java_package_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_package) } inline void FileOptions::set_java_package(const char* value, size_t size) { set_has_java_package(); - if (java_package_ == &::google::protobuf::internal::kEmptyString) { + if (java_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_package_ = new ::std::string; } java_package_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package) } inline ::std::string* FileOptions::mutable_java_package() { set_has_java_package(); - if (java_package_ == &::google::protobuf::internal::kEmptyString) { + if (java_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_package_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package) return java_package_; } inline ::std::string* FileOptions::release_java_package() { clear_has_java_package(); - if (java_package_ == &::google::protobuf::internal::kEmptyString) { + if (java_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = java_package_; - java_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + java_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FileOptions::set_allocated_java_package(::std::string* java_package) { - if (java_package_ != &::google::protobuf::internal::kEmptyString) { + if (java_package_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete java_package_; } if (java_package) { @@ -4609,8 +5060,9 @@ inline void FileOptions::set_allocated_java_package(::std::string* java_package) java_package_ = java_package; } else { clear_has_java_package(); - java_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + java_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package) } // optional string java_outer_classname = 8; @@ -4624,54 +5076,59 @@ inline void FileOptions::clear_has_java_outer_classname() { _has_bits_[0] &= ~0x00000002u; } inline void FileOptions::clear_java_outer_classname() { - if (java_outer_classname_ != &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_outer_classname_->clear(); } clear_has_java_outer_classname(); } inline const ::std::string& FileOptions::java_outer_classname() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname) return *java_outer_classname_; } inline void FileOptions::set_java_outer_classname(const ::std::string& value) { set_has_java_outer_classname(); - if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_outer_classname_ = new ::std::string; } java_outer_classname_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname) } inline void FileOptions::set_java_outer_classname(const char* value) { set_has_java_outer_classname(); - if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_outer_classname_ = new ::std::string; } java_outer_classname_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_outer_classname) } inline void FileOptions::set_java_outer_classname(const char* value, size_t size) { set_has_java_outer_classname(); - if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_outer_classname_ = new ::std::string; } java_outer_classname_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname) } inline ::std::string* FileOptions::mutable_java_outer_classname() { set_has_java_outer_classname(); - if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { java_outer_classname_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname) return java_outer_classname_; } inline ::std::string* FileOptions::release_java_outer_classname() { clear_has_java_outer_classname(); - if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = java_outer_classname_; - java_outer_classname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + java_outer_classname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_classname) { - if (java_outer_classname_ != &::google::protobuf::internal::kEmptyString) { + if (java_outer_classname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete java_outer_classname_; } if (java_outer_classname) { @@ -4679,8 +5136,9 @@ inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_ java_outer_classname_ = java_outer_classname; } else { clear_has_java_outer_classname(); - java_outer_classname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + java_outer_classname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname) } // optional bool java_multiple_files = 10 [default = false]; @@ -4698,11 +5156,13 @@ inline void FileOptions::clear_java_multiple_files() { clear_has_java_multiple_files(); } inline bool FileOptions::java_multiple_files() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_multiple_files) return java_multiple_files_; } inline void FileOptions::set_java_multiple_files(bool value) { set_has_java_multiple_files(); java_multiple_files_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_multiple_files) } // optional bool java_generate_equals_and_hash = 20 [default = false]; @@ -4720,95 +5180,128 @@ inline void FileOptions::clear_java_generate_equals_and_hash() { clear_has_java_generate_equals_and_hash(); } inline bool FileOptions::java_generate_equals_and_hash() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generate_equals_and_hash) return java_generate_equals_and_hash_; } inline void FileOptions::set_java_generate_equals_and_hash(bool value) { set_has_java_generate_equals_and_hash(); java_generate_equals_and_hash_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generate_equals_and_hash) +} + +// optional bool java_string_check_utf8 = 27 [default = false]; +inline bool FileOptions::has_java_string_check_utf8() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void FileOptions::set_has_java_string_check_utf8() { + _has_bits_[0] |= 0x00000010u; +} +inline void FileOptions::clear_has_java_string_check_utf8() { + _has_bits_[0] &= ~0x00000010u; +} +inline void FileOptions::clear_java_string_check_utf8() { + java_string_check_utf8_ = false; + clear_has_java_string_check_utf8(); +} +inline bool FileOptions::java_string_check_utf8() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_string_check_utf8) + return java_string_check_utf8_; +} +inline void FileOptions::set_java_string_check_utf8(bool value) { + set_has_java_string_check_utf8(); + java_string_check_utf8_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_string_check_utf8) } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; inline bool FileOptions::has_optimize_for() const { - return (_has_bits_[0] & 0x00000010u) != 0; + return (_has_bits_[0] & 0x00000020u) != 0; } inline void FileOptions::set_has_optimize_for() { - _has_bits_[0] |= 0x00000010u; + _has_bits_[0] |= 0x00000020u; } inline void FileOptions::clear_has_optimize_for() { - _has_bits_[0] &= ~0x00000010u; + _has_bits_[0] &= ~0x00000020u; } inline void FileOptions::clear_optimize_for() { optimize_for_ = 1; clear_has_optimize_for(); } inline ::google::protobuf::FileOptions_OptimizeMode FileOptions::optimize_for() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.optimize_for) return static_cast< ::google::protobuf::FileOptions_OptimizeMode >(optimize_for_); } inline void FileOptions::set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) { assert(::google::protobuf::FileOptions_OptimizeMode_IsValid(value)); set_has_optimize_for(); optimize_for_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.optimize_for) } // optional string go_package = 11; inline bool FileOptions::has_go_package() const { - return (_has_bits_[0] & 0x00000020u) != 0; + return (_has_bits_[0] & 0x00000040u) != 0; } inline void FileOptions::set_has_go_package() { - _has_bits_[0] |= 0x00000020u; + _has_bits_[0] |= 0x00000040u; } inline void FileOptions::clear_has_go_package() { - _has_bits_[0] &= ~0x00000020u; + _has_bits_[0] &= ~0x00000040u; } inline void FileOptions::clear_go_package() { - if (go_package_ != &::google::protobuf::internal::kEmptyString) { + if (go_package_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { go_package_->clear(); } clear_has_go_package(); } inline const ::std::string& FileOptions::go_package() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package) return *go_package_; } inline void FileOptions::set_go_package(const ::std::string& value) { set_has_go_package(); - if (go_package_ == &::google::protobuf::internal::kEmptyString) { + if (go_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { go_package_ = new ::std::string; } go_package_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package) } inline void FileOptions::set_go_package(const char* value) { set_has_go_package(); - if (go_package_ == &::google::protobuf::internal::kEmptyString) { + if (go_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { go_package_ = new ::std::string; } go_package_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.go_package) } inline void FileOptions::set_go_package(const char* value, size_t size) { set_has_go_package(); - if (go_package_ == &::google::protobuf::internal::kEmptyString) { + if (go_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { go_package_ = new ::std::string; } go_package_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package) } inline ::std::string* FileOptions::mutable_go_package() { set_has_go_package(); - if (go_package_ == &::google::protobuf::internal::kEmptyString) { + if (go_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { go_package_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package) return go_package_; } inline ::std::string* FileOptions::release_go_package() { clear_has_go_package(); - if (go_package_ == &::google::protobuf::internal::kEmptyString) { + if (go_package_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = go_package_; - go_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + go_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FileOptions::set_allocated_go_package(::std::string* go_package) { - if (go_package_ != &::google::protobuf::internal::kEmptyString) { + if (go_package_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete go_package_; } if (go_package) { @@ -4816,74 +5309,105 @@ inline void FileOptions::set_allocated_go_package(::std::string* go_package) { go_package_ = go_package; } else { clear_has_go_package(); - go_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + go_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package) } // optional bool cc_generic_services = 16 [default = false]; inline bool FileOptions::has_cc_generic_services() const { - return (_has_bits_[0] & 0x00000040u) != 0; + return (_has_bits_[0] & 0x00000080u) != 0; } inline void FileOptions::set_has_cc_generic_services() { - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000080u; } inline void FileOptions::clear_has_cc_generic_services() { - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000080u; } inline void FileOptions::clear_cc_generic_services() { cc_generic_services_ = false; clear_has_cc_generic_services(); } inline bool FileOptions::cc_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_generic_services) return cc_generic_services_; } inline void FileOptions::set_cc_generic_services(bool value) { set_has_cc_generic_services(); cc_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_generic_services) } // optional bool java_generic_services = 17 [default = false]; inline bool FileOptions::has_java_generic_services() const { - return (_has_bits_[0] & 0x00000080u) != 0; + return (_has_bits_[0] & 0x00000100u) != 0; } inline void FileOptions::set_has_java_generic_services() { - _has_bits_[0] |= 0x00000080u; + _has_bits_[0] |= 0x00000100u; } inline void FileOptions::clear_has_java_generic_services() { - _has_bits_[0] &= ~0x00000080u; + _has_bits_[0] &= ~0x00000100u; } inline void FileOptions::clear_java_generic_services() { java_generic_services_ = false; clear_has_java_generic_services(); } inline bool FileOptions::java_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generic_services) return java_generic_services_; } inline void FileOptions::set_java_generic_services(bool value) { set_has_java_generic_services(); java_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generic_services) } // optional bool py_generic_services = 18 [default = false]; inline bool FileOptions::has_py_generic_services() const { - return (_has_bits_[0] & 0x00000100u) != 0; + return (_has_bits_[0] & 0x00000200u) != 0; } inline void FileOptions::set_has_py_generic_services() { - _has_bits_[0] |= 0x00000100u; + _has_bits_[0] |= 0x00000200u; } inline void FileOptions::clear_has_py_generic_services() { - _has_bits_[0] &= ~0x00000100u; + _has_bits_[0] &= ~0x00000200u; } inline void FileOptions::clear_py_generic_services() { py_generic_services_ = false; clear_has_py_generic_services(); } inline bool FileOptions::py_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.py_generic_services) return py_generic_services_; } inline void FileOptions::set_py_generic_services(bool value) { set_has_py_generic_services(); py_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) +} + +// optional bool deprecated = 23 [default = false]; +inline bool FileOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000400u) != 0; +} +inline void FileOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000400u; +} +inline void FileOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000400u; +} +inline void FileOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool FileOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.deprecated) + return deprecated_; +} +inline void FileOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.deprecated) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; @@ -4894,20 +5418,25 @@ inline void FileOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& FileOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.FileOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* FileOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -4930,11 +5459,13 @@ inline void MessageOptions::clear_message_set_wire_format() { clear_has_message_set_wire_format(); } inline bool MessageOptions::message_set_wire_format() const { + // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.message_set_wire_format) return message_set_wire_format_; } inline void MessageOptions::set_message_set_wire_format(bool value) { set_has_message_set_wire_format(); message_set_wire_format_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.message_set_wire_format) } // optional bool no_standard_descriptor_accessor = 2 [default = false]; @@ -4952,11 +5483,37 @@ inline void MessageOptions::clear_no_standard_descriptor_accessor() { clear_has_no_standard_descriptor_accessor(); } inline bool MessageOptions::no_standard_descriptor_accessor() const { + // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.no_standard_descriptor_accessor) return no_standard_descriptor_accessor_; } inline void MessageOptions::set_no_standard_descriptor_accessor(bool value) { set_has_no_standard_descriptor_accessor(); no_standard_descriptor_accessor_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.no_standard_descriptor_accessor) +} + +// optional bool deprecated = 3 [default = false]; +inline bool MessageOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void MessageOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000004u; +} +inline void MessageOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000004u; +} +inline void MessageOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool MessageOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated) + return deprecated_; +} +inline void MessageOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; @@ -4967,20 +5524,25 @@ inline void MessageOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& MessageOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.MessageOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* MessageOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -5003,12 +5565,14 @@ inline void FieldOptions::clear_ctype() { clear_has_ctype(); } inline ::google::protobuf::FieldOptions_CType FieldOptions::ctype() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.ctype) return static_cast< ::google::protobuf::FieldOptions_CType >(ctype_); } inline void FieldOptions::set_ctype(::google::protobuf::FieldOptions_CType value) { assert(::google::protobuf::FieldOptions_CType_IsValid(value)); set_has_ctype(); ctype_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.ctype) } // optional bool packed = 2; @@ -5026,11 +5590,13 @@ inline void FieldOptions::clear_packed() { clear_has_packed(); } inline bool FieldOptions::packed() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.packed) return packed_; } inline void FieldOptions::set_packed(bool value) { set_has_packed(); packed_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.packed) } // optional bool lazy = 5 [default = false]; @@ -5048,11 +5614,13 @@ inline void FieldOptions::clear_lazy() { clear_has_lazy(); } inline bool FieldOptions::lazy() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.lazy) return lazy_; } inline void FieldOptions::set_lazy(bool value) { set_has_lazy(); lazy_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.lazy) } // optional bool deprecated = 3 [default = false]; @@ -5070,11 +5638,13 @@ inline void FieldOptions::clear_deprecated() { clear_has_deprecated(); } inline bool FieldOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.deprecated) return deprecated_; } inline void FieldOptions::set_deprecated(bool value) { set_has_deprecated(); deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.deprecated) } // optional string experimental_map_key = 9; @@ -5088,54 +5658,59 @@ inline void FieldOptions::clear_has_experimental_map_key() { _has_bits_[0] &= ~0x00000010u; } inline void FieldOptions::clear_experimental_map_key() { - if (experimental_map_key_ != &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { experimental_map_key_->clear(); } clear_has_experimental_map_key(); } inline const ::std::string& FieldOptions::experimental_map_key() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.experimental_map_key) return *experimental_map_key_; } inline void FieldOptions::set_experimental_map_key(const ::std::string& value) { set_has_experimental_map_key(); - if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { experimental_map_key_ = new ::std::string; } experimental_map_key_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.experimental_map_key) } inline void FieldOptions::set_experimental_map_key(const char* value) { set_has_experimental_map_key(); - if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { experimental_map_key_ = new ::std::string; } experimental_map_key_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldOptions.experimental_map_key) } inline void FieldOptions::set_experimental_map_key(const char* value, size_t size) { set_has_experimental_map_key(); - if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { experimental_map_key_ = new ::std::string; } experimental_map_key_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldOptions.experimental_map_key) } inline ::std::string* FieldOptions::mutable_experimental_map_key() { set_has_experimental_map_key(); - if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { experimental_map_key_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.experimental_map_key) return experimental_map_key_; } inline ::std::string* FieldOptions::release_experimental_map_key() { clear_has_experimental_map_key(); - if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = experimental_map_key_; - experimental_map_key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + experimental_map_key_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void FieldOptions::set_allocated_experimental_map_key(::std::string* experimental_map_key) { - if (experimental_map_key_ != &::google::protobuf::internal::kEmptyString) { + if (experimental_map_key_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete experimental_map_key_; } if (experimental_map_key) { @@ -5143,8 +5718,9 @@ inline void FieldOptions::set_allocated_experimental_map_key(::std::string* expe experimental_map_key_ = experimental_map_key; } else { clear_has_experimental_map_key(); - experimental_map_key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + experimental_map_key_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldOptions.experimental_map_key) } // optional bool weak = 10 [default = false]; @@ -5162,11 +5738,13 @@ inline void FieldOptions::clear_weak() { clear_has_weak(); } inline bool FieldOptions::weak() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.weak) return weak_; } inline void FieldOptions::set_weak(bool value) { set_has_weak(); weak_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.weak) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; @@ -5177,20 +5755,25 @@ inline void FieldOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& FieldOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* FieldOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -5198,7 +5781,7 @@ FieldOptions::mutable_uninterpreted_option() { // EnumOptions -// optional bool allow_alias = 2 [default = true]; +// optional bool allow_alias = 2; inline bool EnumOptions::has_allow_alias() const { return (_has_bits_[0] & 0x00000001u) != 0; } @@ -5209,15 +5792,41 @@ inline void EnumOptions::clear_has_allow_alias() { _has_bits_[0] &= ~0x00000001u; } inline void EnumOptions::clear_allow_alias() { - allow_alias_ = true; + allow_alias_ = false; clear_has_allow_alias(); } inline bool EnumOptions::allow_alias() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.allow_alias) return allow_alias_; } inline void EnumOptions::set_allow_alias(bool value) { set_has_allow_alias(); allow_alias_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.allow_alias) +} + +// optional bool deprecated = 3 [default = false]; +inline bool EnumOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void EnumOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000002u; +} +inline void EnumOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000002u; +} +inline void EnumOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool EnumOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated) + return deprecated_; +} +inline void EnumOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; @@ -5228,20 +5837,25 @@ inline void EnumOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& EnumOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* EnumOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -5249,6 +5863,30 @@ EnumOptions::mutable_uninterpreted_option() { // EnumValueOptions +// optional bool deprecated = 1 [default = false]; +inline bool EnumValueOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void EnumValueOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000001u; +} +inline void EnumValueOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000001u; +} +inline void EnumValueOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool EnumValueOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.deprecated) + return deprecated_; +} +inline void EnumValueOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumValueOptions.deprecated) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int EnumValueOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); @@ -5257,20 +5895,25 @@ inline void EnumValueOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& EnumValueOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumValueOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* EnumValueOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -5278,6 +5921,30 @@ EnumValueOptions::mutable_uninterpreted_option() { // ServiceOptions +// optional bool deprecated = 33 [default = false]; +inline bool ServiceOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ServiceOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000001u; +} +inline void ServiceOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ServiceOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool ServiceOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.deprecated) + return deprecated_; +} +inline void ServiceOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.ServiceOptions.deprecated) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int ServiceOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); @@ -5286,20 +5953,25 @@ inline void ServiceOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& ServiceOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.ServiceOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* ServiceOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -5307,6 +5979,30 @@ ServiceOptions::mutable_uninterpreted_option() { // MethodOptions +// optional bool deprecated = 33 [default = false]; +inline bool MethodOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void MethodOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000001u; +} +inline void MethodOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000001u; +} +inline void MethodOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool MethodOptions::deprecated() const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.deprecated) + return deprecated_; +} +inline void MethodOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.deprecated) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int MethodOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); @@ -5315,20 +6011,25 @@ inline void MethodOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } inline const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option) return uninterpreted_option_.Get(index); } inline ::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } inline ::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() { + // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option) return uninterpreted_option_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& MethodOptions::uninterpreted_option() const { + // @@protoc_insertion_point(field_list:google.protobuf.MethodOptions.uninterpreted_option) return uninterpreted_option_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* MethodOptions::mutable_uninterpreted_option() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option) return &uninterpreted_option_; } @@ -5347,54 +6048,59 @@ inline void UninterpretedOption_NamePart::clear_has_name_part() { _has_bits_[0] &= ~0x00000001u; } inline void UninterpretedOption_NamePart::clear_name_part() { - if (name_part_ != &::google::protobuf::internal::kEmptyString) { + if (name_part_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_part_->clear(); } clear_has_name_part(); } inline const ::std::string& UninterpretedOption_NamePart::name_part() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part) return *name_part_; } inline void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) { set_has_name_part(); - if (name_part_ == &::google::protobuf::internal::kEmptyString) { + if (name_part_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_part_ = new ::std::string; } name_part_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part) } inline void UninterpretedOption_NamePart::set_name_part(const char* value) { set_has_name_part(); - if (name_part_ == &::google::protobuf::internal::kEmptyString) { + if (name_part_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_part_ = new ::std::string; } name_part_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.NamePart.name_part) } inline void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) { set_has_name_part(); - if (name_part_ == &::google::protobuf::internal::kEmptyString) { + if (name_part_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_part_ = new ::std::string; } name_part_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part) } inline ::std::string* UninterpretedOption_NamePart::mutable_name_part() { set_has_name_part(); - if (name_part_ == &::google::protobuf::internal::kEmptyString) { + if (name_part_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_part_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part) return name_part_; } inline ::std::string* UninterpretedOption_NamePart::release_name_part() { clear_has_name_part(); - if (name_part_ == &::google::protobuf::internal::kEmptyString) { + if (name_part_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_part_; - name_part_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_part_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part) { - if (name_part_ != &::google::protobuf::internal::kEmptyString) { + if (name_part_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_part_; } if (name_part) { @@ -5402,8 +6108,9 @@ inline void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part_ = name_part; } else { clear_has_name_part(); - name_part_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + name_part_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part) } // required bool is_extension = 2; @@ -5421,11 +6128,13 @@ inline void UninterpretedOption_NamePart::clear_is_extension() { clear_has_is_extension(); } inline bool UninterpretedOption_NamePart::is_extension() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.is_extension) return is_extension_; } inline void UninterpretedOption_NamePart::set_is_extension(bool value) { set_has_is_extension(); is_extension_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.is_extension) } // ------------------------------------------------------------------- @@ -5440,20 +6149,25 @@ inline void UninterpretedOption::clear_name() { name_.Clear(); } inline const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name) return name_.Get(index); } inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name) return name_.Mutable(index); } inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() { + // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name) return name_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >& UninterpretedOption::name() const { + // @@protoc_insertion_point(field_list:google.protobuf.UninterpretedOption.name) return name_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >* UninterpretedOption::mutable_name() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name) return &name_; } @@ -5468,54 +6182,59 @@ inline void UninterpretedOption::clear_has_identifier_value() { _has_bits_[0] &= ~0x00000002u; } inline void UninterpretedOption::clear_identifier_value() { - if (identifier_value_ != &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { identifier_value_->clear(); } clear_has_identifier_value(); } inline const ::std::string& UninterpretedOption::identifier_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value) return *identifier_value_; } inline void UninterpretedOption::set_identifier_value(const ::std::string& value) { set_has_identifier_value(); - if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { identifier_value_ = new ::std::string; } identifier_value_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value) } inline void UninterpretedOption::set_identifier_value(const char* value) { set_has_identifier_value(); - if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { identifier_value_ = new ::std::string; } identifier_value_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.identifier_value) } inline void UninterpretedOption::set_identifier_value(const char* value, size_t size) { set_has_identifier_value(); - if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { identifier_value_ = new ::std::string; } identifier_value_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value) } inline ::std::string* UninterpretedOption::mutable_identifier_value() { set_has_identifier_value(); - if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { identifier_value_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value) return identifier_value_; } inline ::std::string* UninterpretedOption::release_identifier_value() { clear_has_identifier_value(); - if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = identifier_value_; - identifier_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + identifier_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void UninterpretedOption::set_allocated_identifier_value(::std::string* identifier_value) { - if (identifier_value_ != &::google::protobuf::internal::kEmptyString) { + if (identifier_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete identifier_value_; } if (identifier_value) { @@ -5523,8 +6242,9 @@ inline void UninterpretedOption::set_allocated_identifier_value(::std::string* i identifier_value_ = identifier_value; } else { clear_has_identifier_value(); - identifier_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + identifier_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value) } // optional uint64 positive_int_value = 4; @@ -5542,11 +6262,13 @@ inline void UninterpretedOption::clear_positive_int_value() { clear_has_positive_int_value(); } inline ::google::protobuf::uint64 UninterpretedOption::positive_int_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value) return positive_int_value_; } inline void UninterpretedOption::set_positive_int_value(::google::protobuf::uint64 value) { set_has_positive_int_value(); positive_int_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value) } // optional int64 negative_int_value = 5; @@ -5564,11 +6286,13 @@ inline void UninterpretedOption::clear_negative_int_value() { clear_has_negative_int_value(); } inline ::google::protobuf::int64 UninterpretedOption::negative_int_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value) return negative_int_value_; } inline void UninterpretedOption::set_negative_int_value(::google::protobuf::int64 value) { set_has_negative_int_value(); negative_int_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value) } // optional double double_value = 6; @@ -5586,11 +6310,13 @@ inline void UninterpretedOption::clear_double_value() { clear_has_double_value(); } inline double UninterpretedOption::double_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.double_value) return double_value_; } inline void UninterpretedOption::set_double_value(double value) { set_has_double_value(); double_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.double_value) } // optional bytes string_value = 7; @@ -5604,54 +6330,59 @@ inline void UninterpretedOption::clear_has_string_value() { _has_bits_[0] &= ~0x00000020u; } inline void UninterpretedOption::clear_string_value() { - if (string_value_ != &::google::protobuf::internal::kEmptyString) { + if (string_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { string_value_->clear(); } clear_has_string_value(); } inline const ::std::string& UninterpretedOption::string_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value) return *string_value_; } inline void UninterpretedOption::set_string_value(const ::std::string& value) { set_has_string_value(); - if (string_value_ == &::google::protobuf::internal::kEmptyString) { + if (string_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { string_value_ = new ::std::string; } string_value_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value) } inline void UninterpretedOption::set_string_value(const char* value) { set_has_string_value(); - if (string_value_ == &::google::protobuf::internal::kEmptyString) { + if (string_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { string_value_ = new ::std::string; } string_value_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.string_value) } inline void UninterpretedOption::set_string_value(const void* value, size_t size) { set_has_string_value(); - if (string_value_ == &::google::protobuf::internal::kEmptyString) { + if (string_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { string_value_ = new ::std::string; } string_value_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value) } inline ::std::string* UninterpretedOption::mutable_string_value() { set_has_string_value(); - if (string_value_ == &::google::protobuf::internal::kEmptyString) { + if (string_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { string_value_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value) return string_value_; } inline ::std::string* UninterpretedOption::release_string_value() { clear_has_string_value(); - if (string_value_ == &::google::protobuf::internal::kEmptyString) { + if (string_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = string_value_; - string_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + string_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void UninterpretedOption::set_allocated_string_value(::std::string* string_value) { - if (string_value_ != &::google::protobuf::internal::kEmptyString) { + if (string_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete string_value_; } if (string_value) { @@ -5659,8 +6390,9 @@ inline void UninterpretedOption::set_allocated_string_value(::std::string* strin string_value_ = string_value; } else { clear_has_string_value(); - string_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + string_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value) } // optional string aggregate_value = 8; @@ -5674,54 +6406,59 @@ inline void UninterpretedOption::clear_has_aggregate_value() { _has_bits_[0] &= ~0x00000040u; } inline void UninterpretedOption::clear_aggregate_value() { - if (aggregate_value_ != &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { aggregate_value_->clear(); } clear_has_aggregate_value(); } inline const ::std::string& UninterpretedOption::aggregate_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value) return *aggregate_value_; } inline void UninterpretedOption::set_aggregate_value(const ::std::string& value) { set_has_aggregate_value(); - if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { aggregate_value_ = new ::std::string; } aggregate_value_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value) } inline void UninterpretedOption::set_aggregate_value(const char* value) { set_has_aggregate_value(); - if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { aggregate_value_ = new ::std::string; } aggregate_value_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.aggregate_value) } inline void UninterpretedOption::set_aggregate_value(const char* value, size_t size) { set_has_aggregate_value(); - if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { aggregate_value_ = new ::std::string; } aggregate_value_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value) } inline ::std::string* UninterpretedOption::mutable_aggregate_value() { set_has_aggregate_value(); - if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { aggregate_value_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value) return aggregate_value_; } inline ::std::string* UninterpretedOption::release_aggregate_value() { clear_has_aggregate_value(); - if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = aggregate_value_; - aggregate_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + aggregate_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void UninterpretedOption::set_allocated_aggregate_value(::std::string* aggregate_value) { - if (aggregate_value_ != &::google::protobuf::internal::kEmptyString) { + if (aggregate_value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete aggregate_value_; } if (aggregate_value) { @@ -5729,8 +6466,9 @@ inline void UninterpretedOption::set_allocated_aggregate_value(::std::string* ag aggregate_value_ = aggregate_value; } else { clear_has_aggregate_value(); - aggregate_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + aggregate_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value) } // ------------------------------------------------------------------- @@ -5745,20 +6483,25 @@ inline void SourceCodeInfo_Location::clear_path() { path_.Clear(); } inline ::google::protobuf::int32 SourceCodeInfo_Location::path(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path) return path_.Get(index); } inline void SourceCodeInfo_Location::set_path(int index, ::google::protobuf::int32 value) { path_.Set(index, value); + // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path) } inline void SourceCodeInfo_Location::add_path(::google::protobuf::int32 value) { path_.Add(value); + // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path) } inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& SourceCodeInfo_Location::path() const { + // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path) return path_; } inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* SourceCodeInfo_Location::mutable_path() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path) return &path_; } @@ -5770,20 +6513,25 @@ inline void SourceCodeInfo_Location::clear_span() { span_.Clear(); } inline ::google::protobuf::int32 SourceCodeInfo_Location::span(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span) return span_.Get(index); } inline void SourceCodeInfo_Location::set_span(int index, ::google::protobuf::int32 value) { span_.Set(index, value); + // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span) } inline void SourceCodeInfo_Location::add_span(::google::protobuf::int32 value) { span_.Add(value); + // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span) } inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& SourceCodeInfo_Location::span() const { + // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span) return span_; } inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* SourceCodeInfo_Location::mutable_span() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span) return &span_; } @@ -5798,54 +6546,59 @@ inline void SourceCodeInfo_Location::clear_has_leading_comments() { _has_bits_[0] &= ~0x00000004u; } inline void SourceCodeInfo_Location::clear_leading_comments() { - if (leading_comments_ != &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { leading_comments_->clear(); } clear_has_leading_comments(); } inline const ::std::string& SourceCodeInfo_Location::leading_comments() const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments) return *leading_comments_; } inline void SourceCodeInfo_Location::set_leading_comments(const ::std::string& value) { set_has_leading_comments(); - if (leading_comments_ == &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { leading_comments_ = new ::std::string; } leading_comments_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments) } inline void SourceCodeInfo_Location::set_leading_comments(const char* value) { set_has_leading_comments(); - if (leading_comments_ == &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { leading_comments_ = new ::std::string; } leading_comments_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_comments) } inline void SourceCodeInfo_Location::set_leading_comments(const char* value, size_t size) { set_has_leading_comments(); - if (leading_comments_ == &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { leading_comments_ = new ::std::string; } leading_comments_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments) } inline ::std::string* SourceCodeInfo_Location::mutable_leading_comments() { set_has_leading_comments(); - if (leading_comments_ == &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { leading_comments_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments) return leading_comments_; } inline ::std::string* SourceCodeInfo_Location::release_leading_comments() { clear_has_leading_comments(); - if (leading_comments_ == &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = leading_comments_; - leading_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + leading_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void SourceCodeInfo_Location::set_allocated_leading_comments(::std::string* leading_comments) { - if (leading_comments_ != &::google::protobuf::internal::kEmptyString) { + if (leading_comments_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete leading_comments_; } if (leading_comments) { @@ -5853,8 +6606,9 @@ inline void SourceCodeInfo_Location::set_allocated_leading_comments(::std::strin leading_comments_ = leading_comments; } else { clear_has_leading_comments(); - leading_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + leading_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments) } // optional string trailing_comments = 4; @@ -5868,54 +6622,59 @@ inline void SourceCodeInfo_Location::clear_has_trailing_comments() { _has_bits_[0] &= ~0x00000008u; } inline void SourceCodeInfo_Location::clear_trailing_comments() { - if (trailing_comments_ != &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { trailing_comments_->clear(); } clear_has_trailing_comments(); } inline const ::std::string& SourceCodeInfo_Location::trailing_comments() const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments) return *trailing_comments_; } inline void SourceCodeInfo_Location::set_trailing_comments(const ::std::string& value) { set_has_trailing_comments(); - if (trailing_comments_ == &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { trailing_comments_ = new ::std::string; } trailing_comments_->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments) } inline void SourceCodeInfo_Location::set_trailing_comments(const char* value) { set_has_trailing_comments(); - if (trailing_comments_ == &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { trailing_comments_ = new ::std::string; } trailing_comments_->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.trailing_comments) } inline void SourceCodeInfo_Location::set_trailing_comments(const char* value, size_t size) { set_has_trailing_comments(); - if (trailing_comments_ == &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { trailing_comments_ = new ::std::string; } trailing_comments_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments) } inline ::std::string* SourceCodeInfo_Location::mutable_trailing_comments() { set_has_trailing_comments(); - if (trailing_comments_ == &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { trailing_comments_ = new ::std::string; } + // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments) return trailing_comments_; } inline ::std::string* SourceCodeInfo_Location::release_trailing_comments() { clear_has_trailing_comments(); - if (trailing_comments_ == &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = trailing_comments_; - trailing_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + trailing_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::string* trailing_comments) { - if (trailing_comments_ != &::google::protobuf::internal::kEmptyString) { + if (trailing_comments_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete trailing_comments_; } if (trailing_comments) { @@ -5923,8 +6682,9 @@ inline void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::stri trailing_comments_ = trailing_comments; } else { clear_has_trailing_comments(); - trailing_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + trailing_comments_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments) } // ------------------------------------------------------------------- @@ -5939,20 +6699,25 @@ inline void SourceCodeInfo::clear_location() { location_.Clear(); } inline const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location) return location_.Get(index); } inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location) return location_.Mutable(index); } inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() { + // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location) return location_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >& SourceCodeInfo::location() const { + // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.location) return location_; } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >* SourceCodeInfo::mutable_location() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location) return &location_; } @@ -5966,18 +6731,22 @@ SourceCodeInfo::mutable_location() { namespace google { namespace protobuf { +template <> struct is_proto_enum< ::google::protobuf::FieldDescriptorProto_Type> : ::google::protobuf::internal::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldDescriptorProto_Type>() { return ::google::protobuf::FieldDescriptorProto_Type_descriptor(); } +template <> struct is_proto_enum< ::google::protobuf::FieldDescriptorProto_Label> : ::google::protobuf::internal::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldDescriptorProto_Label>() { return ::google::protobuf::FieldDescriptorProto_Label_descriptor(); } +template <> struct is_proto_enum< ::google::protobuf::FileOptions_OptimizeMode> : ::google::protobuf::internal::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FileOptions_OptimizeMode>() { return ::google::protobuf::FileOptions_OptimizeMode_descriptor(); } +template <> struct is_proto_enum< ::google::protobuf::FieldOptions_CType> : ::google::protobuf::internal::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldOptions_CType>() { return ::google::protobuf::FieldOptions_CType_descriptor(); diff --git a/include/google/protobuf/descriptor.proto b/include/google/protobuf/descriptor.proto index a785f79..a753601 100644 --- a/include/google/protobuf/descriptor.proto +++ b/include/google/protobuf/descriptor.proto @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -96,6 +96,8 @@ message DescriptorProto { } repeated ExtensionRange extension_range = 5; + repeated OneofDescriptorProto oneof_decl = 8; + optional MessageOptions options = 7; } @@ -143,7 +145,7 @@ message FieldDescriptorProto { optional Label label = 4; // If type_name is set, this need not be set. If both this and type_name - // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. optional Type type = 5; // For message and enum types, this is the name of the type. If the name @@ -164,9 +166,20 @@ message FieldDescriptorProto { // TODO(kenton): Base-64 encode? optional string default_value = 7; + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. Extensions of a oneof should + // not set this since the oneof to which they belong will be inferred based + // on the extension range containing the extension's field number. + optional int32 oneof_index = 9; + optional FieldOptions options = 8; } +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; +} + // Describes an enum type. message EnumDescriptorProto { optional string name = 1; @@ -233,7 +246,7 @@ message MethodDescriptorProto { // number. You can declare multiple options with only one extension number by // putting them in a sub-message. See the Custom Options section of the docs // for examples: -// http://code.google.com/apis/protocolbuffers/docs/proto.html#options +// https://developers.google.com/protocol-buffers/docs/proto#options // If this turns out to be popular, a web service will be set up // to automatically assign option numbers. @@ -263,11 +276,26 @@ message FileOptions { optional bool java_multiple_files = 10 [default=false]; // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. This is - // purely a speed optimization, as the AbstractMessage base class includes - // reflection-based implementations of these methods. + // hashCode() methods for all messages defined in the .proto file. + // - In the full runtime, this is purely a speed optimization, as the + // AbstractMessage base class includes reflection-based implementations of + // these methods. + //- In the lite runtime, setting this option changes the semantics of + // equals() and hashCode() to more closely match those of the full runtime; + // the generated methods compute their results based on field values rather + // than object identity. (Implementations should not assume that hashcodes + // will be consistent across runtimes or versions of the protocol compiler.) optional bool java_generate_equals_and_hash = 20 [default=false]; + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default=false]; + + // Generated classes can be optimized for speed or code size. enum OptimizeMode { SPEED = 1; // Generate complete code for parsing, serialization, @@ -297,6 +325,13 @@ message FileOptions { optional bool java_generic_services = 17 [default=false]; optional bool py_generic_services = 18 [default=false]; + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default=false]; + + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -330,6 +365,12 @@ message MessageOptions { // from proto1 easier; new code should avoid fields named "descriptor". optional bool no_standard_descriptor_accessor = 2 [default=false]; + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -412,6 +453,8 @@ message FieldOptions { // For Google-internal migration only. Do not use. optional bool weak = 10 [default=false]; + + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -421,9 +464,15 @@ message FieldOptions { message EnumOptions { - // Set this option to false to disallow mapping different tag names to a same + // Set this option to true to allow mapping different tag names to the same // value. - optional bool allow_alias = 2 [default=true]; + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default=false]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -433,6 +482,12 @@ message EnumOptions { } message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -447,6 +502,12 @@ message ServiceOptions { // we were already using them long before we decided to release Protocol // Buffers. + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -461,6 +522,12 @@ message MethodOptions { // we were already using them long before we decided to release Protocol // Buffers. + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; diff --git a/include/google/protobuf/descriptor_database.h b/include/google/protobuf/descriptor_database.h index 2ccb145..934e402 100644 --- a/include/google/protobuf/descriptor_database.h +++ b/include/google/protobuf/descriptor_database.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -96,11 +96,12 @@ class LIBPROTOBUF_EXPORT DescriptorDatabase { // // This method has a default implementation that always returns // false. - virtual bool FindAllExtensionNumbers(const string& extendee_type, - vector<int>* output) { + virtual bool FindAllExtensionNumbers(const string& /* extendee_type */, + vector<int>* /* output */) { return false; } + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorDatabase); }; @@ -356,6 +357,7 @@ class LIBPROTOBUF_EXPORT MergedDescriptorDatabase : public DescriptorDatabase { bool FindAllExtensionNumbers(const string& extendee_type, vector<int>* output); + private: vector<DescriptorDatabase*> sources_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MergedDescriptorDatabase); diff --git a/include/google/protobuf/dynamic_message.h b/include/google/protobuf/dynamic_message.h index b3d1e5d..10ed700 100644 --- a/include/google/protobuf/dynamic_message.h +++ b/include/google/protobuf/dynamic_message.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -38,6 +38,8 @@ #ifndef GOOGLE_PROTOBUF_DYNAMIC_MESSAGE_H__ #define GOOGLE_PROTOBUF_DYNAMIC_MESSAGE_H__ +#include <memory> + #include <google/protobuf/message.h> #include <google/protobuf/stubs/common.h> @@ -127,6 +129,16 @@ class LIBPROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { friend class DynamicMessage; const Message* GetPrototypeNoLock(const Descriptor* type); + // Construct default oneof instance for reflection usage if oneof + // is defined. + static void ConstructDefaultOneofInstance(const Descriptor* type, + const int offsets[], + void* default_oneof_instance); + // Delete default oneof instance. Called by ~DynamicMessageFactory. + static void DeleteDefaultOneofInstance(const Descriptor* type, + const int offsets[], + void* default_oneof_instance); + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DynamicMessageFactory); }; diff --git a/include/google/protobuf/extension_set.h b/include/google/protobuf/extension_set.h index df8f1f3..d7ec519 100644 --- a/include/google/protobuf/extension_set.h +++ b/include/google/protobuf/extension_set.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -46,6 +46,8 @@ #include <google/protobuf/stubs/common.h> +#include <google/protobuf/repeated_field.h> + namespace google { namespace protobuf { @@ -62,10 +64,7 @@ namespace protobuf { } namespace internal { class FieldSkipper; // wire_format_lite.h - class RepeatedPtrFieldBase; // repeated_field.h } - template <typename Element> class RepeatedField; // repeated_field.h - template <typename Element> class RepeatedPtrField; // repeated_field.h } namespace protobuf { @@ -138,6 +137,9 @@ class LIBPROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder { const MessageLite* containing_type_; }; +// A FieldSkipper used for parsing MessageSet. +class MessageSetFieldSkipper; + // Note: extension_set_heavy.cc defines DescriptorPoolExtensionFinder for // finding extensions from a DescriptorPool. @@ -265,6 +267,20 @@ class LIBPROTOBUF_EXPORT ExtensionSet { // repeated fields ------------------------------------------------- + // Fetches a RepeatedField extension by number; returns |default_value| + // if no such extension exists. User should not touch this directly; it is + // used by the GetRepeatedExtension() method. + const void* GetRawRepeatedField(int number, const void* default_value) const; + // Fetches a mutable version of a RepeatedField extension by number, + // instantiating one if none exists. Similar to above, user should not use + // this directly; it underlies MutableRepeatedExtension(). + void* MutableRawRepeatedField(int number, FieldType field_type, + bool packed, const FieldDescriptor* desc); + + // This is an overload of MutableRawRepeatedField to maintain compatibility + // with old code using a previous API. This version of + // MutableRawRepeatedField() will GOOGLE_CHECK-fail on a missing extension. + // (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.) void* MutableRawRepeatedField(int number); int32 GetRepeatedInt32 (int number, int index) const; @@ -323,6 +339,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet { void Clear(); void MergeFrom(const ExtensionSet& other); void Swap(ExtensionSet* other); + void SwapExtension(ExtensionSet* other, int number); bool IsInitialized() const; // Parses a single extension from the input. The input should start out @@ -342,12 +359,15 @@ class LIBPROTOBUF_EXPORT ExtensionSet { bool ParseField(uint32 tag, io::CodedInputStream* input, const Message* containing_type, UnknownFieldSet* unknown_fields); + bool ParseField(uint32 tag, io::CodedInputStream* input, + const MessageLite* containing_type, + io::CodedOutputStream* unknown_fields); // Parse an entire message in MessageSet format. Such messages have no // fields, only extensions. bool ParseMessageSet(io::CodedInputStream* input, ExtensionFinder* extension_finder, - FieldSkipper* field_skipper); + MessageSetFieldSkipper* field_skipper); // Specific versions for lite or full messages (constructs the appropriate // FieldSkipper automatically). @@ -505,23 +525,38 @@ class LIBPROTOBUF_EXPORT ExtensionSet { // Returns true and fills field_number and extension if extension is found. + // Note to support packed repeated field compatibility, it also fills whether + // the tag on wire is packed, which can be different from + // extension->is_packed (whether packed=true is specified). bool FindExtensionInfoFromTag(uint32 tag, ExtensionFinder* extension_finder, - int* field_number, ExtensionInfo* extension); + int* field_number, ExtensionInfo* extension, + bool* was_packed_on_wire); + + // Returns true and fills extension if extension is found. + // Note to support packed repeated field compatibility, it also fills whether + // the tag on wire is packed, which can be different from + // extension->is_packed (whether packed=true is specified). + bool FindExtensionInfoFromFieldNumber(int wire_type, int field_number, + ExtensionFinder* extension_finder, + ExtensionInfo* extension, + bool* was_packed_on_wire); // Parses a single extension from the input. The input should start out // positioned immediately after the wire tag. This method is called in - // ParseField() after field number is extracted from the wire tag and - // ExtensionInfo is found by the field number. + // ParseField() after field number and was_packed_on_wire is extracted from + // the wire tag and ExtensionInfo is found by the field number. bool ParseFieldWithExtensionInfo(int field_number, + bool was_packed_on_wire, const ExtensionInfo& extension, io::CodedInputStream* input, FieldSkipper* field_skipper); // Like ParseField(), but this method may parse singular message extensions // lazily depending on the value of FLAGS_eagerly_parse_message_sets. - bool ParseFieldMaybeLazily(uint32 tag, io::CodedInputStream* input, + bool ParseFieldMaybeLazily(int wire_type, int field_number, + io::CodedInputStream* input, ExtensionFinder* extension_finder, - FieldSkipper* field_skipper); + MessageSetFieldSkipper* field_skipper); // Gets the extension with the given number, creating it if it does not // already exist. Returns true if the extension did not already exist. @@ -532,7 +567,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet { // tag has been read. bool ParseMessageSetItem(io::CodedInputStream* input, ExtensionFinder* extension_finder, - FieldSkipper* field_skipper); + MessageSetFieldSkipper* field_skipper); // Hack: RepeatedPtrFieldBase declares ExtensionSet as a friend. This @@ -587,6 +622,16 @@ inline void ExtensionSet::AddString(int number, FieldType type, // public: // typedef ? ConstType; // typedef ? MutableType; +// // TypeTraits for singular fields and repeated fields will define the +// // symbol "Singular" or "Repeated" respectively. These two symbols will +// // be used in extension accessors to distinguish between singular +// // extensions and repeated extensions. If the TypeTraits for the passed +// // in extension doesn't have the expected symbol defined, it means the +// // user is passing a repeated extension to a singular accessor, or the +// // opposite. In that case the C++ compiler will generate an error +// // message "no matching member function" to inform the user. +// typedef ? Singular +// typedef ? Repeated // // static inline ConstType Get(int number, const ExtensionSet& set); // static inline void Set(int number, ConstType value, ExtensionSet* set); @@ -625,6 +670,8 @@ template <typename Type> class PrimitiveTypeTraits { public: typedef Type ConstType; + typedef Type MutableType; + typedef PrimitiveTypeTraits<Type> Singular; static inline ConstType Get(int number, const ExtensionSet& set, ConstType default_value); @@ -636,11 +683,41 @@ template <typename Type> class RepeatedPrimitiveTypeTraits { public: typedef Type ConstType; + typedef Type MutableType; + typedef RepeatedPrimitiveTypeTraits<Type> Repeated; + + typedef RepeatedField<Type> RepeatedFieldType; static inline Type Get(int number, const ExtensionSet& set, int index); static inline void Set(int number, int index, Type value, ExtensionSet* set); static inline void Add(int number, FieldType field_type, bool is_packed, Type value, ExtensionSet* set); + + static inline const RepeatedField<ConstType>& + GetRepeated(int number, const ExtensionSet& set); + static inline RepeatedField<Type>* + MutableRepeated(int number, FieldType field_type, + bool is_packed, ExtensionSet* set); + + static const RepeatedFieldType* GetDefaultRepeatedField(); +}; + +// Declared here so that this can be friended below. +void InitializeDefaultRepeatedFields(); +void DestroyDefaultRepeatedFields(); + +class LIBPROTOBUF_EXPORT RepeatedPrimitiveGenericTypeTraits { + private: + template<typename Type> friend class RepeatedPrimitiveTypeTraits; + friend void InitializeDefaultRepeatedFields(); + friend void DestroyDefaultRepeatedFields(); + static const RepeatedField<int32>* default_repeated_field_int32_; + static const RepeatedField<int64>* default_repeated_field_int64_; + static const RepeatedField<uint32>* default_repeated_field_uint32_; + static const RepeatedField<uint64>* default_repeated_field_uint64_; + static const RepeatedField<double>* default_repeated_field_double_; + static const RepeatedField<float>* default_repeated_field_float_; + static const RepeatedField<bool>* default_repeated_field_bool_; }; #define PROTOBUF_DEFINE_PRIMITIVE_TYPE(TYPE, METHOD) \ @@ -665,6 +742,26 @@ template<> inline void RepeatedPrimitiveTypeTraits<TYPE>::Add( \ int number, FieldType field_type, bool is_packed, \ TYPE value, ExtensionSet* set) { \ set->Add##METHOD(number, field_type, is_packed, value, NULL); \ +} \ +template<> inline const RepeatedField<TYPE>* \ + RepeatedPrimitiveTypeTraits<TYPE>::GetDefaultRepeatedField() { \ + return RepeatedPrimitiveGenericTypeTraits:: \ + default_repeated_field_##TYPE##_; \ +} \ +template<> inline const RepeatedField<TYPE>& \ + RepeatedPrimitiveTypeTraits<TYPE>::GetRepeated(int number, \ + const ExtensionSet& set) { \ + return *reinterpret_cast<const RepeatedField<TYPE>*>( \ + set.GetRawRepeatedField( \ + number, GetDefaultRepeatedField())); \ +} \ +template<> inline RepeatedField<TYPE>* \ + RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated(int number, \ + FieldType field_type, \ + bool is_packed, \ + ExtensionSet* set) { \ + return reinterpret_cast<RepeatedField<TYPE>*>( \ + set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); \ } PROTOBUF_DEFINE_PRIMITIVE_TYPE( int32, Int32) @@ -685,6 +782,7 @@ class LIBPROTOBUF_EXPORT StringTypeTraits { public: typedef const string& ConstType; typedef string* MutableType; + typedef StringTypeTraits Singular; static inline const string& Get(int number, const ExtensionSet& set, ConstType default_value) { @@ -704,6 +802,9 @@ class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits { public: typedef const string& ConstType; typedef string* MutableType; + typedef RepeatedStringTypeTraits Repeated; + + typedef RepeatedPtrField<string> RepeatedFieldType; static inline const string& Get(int number, const ExtensionSet& set, int index) { @@ -725,6 +826,28 @@ class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits { ExtensionSet* set) { return set->AddString(number, field_type, NULL); } + static inline const RepeatedPtrField<string>& + GetRepeated(int number, const ExtensionSet& set) { + return *reinterpret_cast<const RepeatedPtrField<string>*>( + set.GetRawRepeatedField(number, GetDefaultRepeatedField())); + } + + static inline RepeatedPtrField<string>* + MutableRepeated(int number, FieldType field_type, + bool is_packed, ExtensionSet* set) { + return reinterpret_cast<RepeatedPtrField<string>*>( + set->MutableRawRepeatedField(number, field_type, + is_packed, NULL)); + } + + static const RepeatedFieldType* GetDefaultRepeatedField() { + return default_repeated_field_; + } + + private: + friend void InitializeDefaultRepeatedFields(); + friend void DestroyDefaultRepeatedFields(); + static const RepeatedFieldType *default_repeated_field_; }; // ------------------------------------------------------------------- @@ -736,6 +859,8 @@ template <typename Type, bool IsValid(int)> class EnumTypeTraits { public: typedef Type ConstType; + typedef Type MutableType; + typedef EnumTypeTraits<Type, IsValid> Singular; static inline ConstType Get(int number, const ExtensionSet& set, ConstType default_value) { @@ -752,6 +877,10 @@ template <typename Type, bool IsValid(int)> class RepeatedEnumTypeTraits { public: typedef Type ConstType; + typedef Type MutableType; + typedef RepeatedEnumTypeTraits<Type, IsValid> Repeated; + + typedef RepeatedField<Type> RepeatedFieldType; static inline ConstType Get(int number, const ExtensionSet& set, int index) { return static_cast<Type>(set.GetRepeatedEnum(number, index)); @@ -766,6 +895,35 @@ class RepeatedEnumTypeTraits { GOOGLE_DCHECK(IsValid(value)); set->AddEnum(number, field_type, is_packed, value, NULL); } + static inline const RepeatedField<Type>& GetRepeated(int number, + const ExtensionSet& + set) { + // Hack: the `Extension` struct stores a RepeatedField<int> for enums. + // RepeatedField<int> cannot implicitly convert to RepeatedField<EnumType> + // so we need to do some casting magic. See message.h for similar + // contortions for non-extension fields. + return *reinterpret_cast<const RepeatedField<Type>*>( + set.GetRawRepeatedField(number, GetDefaultRepeatedField())); + } + + static inline RepeatedField<Type>* MutableRepeated(int number, + FieldType field_type, + bool is_packed, + ExtensionSet* set) { + return reinterpret_cast<RepeatedField<Type>*>( + set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); + } + + static const RepeatedFieldType* GetDefaultRepeatedField() { + // Hack: as noted above, repeated enum fields are internally stored as a + // RepeatedField<int>. We need to be able to instantiate global static + // objects to return as default (empty) repeated fields on non-existent + // extensions. We would not be able to know a-priori all of the enum types + // (values of |Type|) to instantiate all of these, so we just re-use int32's + // default repeated field object. + return reinterpret_cast<const RepeatedField<Type>*>( + RepeatedPrimitiveTypeTraits<int32>::GetDefaultRepeatedField()); + } }; // ------------------------------------------------------------------- @@ -779,6 +937,7 @@ class MessageTypeTraits { public: typedef const Type& ConstType; typedef Type* MutableType; + typedef MessageTypeTraits<Type> Singular; static inline ConstType Get(int number, const ExtensionSet& set, ConstType default_value) { @@ -794,18 +953,24 @@ class MessageTypeTraits { MutableType message, ExtensionSet* set) { set->SetAllocatedMessage(number, field_type, NULL, message); } - static inline MutableType Release(int number, FieldType field_type, + static inline MutableType Release(int number, FieldType /* field_type */, ExtensionSet* set) { return static_cast<Type*>(set->ReleaseMessage( number, Type::default_instance())); } }; +// forward declaration +class RepeatedMessageGenericTypeTraits; + template <typename Type> class RepeatedMessageTypeTraits { public: typedef const Type& ConstType; typedef Type* MutableType; + typedef RepeatedMessageTypeTraits<Type> Repeated; + + typedef RepeatedPtrField<Type> RepeatedFieldType; static inline ConstType Get(int number, const ExtensionSet& set, int index) { return static_cast<const Type&>(set.GetRepeatedMessage(number, index)); @@ -818,8 +983,47 @@ class RepeatedMessageTypeTraits { return static_cast<Type*>( set->AddMessage(number, field_type, Type::default_instance(), NULL)); } + static inline const RepeatedPtrField<Type>& GetRepeated(int number, + const ExtensionSet& + set) { + // See notes above in RepeatedEnumTypeTraits::GetRepeated(): same + // casting hack applies here, because a RepeatedPtrField<MessageLite> + // cannot naturally become a RepeatedPtrType<Type> even though Type is + // presumably a message. google::protobuf::Message goes through similar contortions + // with a reinterpret_cast<>. + return *reinterpret_cast<const RepeatedPtrField<Type>*>( + set.GetRawRepeatedField(number, GetDefaultRepeatedField())); + } + static inline RepeatedPtrField<Type>* MutableRepeated(int number, + FieldType field_type, + bool is_packed, + ExtensionSet* set) { + return reinterpret_cast<RepeatedPtrField<Type>*>( + set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); + } + + static const RepeatedFieldType* GetDefaultRepeatedField(); +}; + +// This class exists only to hold a generic default empty repeated field for all +// message-type repeated field extensions. +class LIBPROTOBUF_EXPORT RepeatedMessageGenericTypeTraits { + public: + typedef RepeatedPtrField< ::google::protobuf::MessageLite*> RepeatedFieldType; + private: + template<typename Type> friend class RepeatedMessageTypeTraits; + friend void InitializeDefaultRepeatedFields(); + friend void DestroyDefaultRepeatedFields(); + static const RepeatedFieldType* default_repeated_field_; }; +template<typename Type> inline + const typename RepeatedMessageTypeTraits<Type>::RepeatedFieldType* + RepeatedMessageTypeTraits<Type>::GetDefaultRepeatedField() { + return reinterpret_cast<const RepeatedFieldType*>( + RepeatedMessageGenericTypeTraits::default_repeated_field_); +} + // ------------------------------------------------------------------- // ExtensionIdentifier @@ -902,7 +1106,7 @@ class ExtensionIdentifier { template <typename _proto_TypeTraits, \ ::google::protobuf::internal::FieldType _field_type, \ bool _is_packed> \ - inline typename _proto_TypeTraits::ConstType GetExtension( \ + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \ return _proto_TypeTraits::Get(id.number(), _extensions_, \ @@ -912,7 +1116,7 @@ class ExtensionIdentifier { template <typename _proto_TypeTraits, \ ::google::protobuf::internal::FieldType _field_type, \ bool _is_packed> \ - inline typename _proto_TypeTraits::MutableType MutableExtension( \ + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ return _proto_TypeTraits::Mutable(id.number(), _field_type, \ @@ -925,7 +1129,7 @@ class ExtensionIdentifier { inline void SetExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::ConstType value) { \ + typename _proto_TypeTraits::Singular::ConstType value) { \ _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); \ } \ \ @@ -935,14 +1139,14 @@ class ExtensionIdentifier { inline void SetAllocatedExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::MutableType value) { \ + typename _proto_TypeTraits::Singular::MutableType value) { \ _proto_TypeTraits::SetAllocated(id.number(), _field_type, \ value, &_extensions_); \ } \ template <typename _proto_TypeTraits, \ ::google::protobuf::internal::FieldType _field_type, \ bool _is_packed> \ - inline typename _proto_TypeTraits::MutableType ReleaseExtension( \ + inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ return _proto_TypeTraits::Release(id.number(), _field_type, \ @@ -953,7 +1157,7 @@ class ExtensionIdentifier { template <typename _proto_TypeTraits, \ ::google::protobuf::internal::FieldType _field_type, \ bool _is_packed> \ - inline typename _proto_TypeTraits::ConstType GetExtension( \ + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ int index) const { \ @@ -963,7 +1167,7 @@ class ExtensionIdentifier { template <typename _proto_TypeTraits, \ ::google::protobuf::internal::FieldType _field_type, \ bool _is_packed> \ - inline typename _proto_TypeTraits::MutableType MutableExtension( \ + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ int index) { \ @@ -976,14 +1180,14 @@ class ExtensionIdentifier { inline void SetExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - int index, typename _proto_TypeTraits::ConstType value) { \ + int index, typename _proto_TypeTraits::Repeated::ConstType value) { \ _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); \ } \ \ template <typename _proto_TypeTraits, \ ::google::protobuf::internal::FieldType _field_type, \ bool _is_packed> \ - inline typename _proto_TypeTraits::MutableType AddExtension( \ + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ return _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); \ @@ -995,9 +1199,32 @@ class ExtensionIdentifier { inline void AddExtension( \ const ::google::protobuf::internal::ExtensionIdentifier< \ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::ConstType value) { \ + typename _proto_TypeTraits::Repeated::ConstType value) { \ _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, \ value, &_extensions_); \ + } \ + \ + template <typename _proto_TypeTraits, \ + ::google::protobuf::internal::FieldType _field_type, \ + bool _is_packed> \ + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& \ + GetRepeatedExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, _field_type, \ + _is_packed>& id) const { \ + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); \ + } \ + \ + template <typename _proto_TypeTraits, \ + ::google::protobuf::internal::FieldType _field_type, \ + bool _is_packed> \ + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* \ + MutableRepeatedExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, _field_type, \ + _is_packed>& id) { \ + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, \ + _is_packed, &_extensions_); \ } } // namespace internal diff --git a/include/google/protobuf/generated_enum_reflection.h b/include/google/protobuf/generated_enum_reflection.h index a09a540..3852cea 100644 --- a/include/google/protobuf/generated_enum_reflection.h +++ b/include/google/protobuf/generated_enum_reflection.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -41,6 +41,8 @@ #include <string> +#include <google/protobuf/stubs/template_util.h> + namespace google { namespace protobuf { class EnumDescriptor; @@ -48,6 +50,10 @@ namespace protobuf { namespace protobuf { +// This type trait can be used to cause templates to only match proto2 enum +// types. +template <typename T> struct is_proto_enum : ::google::protobuf::internal::false_type {}; + // Returns the EnumDescriptor for enum type E, which must be a // proto-declared enum type. Code generated by the protocol compiler // will include specializations of this template for each enum type declared. diff --git a/include/google/protobuf/generated_message_reflection.h b/include/google/protobuf/generated_message_reflection.h index c1c142f..b6671ad 100644 --- a/include/google/protobuf/generated_message_reflection.h +++ b/include/google/protobuf/generated_message_reflection.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -61,6 +61,7 @@ namespace protobuf { namespace protobuf { namespace internal { +class DefaultEmptyOneof; // Defined in this file. class GeneratedMessageReflection; @@ -134,6 +135,42 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { const DescriptorPool* pool, MessageFactory* factory, int object_size); + + // Similar with the construction above. Call this construction if the + // message has oneof definition. + // Parameters: + // offsets: An array of ints giving the byte offsets. + // For each oneof field, the offset is relative to the + // default_oneof_instance. These can be computed at compile + // time using the + // PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET() macro. + // For each none oneof field, the offset is related to + // the start of the message object. These can be computed + // at compile time using the + // GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET() macro. + // Besides offsets for all fields, this array also contains + // offsets for oneof unions. The offset of the i-th oneof + // union is offsets[descriptor->field_count() + i]. + // default_oneof_instance: The default instance of the oneofs. It is a + // struct holding the default value of all oneof fields + // for this message. It is only used to obtain pointers + // to default instances of oneof fields, which Get + // methods will return if the field is not set. + // oneof_case_offset: Offset in the message of an array of uint32s of + // size descriptor->oneof_decl_count(). Each uint32 + // indicates what field is set for each oneof. + // other parameters are the same with the construction above. + GeneratedMessageReflection(const Descriptor* descriptor, + const Message* default_instance, + const int offsets[], + int has_bits_offset, + int unknown_fields_offset, + int extensions_offset, + const void* default_oneof_instance, + int oneof_case_offset, + const DescriptorPool* pool, + MessageFactory* factory, + int object_size); ~GeneratedMessageReflection(); // implements Reflection ------------------------------------------- @@ -146,11 +183,16 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { bool HasField(const Message& message, const FieldDescriptor* field) const; int FieldSize(const Message& message, const FieldDescriptor* field) const; void ClearField(Message* message, const FieldDescriptor* field) const; + bool HasOneof(const Message& message, + const OneofDescriptor* oneof_descriptor) const; + void ClearOneof(Message* message, const OneofDescriptor* field) const; void RemoveLast(Message* message, const FieldDescriptor* field) const; Message* ReleaseLast(Message* message, const FieldDescriptor* field) const; void Swap(Message* message1, Message* message2) const; + void SwapFields(Message* message1, Message* message2, + const vector<const FieldDescriptor*>& fields) const; void SwapElements(Message* message, const FieldDescriptor* field, - int index1, int index2) const; + int index1, int index2) const; void ListFields(const Message& message, vector<const FieldDescriptor*>* output) const; @@ -179,6 +221,11 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { const FieldDescriptor* field, MessageFactory* factory = NULL) const; + const FieldDescriptor* GetOneofFieldDescriptor( + const Message& message, + const OneofDescriptor* oneof_descriptor) const; + + public: void SetInt32 (Message* message, const FieldDescriptor* field, int32 value) const; void SetInt64 (Message* message, @@ -200,6 +247,9 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { const EnumValueDescriptor* value) const; Message* MutableMessage(Message* message, const FieldDescriptor* field, MessageFactory* factory = NULL) const; + void SetAllocatedMessage(Message* message, + Message* sub_message, + const FieldDescriptor* field) const; Message* ReleaseMessage(Message* message, const FieldDescriptor* field, MessageFactory* factory = NULL) const; @@ -293,9 +343,11 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { const Descriptor* descriptor_; const Message* default_instance_; + const void* default_oneof_instance_; const int* offsets_; int has_bits_offset_; + int oneof_case_offset_; int unknown_fields_offset_; int extensions_offset_; int object_size_; @@ -311,9 +363,17 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { const FieldDescriptor* field) const; template <typename Type> inline const Type& DefaultRaw(const FieldDescriptor* field) const; + template <typename Type> + inline const Type& DefaultOneofRaw(const FieldDescriptor* field) const; inline const uint32* GetHasBits(const Message& message) const; inline uint32* MutableHasBits(Message* message) const; + inline uint32 GetOneofCase( + const Message& message, + const OneofDescriptor* oneof_descriptor) const; + inline uint32* MutableOneofCase( + Message* message, + const OneofDescriptor* oneof_descriptor) const; inline const ExtensionSet& GetExtensionSet(const Message& message) const; inline ExtensionSet* MutableExtensionSet(Message* message) const; @@ -323,6 +383,26 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { const FieldDescriptor* field) const; inline void ClearBit(Message* message, const FieldDescriptor* field) const; + inline void SwapBit(Message* message1, + Message* message2, + const FieldDescriptor* field) const; + + // This function only swaps the field. Should swap corresponding has_bit + // before or after using this function. + void SwapField(Message* message1, + Message* message2, + const FieldDescriptor* field) const; + + void SwapOneofField(Message* message1, + Message* message2, + const OneofDescriptor* oneof_descriptor) const; + + inline bool HasOneofField(const Message& message, + const FieldDescriptor* field) const; + inline void SetOneofCase(Message* message, + const FieldDescriptor* field) const; + inline void ClearOneofField(Message* message, + const FieldDescriptor* field) const; template <typename Type> inline const Type& GetField(const Message& message, @@ -376,9 +456,14 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { // be confused by an unaligned pointer. #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TYPE, FIELD) \ static_cast<int>( \ - reinterpret_cast<const char*>( \ - &reinterpret_cast<const TYPE*>(16)->FIELD) - \ - reinterpret_cast<const char*>(16)) + reinterpret_cast<const char*>( \ + &reinterpret_cast<const TYPE*>(16)->FIELD) - \ + reinterpret_cast<const char*>(16)) + +#define PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ONEOF, FIELD) \ + static_cast<int>( \ + reinterpret_cast<const char*>(&(ONEOF->FIELD)) \ + - reinterpret_cast<const char*>(ONEOF)) // There are some places in proto2 where dynamic_cast would be useful as an // optimization. For example, take Message::MergeFrom(const Message& other). diff --git a/include/google/protobuf/generated_message_util.h b/include/google/protobuf/generated_message_util.h index b2fb8f0..678f92a 100644 --- a/include/google/protobuf/generated_message_util.h +++ b/include/google/protobuf/generated_message_util.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -38,13 +38,18 @@ #ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ +#include <assert.h> #include <string> +#include <google/protobuf/stubs/once.h> + #include <google/protobuf/stubs/common.h> namespace google { + namespace protobuf { namespace internal { + // Annotation for the compiler to emit a deprecation message if a field marked // with option 'deprecated=true' is used in the code, or for other things in // generated code which are deprecated. @@ -59,8 +64,26 @@ namespace internal { LIBPROTOBUF_EXPORT double Infinity(); LIBPROTOBUF_EXPORT double NaN(); -// Constant used for empty default strings. -LIBPROTOBUF_EXPORT extern const ::std::string kEmptyString; +// TODO(jieluo): Change to template. We have tried to use template, +// but it causes net/rpc/python:rpcutil_test fail (the empty string will +// init twice). It may related to swig. Change to template after we +// found the solution. + +// Default empty string object. Don't use the pointer directly. Instead, call +// GetEmptyString() to get the reference. +LIBPROTOBUF_EXPORT extern const ::std::string* empty_string_; +LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_; +LIBPROTOBUF_EXPORT void InitEmptyString(); + + +LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyStringAlreadyInited() { + assert(empty_string_ != NULL); + return *empty_string_; +} +LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyString() { + ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString); + return GetEmptyStringAlreadyInited(); +} // Defined in generated_message_reflection.cc -- not actually part of the lite // library. @@ -70,6 +93,19 @@ LIBPROTOBUF_EXPORT extern const ::std::string kEmptyString; // get the declaration from this file. LIBPROTOBUF_EXPORT int StringSpaceUsedExcludingSelf(const string& str); + +// True if IsInitialized() is true for all elements of t. Type is expected +// to be a RepeatedPtrField<some message type>. It's useful to have this +// helper here to keep the protobuf compiler from ever having to emit loops in +// IsInitialized() methods. We want the C++ compiler to inline this or not +// as it sees fit. +template <class Type> bool AllAreInitialized(const Type& t) { + for (int i = t.size(); --i >= 0; ) { + if (!t.Get(i).IsInitialized()) return false; + } + return true; +} + } // namespace internal } // namespace protobuf diff --git a/include/google/protobuf/io/coded_stream.h b/include/google/protobuf/io/coded_stream.h index 66cbee0..81fabb1 100644 --- a/include/google/protobuf/io/coded_stream.h +++ b/include/google/protobuf/io/coded_stream.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -233,11 +233,22 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // Read a tag. This calls ReadVarint32() and returns the result, or returns // zero (which is not a valid tag) if ReadVarint32() fails. Also, it updates // the last tag value, which can be checked with LastTagWas(). - // Always inline because this is only called in once place per parse loop + // Always inline because this is only called in one place per parse loop // but it is called for every iteration of said loop, so it should be fast. // GCC doesn't want to inline this by default. uint32 ReadTag() GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + // This usually a faster alternative to ReadTag() when cutoff is a manifest + // constant. It does particularly well for cutoff >= 127. The first part + // of the return value is the tag that was read, though it can also be 0 in + // the cases where ReadTag() would return 0. If the second part is true + // then the tag is known to be in [0, cutoff]. If not, the tag either is + // above cutoff or is 0. (There's intentional wiggle room when tag is 0, + // because that can arise in several ways, and for best performance we want + // to avoid an extra "is tag == 0?" check here.) + inline std::pair<uint32, bool> ReadTagWithCutoff(uint32 cutoff) + GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + // Usually returns true if calling ReadVarint32() now would produce the given // value. Will always return false if ReadVarint32() would not return the // given value. If ExpectTag() returns true, it also advances past @@ -264,8 +275,8 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // zero, and ConsumedEntireMessage() will return true. bool ExpectAtEnd(); - // If the last call to ReadTag() returned the given value, returns true. - // Otherwise, returns false; + // If the last call to ReadTag() or ReadTagWithCutoff() returned the + // given value, returns true. Otherwise, returns false; // // This is needed because parsers for some types of embedded messages // (with field type TYPE_GROUP) don't actually know that they've reached the @@ -333,7 +344,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // cause integer overflows is 512MB. The default limit is 64MB. Apps // should set shorter limits if possible. If warning_threshold is not -1, // a warning will be printed to stderr after warning_threshold bytes are - // read. For backwards compatibility all negative values get squached to -1, + // read. For backwards compatibility all negative values get squashed to -1, // as other negative values might have special internal meanings. // An error will always be printed to stderr if the limit is reached. // @@ -356,6 +367,10 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // something unusual. void SetTotalBytesLimit(int total_bytes_limit, int warning_threshold); + // The Total Bytes Limit minus the Current Position, or -1 if there + // is no Total Bytes Limit. + int BytesUntilTotalBytesLimit() const; + // Recursion Limit ------------------------------------------------- // To prevent corrupt or malicious messages from causing stack overflows, // we must keep track of the depth of recursion when parsing embedded @@ -466,7 +481,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream { int overflow_bytes_; // LastTagWas() stuff. - uint32 last_tag_; // result of last ReadTag(). + uint32 last_tag_; // result of last ReadTag() or ReadTagWithCutoff(). // This is set true by ReadTag{Fallback/Slow}() if it is called when exactly // at EOF, or by ExpectAtEnd() when it returns true. This happens when we @@ -638,6 +653,9 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { // Write raw bytes, copying them from the given buffer. void WriteRaw(const void* buffer, int size); + // Like WriteRaw() but will try to write aliased data if aliasing is + // turned on. + void WriteRawMaybeAliased(const void* data, int size); // Like WriteRaw() but writing directly to the target array. // This is _not_ inlined, as the compiler often optimizes memcpy into inline // copy loops. Since this gets called by every field with string or bytes @@ -649,8 +667,21 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { void WriteString(const string& str); // Like WriteString() but writing directly to the target array. static uint8* WriteStringToArray(const string& str, uint8* target); + // Write the varint-encoded size of str followed by str. + static uint8* WriteStringWithSizeToArray(const string& str, uint8* target); + // Instructs the CodedOutputStream to allow the underlying + // ZeroCopyOutputStream to hold pointers to the original structure instead of + // copying, if it supports it (i.e. output->AllowsAliasing() is true). If the + // underlying stream does not support aliasing, then enabling it has no + // affect. For now, this only affects the behavior of + // WriteRawMaybeAliased(). + // + // NOTE: It is caller's responsibility to ensure that the chunk of memory + // remains live until all of the data has been consumed from the stream. + void EnableAliasing(bool enabled); + // Write a 32-bit little-endian integer. void WriteLittleEndian32(uint32 value); // Like WriteLittleEndian32() but writing directly to the target array. @@ -725,6 +756,7 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { int buffer_size_; int total_bytes_; // Sum of sizes of all buffers seen so far. bool had_error_; // Whether an error occurred during output. + bool aliasing_enabled_; // See EnableAliasing(). // Advance the buffer by a given number of bytes. void Advance(int amount); @@ -733,6 +765,10 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { // Advance(buffer_size_). bool Refresh(); + // Like WriteRaw() but may avoid copying if the underlying + // ZeroCopyOutputStream supports it. + void WriteAliasedRaw(const void* buffer, int size); + static uint8* WriteVarint32FallbackToArray(uint32 value, uint8* target); // Always-inlined versions of WriteVarint* functions so that code can be @@ -850,6 +886,45 @@ inline uint32 CodedInputStream::ReadTag() { } } +inline std::pair<uint32, bool> CodedInputStream::ReadTagWithCutoff( + uint32 cutoff) { + // In performance-sensitive code we can expect cutoff to be a compile-time + // constant, and things like "cutoff >= kMax1ByteVarint" to be evaluated at + // compile time. + if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_)) { + // Hot case: buffer_ non_empty, buffer_[0] in [1, 128). + // TODO(gpike): Is it worth rearranging this? E.g., if the number of fields + // is large enough then is it better to check for the two-byte case first? + if (static_cast<int8>(buffer_[0]) > 0) { + const uint32 kMax1ByteVarint = 0x7f; + uint32 tag = last_tag_ = buffer_[0]; + Advance(1); + return make_pair(tag, cutoff >= kMax1ByteVarint || tag <= cutoff); + } + // Other hot case: cutoff >= 0x80, buffer_ has at least two bytes available, + // and tag is two bytes. The latter is tested by bitwise-and-not of the + // first byte and the second byte. + if (cutoff >= 0x80 && + GOOGLE_PREDICT_TRUE(buffer_ + 1 < buffer_end_) && + GOOGLE_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) { + const uint32 kMax2ByteVarint = (0x7f << 7) + 0x7f; + uint32 tag = last_tag_ = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80); + Advance(2); + // It might make sense to test for tag == 0 now, but it is so rare that + // that we don't bother. A varint-encoded 0 should be one byte unless + // the encoder lost its mind. The second part of the return value of + // this function is allowed to be either true or false if the tag is 0, + // so we don't have to check for tag == 0. We may need to check whether + // it exceeds cutoff. + bool at_or_below_cutoff = cutoff >= kMax2ByteVarint || tag <= cutoff; + return make_pair(tag, at_or_below_cutoff); + } + } + // Slow path + last_tag_ = ReadTagFallback(); + return make_pair(last_tag_, static_cast<uint32>(last_tag_ - 1) < cutoff); +} + inline bool CodedInputStream::LastTagWas(uint32 expected) { return last_tag_ == expected; } @@ -1029,6 +1104,15 @@ inline void CodedOutputStream::WriteString(const string& str) { WriteRaw(str.data(), static_cast<int>(str.size())); } +inline void CodedOutputStream::WriteRawMaybeAliased( + const void* data, int size) { + if (aliasing_enabled_) { + WriteAliasedRaw(data, size); + } else { + WriteRaw(data, size); + } +} + inline uint8* CodedOutputStream::WriteStringToArray( const string& str, uint8* target) { return WriteRawToArray(str.data(), static_cast<int>(str.size()), target); diff --git a/include/google/protobuf/io/gzip_stream.h b/include/google/protobuf/io/gzip_stream.h index 365e9ea..c7ccc26 100644 --- a/include/google/protobuf/io/gzip_stream.h +++ b/include/google/protobuf/io/gzip_stream.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -118,7 +118,7 @@ class LIBPROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream { ZLIB = 2, }; - struct LIBPROTOBUF_EXPORT Options { + struct Options { // Defaults to GZIP. Format format; diff --git a/include/google/protobuf/io/printer.h b/include/google/protobuf/io/printer.h index 5be4854..f06cbf2 100644 --- a/include/google/protobuf/io/printer.h +++ b/include/google/protobuf/io/printer.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/io/strtod.h b/include/google/protobuf/io/strtod.h new file mode 100644 index 0000000..c2efc8d --- /dev/null +++ b/include/google/protobuf/io/strtod.h @@ -0,0 +1,50 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// A locale-independent version of strtod(), used to parse floating +// point default values in .proto files, where the decimal separator +// is always a dot. + +#ifndef GOOGLE_PROTOBUF_IO_STRTOD_H__ +#define GOOGLE_PROTOBUF_IO_STRTOD_H__ + +namespace google { +namespace protobuf { +namespace io { + +// A locale-independent version of the standard strtod(), which always +// uses a dot as the decimal separator. +double NoLocaleStrtod(const char* str, char** endptr); + +} // namespace io +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_IO_STRTOD_H__ diff --git a/include/google/protobuf/io/tokenizer.h b/include/google/protobuf/io/tokenizer.h index d85b82f..8c6220a 100644 --- a/include/google/protobuf/io/tokenizer.h +++ b/include/google/protobuf/io/tokenizer.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -67,7 +67,8 @@ class LIBPROTOBUF_EXPORT ErrorCollector { // Indicates that there was a warning in the input at the given line and // column numbers. The numbers are zero-based, so you may want to add // 1 to each before printing them. - virtual void AddWarning(int line, int column, const string& message) { } + virtual void AddWarning(int /* line */, int /* column */, + const string& /* message */) { } private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector); @@ -228,6 +229,21 @@ class LIBPROTOBUF_EXPORT Tokenizer { // Sets the comment style. void set_comment_style(CommentStyle style) { comment_style_ = style; } + // Whether to require whitespace between a number and a field name. + // Default is true. Do not use this; for Google-internal cleanup only. + void set_require_space_after_number(bool require) { + require_space_after_number_ = require; + } + + // Whether to allow string literals to span multiple lines. Default is false. + // Do not use this; for Google-internal cleanup only. + void set_allow_multiline_strings(bool allow) { + allow_multiline_strings_ = allow; + } + + // External helper: validate an identifier. + static bool IsIdentifier(const string& text); + // ----------------------------------------------------------------- private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Tokenizer); @@ -258,6 +274,8 @@ class LIBPROTOBUF_EXPORT Tokenizer { // Options. bool allow_f_after_float_; CommentStyle comment_style_; + bool require_space_after_number_; + bool allow_multiline_strings_; // Since we count columns we need to interpret tabs somehow. We'll take // the standard 8-character definition for lack of any way to do better. diff --git a/include/google/protobuf/io/zero_copy_stream.h b/include/google/protobuf/io/zero_copy_stream.h index db5326f..52650fc 100644 --- a/include/google/protobuf/io/zero_copy_stream.h +++ b/include/google/protobuf/io/zero_copy_stream.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -226,6 +226,16 @@ class LIBPROTOBUF_EXPORT ZeroCopyOutputStream { // Returns the total number of bytes written since this object was created. virtual int64 ByteCount() const = 0; + // Write a given chunk of data to the output. Some output streams may + // implement this in a way that avoids copying. Check AllowsAliasing() before + // calling WriteAliasedRaw(). It will GOOGLE_CHECK fail if WriteAliasedRaw() is + // called on a stream that does not allow aliasing. + // + // NOTE: It is caller's responsibility to ensure that the chunk of memory + // remains live until all of the data has been consumed from the stream. + virtual bool WriteAliasedRaw(const void* data, int size); + virtual bool AllowsAliasing() const { return false; } + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ZeroCopyOutputStream); diff --git a/include/google/protobuf/io/zero_copy_stream_impl.h b/include/google/protobuf/io/zero_copy_stream_impl.h index 9fedb00..0746fa6 100644 --- a/include/google/protobuf/io/zero_copy_stream_impl.h +++ b/include/google/protobuf/io/zero_copy_stream_impl.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -344,6 +344,7 @@ class LIBPROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { private: ZeroCopyInputStream* input_; int64 limit_; // Decreases as we go, becomes negative if we overshoot. + int64 prior_bytes_read_; // Bytes read on underlying stream at construction GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream); }; diff --git a/include/google/protobuf/io/zero_copy_stream_impl_lite.h b/include/google/protobuf/io/zero_copy_stream_impl_lite.h index 153f543..e18da72 100644 --- a/include/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/include/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -48,6 +48,7 @@ #include <iosfwd> #include <google/protobuf/io/zero_copy_stream.h> #include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/stl_util.h> namespace google { @@ -333,6 +334,19 @@ class LIBPROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStrea // =================================================================== +// Return a pointer to mutable characters underlying the given string. The +// return value is valid until the next time the string is resized. We +// trust the caller to treat the return value as an array of length s->size(). +inline char* mutable_string_data(string* s) { +#ifdef LANG_CXX11 + // This should be simpler & faster than string_as_array() because the latter + // is guaranteed to return NULL when *s is empty, so it has to check for that. + return &(*s)[0]; +#else + return string_as_array(s); +#endif +} + } // namespace io } // namespace protobuf diff --git a/include/google/protobuf/message.h b/include/google/protobuf/message.h index 0f90bc1..9593560 100644 --- a/include/google/protobuf/message.h +++ b/include/google/protobuf/message.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -110,15 +110,9 @@ #ifndef GOOGLE_PROTOBUF_MESSAGE_H__ #define GOOGLE_PROTOBUF_MESSAGE_H__ -#include <vector> -#include <string> - -#ifdef __DECCXX -// HP C++'s iosfwd doesn't work. -#include <iostream> -#else #include <iosfwd> -#endif +#include <string> +#include <vector> #include <google/protobuf/message_lite.h> @@ -126,6 +120,8 @@ #include <google/protobuf/descriptor.h> +#define GOOGLE_PROTOBUF_HAS_ONEOF + namespace google { namespace protobuf { @@ -184,9 +180,10 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite { virtual void CopyFrom(const Message& from); // Merge the fields from the given message into this message. Singular - // fields will be overwritten, except for embedded messages which will - // be merged. Repeated fields will be concatenated. The given message - // must be of the same type as this message (i.e. the exact same class). + // fields will be overwritten, if specified in from, except for embedded + // messages which will be merged. Repeated fields will be concatenated. + // The given message must be of the same type as this message (i.e. the + // exact same class). virtual void MergeFrom(const Message& from); // Verifies that IsInitialized() returns true. GOOGLE_CHECK-fails otherwise, with @@ -388,6 +385,26 @@ class LIBPROTOBUF_EXPORT Reflection { virtual void ClearField(Message* message, const FieldDescriptor* field) const = 0; + // Check if the oneof is set. Returns ture if any field in oneof + // is set, false otherwise. + // TODO(jieluo) - make it pure virtual after updating all + // the subclasses. + virtual bool HasOneof(const Message& message, + const OneofDescriptor* oneof_descriptor) const { + return false; + } + + virtual void ClearOneof(Message* message, + const OneofDescriptor* oneof_descriptor) const {} + + // Returns the field descriptor if the oneof is set. NULL otherwise. + // TODO(jieluo) - make it pure virtual. + virtual const FieldDescriptor* GetOneofFieldDescriptor( + const Message& message, + const OneofDescriptor* oneof_descriptor) const { + return NULL; + } + // Removes the last element of a repeated field. // We don't provide a way to remove any element other than the last // because it invites inefficient use, such as O(n^2) filtering loops @@ -405,11 +422,17 @@ class LIBPROTOBUF_EXPORT Reflection { // Swap the complete contents of two messages. virtual void Swap(Message* message1, Message* message2) const = 0; + // Swap fields listed in fields vector of two messages. + virtual void SwapFields(Message* message1, + Message* message2, + const vector<const FieldDescriptor*>& fields) + const = 0; + // Swap two elements of a repeated field. virtual void SwapElements(Message* message, - const FieldDescriptor* field, - int index1, - int index2) const = 0; + const FieldDescriptor* field, + int index1, + int index2) const = 0; // List all fields of the message which are currently set. This includes // extensions. Singular fields will only be listed if HasField(field) would @@ -502,6 +525,13 @@ class LIBPROTOBUF_EXPORT Reflection { virtual Message* MutableMessage(Message* message, const FieldDescriptor* field, MessageFactory* factory = NULL) const = 0; + // Replaces the message specified by 'field' with the already-allocated object + // sub_message, passing ownership to the message. If the field contained a + // message, that message is deleted. If sub_message is NULL, the field is + // cleared. + virtual void SetAllocatedMessage(Message* message, + Message* sub_message, + const FieldDescriptor* field) const = 0; // Releases the message specified by 'field' and returns the pointer, // ReleaseMessage() will return the message the message object if it exists. // Otherwise, it may or may not return NULL. In any case, if the return value @@ -699,7 +729,7 @@ class LIBPROTOBUF_EXPORT MessageFactory { // Calling this method twice with the same Descriptor returns the same // object. The returned object remains property of the factory. Also, any // objects created by calling the prototype's New() method share some data - // with the prototype, so these must be destoyed before the MessageFactory + // with the prototype, so these must be destroyed before the MessageFactory // is destroyed. // // The given descriptor must outlive the returned message, and hence must @@ -757,7 +787,6 @@ const RepeatedField<TYPE>& Reflection::GetRepeatedField<TYPE>( \ const Message& message, const FieldDescriptor* field) const; \ \ template<> \ -LIBPROTOBUF_EXPORT \ RepeatedField<TYPE>* Reflection::MutableRepeatedField<TYPE>( \ Message* message, const FieldDescriptor* field) const; diff --git a/include/google/protobuf/message_lite.h b/include/google/protobuf/message_lite.h index 1ec3068..027cabf 100644 --- a/include/google/protobuf/message_lite.h +++ b/include/google/protobuf/message_lite.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -109,7 +109,8 @@ class LIBPROTOBUF_EXPORT MessageLite { // Parsing --------------------------------------------------------- // Methods for parsing in protocol buffer format. Most of these are - // just simple wrappers around MergeFromCodedStream(). + // just simple wrappers around MergeFromCodedStream(). Clear() will be called + // before merging the input. // Fill the message with a protocol buffer parsed from the given input // stream. Returns false on a read error or if the input is in the diff --git a/include/google/protobuf/reflection_ops.h b/include/google/protobuf/reflection_ops.h index 60165c2..4775911 100644 --- a/include/google/protobuf/reflection_ops.h +++ b/include/google/protobuf/reflection_ops.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/repeated_field.h b/include/google/protobuf/repeated_field.h index 570d4b7..5005183 100644 --- a/include/google/protobuf/repeated_field.h +++ b/include/google/protobuf/repeated_field.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -46,7 +46,11 @@ #ifndef GOOGLE_PROTOBUF_REPEATED_FIELD_H__ #define GOOGLE_PROTOBUF_REPEATED_FIELD_H__ +#ifdef _MSC_VER +// This is required for min/max on VS2013 only. #include <algorithm> +#endif + #include <string> #include <iterator> #include <google/protobuf/stubs/common.h> @@ -72,6 +76,22 @@ static const int kMinRepeatedFieldAllocationSize = 4; // A utility function for logging that doesn't need any template types. void LogIndexOutOfBounds(int index, int size); + +template <typename Iter> +inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) { + return std::distance(begin, end); +} + +template <typename Iter> +inline int CalculateReserve(Iter begin, Iter end, std::input_iterator_tag) { + return -1; +} + +template <typename Iter> +inline int CalculateReserve(Iter begin, Iter end) { + typedef typename std::iterator_traits<Iter>::iterator_category Category; + return CalculateReserve(begin, end, Category()); +} } // namespace internal @@ -90,6 +110,7 @@ class RepeatedField { RepeatedField& operator=(const RepeatedField& other); + bool empty() const; int size() const; const Element& Get(int index) const; @@ -121,6 +142,11 @@ class RepeatedField { Element* AddAlreadyReserved(); int Capacity() const; + // Like STL resize. Uses value to fill appended elements. + // Like Truncate() if new_size <= size(), otherwise this is + // O(new_size - size()). + void Resize(int new_size, const Element& value); + // Gets the underlying array. This pointer is possibly invalidated by // any add or remove operation. Element* mutable_data(); @@ -245,6 +271,7 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { template <typename TypeHandler> void Destroy(); + bool empty() const; int size() const; template <typename TypeHandler> @@ -309,8 +336,6 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { typename TypeHandler::Type* ReleaseCleared(); private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase); - static const int kInitialSize = 0; void** elements_; @@ -326,6 +351,8 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { static inline const typename TypeHandler::Type* cast(const void* element) { return reinterpret_cast<const typename TypeHandler::Type*>(element); } + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase); }; template <typename GenericType> @@ -383,7 +410,7 @@ class LIBPROTOBUF_EXPORT StringTypeHandlerBase { static void Clear(string* value) { value->clear(); } static void Merge(const string& from, string* to) { *to = from; } static const Type& default_instance() { - return ::google::protobuf::internal::kEmptyString; + return ::google::protobuf::internal::GetEmptyString(); } }; @@ -410,6 +437,7 @@ class RepeatedPtrField : public internal::RepeatedPtrFieldBase { RepeatedPtrField& operator=(const RepeatedPtrField& other); + bool empty() const; int size() const; const Element& Get(int index) const; @@ -568,8 +596,16 @@ inline RepeatedField<Element>::RepeatedField(Iter begin, const Iter& end) : elements_(NULL), current_size_(0), total_size_(kInitialSize) { - for (; begin != end; ++begin) { - Add(*begin); + int reserve = internal::CalculateReserve(begin, end); + if (reserve != -1) { + Reserve(reserve); + for (; begin != end; ++begin) { + AddAlreadyReserved(*begin); + } + } else { + for (; begin != end; ++begin) { + Add(*begin); + } } } @@ -587,6 +623,11 @@ RepeatedField<Element>::operator=(const RepeatedField& other) { } template <typename Element> +inline bool RepeatedField<Element>::empty() const { + return current_size_ == 0; +} + +template <typename Element> inline int RepeatedField<Element>::size() const { return current_size_; } @@ -608,20 +649,33 @@ inline Element* RepeatedField<Element>::AddAlreadyReserved() { return &elements_[current_size_++]; } +template<typename Element> +inline void RepeatedField<Element>::Resize(int new_size, const Element& value) { + GOOGLE_DCHECK_GE(new_size, 0); + if (new_size > size()) { + Reserve(new_size); + std::fill(&elements_[current_size_], &elements_[new_size], value); + } + current_size_ = new_size; +} + template <typename Element> inline const Element& RepeatedField<Element>::Get(int index) const { + GOOGLE_DCHECK_GE(index, 0); GOOGLE_DCHECK_LT(index, size()); return elements_[index]; } template <typename Element> inline Element* RepeatedField<Element>::Mutable(int index) { + GOOGLE_DCHECK_GE(index, 0); GOOGLE_DCHECK_LT(index, size()); return elements_ + index; } template <typename Element> inline void RepeatedField<Element>::Set(int index, const Element& value) { + GOOGLE_DCHECK_GE(index, 0); GOOGLE_DCHECK_LT(index, size()); elements_[index] = value; } @@ -672,6 +726,7 @@ inline void RepeatedField<Element>::Clear() { template <typename Element> inline void RepeatedField<Element>::MergeFrom(const RepeatedField& other) { + GOOGLE_CHECK_NE(&other, this); if (other.current_size_ != 0) { Reserve(current_size_ + other.current_size_); CopyArray(elements_ + current_size_, other.elements_, other.current_size_); @@ -681,6 +736,7 @@ inline void RepeatedField<Element>::MergeFrom(const RepeatedField& other) { template <typename Element> inline void RepeatedField<Element>::CopyFrom(const RepeatedField& other) { + if (&other == this) return; Clear(); MergeFrom(other); } @@ -714,7 +770,8 @@ void RepeatedField<Element>::Swap(RepeatedField* other) { template <typename Element> void RepeatedField<Element>::SwapElements(int index1, int index2) { - std::swap(elements_[index1], elements_[index2]); + using std::swap; // enable ADL with fallback + swap(elements_[index1], elements_[index2]); } template <typename Element> @@ -814,6 +871,10 @@ void RepeatedPtrFieldBase::Destroy() { delete [] elements_; } +inline bool RepeatedPtrFieldBase::empty() const { + return current_size_ == 0; +} + inline int RepeatedPtrFieldBase::size() const { return current_size_; } @@ -821,6 +882,7 @@ inline int RepeatedPtrFieldBase::size() const { template <typename TypeHandler> inline const typename TypeHandler::Type& RepeatedPtrFieldBase::Get(int index) const { + GOOGLE_DCHECK_GE(index, 0); GOOGLE_DCHECK_LT(index, size()); return *cast<TypeHandler>(elements_[index]); } @@ -829,6 +891,7 @@ RepeatedPtrFieldBase::Get(int index) const { template <typename TypeHandler> inline typename TypeHandler::Type* RepeatedPtrFieldBase::Mutable(int index) { + GOOGLE_DCHECK_GE(index, 0); GOOGLE_DCHECK_LT(index, size()); return cast<TypeHandler>(elements_[index]); } @@ -839,8 +902,8 @@ inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add() { return cast<TypeHandler>(elements_[current_size_++]); } if (allocated_size_ == total_size_) Reserve(total_size_ + 1); - ++allocated_size_; typename TypeHandler::Type* result = TypeHandler::New(); + ++allocated_size_; elements_[current_size_++] = result; return result; } @@ -861,6 +924,7 @@ void RepeatedPtrFieldBase::Clear() { template <typename TypeHandler> inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) { + GOOGLE_CHECK_NE(&other, this); Reserve(current_size_ + other.current_size_); for (int i = 0; i < other.current_size_; i++) { TypeHandler::Merge(other.template Get<TypeHandler>(i), Add<TypeHandler>()); @@ -869,6 +933,7 @@ inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) { template <typename TypeHandler> inline void RepeatedPtrFieldBase::CopyFrom(const RepeatedPtrFieldBase& other) { + if (&other == this) return; RepeatedPtrFieldBase::Clear<TypeHandler>(); RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other); } @@ -901,7 +966,8 @@ RepeatedPtrFieldBase::data() const { } inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { - std::swap(elements_[index1], elements_[index2]); + using std::swap; // enable ADL with fallback + swap(elements_[index1], elements_[index2]); } template <typename TypeHandler> @@ -1001,7 +1067,8 @@ inline RepeatedPtrField<Element>::RepeatedPtrField() {} template <typename Element> inline RepeatedPtrField<Element>::RepeatedPtrField( - const RepeatedPtrField& other) { + const RepeatedPtrField& other) + : RepeatedPtrFieldBase() { CopyFrom(other); } @@ -1009,6 +1076,10 @@ template <typename Element> template <typename Iter> inline RepeatedPtrField<Element>::RepeatedPtrField( Iter begin, const Iter& end) { + int reserve = internal::CalculateReserve(begin, end); + if (reserve != -1) { + Reserve(reserve); + } for (; begin != end; ++begin) { *Add() = *begin; } @@ -1028,6 +1099,11 @@ inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( } template <typename Element> +inline bool RepeatedPtrField<Element>::empty() const { + return RepeatedPtrFieldBase::empty(); +} + +template <typename Element> inline int RepeatedPtrField<Element>::size() const { return RepeatedPtrFieldBase::size(); } @@ -1182,6 +1258,10 @@ class RepeatedPtrIterator typedef std::iterator< std::random_access_iterator_tag, Element> superclass; + // Shadow the value_type in std::iterator<> because const_iterator::value_type + // needs to be T, not const T. + typedef typename remove_const<Element>::type value_type; + // Let the compiler know that these are type names, so we don't have to // write "typename" in front of them everywhere. typedef typename superclass::reference reference; @@ -1273,6 +1353,10 @@ class RepeatedPtrOverPtrsIterator typedef std::iterator< std::random_access_iterator_tag, Element*> superclass; + // Shadow the value_type in std::iterator<> because const_iterator::value_type + // needs to be T, not const T. + typedef typename remove_const<Element*>::type value_type; + // Let the compiler know that these are type names, so we don't have to // write "typename" in front of them everywhere. typedef typename superclass::reference reference; diff --git a/include/google/protobuf/service.h b/include/google/protobuf/service.h index a6a7d16..cc0b45d 100644 --- a/include/google/protobuf/service.h +++ b/include/google/protobuf/service.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops.h b/include/google/protobuf/stubs/atomicops.h index b8581fa..b1336e3 100644 --- a/include/google/protobuf/stubs/atomicops.h +++ b/include/google/protobuf/stubs/atomicops.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -66,9 +66,10 @@ typedef int32 Atomic32; #ifdef GOOGLE_PROTOBUF_ARCH_64_BIT // We need to be able to go between Atomic64 and AtomicWord implicitly. This // means Atomic64 and AtomicWord should be the same type on 64-bit. -#if defined(GOOGLE_PROTOBUF_OS_NACL) +#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) || defined(GOOGLE_PROTOBUF_ARCH_SPARC) // NaCl's intptr_t is not actually 64-bits on 64-bit! // http://code.google.com/p/nativeclient/issues/detail?id=1162 +// sparcv9's pointer type is 32bits typedef int64 Atomic64; #else typedef intptr_t Atomic64; @@ -120,6 +121,9 @@ Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value); +#if defined(__MINGW32__) && defined(MemoryBarrier) +#undef MemoryBarrier +#endif void MemoryBarrier(); void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); @@ -160,14 +164,21 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); #define GOOGLE_PROTOBUF_ATOMICOPS_ERROR \ #error "Atomic operations are not supported on your platform" +// ThreadSanitizer, http://clang.llvm.org/docs/ThreadSanitizer.html. +#if defined(THREAD_SANITIZER) +#include <google/protobuf/stubs/atomicops_internals_tsan.h> // MSVC. -#if defined(_MSC_VER) +#elif defined(_MSC_VER) #if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64) #include <google/protobuf/stubs/atomicops_internals_x86_msvc.h> #else GOOGLE_PROTOBUF_ATOMICOPS_ERROR #endif +// Solaris +#elif defined(GOOGLE_PROTOBUF_OS_SOLARIS) +#include <google/protobuf/stubs/atomicops_internals_solaris.h> + // Apple. #elif defined(GOOGLE_PROTOBUF_OS_APPLE) #include <google/protobuf/stubs/atomicops_internals_macosx.h> @@ -176,14 +187,24 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR #elif defined(__GNUC__) #if defined(GOOGLE_PROTOBUF_ARCH_IA32) || defined(GOOGLE_PROTOBUF_ARCH_X64) #include <google/protobuf/stubs/atomicops_internals_x86_gcc.h> -#elif defined(GOOGLE_PROTOBUF_ARCH_ARM) +#elif defined(GOOGLE_PROTOBUF_ARCH_ARM) && defined(__linux__) #include <google/protobuf/stubs/atomicops_internals_arm_gcc.h> +#elif defined(GOOGLE_PROTOBUF_ARCH_AARCH64) +#include <google/protobuf/stubs/atomicops_internals_arm64_gcc.h> #elif defined(GOOGLE_PROTOBUF_ARCH_ARM_QNX) #include <google/protobuf/stubs/atomicops_internals_arm_qnx.h> -#elif defined(GOOGLE_PROTOBUF_ARCH_MIPS) +#elif defined(GOOGLE_PROTOBUF_ARCH_MIPS) || defined(GOOGLE_PROTOBUF_ARCH_MIPS64) #include <google/protobuf/stubs/atomicops_internals_mips_gcc.h> -#elif defined(__pnacl__) +#elif defined(__native_client__) #include <google/protobuf/stubs/atomicops_internals_pnacl.h> +#elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) +#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h> +#elif defined(__clang__) +#if __has_extension(c_atomic) +#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h> +#else +GOOGLE_PROTOBUF_ATOMICOPS_ERROR +#endif #else GOOGLE_PROTOBUF_ATOMICOPS_ERROR #endif diff --git a/include/google/protobuf/stubs/atomicops_internals_arm64_gcc.h b/include/google/protobuf/stubs/atomicops_internals_arm64_gcc.h new file mode 100644 index 0000000..0a2d2b8 --- /dev/null +++ b/include/google/protobuf/stubs/atomicops_internals_arm64_gcc.h @@ -0,0 +1,325 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2012 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is an internal atomic implementation, use atomicops.h instead. + +#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM64_GCC_H_ +#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM64_GCC_H_ + +namespace google { +namespace protobuf { +namespace internal { + +inline void MemoryBarrier() { + __asm__ __volatile__ ("dmb ish" ::: "memory"); // NOLINT +} + +// NoBarrier versions of the operation include "memory" in the clobber list. +// This is not required for direct usage of the NoBarrier versions of the +// operations. However this is required for correctness when they are used as +// part of the Acquire or Release versions, to ensure that nothing from outside +// the call is reordered between the operation and the memory barrier. This does +// not change the code generated, so has no or minimal impact on the +// NoBarrier operations. + +inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + Atomic32 prev; + int32_t temp; + + __asm__ __volatile__ ( // NOLINT + "0: \n\t" + "ldxr %w[prev], %[ptr] \n\t" // Load the previous value. + "cmp %w[prev], %w[old_value] \n\t" + "bne 1f \n\t" + "stxr %w[temp], %w[new_value], %[ptr] \n\t" // Try to store the new value. + "cbnz %w[temp], 0b \n\t" // Retry if it did not work. + "1: \n\t" + : [prev]"=&r" (prev), + [temp]"=&r" (temp), + [ptr]"+Q" (*ptr) + : [old_value]"IJr" (old_value), + [new_value]"r" (new_value) + : "cc", "memory" + ); // NOLINT + + return prev; +} + +inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, + Atomic32 new_value) { + Atomic32 result; + int32_t temp; + + __asm__ __volatile__ ( // NOLINT + "0: \n\t" + "ldxr %w[result], %[ptr] \n\t" // Load the previous value. + "stxr %w[temp], %w[new_value], %[ptr] \n\t" // Try to store the new value. + "cbnz %w[temp], 0b \n\t" // Retry if it did not work. + : [result]"=&r" (result), + [temp]"=&r" (temp), + [ptr]"+Q" (*ptr) + : [new_value]"r" (new_value) + : "memory" + ); // NOLINT + + return result; +} + +inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + Atomic32 result; + int32_t temp; + + __asm__ __volatile__ ( // NOLINT + "0: \n\t" + "ldxr %w[result], %[ptr] \n\t" // Load the previous value. + "add %w[result], %w[result], %w[increment]\n\t" + "stxr %w[temp], %w[result], %[ptr] \n\t" // Try to store the result. + "cbnz %w[temp], 0b \n\t" // Retry on failure. + : [result]"=&r" (result), + [temp]"=&r" (temp), + [ptr]"+Q" (*ptr) + : [increment]"IJr" (increment) + : "memory" + ); // NOLINT + + return result; +} + +inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + MemoryBarrier(); + Atomic32 result = NoBarrier_AtomicIncrement(ptr, increment); + MemoryBarrier(); + + return result; +} + +inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + Atomic32 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + MemoryBarrier(); + + return prev; +} + +inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + MemoryBarrier(); + Atomic32 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + + return prev; +} + +inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { + *ptr = value; +} + +inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { + *ptr = value; + MemoryBarrier(); +} + +inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { + __asm__ __volatile__ ( // NOLINT + "stlr %w[value], %[ptr] \n\t" + : [ptr]"=Q" (*ptr) + : [value]"r" (value) + : "memory" + ); // NOLINT +} + +inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { + return *ptr; +} + +inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { + Atomic32 value; + + __asm__ __volatile__ ( // NOLINT + "ldar %w[value], %[ptr] \n\t" + : [value]"=r" (value) + : [ptr]"Q" (*ptr) + : "memory" + ); // NOLINT + + return value; +} + +inline Atomic32 Release_Load(volatile const Atomic32* ptr) { + MemoryBarrier(); + return *ptr; +} + +// 64-bit versions of the operations. +// See the 32-bit versions for comments. + +inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 prev; + int32_t temp; + + __asm__ __volatile__ ( // NOLINT + "0: \n\t" + "ldxr %[prev], %[ptr] \n\t" + "cmp %[prev], %[old_value] \n\t" + "bne 1f \n\t" + "stxr %w[temp], %[new_value], %[ptr] \n\t" + "cbnz %w[temp], 0b \n\t" + "1: \n\t" + : [prev]"=&r" (prev), + [temp]"=&r" (temp), + [ptr]"+Q" (*ptr) + : [old_value]"IJr" (old_value), + [new_value]"r" (new_value) + : "cc", "memory" + ); // NOLINT + + return prev; +} + +inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, + Atomic64 new_value) { + Atomic64 result; + int32_t temp; + + __asm__ __volatile__ ( // NOLINT + "0: \n\t" + "ldxr %[result], %[ptr] \n\t" + "stxr %w[temp], %[new_value], %[ptr] \n\t" + "cbnz %w[temp], 0b \n\t" + : [result]"=&r" (result), + [temp]"=&r" (temp), + [ptr]"+Q" (*ptr) + : [new_value]"r" (new_value) + : "memory" + ); // NOLINT + + return result; +} + +inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, + Atomic64 increment) { + Atomic64 result; + int32_t temp; + + __asm__ __volatile__ ( // NOLINT + "0: \n\t" + "ldxr %[result], %[ptr] \n\t" + "add %[result], %[result], %[increment] \n\t" + "stxr %w[temp], %[result], %[ptr] \n\t" + "cbnz %w[temp], 0b \n\t" + : [result]"=&r" (result), + [temp]"=&r" (temp), + [ptr]"+Q" (*ptr) + : [increment]"IJr" (increment) + : "memory" + ); // NOLINT + + return result; +} + +inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, + Atomic64 increment) { + MemoryBarrier(); + Atomic64 result = NoBarrier_AtomicIncrement(ptr, increment); + MemoryBarrier(); + + return result; +} + +inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + MemoryBarrier(); + + return prev; +} + +inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + MemoryBarrier(); + Atomic64 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + + return prev; +} + +inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { + *ptr = value; +} + +inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { + *ptr = value; + MemoryBarrier(); +} + +inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { + __asm__ __volatile__ ( // NOLINT + "stlr %x[value], %[ptr] \n\t" + : [ptr]"=Q" (*ptr) + : [value]"r" (value) + : "memory" + ); // NOLINT +} + +inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { + return *ptr; +} + +inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { + Atomic64 value; + + __asm__ __volatile__ ( // NOLINT + "ldar %x[value], %[ptr] \n\t" + : [value]"=r" (value) + : [ptr]"Q" (*ptr) + : "memory" + ); // NOLINT + + return value; +} + +inline Atomic64 Release_Load(volatile const Atomic64* ptr) { + MemoryBarrier(); + return *ptr; +} + +} // namespace internal +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ARM64_GCC_H_ diff --git a/include/google/protobuf/stubs/atomicops_internals_arm_gcc.h b/include/google/protobuf/stubs/atomicops_internals_arm_gcc.h index 1f4dedc..90e727b 100644 --- a/include/google/protobuf/stubs/atomicops_internals_arm_gcc.h +++ b/include/google/protobuf/stubs/atomicops_internals_arm_gcc.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops_internals_arm_qnx.h b/include/google/protobuf/stubs/atomicops_internals_arm_qnx.h index f050769..17dfaa5 100644 --- a/include/google/protobuf/stubs/atomicops_internals_arm_qnx.h +++ b/include/google/protobuf/stubs/atomicops_internals_arm_qnx.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops_internals_atomicword_compat.h b/include/google/protobuf/stubs/atomicops_internals_atomicword_compat.h index e9d8679..eb198ff 100644 --- a/include/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +++ b/include/google/protobuf/stubs/atomicops_internals_atomicword_compat.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/include/google/protobuf/stubs/atomicops_internals_generic_gcc.h new file mode 100644 index 0000000..dd7abf6 --- /dev/null +++ b/include/google/protobuf/stubs/atomicops_internals_generic_gcc.h @@ -0,0 +1,137 @@ +// Copyright 2013 Red Hat Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Red Hat Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is an internal atomic implementation, use atomicops.h instead. + +#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_ +#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_ + +namespace google { +namespace protobuf { +namespace internal { + +inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + __atomic_compare_exchange_n(ptr, &old_value, new_value, true, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); + return old_value; +} + +inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, + Atomic32 new_value) { + return __atomic_exchange_n(ptr, new_value, __ATOMIC_RELAXED); +} + +inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + return __atomic_add_fetch(ptr, increment, __ATOMIC_RELAXED); +} + +inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + return __atomic_add_fetch(ptr, increment, __ATOMIC_SEQ_CST); +} + +inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + __atomic_compare_exchange(ptr, &old_value, &new_value, true, + __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); + return old_value; +} + +inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + __atomic_compare_exchange_n(ptr, &old_value, new_value, true, + __ATOMIC_RELEASE, __ATOMIC_ACQUIRE); + return old_value; +} + +inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { + __atomic_store_n(ptr, value, __ATOMIC_RELAXED); +} + +inline void MemoryBarrier() { + __sync_synchronize(); +} + +inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { + __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST); +} + +inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { + __atomic_store_n(ptr, value, __ATOMIC_RELEASE); +} + +inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { + return __atomic_load_n(ptr, __ATOMIC_RELAXED); +} + +inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { + return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); +} + +inline Atomic32 Release_Load(volatile const Atomic32* ptr) { + return __atomic_load_n(ptr, __ATOMIC_SEQ_CST); +} + +#ifdef __LP64__ + +inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { + __atomic_store_n(ptr, value, __ATOMIC_RELEASE); +} + +inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { + return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); +} + +inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + __atomic_compare_exchange_n(ptr, &old_value, new_value, true, + __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); + return old_value; +} + +inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + __atomic_compare_exchange_n(ptr, &old_value, new_value, true, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); + return old_value; +} + +#endif // defined(__LP64__) + +} // namespace internal +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_ diff --git a/include/google/protobuf/stubs/atomicops_internals_macosx.h b/include/google/protobuf/stubs/atomicops_internals_macosx.h index f9b7581..7963324 100644 --- a/include/google/protobuf/stubs/atomicops_internals_macosx.h +++ b/include/google/protobuf/stubs/atomicops_internals_macosx.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops_internals_mips_gcc.h b/include/google/protobuf/stubs/atomicops_internals_mips_gcc.h index dc46851..e3cd14c 100644 --- a/include/google/protobuf/stubs/atomicops_internals_mips_gcc.h +++ b/include/google/protobuf/stubs/atomicops_internals_mips_gcc.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -78,7 +78,7 @@ inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, __asm__ __volatile__(".set push\n" ".set noreorder\n" "1:\n" - "ll %1, %2\n" // old = *ptr + "ll %1, %4\n" // old = *ptr "move %0, %3\n" // temp = new_value "sc %0, %2\n" // *ptr = temp (with atomic check) "beqz %0, 1b\n" // start again on atomic error @@ -100,7 +100,7 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, __asm__ __volatile__(".set push\n" ".set noreorder\n" "1:\n" - "ll %0, %2\n" // temp = *ptr + "ll %0, %4\n" // temp = *ptr "addu %1, %0, %3\n" // temp2 = temp + increment "sc %1, %2\n" // *ptr = temp2 (with atomic check) "beqz %1, 1b\n" // start again on atomic error @@ -178,6 +178,132 @@ inline Atomic32 Release_Load(volatile const Atomic32* ptr) { return *ptr; } +#if defined(__LP64__) +// 64-bit versions of the atomic ops. + +inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 prev, tmp; + __asm__ __volatile__(".set push\n" + ".set noreorder\n" + "1:\n" + "lld %0, %5\n" // prev = *ptr + "bne %0, %3, 2f\n" // if (prev != old_value) goto 2 + "move %2, %4\n" // tmp = new_value + "scd %2, %1\n" // *ptr = tmp (with atomic check) + "beqz %2, 1b\n" // start again on atomic error + "nop\n" // delay slot nop + "2:\n" + ".set pop\n" + : "=&r" (prev), "=m" (*ptr), "=&r" (tmp) + : "Ir" (old_value), "r" (new_value), "m" (*ptr) + : "memory"); + return prev; +} + +// Atomically store new_value into *ptr, returning the previous value held in +// *ptr. This routine implies no memory barriers. +inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, + Atomic64 new_value) { + Atomic64 temp, old; + __asm__ __volatile__(".set push\n" + ".set noreorder\n" + "1:\n" + "lld %1, %4\n" // old = *ptr + "move %0, %3\n" // temp = new_value + "scd %0, %2\n" // *ptr = temp (with atomic check) + "beqz %0, 1b\n" // start again on atomic error + "nop\n" // delay slot nop + ".set pop\n" + : "=&r" (temp), "=&r" (old), "=m" (*ptr) + : "r" (new_value), "m" (*ptr) + : "memory"); + + return old; +} + +// Atomically increment *ptr by "increment". Returns the new value of +// *ptr with the increment applied. This routine implies no memory barriers. +inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, + Atomic64 increment) { + Atomic64 temp, temp2; + + __asm__ __volatile__(".set push\n" + ".set noreorder\n" + "1:\n" + "lld %0, %4\n" // temp = *ptr + "daddu %1, %0, %3\n" // temp2 = temp + increment + "scd %1, %2\n" // *ptr = temp2 (with atomic check) + "beqz %1, 1b\n" // start again on atomic error + "daddu %1, %0, %3\n" // temp2 = temp + increment + ".set pop\n" + : "=&r" (temp), "=&r" (temp2), "=m" (*ptr) + : "Ir" (increment), "m" (*ptr) + : "memory"); + // temp2 now holds the final value. + return temp2; +} + +inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, + Atomic64 increment) { + MemoryBarrier(); + Atomic64 res = NoBarrier_AtomicIncrement(ptr, increment); + MemoryBarrier(); + return res; +} + +// "Acquire" operations +// ensure that no later memory access can be reordered ahead of the operation. +// "Release" operations ensure that no previous memory access can be reordered +// after the operation. "Barrier" operations have both "Acquire" and "Release" +// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory +// access. +inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + MemoryBarrier(); + return res; +} + +inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + MemoryBarrier(); + return NoBarrier_CompareAndSwap(ptr, old_value, new_value); +} + +inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { + *ptr = value; +} + +inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { + *ptr = value; + MemoryBarrier(); +} + +inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { + MemoryBarrier(); + *ptr = value; +} + +inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { + return *ptr; +} + +inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { + Atomic64 value = *ptr; + MemoryBarrier(); + return value; +} + +inline Atomic64 Release_Load(volatile const Atomic64* ptr) { + MemoryBarrier(); + return *ptr; +} +#endif + } // namespace internal } // namespace protobuf } // namespace google diff --git a/include/google/protobuf/stubs/atomicops_internals_pnacl.h b/include/google/protobuf/stubs/atomicops_internals_pnacl.h index 04a91a8..b10ac02 100644 --- a/include/google/protobuf/stubs/atomicops_internals_pnacl.h +++ b/include/google/protobuf/stubs/atomicops_internals_pnacl.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops_internals_tsan.h b/include/google/protobuf/stubs/atomicops_internals_tsan.h new file mode 100644 index 0000000..0c90354 --- /dev/null +++ b/include/google/protobuf/stubs/atomicops_internals_tsan.h @@ -0,0 +1,219 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2013 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is an internal atomic implementation for compiler-based +// ThreadSanitizer (http://clang.llvm.org/docs/ThreadSanitizer.html). +// Use atomicops.h instead. + +#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_TSAN_H_ +#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_TSAN_H_ + +#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") + +#include <sanitizer/tsan_interface_atomic.h> + +namespace google { +namespace protobuf { +namespace internal { + +inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr, + Atomic32 old_value, + Atomic32 new_value) { + Atomic32 cmp = old_value; + __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value, + __tsan_memory_order_relaxed, __tsan_memory_order_relaxed); + return cmp; +} + +inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32 *ptr, + Atomic32 new_value) { + return __tsan_atomic32_exchange(ptr, new_value, + __tsan_memory_order_relaxed); +} + +inline Atomic32 Acquire_AtomicExchange(volatile Atomic32 *ptr, + Atomic32 new_value) { + return __tsan_atomic32_exchange(ptr, new_value, + __tsan_memory_order_acquire); +} + +inline Atomic32 Release_AtomicExchange(volatile Atomic32 *ptr, + Atomic32 new_value) { + return __tsan_atomic32_exchange(ptr, new_value, + __tsan_memory_order_release); +} + +inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, + Atomic32 increment) { + return increment + __tsan_atomic32_fetch_add(ptr, increment, + __tsan_memory_order_relaxed); +} + +inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32 *ptr, + Atomic32 increment) { + return increment + __tsan_atomic32_fetch_add(ptr, increment, + __tsan_memory_order_acq_rel); +} + +inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr, + Atomic32 old_value, + Atomic32 new_value) { + Atomic32 cmp = old_value; + __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value, + __tsan_memory_order_acquire, __tsan_memory_order_acquire); + return cmp; +} + +inline Atomic32 Release_CompareAndSwap(volatile Atomic32 *ptr, + Atomic32 old_value, + Atomic32 new_value) { + Atomic32 cmp = old_value; + __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value, + __tsan_memory_order_release, __tsan_memory_order_relaxed); + return cmp; +} + +inline void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value) { + __tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed); +} + +inline void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value) { + __tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed); + __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); +} + +inline void Release_Store(volatile Atomic32 *ptr, Atomic32 value) { + __tsan_atomic32_store(ptr, value, __tsan_memory_order_release); +} + +inline Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr) { + return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed); +} + +inline Atomic32 Acquire_Load(volatile const Atomic32 *ptr) { + return __tsan_atomic32_load(ptr, __tsan_memory_order_acquire); +} + +inline Atomic32 Release_Load(volatile const Atomic32 *ptr) { + __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); + return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed); +} + +inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64 *ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 cmp = old_value; + __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value, + __tsan_memory_order_relaxed, __tsan_memory_order_relaxed); + return cmp; +} + +inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64 *ptr, + Atomic64 new_value) { + return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_relaxed); +} + +inline Atomic64 Acquire_AtomicExchange(volatile Atomic64 *ptr, + Atomic64 new_value) { + return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_acquire); +} + +inline Atomic64 Release_AtomicExchange(volatile Atomic64 *ptr, + Atomic64 new_value) { + return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_release); +} + +inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64 *ptr, + Atomic64 increment) { + return increment + __tsan_atomic64_fetch_add(ptr, increment, + __tsan_memory_order_relaxed); +} + +inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64 *ptr, + Atomic64 increment) { + return increment + __tsan_atomic64_fetch_add(ptr, increment, + __tsan_memory_order_acq_rel); +} + +inline void NoBarrier_Store(volatile Atomic64 *ptr, Atomic64 value) { + __tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed); +} + +inline void Acquire_Store(volatile Atomic64 *ptr, Atomic64 value) { + __tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed); + __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); +} + +inline void Release_Store(volatile Atomic64 *ptr, Atomic64 value) { + __tsan_atomic64_store(ptr, value, __tsan_memory_order_release); +} + +inline Atomic64 NoBarrier_Load(volatile const Atomic64 *ptr) { + return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed); +} + +inline Atomic64 Acquire_Load(volatile const Atomic64 *ptr) { + return __tsan_atomic64_load(ptr, __tsan_memory_order_acquire); +} + +inline Atomic64 Release_Load(volatile const Atomic64 *ptr) { + __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); + return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed); +} + +inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64 *ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 cmp = old_value; + __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value, + __tsan_memory_order_acquire, __tsan_memory_order_acquire); + return cmp; +} + +inline Atomic64 Release_CompareAndSwap(volatile Atomic64 *ptr, + Atomic64 old_value, + Atomic64 new_value) { + Atomic64 cmp = old_value; + __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value, + __tsan_memory_order_release, __tsan_memory_order_relaxed); + return cmp; +} + +inline void MemoryBarrier() { + __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); +} + +} // namespace internal +} // namespace protobuf +} // namespace google + +#undef ATOMICOPS_COMPILER_BARRIER + +#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_TSAN_H_ diff --git a/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h b/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h index 5324dfb..edccc59 100644 --- a/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h +++ b/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/atomicops_internals_x86_msvc.h b/include/google/protobuf/stubs/atomicops_internals_x86_msvc.h index 6f9869d..e53a641 100644 --- a/include/google/protobuf/stubs/atomicops_internals_x86_msvc.h +++ b/include/google/protobuf/stubs/atomicops_internals_x86_msvc.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/google/protobuf/stubs/common.h b/include/google/protobuf/stubs/common.h index f287ddf..f096fa9 100644 --- a/include/google/protobuf/stubs/common.h +++ b/include/google/protobuf/stubs/common.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -113,24 +113,24 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 2005000 +#define GOOGLE_PROTOBUF_VERSION 2006001 // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 2005000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 2006000 // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code // generator. -static const int kMinHeaderVersionForLibrary = 2005000; +static const int kMinHeaderVersionForLibrary = 2006000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 2005000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 2006000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 2005000; +static const int kMinHeaderVersionForProtoc = 2006000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. @@ -685,6 +685,7 @@ class LIBPROTOBUF_EXPORT LogFinisher { #undef GOOGLE_LOG_IF #undef GOOGLE_CHECK +#undef GOOGLE_CHECK_OK #undef GOOGLE_CHECK_EQ #undef GOOGLE_CHECK_NE #undef GOOGLE_CHECK_LT @@ -711,6 +712,7 @@ class LIBPROTOBUF_EXPORT LogFinisher { #define GOOGLE_CHECK(EXPRESSION) \ GOOGLE_LOG_IF(FATAL, !(EXPRESSION)) << "CHECK failed: " #EXPRESSION ": " +#define GOOGLE_CHECK_OK(A) GOOGLE_CHECK(A) #define GOOGLE_CHECK_EQ(A, B) GOOGLE_CHECK((A) == (B)) #define GOOGLE_CHECK_NE(A, B) GOOGLE_CHECK((A) != (B)) #define GOOGLE_CHECK_LT(A, B) GOOGLE_CHECK((A) < (B)) @@ -720,7 +722,8 @@ class LIBPROTOBUF_EXPORT LogFinisher { namespace internal { template<typename T> -T* CheckNotNull(const char *file, int line, const char *name, T* val) { +T* CheckNotNull(const char* /* file */, int /* line */, + const char* name, T* val) { if (val == NULL) { GOOGLE_LOG(FATAL) << name; } diff --git a/include/google/protobuf/stubs/once.h b/include/google/protobuf/stubs/once.h index 7fbc117..cc62bba 100644 --- a/include/google/protobuf/stubs/once.h +++ b/include/google/protobuf/stubs/once.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -139,6 +139,24 @@ inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)(Arg*), #endif // GOOGLE_PROTOBUF_NO_THREAD_SAFETY +class GoogleOnceDynamic { + public: + GoogleOnceDynamic() : state_(GOOGLE_PROTOBUF_ONCE_INIT) { } + + // If this->Init() has not been called before by any thread, + // execute (*func_with_arg)(arg) then return. + // Otherwise, wait until that prior invocation has finished + // executing its function, then return. + template<typename T> + void Init(void (*func_with_arg)(T*), T* arg) { + GoogleOnceInit<T>(&this->state_, + func_with_arg, + arg); + } + private: + ProtobufOnceType state_; +}; + #define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \ ::google::protobuf::ProtobufOnceType NAME = GOOGLE_PROTOBUF_ONCE_INIT diff --git a/include/google/protobuf/stubs/platform_macros.h b/include/google/protobuf/stubs/platform_macros.h index b1df60e..7956d07 100644 --- a/include/google/protobuf/stubs/platform_macros.h +++ b/include/google/protobuf/stubs/platform_macros.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2012 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,6 +33,9 @@ #include <google/protobuf/stubs/common.h> +#define GOOGLE_PROTOBUF_PLATFORM_ERROR \ +#error "Host platform was not detected as supported by protobuf" + // Processor architecture detection. For more info on what's defined, see: // http://msdn.microsoft.com/en-us/library/b0084kay.aspx // http://www.agner.org/optimize/calling_conventions.pdf @@ -49,22 +52,52 @@ #elif defined(__ARMEL__) #define GOOGLE_PROTOBUF_ARCH_ARM 1 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 +#elif defined(__aarch64__) +#define GOOGLE_PROTOBUF_ARCH_AARCH64 1 +#define GOOGLE_PROTOBUF_ARCH_64_BIT 1 #elif defined(__MIPSEL__) +#if defined(__LP64__) +#define GOOGLE_PROTOBUF_ARCH_MIPS64 1 +#define GOOGLE_PROTOBUF_ARCH_64_BIT 1 +#else #define GOOGLE_PROTOBUF_ARCH_MIPS 1 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 +#endif #elif defined(__pnacl__) #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 -#elif defined(__ppc__) -#define GOOGLE_PROTOBUF_ARCH_PPC 1 +#elif defined(sparc) +#define GOOGLE_PROTOBUF_ARCH_SPARC 1 +#ifdef SOLARIS_64BIT_ENABLED +#define GOOGLE_PROTOBUF_ARCH_64_BIT 1 +#else #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 +#endif +#elif defined(__GNUC__) +# if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) +// We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h +# elif defined(__clang__) +# if !__has_extension(c_atomic) +GOOGLE_PROTOBUF_PLATFORM_ERROR +# endif +// We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h +# endif +# if __LP64__ +# define GOOGLE_PROTOBUF_ARCH_64_BIT 1 +# else +# define GOOGLE_PROTOBUF_ARCH_32_BIT 1 +# endif #else -#error Host architecture was not detected as supported by protobuf +GOOGLE_PROTOBUF_PLATFORM_ERROR #endif #if defined(__APPLE__) #define GOOGLE_PROTOBUF_OS_APPLE #elif defined(__native_client__) #define GOOGLE_PROTOBUF_OS_NACL +#elif defined(sun) +#define GOOGLE_PROTOBUF_OS_SOLARIS #endif +#undef GOOGLE_PROTOBUF_PLATFORM_ERROR + #endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ diff --git a/include/google/protobuf/stubs/stl_util.h b/include/google/protobuf/stubs/stl_util.h new file mode 100644 index 0000000..9e4c82a --- /dev/null +++ b/include/google/protobuf/stubs/stl_util.h @@ -0,0 +1,121 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// from google3/util/gtl/stl_util.h + +#ifndef GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__ +#define GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__ + +#include <google/protobuf/stubs/common.h> + +namespace google { +namespace protobuf { + +// STLDeleteContainerPointers() +// For a range within a container of pointers, calls delete +// (non-array version) on these pointers. +// NOTE: for these three functions, we could just implement a DeleteObject +// functor and then call for_each() on the range and functor, but this +// requires us to pull in all of algorithm.h, which seems expensive. +// For hash_[multi]set, it is important that this deletes behind the iterator +// because the hash_set may call the hash function on the iterator when it is +// advanced, which could result in the hash function trying to deference a +// stale pointer. +template <class ForwardIterator> +void STLDeleteContainerPointers(ForwardIterator begin, + ForwardIterator end) { + while (begin != end) { + ForwardIterator temp = begin; + ++begin; + delete *temp; + } +} + +// Inside Google, this function implements a horrible, disgusting hack in which +// we reach into the string's private implementation and resize it without +// initializing the new bytes. In some cases doing this can significantly +// improve performance. However, since it's totally non-portable it has no +// place in open source code. Feel free to fill this function in with your +// own disgusting hack if you want the perf boost. +inline void STLStringResizeUninitialized(string* s, size_t new_size) { + s->resize(new_size); +} + +// Return a mutable char* pointing to a string's internal buffer, +// which may not be null-terminated. Writing through this pointer will +// modify the string. +// +// string_as_array(&str)[i] is valid for 0 <= i < str.size() until the +// next call to a string method that invalidates iterators. +// +// As of 2006-04, there is no standard-blessed way of getting a +// mutable reference to a string's internal buffer. However, issue 530 +// (http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#530) +// proposes this as the method. According to Matt Austern, this should +// already work on all current implementations. +inline char* string_as_array(string* str) { + // DO NOT USE const_cast<char*>(str->data())! See the unittest for why. + return str->empty() ? NULL : &*str->begin(); +} + +// STLDeleteElements() deletes all the elements in an STL container and clears +// the container. This function is suitable for use with a vector, set, +// hash_set, or any other STL container which defines sensible begin(), end(), +// and clear() methods. +// +// If container is NULL, this function is a no-op. +// +// As an alternative to calling STLDeleteElements() directly, consider +// ElementDeleter (defined below), which ensures that your container's elements +// are deleted when the ElementDeleter goes out of scope. +template <class T> +void STLDeleteElements(T *container) { + if (!container) return; + STLDeleteContainerPointers(container->begin(), container->end()); + container->clear(); +} + +// Given an STL container consisting of (key, value) pairs, STLDeleteValues +// deletes all the "value" components and clears the container. Does nothing +// in the case it's given a NULL pointer. + +template <class T> +void STLDeleteValues(T *v) { + if (!v) return; + for (typename T::iterator i = v->begin(); i != v->end(); ++i) { + delete i->second; + } + v->clear(); +} + +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__ diff --git a/include/google/protobuf/text_format.h b/include/google/protobuf/text_format.h index 01f3ffb..2954941 100644 --- a/include/google/protobuf/text_format.h +++ b/include/google/protobuf/text_format.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -39,11 +39,13 @@ #define GOOGLE_PROTOBUF_TEXT_FORMAT_H__ #include <map> +#include <memory> #include <string> #include <vector> + #include <google/protobuf/stubs/common.h> -#include <google/protobuf/message.h> #include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> namespace google { namespace protobuf { @@ -85,6 +87,41 @@ class LIBPROTOBUF_EXPORT TextFormat { int index, string* output); + // The default printer that converts scalar values from fields into + // their string representation. + // You can derive from this FieldValuePrinter if you want to have + // fields to be printed in a different way and register it at the + // Printer. + class LIBPROTOBUF_EXPORT FieldValuePrinter { + public: + FieldValuePrinter(); + virtual ~FieldValuePrinter(); + virtual string PrintBool(bool val) const; + virtual string PrintInt32(int32 val) const; + virtual string PrintUInt32(uint32 val) const; + virtual string PrintInt64(int64 val) const; + virtual string PrintUInt64(uint64 val) const; + virtual string PrintFloat(float val) const; + virtual string PrintDouble(double val) const; + virtual string PrintString(const string& val) const; + virtual string PrintBytes(const string& val) const; + virtual string PrintEnum(int32 val, const string& name) const; + virtual string PrintFieldName(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field) const; + virtual string PrintMessageStart(const Message& message, + int field_index, + int field_count, + bool single_line_mode) const; + virtual string PrintMessageEnd(const Message& message, + int field_index, + int field_count, + bool single_line_mode) const; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldValuePrinter); + }; + // Class for those users which require more fine-grained control over how // a protobuffer message is printed out. class LIBPROTOBUF_EXPORT Printer { @@ -120,6 +157,15 @@ class LIBPROTOBUF_EXPORT TextFormat { single_line_mode_ = single_line_mode; } + bool IsInSingleLineMode() { + return single_line_mode_; + } + + // If use_field_number is true, uses field number instead of field name. + void SetUseFieldNumber(bool use_field_number) { + use_field_number_ = use_field_number; + } + // Set true to print repeated primitives in a format like: // field_name: [1, 2, 3, 4] // instead of printing each value on its own line. Short format applies @@ -132,11 +178,41 @@ class LIBPROTOBUF_EXPORT TextFormat { // Set true to output UTF-8 instead of ASCII. The only difference // is that bytes >= 0x80 in string fields will not be escaped, // because they are assumed to be part of UTF-8 multi-byte - // sequences. - void SetUseUtf8StringEscaping(bool as_utf8) { - utf8_string_escaping_ = as_utf8; + // sequences. This will change the default FieldValuePrinter. + void SetUseUtf8StringEscaping(bool as_utf8); + + // Set the default FieldValuePrinter that is used for all fields that + // don't have a field-specific printer registered. + // Takes ownership of the printer. + void SetDefaultFieldValuePrinter(const FieldValuePrinter* printer); + + // Sets whether we want to hide unknown fields or not. + // Usually unknown fields are printed in a generic way that includes the + // tag number of the field instead of field name. However, sometimes it + // is useful to be able to print the message without unknown fields (e.g. + // for the python protobuf version to maintain consistency between its pure + // python and c++ implementations). + void SetHideUnknownFields(bool hide) { + hide_unknown_fields_ = hide; } + // If print_message_fields_in_index_order is true, print fields of a proto + // message using the order defined in source code instead of the field + // number. By default, use the field number order. + void SetPrintMessageFieldsInIndexOrder( + bool print_message_fields_in_index_order) { + print_message_fields_in_index_order_ = + print_message_fields_in_index_order; + } + + // Register a custom field-specific FieldValuePrinter for fields + // with a particular FieldDescriptor. + // Returns "true" if the registration succeeded, or "false", if there is + // already a printer for that FieldDescriptor. + // Takes ownership of the printer on successful registration. + bool RegisterFieldValuePrinter(const FieldDescriptor* field, + const FieldValuePrinter* printer); + private: // Forward declaration of an internal class used to print the text // output to the OutputStream (see text_format.cc for implementation). @@ -184,9 +260,18 @@ class LIBPROTOBUF_EXPORT TextFormat { bool single_line_mode_; + bool use_field_number_; + bool use_short_repeated_primitives_; - bool utf8_string_escaping_; + bool hide_unknown_fields_; + + bool print_message_fields_in_index_order_; + + scoped_ptr<const FieldValuePrinter> default_field_value_printer_; + typedef map<const FieldDescriptor*, + const FieldValuePrinter*> CustomPrinterMap; + CustomPrinterMap custom_printers_; }; // Parses a text-format protocol message from the given input stream to @@ -314,12 +399,24 @@ class LIBPROTOBUF_EXPORT TextFormat { allow_partial_ = allow; } + // Allow field names to be matched case-insensitively. + // This is not advisable if there are fields that only differ in case, or + // if you want to enforce writing in the canonical form. + // This is 'false' by default. + void AllowCaseInsensitiveField(bool allow) { + allow_case_insensitive_field_ = allow; + } + // Like TextFormat::ParseFieldValueFromString bool ParseFieldValueFromString(const string& input, const FieldDescriptor* field, Message* output); + void AllowFieldNumber(bool allow) { + allow_field_number_ = allow; + } + private: // Forward declaration of an internal class used to parse text // representations (see text_format.cc for implementation). @@ -335,9 +432,15 @@ class LIBPROTOBUF_EXPORT TextFormat { Finder* finder_; ParseInfoTree* parse_info_tree_; bool allow_partial_; + bool allow_case_insensitive_field_; bool allow_unknown_field_; + bool allow_unknown_enum_; + bool allow_field_number_; + bool allow_relaxed_whitespace_; + bool allow_singular_overwrites_; }; + private: // Hack: ParseInfoTree declares TextFormat as a friend which should extend // the friendship to TextFormat::Parser::ParserImpl, but unfortunately some @@ -358,6 +461,7 @@ inline void TextFormat::RecordLocation(ParseInfoTree* info_tree, info_tree->RecordLocation(field, location); } + inline TextFormat::ParseInfoTree* TextFormat::CreateNested( ParseInfoTree* info_tree, const FieldDescriptor* field) { return info_tree->CreateNested(field); diff --git a/include/google/protobuf/unknown_field_set.h b/include/google/protobuf/unknown_field_set.h index 825bba8..ba202eb 100644 --- a/include/google/protobuf/unknown_field_set.h +++ b/include/google/protobuf/unknown_field_set.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -42,7 +42,6 @@ #include <string> #include <vector> #include <google/protobuf/stubs/common.h> -// TODO(jasonh): some people seem to rely on protobufs to include this for them! namespace google { namespace protobuf { @@ -53,7 +52,7 @@ namespace protobuf { } namespace internal { class WireFormat; // wire_format.h - class UnknownFieldSetFieldSkipperUsingCord; + class MessageSetFieldSkipperUsingCord; // extension_set_heavy.cc } @@ -139,7 +138,7 @@ class LIBPROTOBUF_EXPORT UnknownFieldSet { bool ParseFromZeroCopyStream(io::ZeroCopyInputStream* input); bool ParseFromArray(const void* data, int size); inline bool ParseFromString(const string& data) { - return ParseFromArray(data.data(), data.size()); + return ParseFromArray(data.data(), static_cast<int>(data.size())); } private: @@ -202,9 +201,12 @@ class LIBPROTOBUF_EXPORT UnknownField { // Make a deep copy of any pointers in this UnknownField. void DeepCopy(); + // Set the wire type of this UnknownField. Should only be used when this + // UnknownField is being created. + inline void SetType(Type type); - unsigned int number_ : 29; - unsigned int type_ : 3; + uint32 number_; + uint32 type_; union { uint64 varint_; uint32 fixed32_; @@ -234,7 +236,7 @@ inline void UnknownFieldSet::Swap(UnknownFieldSet* x) { } inline int UnknownFieldSet::field_count() const { - return (fields_ == NULL) ? 0 : fields_->size(); + return (fields_ == NULL) ? 0 : static_cast<int>(fields_->size()); } inline const UnknownField& UnknownFieldSet::field(int index) const { return (*fields_)[index]; @@ -254,57 +256,62 @@ inline UnknownField::Type UnknownField::type() const { return static_cast<Type>(type_); } -inline uint64 UnknownField::varint () const { - assert(type_ == TYPE_VARINT); +inline uint64 UnknownField::varint() const { + assert(type() == TYPE_VARINT); return varint_; } inline uint32 UnknownField::fixed32() const { - assert(type_ == TYPE_FIXED32); + assert(type() == TYPE_FIXED32); return fixed32_; } inline uint64 UnknownField::fixed64() const { - assert(type_ == TYPE_FIXED64); + assert(type() == TYPE_FIXED64); return fixed64_; } inline const string& UnknownField::length_delimited() const { - assert(type_ == TYPE_LENGTH_DELIMITED); + assert(type() == TYPE_LENGTH_DELIMITED); return *length_delimited_.string_value_; } inline const UnknownFieldSet& UnknownField::group() const { - assert(type_ == TYPE_GROUP); + assert(type() == TYPE_GROUP); return *group_; } inline void UnknownField::set_varint(uint64 value) { - assert(type_ == TYPE_VARINT); + assert(type() == TYPE_VARINT); varint_ = value; } inline void UnknownField::set_fixed32(uint32 value) { - assert(type_ == TYPE_FIXED32); + assert(type() == TYPE_FIXED32); fixed32_ = value; } inline void UnknownField::set_fixed64(uint64 value) { - assert(type_ == TYPE_FIXED64); + assert(type() == TYPE_FIXED64); fixed64_ = value; } inline void UnknownField::set_length_delimited(const string& value) { - assert(type_ == TYPE_LENGTH_DELIMITED); + assert(type() == TYPE_LENGTH_DELIMITED); length_delimited_.string_value_->assign(value); } inline string* UnknownField::mutable_length_delimited() { - assert(type_ == TYPE_LENGTH_DELIMITED); + assert(type() == TYPE_LENGTH_DELIMITED); return length_delimited_.string_value_; } inline UnknownFieldSet* UnknownField::mutable_group() { - assert(type_ == TYPE_GROUP); + assert(type() == TYPE_GROUP); return group_; } inline int UnknownField::GetLengthDelimitedSize() const { - GOOGLE_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type_); - return length_delimited_.string_value_->size(); + GOOGLE_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type()); + return static_cast<int>(length_delimited_.string_value_->size()); } +inline void UnknownField::SetType(Type type) { + type_ = type; +} + + } // namespace protobuf } // namespace google diff --git a/include/google/protobuf/wire_format.h b/include/google/protobuf/wire_format.h index 6cc9002..9f26eb2 100644 --- a/include/google/protobuf/wire_format.h +++ b/include/google/protobuf/wire_format.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -79,7 +79,7 @@ class LIBPROTOBUF_EXPORT WireFormat { static inline WireFormatLite::WireType WireTypeForField( const FieldDescriptor* field); - // Given a FieldSescriptor::Type return its WireType + // Given a FieldDescriptor::Type return its WireType static inline WireFormatLite::WireType WireTypeForFieldType( FieldDescriptor::Type type); @@ -180,7 +180,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // of packed repeated fields. static uint32 MakeTag(const FieldDescriptor* field); - // Parse a single field. The input should start out positioned immidately + // Parse a single field. The input should start out positioned immediately // after the tag. static bool ParseAndMergeField( uint32 tag, @@ -228,14 +228,34 @@ class LIBPROTOBUF_EXPORT WireFormat { }; // Verifies that a string field is valid UTF8, logging an error if not. + // This function will not be called by newly generated protobuf code + // but remains present to support existing code. static void VerifyUTF8String(const char* data, int size, Operation op); + // The NamedField variant takes a field name in order to produce an + // informative error message if verification fails. + static void VerifyUTF8StringNamedField(const char* data, + int size, + Operation op, + const char* field_name); private: // Verifies that a string field is valid UTF8, logging an error if not. static void VerifyUTF8StringFallback( const char* data, int size, - Operation op); + Operation op, + const char* field_name); + + // Skip a MessageSet field. + static bool SkipMessageSetField(io::CodedInputStream* input, + uint32 field_number, + UnknownFieldSet* unknown_fields); + + // Parse a MessageSet field. + static bool ParseAndMergeMessageSetField(uint32 field_number, + const FieldDescriptor* field, + Message* message, + io::CodedInputStream* input); @@ -293,13 +313,21 @@ inline int WireFormat::TagSize(int field_number, FieldDescriptor::Type type) { inline void WireFormat::VerifyUTF8String(const char* data, int size, WireFormat::Operation op) { #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED - WireFormat::VerifyUTF8StringFallback(data, size, op); + WireFormat::VerifyUTF8StringFallback(data, size, op, NULL); #else // Avoid the compiler warning about unsued variables. (void)data; (void)size; (void)op; #endif } +inline void WireFormat::VerifyUTF8StringNamedField( + const char* data, int size, WireFormat::Operation op, + const char* field_name) { +#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED + WireFormat::VerifyUTF8StringFallback(data, size, op, field_name); +#endif +} + } // namespace internal } // namespace protobuf diff --git a/include/google/protobuf/wire_format_lite.h b/include/google/protobuf/wire_format_lite.h index cb4fc91..21aa488 100644 --- a/include/google/protobuf/wire_format_lite.h +++ b/include/google/protobuf/wire_format_lite.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -163,11 +163,22 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // records to an UnknownFieldSet. static bool SkipField(io::CodedInputStream* input, uint32 tag); + // Skips a field value with the given tag. The input should start + // positioned immediately after the tag. Skipped values are recorded to a + // CodedOutputStream. + static bool SkipField(io::CodedInputStream* input, uint32 tag, + io::CodedOutputStream* output); + // Reads and ignores a message from the input. Skipped values are simply // discarded, not recorded anywhere. See WireFormat::SkipMessage() for a // version that records to an UnknownFieldSet. static bool SkipMessage(io::CodedInputStream* input); + // Reads and ignores a message from the input. Skipped values are recorded + // to a CodedOutputStream. + static bool SkipMessage(io::CodedInputStream* input, + io::CodedOutputStream* output); + // This macro does the same thing as WireFormatLite::MakeTag(), but the // result is usable as a compile-time constant, which makes it usable // as a switch case or a template input. WireFormatLite::MakeTag() is more @@ -228,9 +239,9 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // that file to use these. // Avoid ugly line wrapping -#define input io::CodedInputStream* input -#define output io::CodedOutputStream* output -#define field_number int field_number +#define input io::CodedInputStream* input_arg +#define output io::CodedOutputStream* output_arg +#define field_number int field_number_arg #define INL GOOGLE_ATTRIBUTE_ALWAYS_INLINE // Read fields, not including tags. The assumption is that you already @@ -340,6 +351,10 @@ class LIBPROTOBUF_EXPORT WireFormatLite { static void WriteString(field_number, const string& value, output); static void WriteBytes (field_number, const string& value, output); + static void WriteStringMaybeAliased( + field_number, const string& value, output); + static void WriteBytesMaybeAliased( + field_number, const string& value, output); static void WriteGroup( field_number, const MessageLite& value, output); @@ -490,6 +505,12 @@ class LIBPROTOBUF_EXPORT WireFormatLite { google::protobuf::io::CodedInputStream* input, RepeatedField<CType>* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + // Like ReadRepeatedFixedSizePrimitive but for packed primitive fields. + template <typename CType, enum FieldType DeclaredType> + static inline bool ReadPackedFixedSizePrimitive( + google::protobuf::io::CodedInputStream* input, + RepeatedField<CType>* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + static const CppType kFieldTypeToCppTypeMap[]; static const WireFormatLite::WireType kWireTypeForFieldType[]; @@ -518,6 +539,24 @@ class LIBPROTOBUF_EXPORT FieldSkipper { virtual void SkipUnknownEnum(int field_number, int value); }; +// Subclass of FieldSkipper which saves skipped fields to a CodedOutputStream. + +class LIBPROTOBUF_EXPORT CodedOutputStreamFieldSkipper : public FieldSkipper { + public: + explicit CodedOutputStreamFieldSkipper(io::CodedOutputStream* unknown_fields) + : unknown_fields_(unknown_fields) {} + virtual ~CodedOutputStreamFieldSkipper() {} + + // implements FieldSkipper ----------------------------------------- + virtual bool SkipField(io::CodedInputStream* input, uint32 tag); + virtual bool SkipMessage(io::CodedInputStream* input); + virtual void SkipUnknownEnum(int field_number, int value); + + protected: + io::CodedOutputStream* unknown_fields_; +}; + + // inline methods ==================================================== inline WireFormatLite::CppType diff --git a/include/google/protobuf/wire_format_lite_inl.h b/include/google/protobuf/wire_format_lite_inl.h index 641cc92..4e8ac9b 100644 --- a/include/google/protobuf/wire_format_lite_inl.h +++ b/include/google/protobuf/wire_format_lite_inl.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -36,6 +36,11 @@ #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ +#ifdef _MSC_VER +// This is required for min/max on VS2013 only. +#include <algorithm> +#endif + #include <string> #include <google/protobuf/stubs/common.h> #include <google/protobuf/message_lite.h> @@ -150,8 +155,8 @@ template <> inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>( io::CodedInputStream* input, bool* value) { - uint32 temp; - if (!input->ReadVarint32(&temp)) return false; + uint64 temp; + if (!input->ReadVarint64(&temp)) return false; *value = temp != 0; return true; } @@ -221,10 +226,11 @@ inline const uint8* WireFormatLite::ReadPrimitiveFromArray< } template <typename CType, enum WireFormatLite::FieldType DeclaredType> -inline bool WireFormatLite::ReadRepeatedPrimitive(int, // tag_size, unused. - uint32 tag, - io::CodedInputStream* input, - RepeatedField<CType>* values) { +inline bool WireFormatLite::ReadRepeatedPrimitive( + int, // tag_size, unused. + uint32 tag, + io::CodedInputStream* input, + RepeatedField<CType>* values) { CType value; if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false; values->Add(value); @@ -284,7 +290,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( return true; } -// Specializations of ReadRepeatedPrimitive for the fixed size types, which use +// Specializations of ReadRepeatedPrimitive for the fixed size types, which use // the optimized code path. #define READ_REPEATED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \ template <> \ @@ -334,6 +340,86 @@ inline bool WireFormatLite::ReadPackedPrimitive(io::CodedInputStream* input, } template <typename CType, enum WireFormatLite::FieldType DeclaredType> +inline bool WireFormatLite::ReadPackedFixedSizePrimitive( + io::CodedInputStream* input, RepeatedField<CType>* values) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + const uint32 old_entries = values->size(); + const uint32 new_entries = length / sizeof(CType); + const uint32 new_bytes = new_entries * sizeof(CType); + if (new_bytes != length) return false; + // We would *like* to pre-allocate the buffer to write into (for + // speed), but *must* avoid performing a very large allocation due + // to a malicious user-supplied "length" above. So we have a fast + // path that pre-allocates when the "length" is less than a bound. + // We determine the bound by calling BytesUntilTotalBytesLimit() and + // BytesUntilLimit(). These return -1 to mean "no limit set". + // There are four cases: + // TotalBytesLimit Limit + // -1 -1 Use slow path. + // -1 >= 0 Use fast path if length <= Limit. + // >= 0 -1 Use slow path. + // >= 0 >= 0 Use fast path if length <= min(both limits). + int64 bytes_limit = input->BytesUntilTotalBytesLimit(); + if (bytes_limit == -1) { + bytes_limit = input->BytesUntilLimit(); + } else { + bytes_limit = + min(bytes_limit, static_cast<int64>(input->BytesUntilLimit())); + } + if (bytes_limit >= new_bytes) { + // Fast-path that pre-allocates *values to the final size. +#if defined(PROTOBUF_LITTLE_ENDIAN) + values->Resize(old_entries + new_entries, 0); + // values->mutable_data() may change after Resize(), so do this after: + void* dest = reinterpret_cast<void*>(values->mutable_data() + old_entries); + if (!input->ReadRaw(dest, new_bytes)) { + values->Truncate(old_entries); + return false; + } +#else + values->Reserve(old_entries + new_entries); + CType value; + for (int i = 0; i < new_entries; ++i) { + if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false; + values->AddAlreadyReserved(value); + } +#endif + } else { + // This is the slow-path case where "length" may be too large to + // safely allocate. We read as much as we can into *values + // without pre-allocating "length" bytes. + CType value; + for (uint32 i = 0; i < new_entries; ++i) { + if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false; + values->Add(value); + } + } + return true; +} + +// Specializations of ReadPackedPrimitive for the fixed size types, which use +// an optimized code path. +#define READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \ +template <> \ +inline bool WireFormatLite::ReadPackedPrimitive< \ + CPPTYPE, WireFormatLite::DECLARED_TYPE>( \ + io::CodedInputStream* input, \ + RepeatedField<CPPTYPE>* values) { \ + return ReadPackedFixedSizePrimitive< \ + CPPTYPE, WireFormatLite::DECLARED_TYPE>(input, values); \ +} + +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE); + +#undef READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE + +template <typename CType, enum WireFormatLite::FieldType DeclaredType> bool WireFormatLite::ReadPackedPrimitiveNoInline(io::CodedInputStream* input, RepeatedField<CType>* values) { return ReadPackedPrimitive<CType, DeclaredType>(input, values); @@ -660,15 +746,13 @@ inline uint8* WireFormatLite::WriteStringToArray(int field_number, // WriteString() to avoid code duplication. If the implementations become // different, you will need to update that usage. target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); - target = io::CodedOutputStream::WriteVarint32ToArray(value.size(), target); - return io::CodedOutputStream::WriteStringToArray(value, target); + return io::CodedOutputStream::WriteStringWithSizeToArray(value, target); } inline uint8* WireFormatLite::WriteBytesToArray(int field_number, const string& value, uint8* target) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); - target = io::CodedOutputStream::WriteVarint32ToArray(value.size(), target); - return io::CodedOutputStream::WriteStringToArray(value, target); + return io::CodedOutputStream::WriteStringWithSizeToArray(value, target); } diff --git a/lib/libprotobuf-lite.8.dylib b/lib/libprotobuf-lite.8.dylib Binary files differdeleted file mode 100755 index 5b599a6..0000000 --- a/lib/libprotobuf-lite.8.dylib +++ /dev/null diff --git a/lib/libprotobuf-lite.9.dylib b/lib/libprotobuf-lite.9.dylib Binary files differnew file mode 100755 index 0000000..5721231 --- /dev/null +++ b/lib/libprotobuf-lite.9.dylib diff --git a/lib/libprotobuf-lite.a b/lib/libprotobuf-lite.a Binary files differindex 5dc37f7..92b21d9 100644 --- a/lib/libprotobuf-lite.a +++ b/lib/libprotobuf-lite.a diff --git a/lib/libprotobuf-lite.dylib b/lib/libprotobuf-lite.dylib index 3484cfa..3e34c1a 120000 --- a/lib/libprotobuf-lite.dylib +++ b/lib/libprotobuf-lite.dylib @@ -1 +1 @@ -libprotobuf-lite.8.dylib
\ No newline at end of file +libprotobuf-lite.9.dylib
\ No newline at end of file diff --git a/lib/libprotobuf-lite.la b/lib/libprotobuf-lite.la deleted file mode 100755 index 22e4c6c..0000000 --- a/lib/libprotobuf-lite.la +++ /dev/null @@ -1,41 +0,0 @@ -# libprotobuf-lite.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libprotobuf-lite.8.dylib' - -# Names of this library. -library_names='libprotobuf-lite.8.dylib libprotobuf-lite.dylib' - -# The name of the static archive. -old_library='libprotobuf-lite.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' ' - -# Libraries that this one depends upon. -dependency_libs=' -lz' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libprotobuf-lite. -current=8 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/tmp/libprotobuf-chaorenl/install/lib' diff --git a/lib/libprotobuf.8.dylib b/lib/libprotobuf.8.dylib Binary files differdeleted file mode 100755 index 65f178a..0000000 --- a/lib/libprotobuf.8.dylib +++ /dev/null diff --git a/lib/libprotobuf.9.dylib b/lib/libprotobuf.9.dylib Binary files differnew file mode 100755 index 0000000..460d2f4 --- /dev/null +++ b/lib/libprotobuf.9.dylib diff --git a/lib/libprotobuf.a b/lib/libprotobuf.a Binary files differindex 3d68280..7cf5527 100644 --- a/lib/libprotobuf.a +++ b/lib/libprotobuf.a diff --git a/lib/libprotobuf.dylib b/lib/libprotobuf.dylib index 4282cde..e5791d1 120000 --- a/lib/libprotobuf.dylib +++ b/lib/libprotobuf.dylib @@ -1 +1 @@ -libprotobuf.8.dylib
\ No newline at end of file +libprotobuf.9.dylib
\ No newline at end of file diff --git a/lib/libprotobuf.la b/lib/libprotobuf.la deleted file mode 100755 index 1a93f04..0000000 --- a/lib/libprotobuf.la +++ /dev/null @@ -1,41 +0,0 @@ -# libprotobuf.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libprotobuf.8.dylib' - -# Names of this library. -library_names='libprotobuf.8.dylib libprotobuf.dylib' - -# The name of the static archive. -old_library='libprotobuf.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' ' - -# Libraries that this one depends upon. -dependency_libs=' -lz' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libprotobuf. -current=8 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/tmp/libprotobuf-chaorenl/install/lib' diff --git a/lib/libprotoc.8.dylib b/lib/libprotoc.8.dylib Binary files differdeleted file mode 100755 index c3fe71e..0000000 --- a/lib/libprotoc.8.dylib +++ /dev/null diff --git a/lib/libprotoc.9.dylib b/lib/libprotoc.9.dylib Binary files differnew file mode 100755 index 0000000..7ac4a3f --- /dev/null +++ b/lib/libprotoc.9.dylib diff --git a/lib/libprotoc.a b/lib/libprotoc.a Binary files differindex 45f4728..2abba9a 100644 --- a/lib/libprotoc.a +++ b/lib/libprotoc.a diff --git a/lib/libprotoc.dylib b/lib/libprotoc.dylib index cb30aec..e738fd8 120000 --- a/lib/libprotoc.dylib +++ b/lib/libprotoc.dylib @@ -1 +1 @@ -libprotoc.8.dylib
\ No newline at end of file +libprotoc.9.dylib
\ No newline at end of file diff --git a/lib/libprotoc.la b/lib/libprotoc.la deleted file mode 100755 index bf059ab..0000000 --- a/lib/libprotoc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libprotoc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libprotoc.8.dylib' - -# Names of this library. -library_names='libprotoc.8.dylib libprotoc.dylib' - -# The name of the static archive. -old_library='libprotoc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' ' - -# Libraries that this one depends upon. -dependency_libs=' /tmp/libprotobuf-chaorenl/install/lib/libprotobuf.la -lz' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libprotoc. -current=8 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/tmp/libprotobuf-chaorenl/install/lib' diff --git a/lib/pkgconfig/protobuf-lite.pc b/lib/pkgconfig/protobuf-lite.pc deleted file mode 100644 index 15235dd..0000000 --- a/lib/pkgconfig/protobuf-lite.pc +++ /dev/null @@ -1,13 +0,0 @@ -prefix=/tmp/libprotobuf-chaorenl/install -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Protocol Buffers -Description: Google's Data Interchange Format -Version: 2.5.0 -Libs: -L${libdir} -lprotobuf-lite -D_THREAD_SAFE -Cflags: -I${includedir} -D_THREAD_SAFE -# Commented out because it crashes pkg-config *sigh*: -# http://bugs.freedesktop.org/show_bug.cgi?id=13265 -# Conflicts: protobuf diff --git a/lib/pkgconfig/protobuf.pc b/lib/pkgconfig/protobuf.pc deleted file mode 100644 index 495f819..0000000 --- a/lib/pkgconfig/protobuf.pc +++ /dev/null @@ -1,14 +0,0 @@ -prefix=/tmp/libprotobuf-chaorenl/install -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Protocol Buffers -Description: Google's Data Interchange Format -Version: 2.5.0 -Libs: -L${libdir} -lprotobuf -D_THREAD_SAFE -Libs.private: -lz -Cflags: -I${includedir} -D_THREAD_SAFE -# Commented out because it crashes pkg-config *sigh*: -# http://bugs.freedesktop.org/show_bug.cgi?id=13265 -# Conflicts: protobuf-lite |