Merge pull request #783 from podsvirov/topic-cmake-project
Improved CMake project
diff --git a/BUILD b/BUILD
index 571f48b..69ea6cf 100644
--- a/BUILD
+++ b/BUILD
@@ -18,6 +18,8 @@
# Bazel should provide portable link_opts for pthread.
LINK_OPTS = ["-lpthread"]
+load("protobuf", "cc_proto_library")
+
cc_library(
name = "protobuf_lite",
srcs = [
@@ -140,6 +142,14 @@
"google/protobuf/wrappers.proto",
]
+cc_proto_library(
+ name = "cc_wkt_protos",
+ srcs = ["src/" + s for s in WELL_KNOWN_PROTOS],
+ internal_bootstrap_hack = 1,
+ include = "src",
+ cc_libs = [":protobuf"],
+)
+
################################################################################
# Protocol Buffers Compiler
################################################################################
@@ -163,6 +173,7 @@
"src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
"src/google/protobuf/compiler/cpp/cpp_service.cc",
"src/google/protobuf/compiler/cpp/cpp_string_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
"src/google/protobuf/compiler/csharp/csharp_enum.cc",
"src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
"src/google/protobuf/compiler/csharp/csharp_field_base.cc",
@@ -253,6 +264,27 @@
)
################################################################################
+# Java support
+################################################################################
+genrule(
+ name = "generate_java_descriptor_proto",
+ srcs = ["src/google/protobuf/descriptor.proto"],
+ outs = ["com/google/protobuf/DescriptorProtos.java"],
+ cmd = "$(location :protoc) --java_out=$(@D)/../../.. $<",
+ tools = [":protoc"],
+)
+
+java_library(
+ name = "java_proto",
+ srcs = glob([
+ "java/src/main/java/com/google/protobuf/*.java",
+ ]) + [
+ ":generate_java_descriptor_proto",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+################################################################################
# Tests
################################################################################
@@ -305,22 +337,11 @@
"google/protobuf/util/json_format_proto3.proto",
]
-PROTOS = LITE_TEST_PROTOS + TEST_PROTOS
-
-INPUTS = PROTOS + WELL_KNOWN_PROTOS
-
-OUTPUTS = ["src/" + x[:-5] + "pb.h" for x in PROTOS] + \
- ["src/" + x[:-5] + "pb.cc" for x in PROTOS]
-
-genrule(
- name = "gen_test_protos",
- srcs = ["src/" + x for x in INPUTS],
- outs = OUTPUTS,
- cmd =
- "$(location :protoc) --cpp_out=$(@D)/src" +
- "".join([" -I" + x + "=$(location src/" + x + ")" for x in INPUTS]) +
- "".join([" $(location src/" + x + ")" for x in PROTOS]),
- tools = [":protoc"],
+cc_proto_library(
+ name = "cc_test_protos",
+ srcs = ["src/" + s for s in (LITE_TEST_PROTOS + TEST_PROTOS)],
+ include = "src",
+ deps = [":cc_wkt_protos"],
)
COMMON_TEST_SRCS = [
@@ -349,7 +370,7 @@
cc_test(
name = "protobuf_test",
- srcs = OUTPUTS + COMMON_TEST_SRCS + [
+ srcs = COMMON_TEST_SRCS + [
# AUTOGEN(test_srcs)
"src/google/protobuf/any_test.cc",
"src/google/protobuf/arena_unittest.cc",
@@ -426,7 +447,7 @@
deps = [
":protobuf",
":protoc_lib",
+ ":cc_test_protos",
"//external:gtest_main",
],
)
-
diff --git a/Makefile.am b/Makefile.am
index 82ce190..6223301 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,6 +95,7 @@
csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs \
+ csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \
@@ -149,6 +150,7 @@
csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs \
csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs \
csharp/src/Google.Protobuf/WellKnownTypes/Any.cs \
+ csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs \
csharp/src/Google.Protobuf/WellKnownTypes/Api.cs \
csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs \
csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs \
@@ -454,6 +456,7 @@
objectivec/Tests/GPBMessageTests+Runtime.m \
objectivec/Tests/GPBMessageTests+Serialization.m \
objectivec/Tests/GPBMessageTests.m \
+ objectivec/Tests/GPBObjectiveCPlusPlusTest.mm \
objectivec/Tests/GPBPerfTests.m \
objectivec/Tests/GPBStringTests.m \
objectivec/Tests/GPBSwiftTests.swift \
@@ -505,6 +508,7 @@
python/google/protobuf/internal/factory_test1.proto \
python/google/protobuf/internal/factory_test2.proto \
python/google/protobuf/internal/generator_test.py \
+ python/google/protobuf/internal/json_format_test.py \
python/google/protobuf/internal/message_factory_test.py \
python/google/protobuf/internal/message_listener.py \
python/google/protobuf/internal/message_set_extensions.proto \
@@ -560,6 +564,7 @@
python/google/protobuf/descriptor.py \
python/google/protobuf/descriptor_database.py \
python/google/protobuf/descriptor_pool.py \
+ python/google/protobuf/json_format.py \
python/google/protobuf/message.py \
python/google/protobuf/message_factory.py \
python/google/protobuf/proto_builder.py \
diff --git a/Protobuf.podspec b/Protobuf.podspec
index 5cfc02b..92ff290 100644
--- a/Protobuf.podspec
+++ b/Protobuf.podspec
@@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
- s.version = '3.0.0-alpha-4'
+ s.version = '3.0.0-alpha-4.1'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/google/protobuf'
s.license = 'New BSD'
@@ -21,7 +21,7 @@
'objectivec/google/protobuf/SourceContext.pbobjc.{h,m}',
'objectivec/google/protobuf/Struct.pbobjc.{h,m}',
'objectivec/google/protobuf/Timestamp.pbobjc.h',
- 'objectivec/google/protobuf/Type.pbobjc.{h,m}'
+ 'objectivec/google/protobuf/Type.pbobjc.{h,m}',
'objectivec/google/protobuf/Wrappers.pbobjc.{h,m}'
# Timestamp.pbobjc.m and Duration.pbobjc.m are #imported by GPBWellKnownTypes.m. So we can't
# compile them (duplicate symbols), but we need them available for the importing:
diff --git a/autogen.sh b/autogen.sh
index 8160313..5b4c29f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -6,6 +6,18 @@
set -e
+if [ ! -z "$@" ]; then
+ for argument in "$@"; do
+ case $argument in
+ # make curl silent
+ "-s")
+ curlopts="-s"
+ ;;
+ esac
+ done
+fi
+
+
# Check that we're being run from the right directory.
if test ! -f src/google/protobuf/stubs/common.h; then
cat >&2 << __EOF__
@@ -19,7 +31,7 @@
# directory is set up as an SVN external.
if test ! -e gmock; then
echo "Google Mock not present. Fetching gmock-1.7.0 from the web..."
- curl -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
+ curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
unzip -q gmock-1.7.0.zip
rm gmock-1.7.0.zip
mv gmock-1.7.0 gmock
diff --git a/cmake/README.md b/cmake/README.md
index c68defd..4cd049e 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -1,60 +1,235 @@
-This directory contains cmake files that can be used to generate MSVC project
-files in order to build protobuf on windows. You need to have cmake installed
-on your computer before proceeding.
+This directory contains *CMake* files that can be used to build protobuf
+with *MSVC* on *Windows*. You can build the project from *Command Prompt*
+and using an *Visual Studio* IDE.
-Compiling and Installing
-========================
+You need to have [CMake](http://www.cmake.org), [Visual Studio](https://www.visualstudio.com)
+and optionally [Git](http://git-scm.com) installed on your computer before proceeding.
-1. Check whether a gmock directory exists in the upper level directory. If you
- checkout the code from github via "git clone", this gmock directory won't
- exist and you won't be able to build protobuf unit-tests. Consider using one
- of the release tar balls instead:
+Most of the instructions will be given to the *Сommand Prompt*, but the same
+actions can be performed using appropriate GUI tools.
- https://github.com/google/protobuf/releases
+Environment Setup
+=================
- These release tar balls are more stable versions of protobuf and already
- have the gmock directory included.
+Open the appropriate *Command Prompt* from the *Start* menu.
- You can also download gmock by yourself and put it in the right place.
+For example *VS2013 x64 Native Tools Command Prompt*:
- If you absolutely don't want to build and run protobuf unit-tests, skip
- this step and use protobuf at your own risk.
+ C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64>
-2. Use cmake to generate MSVC project files. Running the following commands
- in a command shell will generate project files for Visual Studio 2008 in
- a sub-directory named "build".
+Change to your working directory:
- $ cd path/to/protobuf/cmake
- $ mkdir build
- $ cd build
- $ cmake -G "Visual Studio 9 2008" ..
+ C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64>cd C:\Path\to
+ C:\Path\to>
- If you don't have gmock, skip the build of tests by turning off the
- BUILD_TESTING option:
+Where *C:\Path\to* is path to your real working directory.
- $ cmake -G "Visual Studio 9 2008" -DBUILD_TESTING=OFF ..
+Create a folder where protobuf headers/libraries/binaries will be installed after built:
-3. Open the generated protobuf.sln file in Microsoft Visual Studio.
-4. Choose "Debug" or "Release" configuration as desired.
-5. From the Build menu, choose "Build Solution". Wait for compiling to finish.
-6. If you have built tests, run tests.exe and lite-test.exe from a command
- shell and check that all tests pass. Make sure you have changed the working
- directory to the output directory because tests.exe will try to find and run
- test_plugin.exe in the working directory.
-7. Run extract_includes.bat to copy all the public headers into a separate
- "include" directory. This batch script can be found along with the generated
- protobuf.sln file in the same directory.
-8. Copy the contents of the include directory to wherever you want to put
- headers.
-9. Copy protoc.exe wherever you put build tools (probably somewhere in your
- PATH).
-10. Copy libprotobuf.lib, libprotobuf-lite.lib, and libprotoc.lib wherever you
- put libraries.
+ C:\Path\to>mkdir install
- To avoid conflicts between the MSVC debug and release runtime libraries, when
- compiling a debug build of your application, you may need to link against a
- debug build of libprotobuf.lib. Similarly, release builds should link against
- release libs.
+If *cmake* coomand is not avaliable from *Command Promt*, add it to system *PATH* variable:
+
+ C:\Path\to>set PATH=%PATH%;C:\Program Files (x86)\CMake\bin
+
+If *git* coomand is not avaliable from *Command Promt*, add it to system *PATH* variable:
+
+ C:\Path\to>set PATH=%PATH%;C:\Program Files\Git\cmd
+
+Good. Now you are ready to continue.
+
+Getting Sources
+===============
+
+You can get the latest stable source packages from the
+[releases](https://github.com/google/protobuf/releases) page.
+Or you can type:
+
+ C:\Path\to> git clone -b [release_tag] https://github.com/google/protobuf.git
+
+Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *master*
+if you want to get the latest code.
+
+Go to the project folder:
+
+ C:\Path\to>cd protobuf
+ C:\Path\to\protobuf>
+
+Protobuf unit-tests require gmock to build. If you download protobuf source code
+from the *releases* page, the *gmock* directory should already be there. If you checkout
+the code via `git clone`, this *gmock* directory won't exist and you will have to
+download it manually or skip building protobuf unit-tests.
+
+You can download gmock as follows:
+
+ C:\Path\to\protobuf>git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock
+
+Then go to *gmock* folder and downdload gtest:
+
+ C:\Path\to\protobuf>cd gmock
+ C:\Path\to\protobuf\gmock>git clone -b release-1.7.0 https://github.com/google/googletest.git gtest
+
+If you absolutely don't want to build and run protobuf unit-tests, skip
+this steps and use protobuf at your own risk.
+
+Now go to *cmake* folder in protobuf sources:
+
+ C:\Path\to\protobuf\gmock>cd ..\cmake
+ C:\Path\to\protobuf\cmake>
+
+Good. Now you are ready to *CMake* configuration.
+
+CMake Configuration
+===================
+
+*CMake* supports a lot of different
+[generators](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
+for various native build systems.
+We are only interested in
+[Makefile](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators)
+and
+[Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators)
+generators.
+
+We will use shadow building to separate the temporary files from the protobuf source code.
+
+Create a temporary *build* folder and change your working directory to it:
+
+ C:\Path\to\protobuf\cmake>mkdir build & cd build
+ C:\Path\to\protobuf\cmake\build>
+
+The *Makefile* generator can build the project in only one configuration, so you need to build
+a separate folder for each configuration.
+
+To start using a *Release* configuration:
+
+ C:\Path\to\protobuf\cmake\build>mkdir release & cd release
+ C:\Path\to\protobuf\cmake\build\release>cmake -G "NMake Makefiles" ^
+ -DCMAKE_BUILD_TYPE=Release ^
+ -DCMAKE_INSTALL_PREFIX=../../../../install ^
+ ../..
+
+It will generate *nmake* *Makefile* in current directory.
+
+To use *Debug* configuration:
+
+ C:\Path\to\protobuf\cmake\build>mkdir debug & cd debug
+ C:\Path\to\protobuf\cmake\build\debug>cmake -G "NMake Makefiles" ^
+ -DCMAKE_BUILD_TYPE=Debug ^
+ -DCMAKE_INSTALL_PREFIX=../../../../install ^
+ ../..
+
+It will generate *nmake* *Makefile* in current directory.
+
+To create *Visual Studio* solution file:
+
+ C:\Path\to\protobuf\cmake>mkdir solution & cd solution
+ C:\Path\to\protobuf\cmake\solution>cmake -G "Visual Studio 12 2013 Win64" ^
+ -DCMAKE_INSTALL_PREFIX=../../../../install ^
+ ../..
+
+It will generate *Visual Studion* solution file *protobuf.sln* in current directory.
+
+If the *gmock* directory does not exist, and you do not want to build protobuf unit tests,
+you need to add *cmake* command argument `-Dprotobuf_BUILD_TESTS=OFF` to disable testing.
+
+Compiling
+=========
+
+To compile protobuf:
+
+ C:\Path\to\protobuf\cmake\build\release>nmake
+
+or
+
+ C:\Path\to\protobuf\cmake\build\debug>nmake
+
+And wait for the compilation to finish.
+
+You prefer to use the IDE:
+
+ * Open the generated protobuf.sln file in Microsoft Visual Studio.
+ * Choose "Debug" or "Release" configuration as desired.
+ * From the Build menu, choose "Build Solution".
+
+wait for the compilation to finish.
+
+Testing
+=======
+
+To run unit-tests:
+
+ C:\Path\to\protobuf\cmake\build\release>nmake check
+
+or
+
+ C:\Path\to\protobuf\cmake\build\debug>nmake check
+
+You can also build project *check* from Visual Studio solution.
+Yes, it may sound strange, but it works.
+
+You should see output similar to:
+
+ Running main() from gmock_main.cc
+ [==========] Running 1546 tests from 165 test cases.
+
+ ...
+
+ [==========] 1546 tests from 165 test cases ran. (2529 ms total)
+ [ PASSED ] 1546 tests.
+
+To run specific tests:
+
+ C:\Path\to\protobuf>cmake\build\release\tests.exe --gtest_filter=AnyTest*
+ Running main() from gmock_main.cc
+ Note: Google Test filter = AnyTest*
+ [==========] Running 3 tests from 1 test case.
+ [----------] Global test environment set-up.
+ [----------] 3 tests from AnyTest
+ [ RUN ] AnyTest.TestPackAndUnpack
+ [ OK ] AnyTest.TestPackAndUnpack (0 ms)
+ [ RUN ] AnyTest.TestPackAndUnpackAny
+ [ OK ] AnyTest.TestPackAndUnpackAny (0 ms)
+ [ RUN ] AnyTest.TestIs
+ [ OK ] AnyTest.TestIs (0 ms)
+ [----------] 3 tests from AnyTest (1 ms total)
+
+ [----------] Global test environment tear-down
+ [==========] 3 tests from 1 test case ran. (2 ms total)
+ [ PASSED ] 3 tests.
+
+Note that the tests must be run from the source folder.
+
+If all tests are passed, safely continue.
+
+Installing
+==========
+
+To install protobuf to the specified *install* folder:
+
+ C:\Path\to\protobuf\cmake\build\release>nmake install
+
+or
+
+ C:\Path\to\protobuf\cmake\build\debug>nmake install
+
+You can also build project *INSTALL* from Visual Studio solution.
+It sounds not so strange and it works.
+
+This will create the following folders under the *install* location:
+ * bin - that contains protobuf *protoc.exe* compiler;
+ * inclue - that contains C++ headers and protobuf *.proto files;
+ * lib - that contains linking libraries and *CMake* configuration files for *protobuf* package.
+
+Now you can if needed:
+ * Copy the contents of the include directory to wherever you want to put headers.
+ * Copy protoc.exe wherever you put build tools (probably somewhere in your PATH).
+ * Copy linking libraries libprotobuf[d].lib, libprotobuf-lite[d].lib, and libprotoc[d].lib wherever you put libraries.
+
+To avoid conflicts between the MSVC debug and release runtime libraries, when
+compiling a debug build of your application, you may need to link against a
+debug build of libprotobufd.lib with "d" postfix. Similarly, release builds should link against
+release libprotobuf.lib library.
DLLs vs. static linking
=======================
@@ -66,12 +241,9 @@
build libprotobuf and libprotoc as DLLs if you really want. To do this,
do the following:
- 1. Add an additional flag "-DBUILD_SHARED_LIBS=ON" when invoking cmake:
-
- $ cmake -G "Visual Studio 9 2008" -DBUILD_SHARED_LIBS=ON ..
-
- 2. Follow the same steps as described in the above section.
- 3. When compiling your project, make sure to #define PROTOBUF_USE_DLLS.
+ * Add an additional flag `-Dprotobuf_BUILD_SHARED_LIBS=ON` when invoking cmake
+ * Follow the same steps as described in the above section.
+ * When compiling your project, make sure to `#define PROTOBUF_USE_DLLS`.
When distributing your software to end users, we strongly recommend that you
do NOT install libprotobuf.dll or libprotoc.dll to any shared location.
@@ -90,21 +262,46 @@
If you want to include GzipInputStream and GzipOutputStream
(google/protobuf/io/gzip_stream.h) in libprotobuf, you will need to do a few
-additional steps:
+additional steps.
-1. Obtain a copy of the zlib library. The pre-compiled DLL at zlib.net works.
-2. Make sure zlib's two headers are in your include path and that the .lib file
- is in your library path. You could place all three files directly into this
- cmake directory to compile libprotobuf, but they need to be visible to
- your own project as well, so you should probably just put them into the
- VC shared icnlude and library directories.
-3. Add flag "-DZLIB=ON" when invoking cmake:
+Obtain a copy of the zlib library. The pre-compiled DLL at zlib.net works.
+You need prepare it:
- $ cmake -G "Visual Studio 9 2008" -DZLIB=ON ..
+ * Make sure zlib's two headers are in your `C:\Path\to\install\include` path
+ * Make sure zlib's linking libraries (*.lib file) is in your
+ `C:\Path\to\install\lib` library path.
- If it reports NOTFOUND for zlib_include or zlib_lib, you might haven't put
- the headers or the .lib file in the right directory.
-4) Open the generated protobuf.sln file and build as usual.
+You can also compile it from source by yourself.
+
+Getting sources:
+
+ C:\Path\to>git clone -b v1.2.8 https://github.com/madler/zlib.git
+ C:\Path\to>cd zlib
+
+Compiling and Installing:
+
+ C:\Path\to\zlib>mkdir build & cd build
+ C:\Path\to\zlib\build>mkdir release & cd release
+ C:\Path\to\zlib\build\release>cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ^
+ -DCMAKE_INSTALL_PREFIX=../../../install ../..
+ C:\Path\to\zlib\build\release>nmake & nmake install
+
+You can make *debug* version or use *Visual Studio* generator also as before for the
+protobuf project.
+
+Now add *bin* folder from *install* to system *PATH*:
+
+ C:\Path\to>set PATH=%PATH%;C:\Path\to\install\bin
+
+You need reconfigure protobuf with flag `-Dprotobuf_WITH_ZLIB=ON` when invoking cmake.
+
+Note that if you have compiled ZLIB yourself, as stated above,
+further disable the option `-Dprotobuf_MSVC_STATIC_RUNTIME=OFF`.
+
+If it reports NOTFOUND for zlib_include or zlib_lib, you might haven't put
+the headers or the .lib file in the right directory.
+
+Build and testing protobuf as usual.
Notes on Compiler Warnings
==========================
@@ -136,4 +333,3 @@
nevertheless. So, we disable it. Unfortunately, this warning will also be
produced when compiling code which merely uses protocol buffers, meaning you
may have to disable it in your code too.
-
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index 7424ff0..1ee87b4 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -14,6 +14,7 @@
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 0d217a9..3a556b0 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -35,11 +35,10 @@
fi
fi
-# Descriptor proto
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf/Reflection \
- src/google/protobuf/descriptor.proto
-
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf/WellKnownTypes \
+# descriptor.proto and well-known types
+$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
+ --csharp_opt=base_namespace=Google.Protobuf \
+ src/google/protobuf/descriptor.proto \
src/google/protobuf/any.proto \
src/google/protobuf/api.proto \
src/google/protobuf/duration.proto \
@@ -51,15 +50,18 @@
src/google/protobuf/type.proto \
src/google/protobuf/wrappers.proto
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
+# Test protos where the namespace matches the target location
+$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \
+ --csharp_opt=base_namespace=Google.Protobuf \
src/google/protobuf/map_unittest_proto3.proto \
src/google/protobuf/unittest_proto3.proto \
src/google/protobuf/unittest_import_proto3.proto \
src/google/protobuf/unittest_import_public_proto3.proto \
src/google/protobuf/unittest_well_known_types.proto
-
-$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
+# Different base namespace to the protos above
+$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \
+ --csharp_opt=base_namespace=UnitTest.Issues \
csharp/protos/unittest_issues.proto
# AddressBook sample protos
diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs
index f2be5ba..a830418 100644
--- a/csharp/src/AddressBook/Addressbook.cs
+++ b/csharp/src/AddressBook/Addressbook.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.Examples.AddressBook {
+ /// <summary>Holder for reflection information generated from addressbook.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Addressbook {
#region Descriptor
+ /// <summary>File descriptor for addressbook.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,14 +23,14 @@
static Addressbook() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu",
- "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l",
- "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u",
- "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y",
- "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA",
- "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl",
- "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y",
- "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt",
+ "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu",
+ "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l",
+ "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u",
+ "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y",
+ "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA",
+ "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl",
+ "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y",
+ "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt",
"cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -71,6 +73,7 @@
return new Person(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -80,8 +83,12 @@
}
}
+ /// <summary>Field number for the "id" field.</summary>
public const int IdFieldNumber = 2;
private int id_;
+ /// <summary>
+ /// Unique ID number for this person.
+ /// </summary>
public int Id {
get { return id_; }
set {
@@ -89,6 +96,7 @@
}
}
+ /// <summary>Field number for the "email" field.</summary>
public const int EmailFieldNumber = 3;
private string email_ = "";
public string Email {
@@ -98,6 +106,7 @@
}
}
+ /// <summary>Field number for the "phones" field.</summary>
public const int PhonesFieldNumber = 4;
private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> _repeated_phones_codec
= pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser);
@@ -212,6 +221,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the Person message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
public enum PhoneType {
@@ -248,6 +258,7 @@
return new PhoneNumber(this);
}
+ /// <summary>Field number for the "number" field.</summary>
public const int NumberFieldNumber = 1;
private string number_ = "";
public string Number {
@@ -257,6 +268,7 @@
}
}
+ /// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 2;
private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.MOBILE;
public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type {
@@ -353,6 +365,9 @@
}
+ /// <summary>
+ /// Our address book file is just one of these.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class AddressBook : pb::IMessage<AddressBook> {
private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook());
@@ -380,6 +395,7 @@
return new AddressBook(this);
}
+ /// <summary>Field number for the "people" field.</summary>
public const int PeopleFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person> _repeated_people_codec
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser);
diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
index e905d4e..dfd331a 100644
--- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Conformance {
+ /// <summary>Holder for reflection information generated from conformance.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Conformance {
#region Descriptor
+ /// <summary>File descriptor for conformance.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,116 +23,116 @@
static Conformance() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UijQEKEkNvbmZvcm1h",
- "bmNlUmVxdWVzdBIaChBwcm90b2J1Zl9wYXlsb2FkGAEgASgMSAASFgoManNv",
- "bl9wYXlsb2FkGAIgASgJSAASOAoXcmVxdWVzdGVkX291dHB1dF9mb3JtYXQY",
- "AyABKA4yFy5jb25mb3JtYW5jZS5XaXJlRm9ybWF0QgkKB3BheWxvYWQilgEK",
- "E0NvbmZvcm1hbmNlUmVzcG9uc2USFQoLcGFyc2VfZXJyb3IYASABKAlIABIX",
- "Cg1ydW50aW1lX2Vycm9yGAIgASgJSAASGgoQcHJvdG9idWZfcGF5bG9hZBgD",
- "IAEoDEgAEhYKDGpzb25fcGF5bG9hZBgEIAEoCUgAEhEKB3NraXBwZWQYBSAB",
- "KAlIAEIICgZyZXN1bHQi6yIKDFRlc3RBbGxUeXBlcxIWCg5vcHRpb25hbF9p",
- "bnQzMhgBIAEoBRIWCg5vcHRpb25hbF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25h",
- "bF91aW50MzIYAyABKA0SFwoPb3B0aW9uYWxfdWludDY0GAQgASgEEhcKD29w",
- "dGlvbmFsX3NpbnQzMhgFIAEoERIXCg9vcHRpb25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WUYAiABKAsyJy5jb25mb3JtYW5jZS5U",
+ "ZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZToCOAEaWwocTWFwU3RyaW5nRm9y",
+ "ZWlnbk1lc3NhZ2VFbnRyeRILCgNrZXkYASABKAkSKgoFdmFsdWUYAiABKAsy",
+ "Gy5jb25mb3JtYW5jZS5Gb3JlaWduTWVzc2FnZToCOAEaYAoYTWFwU3RyaW5n",
+ "TmVzdGVkRW51bUVudHJ5EgsKA2tleRgBIAEoCRIzCgV2YWx1ZRgCIAEoDjIk",
+ "LmNvbmZvcm1hbmNlLlRlc3RBbGxUeXBlcy5OZXN0ZWRFbnVtOgI4ARpVChlN",
+ "YXBTdHJpbmdGb3JlaWduRW51bUVudHJ5EgsKA2tleRgBIAEoCRInCgV2YWx1",
+ "ZRgCIAEoDjIYLmNvbmZvcm1hbmNlLkZvcmVpZ25FbnVtOgI4ASI5CgpOZXN0",
+ "ZWRFbnVtEgcKA0ZPTxAAEgcKA0JBUhABEgcKA0JBWhACEhAKA05FRxD/////",
+ "//////8BQg0KC29uZW9mX2ZpZWxkIhsKDkZvcmVpZ25NZXNzYWdlEgkKAWMY",
+ "ASABKAUqNQoKV2lyZUZvcm1hdBIPCgtVTlNQRUNJRklFRBAAEgwKCFBST1RP",
+ "QlVGEAESCAoESlNPThACKkAKC0ZvcmVpZ25FbnVtEg8KC0ZPUkVJR05fRk9P",
+ "EAASDwoLRk9SRUlHTl9CQVIQARIPCgtGT1JFSUdOX0JBWhACQiEKH2NvbS5n",
"b29nbGUucHJvdG9idWYuY29uZm9ybWFuY2ViBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -161,6 +163,12 @@
#endregion
#region Messages
+ /// <summary>
+ /// Represents a single test case's input. The testee should:
+ /// 1. parse this proto (which should always succeed)
+ /// 2. parse the protobuf or JSON payload in "payload" (which may fail)
+ /// 3. if the parse succeeded, serialize the message in the requested format.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ConformanceRequest : pb::IMessage<ConformanceRequest> {
private static readonly pb::MessageParser<ConformanceRequest> _parser = new pb::MessageParser<ConformanceRequest>(() => new ConformanceRequest());
@@ -197,6 +205,7 @@
return new ConformanceRequest(this);
}
+ /// <summary>Field number for the "protobuf_payload" field.</summary>
public const int ProtobufPayloadFieldNumber = 1;
public pb::ByteString ProtobufPayload {
get { return payloadCase_ == PayloadOneofCase.ProtobufPayload ? (pb::ByteString) payload_ : pb::ByteString.Empty; }
@@ -206,6 +215,7 @@
}
}
+ /// <summary>Field number for the "json_payload" field.</summary>
public const int JsonPayloadFieldNumber = 2;
public string JsonPayload {
get { return payloadCase_ == PayloadOneofCase.JsonPayload ? (string) payload_ : ""; }
@@ -215,8 +225,12 @@
}
}
+ /// <summary>Field number for the "requested_output_format" field.</summary>
public const int RequestedOutputFormatFieldNumber = 3;
private global::Conformance.WireFormat requestedOutputFormat_ = global::Conformance.WireFormat.UNSPECIFIED;
+ /// <summary>
+ /// Which format should the testee serialize its message to?
+ /// </summary>
public global::Conformance.WireFormat RequestedOutputFormat {
get { return requestedOutputFormat_; }
set {
@@ -225,6 +239,7 @@
}
private object payload_;
+ /// <summary>Enum of possible cases for the "payload" oneof.</summary>
public enum PayloadOneofCase {
None = 0,
ProtobufPayload = 1,
@@ -341,6 +356,9 @@
}
+ /// <summary>
+ /// Represents a single test case's output.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ConformanceResponse : pb::IMessage<ConformanceResponse> {
private static readonly pb::MessageParser<ConformanceResponse> _parser = new pb::MessageParser<ConformanceResponse>(() => new ConformanceResponse());
@@ -385,7 +403,14 @@
return new ConformanceResponse(this);
}
+ /// <summary>Field number for the "parse_error" field.</summary>
public const int ParseErrorFieldNumber = 1;
+ /// <summary>
+ /// This string should be set to indicate parsing failed. The string can
+ /// provide more information about the parse error if it is available.
+ /// Setting this string does not necessarily mean the testee failed the
+ /// test. Some of the test cases are intentionally invalid input.
+ /// </summary>
public string ParseError {
get { return resultCase_ == ResultOneofCase.ParseError ? (string) result_ : ""; }
set {
@@ -394,7 +419,13 @@
}
}
+ /// <summary>Field number for the "runtime_error" field.</summary>
public const int RuntimeErrorFieldNumber = 2;
+ /// <summary>
+ /// This should be set if some other error occurred. This will always
+ /// indicate that the test failed. The string can provide more information
+ /// about the failure.
+ /// </summary>
public string RuntimeError {
get { return resultCase_ == ResultOneofCase.RuntimeError ? (string) result_ : ""; }
set {
@@ -403,7 +434,12 @@
}
}
+ /// <summary>Field number for the "protobuf_payload" field.</summary>
public const int ProtobufPayloadFieldNumber = 3;
+ /// <summary>
+ /// If the input was successfully parsed and the requested output was
+ /// protobuf, serialize it to protobuf and set it in this field.
+ /// </summary>
public pb::ByteString ProtobufPayload {
get { return resultCase_ == ResultOneofCase.ProtobufPayload ? (pb::ByteString) result_ : pb::ByteString.Empty; }
set {
@@ -412,7 +448,12 @@
}
}
+ /// <summary>Field number for the "json_payload" field.</summary>
public const int JsonPayloadFieldNumber = 4;
+ /// <summary>
+ /// If the input was successfully parsed and the requested output was JSON,
+ /// serialize to JSON and set it in this field.
+ /// </summary>
public string JsonPayload {
get { return resultCase_ == ResultOneofCase.JsonPayload ? (string) result_ : ""; }
set {
@@ -421,7 +462,12 @@
}
}
+ /// <summary>Field number for the "skipped" field.</summary>
public const int SkippedFieldNumber = 5;
+ /// <summary>
+ /// For when the testee skipped the test, likely because a certain feature
+ /// wasn't supported, like JSON input/output.
+ /// </summary>
public string Skipped {
get { return resultCase_ == ResultOneofCase.Skipped ? (string) result_ : ""; }
set {
@@ -431,6 +477,7 @@
}
private object result_;
+ /// <summary>Enum of possible cases for the "result" oneof.</summary>
public enum ResultOneofCase {
None = 0,
ParseError = 1,
@@ -582,6 +629,10 @@
}
+ /// <summary>
+ /// This proto includes every type of field in both singular and repeated
+ /// forms.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes> {
private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes());
@@ -685,8 +736,12 @@
return new TestAllTypes(this);
}
+ /// <summary>Field number for the "optional_int32" field.</summary>
public const int OptionalInt32FieldNumber = 1;
private int optionalInt32_;
+ /// <summary>
+ /// Singular
+ /// </summary>
public int OptionalInt32 {
get { return optionalInt32_; }
set {
@@ -694,6 +749,7 @@
}
}
+ /// <summary>Field number for the "optional_int64" field.</summary>
public const int OptionalInt64FieldNumber = 2;
private long optionalInt64_;
public long OptionalInt64 {
@@ -703,6 +759,7 @@
}
}
+ /// <summary>Field number for the "optional_uint32" field.</summary>
public const int OptionalUint32FieldNumber = 3;
private uint optionalUint32_;
public uint OptionalUint32 {
@@ -712,6 +769,7 @@
}
}
+ /// <summary>Field number for the "optional_uint64" field.</summary>
public const int OptionalUint64FieldNumber = 4;
private ulong optionalUint64_;
public ulong OptionalUint64 {
@@ -721,6 +779,7 @@
}
}
+ /// <summary>Field number for the "optional_sint32" field.</summary>
public const int OptionalSint32FieldNumber = 5;
private int optionalSint32_;
public int OptionalSint32 {
@@ -730,6 +789,7 @@
}
}
+ /// <summary>Field number for the "optional_sint64" field.</summary>
public const int OptionalSint64FieldNumber = 6;
private long optionalSint64_;
public long OptionalSint64 {
@@ -739,6 +799,7 @@
}
}
+ /// <summary>Field number for the "optional_fixed32" field.</summary>
public const int OptionalFixed32FieldNumber = 7;
private uint optionalFixed32_;
public uint OptionalFixed32 {
@@ -748,6 +809,7 @@
}
}
+ /// <summary>Field number for the "optional_fixed64" field.</summary>
public const int OptionalFixed64FieldNumber = 8;
private ulong optionalFixed64_;
public ulong OptionalFixed64 {
@@ -757,6 +819,7 @@
}
}
+ /// <summary>Field number for the "optional_sfixed32" field.</summary>
public const int OptionalSfixed32FieldNumber = 9;
private int optionalSfixed32_;
public int OptionalSfixed32 {
@@ -766,6 +829,7 @@
}
}
+ /// <summary>Field number for the "optional_sfixed64" field.</summary>
public const int OptionalSfixed64FieldNumber = 10;
private long optionalSfixed64_;
public long OptionalSfixed64 {
@@ -775,6 +839,7 @@
}
}
+ /// <summary>Field number for the "optional_float" field.</summary>
public const int OptionalFloatFieldNumber = 11;
private float optionalFloat_;
public float OptionalFloat {
@@ -784,6 +849,7 @@
}
}
+ /// <summary>Field number for the "optional_double" field.</summary>
public const int OptionalDoubleFieldNumber = 12;
private double optionalDouble_;
public double OptionalDouble {
@@ -793,6 +859,7 @@
}
}
+ /// <summary>Field number for the "optional_bool" field.</summary>
public const int OptionalBoolFieldNumber = 13;
private bool optionalBool_;
public bool OptionalBool {
@@ -802,6 +869,7 @@
}
}
+ /// <summary>Field number for the "optional_string" field.</summary>
public const int OptionalStringFieldNumber = 14;
private string optionalString_ = "";
public string OptionalString {
@@ -811,6 +879,7 @@
}
}
+ /// <summary>Field number for the "optional_bytes" field.</summary>
public const int OptionalBytesFieldNumber = 15;
private pb::ByteString optionalBytes_ = pb::ByteString.Empty;
public pb::ByteString OptionalBytes {
@@ -820,6 +889,7 @@
}
}
+ /// <summary>Field number for the "optional_nested_message" field.</summary>
public const int OptionalNestedMessageFieldNumber = 18;
private global::Conformance.TestAllTypes.Types.NestedMessage optionalNestedMessage_;
public global::Conformance.TestAllTypes.Types.NestedMessage OptionalNestedMessage {
@@ -829,6 +899,7 @@
}
}
+ /// <summary>Field number for the "optional_foreign_message" field.</summary>
public const int OptionalForeignMessageFieldNumber = 19;
private global::Conformance.ForeignMessage optionalForeignMessage_;
public global::Conformance.ForeignMessage OptionalForeignMessage {
@@ -838,6 +909,7 @@
}
}
+ /// <summary>Field number for the "optional_nested_enum" field.</summary>
public const int OptionalNestedEnumFieldNumber = 21;
private global::Conformance.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = global::Conformance.TestAllTypes.Types.NestedEnum.FOO;
public global::Conformance.TestAllTypes.Types.NestedEnum OptionalNestedEnum {
@@ -847,6 +919,7 @@
}
}
+ /// <summary>Field number for the "optional_foreign_enum" field.</summary>
public const int OptionalForeignEnumFieldNumber = 22;
private global::Conformance.ForeignEnum optionalForeignEnum_ = global::Conformance.ForeignEnum.FOREIGN_FOO;
public global::Conformance.ForeignEnum OptionalForeignEnum {
@@ -856,6 +929,7 @@
}
}
+ /// <summary>Field number for the "optional_string_piece" field.</summary>
public const int OptionalStringPieceFieldNumber = 24;
private string optionalStringPiece_ = "";
public string OptionalStringPiece {
@@ -865,6 +939,7 @@
}
}
+ /// <summary>Field number for the "optional_cord" field.</summary>
public const int OptionalCordFieldNumber = 25;
private string optionalCord_ = "";
public string OptionalCord {
@@ -874,6 +949,7 @@
}
}
+ /// <summary>Field number for the "recursive_message" field.</summary>
public const int RecursiveMessageFieldNumber = 27;
private global::Conformance.TestAllTypes recursiveMessage_;
public global::Conformance.TestAllTypes RecursiveMessage {
@@ -883,14 +959,19 @@
}
}
+ /// <summary>Field number for the "repeated_int32" field.</summary>
public const int RepeatedInt32FieldNumber = 31;
private static readonly pb::FieldCodec<int> _repeated_repeatedInt32_codec
= pb::FieldCodec.ForInt32(250);
private readonly pbc::RepeatedField<int> repeatedInt32_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Repeated
+ /// </summary>
public pbc::RepeatedField<int> RepeatedInt32 {
get { return repeatedInt32_; }
}
+ /// <summary>Field number for the "repeated_int64" field.</summary>
public const int RepeatedInt64FieldNumber = 32;
private static readonly pb::FieldCodec<long> _repeated_repeatedInt64_codec
= pb::FieldCodec.ForInt64(258);
@@ -899,6 +980,7 @@
get { return repeatedInt64_; }
}
+ /// <summary>Field number for the "repeated_uint32" field.</summary>
public const int RepeatedUint32FieldNumber = 33;
private static readonly pb::FieldCodec<uint> _repeated_repeatedUint32_codec
= pb::FieldCodec.ForUInt32(266);
@@ -907,6 +989,7 @@
get { return repeatedUint32_; }
}
+ /// <summary>Field number for the "repeated_uint64" field.</summary>
public const int RepeatedUint64FieldNumber = 34;
private static readonly pb::FieldCodec<ulong> _repeated_repeatedUint64_codec
= pb::FieldCodec.ForUInt64(274);
@@ -915,6 +998,7 @@
get { return repeatedUint64_; }
}
+ /// <summary>Field number for the "repeated_sint32" field.</summary>
public const int RepeatedSint32FieldNumber = 35;
private static readonly pb::FieldCodec<int> _repeated_repeatedSint32_codec
= pb::FieldCodec.ForSInt32(282);
@@ -923,6 +1007,7 @@
get { return repeatedSint32_; }
}
+ /// <summary>Field number for the "repeated_sint64" field.</summary>
public const int RepeatedSint64FieldNumber = 36;
private static readonly pb::FieldCodec<long> _repeated_repeatedSint64_codec
= pb::FieldCodec.ForSInt64(290);
@@ -931,6 +1016,7 @@
get { return repeatedSint64_; }
}
+ /// <summary>Field number for the "repeated_fixed32" field.</summary>
public const int RepeatedFixed32FieldNumber = 37;
private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec
= pb::FieldCodec.ForFixed32(298);
@@ -939,6 +1025,7 @@
get { return repeatedFixed32_; }
}
+ /// <summary>Field number for the "repeated_fixed64" field.</summary>
public const int RepeatedFixed64FieldNumber = 38;
private static readonly pb::FieldCodec<ulong> _repeated_repeatedFixed64_codec
= pb::FieldCodec.ForFixed64(306);
@@ -947,6 +1034,7 @@
get { return repeatedFixed64_; }
}
+ /// <summary>Field number for the "repeated_sfixed32" field.</summary>
public const int RepeatedSfixed32FieldNumber = 39;
private static readonly pb::FieldCodec<int> _repeated_repeatedSfixed32_codec
= pb::FieldCodec.ForSFixed32(314);
@@ -955,6 +1043,7 @@
get { return repeatedSfixed32_; }
}
+ /// <summary>Field number for the "repeated_sfixed64" field.</summary>
public const int RepeatedSfixed64FieldNumber = 40;
private static readonly pb::FieldCodec<long> _repeated_repeatedSfixed64_codec
= pb::FieldCodec.ForSFixed64(322);
@@ -963,6 +1052,7 @@
get { return repeatedSfixed64_; }
}
+ /// <summary>Field number for the "repeated_float" field.</summary>
public const int RepeatedFloatFieldNumber = 41;
private static readonly pb::FieldCodec<float> _repeated_repeatedFloat_codec
= pb::FieldCodec.ForFloat(330);
@@ -971,6 +1061,7 @@
get { return repeatedFloat_; }
}
+ /// <summary>Field number for the "repeated_double" field.</summary>
public const int RepeatedDoubleFieldNumber = 42;
private static readonly pb::FieldCodec<double> _repeated_repeatedDouble_codec
= pb::FieldCodec.ForDouble(338);
@@ -979,6 +1070,7 @@
get { return repeatedDouble_; }
}
+ /// <summary>Field number for the "repeated_bool" field.</summary>
public const int RepeatedBoolFieldNumber = 43;
private static readonly pb::FieldCodec<bool> _repeated_repeatedBool_codec
= pb::FieldCodec.ForBool(346);
@@ -987,6 +1079,7 @@
get { return repeatedBool_; }
}
+ /// <summary>Field number for the "repeated_string" field.</summary>
public const int RepeatedStringFieldNumber = 44;
private static readonly pb::FieldCodec<string> _repeated_repeatedString_codec
= pb::FieldCodec.ForString(354);
@@ -995,6 +1088,7 @@
get { return repeatedString_; }
}
+ /// <summary>Field number for the "repeated_bytes" field.</summary>
public const int RepeatedBytesFieldNumber = 45;
private static readonly pb::FieldCodec<pb::ByteString> _repeated_repeatedBytes_codec
= pb::FieldCodec.ForBytes(362);
@@ -1003,6 +1097,7 @@
get { return repeatedBytes_; }
}
+ /// <summary>Field number for the "repeated_nested_message" field.</summary>
public const int RepeatedNestedMessageFieldNumber = 48;
private static readonly pb::FieldCodec<global::Conformance.TestAllTypes.Types.NestedMessage> _repeated_repeatedNestedMessage_codec
= pb::FieldCodec.ForMessage(386, global::Conformance.TestAllTypes.Types.NestedMessage.Parser);
@@ -1011,6 +1106,7 @@
get { return repeatedNestedMessage_; }
}
+ /// <summary>Field number for the "repeated_foreign_message" field.</summary>
public const int RepeatedForeignMessageFieldNumber = 49;
private static readonly pb::FieldCodec<global::Conformance.ForeignMessage> _repeated_repeatedForeignMessage_codec
= pb::FieldCodec.ForMessage(394, global::Conformance.ForeignMessage.Parser);
@@ -1019,6 +1115,7 @@
get { return repeatedForeignMessage_; }
}
+ /// <summary>Field number for the "repeated_nested_enum" field.</summary>
public const int RepeatedNestedEnumFieldNumber = 51;
private static readonly pb::FieldCodec<global::Conformance.TestAllTypes.Types.NestedEnum> _repeated_repeatedNestedEnum_codec
= pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::Conformance.TestAllTypes.Types.NestedEnum) x);
@@ -1027,6 +1124,7 @@
get { return repeatedNestedEnum_; }
}
+ /// <summary>Field number for the "repeated_foreign_enum" field.</summary>
public const int RepeatedForeignEnumFieldNumber = 52;
private static readonly pb::FieldCodec<global::Conformance.ForeignEnum> _repeated_repeatedForeignEnum_codec
= pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::Conformance.ForeignEnum) x);
@@ -1035,6 +1133,7 @@
get { return repeatedForeignEnum_; }
}
+ /// <summary>Field number for the "repeated_string_piece" field.</summary>
public const int RepeatedStringPieceFieldNumber = 54;
private static readonly pb::FieldCodec<string> _repeated_repeatedStringPiece_codec
= pb::FieldCodec.ForString(434);
@@ -1043,6 +1142,7 @@
get { return repeatedStringPiece_; }
}
+ /// <summary>Field number for the "repeated_cord" field.</summary>
public const int RepeatedCordFieldNumber = 55;
private static readonly pb::FieldCodec<string> _repeated_repeatedCord_codec
= pb::FieldCodec.ForString(442);
@@ -1051,14 +1151,19 @@
get { return repeatedCord_; }
}
+ /// <summary>Field number for the "map_int32_int32" field.</summary>
public const int MapInt32Int32FieldNumber = 56;
private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 450);
private readonly pbc::MapField<int, int> mapInt32Int32_ = new pbc::MapField<int, int>();
+ /// <summary>
+ /// Map
+ /// </summary>
public pbc::MapField<int, int> MapInt32Int32 {
get { return mapInt32Int32_; }
}
+ /// <summary>Field number for the "map_int64_int64" field.</summary>
public const int MapInt64Int64FieldNumber = 57;
private static readonly pbc::MapField<long, long>.Codec _map_mapInt64Int64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 458);
@@ -1067,6 +1172,7 @@
get { return mapInt64Int64_; }
}
+ /// <summary>Field number for the "map_uint32_uint32" field.</summary>
public const int MapUint32Uint32FieldNumber = 58;
private static readonly pbc::MapField<uint, uint>.Codec _map_mapUint32Uint32_codec
= new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 466);
@@ -1075,6 +1181,7 @@
get { return mapUint32Uint32_; }
}
+ /// <summary>Field number for the "map_uint64_uint64" field.</summary>
public const int MapUint64Uint64FieldNumber = 59;
private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapUint64Uint64_codec
= new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 474);
@@ -1083,6 +1190,7 @@
get { return mapUint64Uint64_; }
}
+ /// <summary>Field number for the "map_sint32_sint32" field.</summary>
public const int MapSint32Sint32FieldNumber = 60;
private static readonly pbc::MapField<int, int>.Codec _map_mapSint32Sint32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 482);
@@ -1091,6 +1199,7 @@
get { return mapSint32Sint32_; }
}
+ /// <summary>Field number for the "map_sint64_sint64" field.</summary>
public const int MapSint64Sint64FieldNumber = 61;
private static readonly pbc::MapField<long, long>.Codec _map_mapSint64Sint64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 490);
@@ -1099,6 +1208,7 @@
get { return mapSint64Sint64_; }
}
+ /// <summary>Field number for the "map_fixed32_fixed32" field.</summary>
public const int MapFixed32Fixed32FieldNumber = 62;
private static readonly pbc::MapField<uint, uint>.Codec _map_mapFixed32Fixed32_codec
= new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 498);
@@ -1107,6 +1217,7 @@
get { return mapFixed32Fixed32_; }
}
+ /// <summary>Field number for the "map_fixed64_fixed64" field.</summary>
public const int MapFixed64Fixed64FieldNumber = 63;
private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapFixed64Fixed64_codec
= new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 506);
@@ -1115,6 +1226,7 @@
get { return mapFixed64Fixed64_; }
}
+ /// <summary>Field number for the "map_sfixed32_sfixed32" field.</summary>
public const int MapSfixed32Sfixed32FieldNumber = 64;
private static readonly pbc::MapField<int, int>.Codec _map_mapSfixed32Sfixed32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 514);
@@ -1123,6 +1235,7 @@
get { return mapSfixed32Sfixed32_; }
}
+ /// <summary>Field number for the "map_sfixed64_sfixed64" field.</summary>
public const int MapSfixed64Sfixed64FieldNumber = 65;
private static readonly pbc::MapField<long, long>.Codec _map_mapSfixed64Sfixed64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 522);
@@ -1131,6 +1244,7 @@
get { return mapSfixed64Sfixed64_; }
}
+ /// <summary>Field number for the "map_int32_float" field.</summary>
public const int MapInt32FloatFieldNumber = 66;
private static readonly pbc::MapField<int, float>.Codec _map_mapInt32Float_codec
= new pbc::MapField<int, float>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 530);
@@ -1139,6 +1253,7 @@
get { return mapInt32Float_; }
}
+ /// <summary>Field number for the "map_int32_double" field.</summary>
public const int MapInt32DoubleFieldNumber = 67;
private static readonly pbc::MapField<int, double>.Codec _map_mapInt32Double_codec
= new pbc::MapField<int, double>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 538);
@@ -1147,6 +1262,7 @@
get { return mapInt32Double_; }
}
+ /// <summary>Field number for the "map_bool_bool" field.</summary>
public const int MapBoolBoolFieldNumber = 68;
private static readonly pbc::MapField<bool, bool>.Codec _map_mapBoolBool_codec
= new pbc::MapField<bool, bool>.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 546);
@@ -1155,6 +1271,7 @@
get { return mapBoolBool_; }
}
+ /// <summary>Field number for the "map_string_string" field.</summary>
public const int MapStringStringFieldNumber = 69;
private static readonly pbc::MapField<string, string>.Codec _map_mapStringString_codec
= new pbc::MapField<string, string>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 554);
@@ -1163,6 +1280,7 @@
get { return mapStringString_; }
}
+ /// <summary>Field number for the "map_string_bytes" field.</summary>
public const int MapStringBytesFieldNumber = 70;
private static readonly pbc::MapField<string, pb::ByteString>.Codec _map_mapStringBytes_codec
= new pbc::MapField<string, pb::ByteString>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForBytes(18), 562);
@@ -1171,6 +1289,7 @@
get { return mapStringBytes_; }
}
+ /// <summary>Field number for the "map_string_nested_message" field.</summary>
public const int MapStringNestedMessageFieldNumber = 71;
private static readonly pbc::MapField<string, global::Conformance.TestAllTypes.Types.NestedMessage>.Codec _map_mapStringNestedMessage_codec
= new pbc::MapField<string, global::Conformance.TestAllTypes.Types.NestedMessage>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Conformance.TestAllTypes.Types.NestedMessage.Parser), 570);
@@ -1179,6 +1298,7 @@
get { return mapStringNestedMessage_; }
}
+ /// <summary>Field number for the "map_string_foreign_message" field.</summary>
public const int MapStringForeignMessageFieldNumber = 72;
private static readonly pbc::MapField<string, global::Conformance.ForeignMessage>.Codec _map_mapStringForeignMessage_codec
= new pbc::MapField<string, global::Conformance.ForeignMessage>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Conformance.ForeignMessage.Parser), 578);
@@ -1187,6 +1307,7 @@
get { return mapStringForeignMessage_; }
}
+ /// <summary>Field number for the "map_string_nested_enum" field.</summary>
public const int MapStringNestedEnumFieldNumber = 73;
private static readonly pbc::MapField<string, global::Conformance.TestAllTypes.Types.NestedEnum>.Codec _map_mapStringNestedEnum_codec
= new pbc::MapField<string, global::Conformance.TestAllTypes.Types.NestedEnum>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Conformance.TestAllTypes.Types.NestedEnum) x), 586);
@@ -1195,6 +1316,7 @@
get { return mapStringNestedEnum_; }
}
+ /// <summary>Field number for the "map_string_foreign_enum" field.</summary>
public const int MapStringForeignEnumFieldNumber = 74;
private static readonly pbc::MapField<string, global::Conformance.ForeignEnum>.Codec _map_mapStringForeignEnum_codec
= new pbc::MapField<string, global::Conformance.ForeignEnum>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Conformance.ForeignEnum) x), 594);
@@ -1203,6 +1325,7 @@
get { return mapStringForeignEnum_; }
}
+ /// <summary>Field number for the "oneof_uint32" field.</summary>
public const int OneofUint32FieldNumber = 111;
public uint OneofUint32 {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; }
@@ -1212,6 +1335,7 @@
}
}
+ /// <summary>Field number for the "oneof_nested_message" field.</summary>
public const int OneofNestedMessageFieldNumber = 112;
public global::Conformance.TestAllTypes.Types.NestedMessage OneofNestedMessage {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Conformance.TestAllTypes.Types.NestedMessage) oneofField_ : null; }
@@ -1221,6 +1345,7 @@
}
}
+ /// <summary>Field number for the "oneof_string" field.</summary>
public const int OneofStringFieldNumber = 113;
public string OneofString {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; }
@@ -1230,6 +1355,7 @@
}
}
+ /// <summary>Field number for the "oneof_bytes" field.</summary>
public const int OneofBytesFieldNumber = 114;
public pb::ByteString OneofBytes {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; }
@@ -1240,6 +1366,7 @@
}
private object oneofField_;
+ /// <summary>Enum of possible cases for the "oneof_field" oneof.</summary>
public enum OneofFieldOneofCase {
None = 0,
OneofUint32 = 111,
@@ -2123,12 +2250,16 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the TestAllTypes message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
public enum NestedEnum {
FOO = 0,
BAR = 1,
BAZ = 2,
+ /// <summary>
+ /// Intentionally negative.
+ /// </summary>
NEG = -1,
}
@@ -2160,6 +2291,7 @@
return new NestedMessage(this);
}
+ /// <summary>Field number for the "a" field.</summary>
public const int AFieldNumber = 1;
private int a_;
public int A {
@@ -2169,6 +2301,7 @@
}
}
+ /// <summary>Field number for the "corecursive" field.</summary>
public const int CorecursiveFieldNumber = 2;
private global::Conformance.TestAllTypes corecursive_;
public global::Conformance.TestAllTypes Corecursive {
@@ -2298,6 +2431,7 @@
return new ForeignMessage(this);
}
+ /// <summary>Field number for the "c" field.</summary>
public const int CFieldNumber = 1;
private int c_;
public int C {
diff --git a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
index 29c4c2a..ba82c0e 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
@@ -562,6 +562,20 @@
Assert.IsFalse(values.Contains(null));
}
+ [Test]
+ public void ToString_StringToString()
+ {
+ var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } };
+ Assert.AreEqual("{ \"foo\": \"bar\", \"x\": \"y\" }", map.ToString());
+ }
+
+ [Test]
+ public void ToString_UnsupportedKeyType()
+ {
+ var map = new MapField<byte, string> { { 10, "foo" } };
+ Assert.Throws<ArgumentException>(() => map.ToString());
+ }
+
private static KeyValuePair<TKey, TValue> NewKeyValuePair<TKey, TValue>(TKey key, TValue value)
{
return new KeyValuePair<TKey, TValue>(key, value);
diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index 8c804fd..8ed54cf 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
@@ -37,6 +37,7 @@
using System.Linq;
using System.Text;
using Google.Protobuf.TestProtos;
+using Google.Protobuf.WellKnownTypes;
using NUnit.Framework;
namespace Google.Protobuf.Collections
@@ -599,5 +600,61 @@
list.Insert(1, "middle");
CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list);
}
+
+ [Test]
+ public void ToString_Integers()
+ {
+ var list = new RepeatedField<int> { 5, 10, 20 };
+ var text = list.ToString();
+ Assert.AreEqual("[ 5, 10, 20 ]", text);
+ }
+
+ [Test]
+ public void ToString_Strings()
+ {
+ var list = new RepeatedField<string> { "x", "y", "z" };
+ var text = list.ToString();
+ Assert.AreEqual("[ \"x\", \"y\", \"z\" ]", text);
+ }
+
+ [Test]
+ public void ToString_Messages()
+ {
+ var list = new RepeatedField<TestAllTypes> { new TestAllTypes { SingleDouble = 1.5 }, new TestAllTypes { SingleInt32 = 10 } };
+ var text = list.ToString();
+ Assert.AreEqual("[ { \"singleDouble\": 1.5 }, { \"singleInt32\": 10 } ]", text);
+ }
+
+ [Test]
+ public void ToString_Empty()
+ {
+ var list = new RepeatedField<TestAllTypes> { };
+ var text = list.ToString();
+ Assert.AreEqual("[ ]", text);
+ }
+
+ [Test]
+ public void ToString_InvalidElementType()
+ {
+ var list = new RepeatedField<decimal> { 15m };
+ Assert.Throws<ArgumentException>(() => list.ToString());
+ }
+
+ [Test]
+ public void ToString_Timestamp()
+ {
+ var list = new RepeatedField<Timestamp> { Timestamp.FromDateTime(new DateTime(2015, 10, 1, 12, 34, 56, DateTimeKind.Utc)) };
+ var text = list.ToString();
+ Assert.AreEqual("[ \"2015-10-01T12:34:56Z\" ]", text);
+ }
+
+ [Test]
+ public void ToString_Struct()
+ {
+ var message = new Struct { Fields = { { "foo", new Value { NumberValue = 20 } } } };
+ var list = new RepeatedField<Struct> { message };
+ var text = list.ToString();
+ Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString());
+ }
}
}
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index d959382..33be5da 100644
--- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -109,6 +109,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestCornerCases.cs" />
<Compile Include="TestProtos\UnittestWellKnownTypes.cs" />
+ <Compile Include="WellKnownTypes\AnyTest.cs" />
<Compile Include="WellKnownTypes\DurationTest.cs" />
<Compile Include="WellKnownTypes\TimestampTest.cs" />
<Compile Include="WellKnownTypes\WrappersTest.cs" />
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
index e9e1819..e3991bc 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
+ /// <summary>Holder for reflection information generated from google/protobuf/map_unittest_proto3.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class MapUnittestProto3 {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/map_unittest_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,129 +23,129 @@
static MapUnittestProto3() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Cilnb29nbGUvcHJvdG9idWYvbWFwX3VuaXR0ZXN0X3Byb3RvMy5wcm90bxIR",
- "cHJ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 "bUVudHJ5EgsKA2tleRgBIAEoBRIpCgV2YWx1ZRgCIAEoDjIaLnByb3RvYnVm",
+ "X3VuaXR0ZXN0Lk1hcEVudW06AjgBGmAKG01hcEludDMyRm9yZWlnbk1lc3Nh",
+ "Z2VFbnRyeRILCgNrZXkYASABKAUSMAoFdmFsdWUYAiABKAsyIS5wcm90b2J1",
+ "Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZToCOAEi5AEKH01lc3NhZ2VDb250",
+ "YWluaW5nRW51bUNhbGxlZFR5cGUSSgoEdHlwZRgBIAMoCzI8LnByb3RvYnVm",
+ "X3VuaXR0ZXN0Lk1lc3NhZ2VDb250YWluaW5nRW51bUNhbGxlZFR5cGUuVHlw",
+ "ZUVudHJ5Gl8KCVR5cGVFbnRyeRILCgNrZXkYASABKAUSQQoFdmFsdWUYAiAB",
+ "KAsyMi5wcm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ0VudW1D",
+ "YWxsZWRUeXBlOgI4ASIUCgRUeXBlEgwKCFRZUEVfRk9PEAAinQEKH01lc3Nh",
+ "Z2VDb250YWluaW5nTWFwQ2FsbGVkRW50cnkSTAoFZW50cnkYASADKAsyPS5w",
+ "cm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ01hcENhbGxlZEVu",
+ "dHJ5LkVudHJ5RW50cnkaLAoKRW50cnlFbnRyeRILCgNrZXkYASABKAUSDQoF",
+ "dmFsdWUYAiABKAU6AjgBKj8KB01hcEVudW0SEAoMTUFQX0VOVU1fRk9PEAAS",
+ "EAoMTUFQX0VOVU1fQkFSEAESEAoMTUFQX0VOVU1fQkFaEAJCIPgBAaoCGkdv",
"b2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3.Descriptor, },
@@ -170,6 +172,9 @@
#endregion
#region Messages
+ /// <summary>
+ /// Tests maps.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestMap : pb::IMessage<TestMap> {
private static readonly pb::MessageParser<TestMap> _parser = new pb::MessageParser<TestMap>(() => new TestMap());
@@ -213,6 +218,7 @@
return new TestMap(this);
}
+ /// <summary>Field number for the "map_int32_int32" field.</summary>
public const int MapInt32Int32FieldNumber = 1;
private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
@@ -221,6 +227,7 @@
get { return mapInt32Int32_; }
}
+ /// <summary>Field number for the "map_int64_int64" field.</summary>
public const int MapInt64Int64FieldNumber = 2;
private static readonly pbc::MapField<long, long>.Codec _map_mapInt64Int64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18);
@@ -229,6 +236,7 @@
get { return mapInt64Int64_; }
}
+ /// <summary>Field number for the "map_uint32_uint32" field.</summary>
public const int MapUint32Uint32FieldNumber = 3;
private static readonly pbc::MapField<uint, uint>.Codec _map_mapUint32Uint32_codec
= new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26);
@@ -237,6 +245,7 @@
get { return mapUint32Uint32_; }
}
+ /// <summary>Field number for the "map_uint64_uint64" field.</summary>
public const int MapUint64Uint64FieldNumber = 4;
private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapUint64Uint64_codec
= new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34);
@@ -245,6 +254,7 @@
get { return mapUint64Uint64_; }
}
+ /// <summary>Field number for the "map_sint32_sint32" field.</summary>
public const int MapSint32Sint32FieldNumber = 5;
private static readonly pbc::MapField<int, int>.Codec _map_mapSint32Sint32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42);
@@ -253,6 +263,7 @@
get { return mapSint32Sint32_; }
}
+ /// <summary>Field number for the "map_sint64_sint64" field.</summary>
public const int MapSint64Sint64FieldNumber = 6;
private static readonly pbc::MapField<long, long>.Codec _map_mapSint64Sint64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50);
@@ -261,6 +272,7 @@
get { return mapSint64Sint64_; }
}
+ /// <summary>Field number for the "map_fixed32_fixed32" field.</summary>
public const int MapFixed32Fixed32FieldNumber = 7;
private static readonly pbc::MapField<uint, uint>.Codec _map_mapFixed32Fixed32_codec
= new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58);
@@ -269,6 +281,7 @@
get { return mapFixed32Fixed32_; }
}
+ /// <summary>Field number for the "map_fixed64_fixed64" field.</summary>
public const int MapFixed64Fixed64FieldNumber = 8;
private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapFixed64Fixed64_codec
= new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66);
@@ -277,6 +290,7 @@
get { return mapFixed64Fixed64_; }
}
+ /// <summary>Field number for the "map_sfixed32_sfixed32" field.</summary>
public const int MapSfixed32Sfixed32FieldNumber = 9;
private static readonly pbc::MapField<int, int>.Codec _map_mapSfixed32Sfixed32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74);
@@ -285,6 +299,7 @@
get { return mapSfixed32Sfixed32_; }
}
+ /// <summary>Field number for the "map_sfixed64_sfixed64" field.</summary>
public const int MapSfixed64Sfixed64FieldNumber = 10;
private static readonly pbc::MapField<long, long>.Codec _map_mapSfixed64Sfixed64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82);
@@ -293,6 +308,7 @@
get { return mapSfixed64Sfixed64_; }
}
+ /// <summary>Field number for the "map_int32_float" field.</summary>
public const int MapInt32FloatFieldNumber = 11;
private static readonly pbc::MapField<int, float>.Codec _map_mapInt32Float_codec
= new pbc::MapField<int, float>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90);
@@ -301,6 +317,7 @@
get { return mapInt32Float_; }
}
+ /// <summary>Field number for the "map_int32_double" field.</summary>
public const int MapInt32DoubleFieldNumber = 12;
private static readonly pbc::MapField<int, double>.Codec _map_mapInt32Double_codec
= new pbc::MapField<int, double>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98);
@@ -309,6 +326,7 @@
get { return mapInt32Double_; }
}
+ /// <summary>Field number for the "map_bool_bool" field.</summary>
public const int MapBoolBoolFieldNumber = 13;
private static readonly pbc::MapField<bool, bool>.Codec _map_mapBoolBool_codec
= new pbc::MapField<bool, bool>.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106);
@@ -317,6 +335,7 @@
get { return mapBoolBool_; }
}
+ /// <summary>Field number for the "map_string_string" field.</summary>
public const int MapStringStringFieldNumber = 14;
private static readonly pbc::MapField<string, string>.Codec _map_mapStringString_codec
= new pbc::MapField<string, string>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 114);
@@ -325,6 +344,7 @@
get { return mapStringString_; }
}
+ /// <summary>Field number for the "map_int32_bytes" field.</summary>
public const int MapInt32BytesFieldNumber = 15;
private static readonly pbc::MapField<int, pb::ByteString>.Codec _map_mapInt32Bytes_codec
= new pbc::MapField<int, pb::ByteString>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForBytes(18), 122);
@@ -333,6 +353,7 @@
get { return mapInt32Bytes_; }
}
+ /// <summary>Field number for the "map_int32_enum" field.</summary>
public const int MapInt32EnumFieldNumber = 16;
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec _map_mapInt32Enum_codec
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 130);
@@ -341,6 +362,7 @@
get { return mapInt32Enum_; }
}
+ /// <summary>Field number for the "map_int32_foreign_message" field.</summary>
public const int MapInt32ForeignMessageFieldNumber = 17;
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec _map_mapInt32ForeignMessage_codec
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 138);
@@ -579,6 +601,7 @@
return new TestMapSubmessage(this);
}
+ /// <summary>Field number for the "test_map" field.</summary>
public const int TestMapFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestMap testMap_;
public global::Google.Protobuf.TestProtos.TestMap TestMap {
@@ -687,6 +710,7 @@
return new TestMessageMap(this);
}
+ /// <summary>Field number for the "map_int32_message" field.</summary>
public const int MapInt32MessageFieldNumber = 1;
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec _map_mapInt32Message_codec
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10);
@@ -754,6 +778,9 @@
}
+ /// <summary>
+ /// Two map fields share the same entry default instance.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestSameTypeMap : pb::IMessage<TestSameTypeMap> {
private static readonly pb::MessageParser<TestSameTypeMap> _parser = new pb::MessageParser<TestSameTypeMap>(() => new TestSameTypeMap());
@@ -782,6 +809,7 @@
return new TestSameTypeMap(this);
}
+ /// <summary>Field number for the "map1" field.</summary>
public const int Map1FieldNumber = 1;
private static readonly pbc::MapField<int, int>.Codec _map_map1_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
@@ -790,6 +818,7 @@
get { return map1_; }
}
+ /// <summary>Field number for the "map2" field.</summary>
public const int Map2FieldNumber = 2;
private static readonly pbc::MapField<int, int>.Codec _map_map2_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 18);
@@ -907,6 +936,7 @@
return new TestArenaMap(this);
}
+ /// <summary>Field number for the "map_int32_int32" field.</summary>
public const int MapInt32Int32FieldNumber = 1;
private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
@@ -915,6 +945,7 @@
get { return mapInt32Int32_; }
}
+ /// <summary>Field number for the "map_int64_int64" field.</summary>
public const int MapInt64Int64FieldNumber = 2;
private static readonly pbc::MapField<long, long>.Codec _map_mapInt64Int64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18);
@@ -923,6 +954,7 @@
get { return mapInt64Int64_; }
}
+ /// <summary>Field number for the "map_uint32_uint32" field.</summary>
public const int MapUint32Uint32FieldNumber = 3;
private static readonly pbc::MapField<uint, uint>.Codec _map_mapUint32Uint32_codec
= new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26);
@@ -931,6 +963,7 @@
get { return mapUint32Uint32_; }
}
+ /// <summary>Field number for the "map_uint64_uint64" field.</summary>
public const int MapUint64Uint64FieldNumber = 4;
private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapUint64Uint64_codec
= new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34);
@@ -939,6 +972,7 @@
get { return mapUint64Uint64_; }
}
+ /// <summary>Field number for the "map_sint32_sint32" field.</summary>
public const int MapSint32Sint32FieldNumber = 5;
private static readonly pbc::MapField<int, int>.Codec _map_mapSint32Sint32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42);
@@ -947,6 +981,7 @@
get { return mapSint32Sint32_; }
}
+ /// <summary>Field number for the "map_sint64_sint64" field.</summary>
public const int MapSint64Sint64FieldNumber = 6;
private static readonly pbc::MapField<long, long>.Codec _map_mapSint64Sint64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50);
@@ -955,6 +990,7 @@
get { return mapSint64Sint64_; }
}
+ /// <summary>Field number for the "map_fixed32_fixed32" field.</summary>
public const int MapFixed32Fixed32FieldNumber = 7;
private static readonly pbc::MapField<uint, uint>.Codec _map_mapFixed32Fixed32_codec
= new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58);
@@ -963,6 +999,7 @@
get { return mapFixed32Fixed32_; }
}
+ /// <summary>Field number for the "map_fixed64_fixed64" field.</summary>
public const int MapFixed64Fixed64FieldNumber = 8;
private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapFixed64Fixed64_codec
= new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66);
@@ -971,6 +1008,7 @@
get { return mapFixed64Fixed64_; }
}
+ /// <summary>Field number for the "map_sfixed32_sfixed32" field.</summary>
public const int MapSfixed32Sfixed32FieldNumber = 9;
private static readonly pbc::MapField<int, int>.Codec _map_mapSfixed32Sfixed32_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74);
@@ -979,6 +1017,7 @@
get { return mapSfixed32Sfixed32_; }
}
+ /// <summary>Field number for the "map_sfixed64_sfixed64" field.</summary>
public const int MapSfixed64Sfixed64FieldNumber = 10;
private static readonly pbc::MapField<long, long>.Codec _map_mapSfixed64Sfixed64_codec
= new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82);
@@ -987,6 +1026,7 @@
get { return mapSfixed64Sfixed64_; }
}
+ /// <summary>Field number for the "map_int32_float" field.</summary>
public const int MapInt32FloatFieldNumber = 11;
private static readonly pbc::MapField<int, float>.Codec _map_mapInt32Float_codec
= new pbc::MapField<int, float>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90);
@@ -995,6 +1035,7 @@
get { return mapInt32Float_; }
}
+ /// <summary>Field number for the "map_int32_double" field.</summary>
public const int MapInt32DoubleFieldNumber = 12;
private static readonly pbc::MapField<int, double>.Codec _map_mapInt32Double_codec
= new pbc::MapField<int, double>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98);
@@ -1003,6 +1044,7 @@
get { return mapInt32Double_; }
}
+ /// <summary>Field number for the "map_bool_bool" field.</summary>
public const int MapBoolBoolFieldNumber = 13;
private static readonly pbc::MapField<bool, bool>.Codec _map_mapBoolBool_codec
= new pbc::MapField<bool, bool>.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106);
@@ -1011,6 +1053,7 @@
get { return mapBoolBool_; }
}
+ /// <summary>Field number for the "map_int32_enum" field.</summary>
public const int MapInt32EnumFieldNumber = 14;
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec _map_mapInt32Enum_codec
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 114);
@@ -1019,6 +1062,7 @@
get { return mapInt32Enum_; }
}
+ /// <summary>Field number for the "map_int32_foreign_message" field.</summary>
public const int MapInt32ForeignMessageFieldNumber = 15;
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec _map_mapInt32ForeignMessage_codec
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 122);
@@ -1212,6 +1256,10 @@
}
+ /// <summary>
+ /// Previously, message containing enum called Type cannot be used as value of
+ /// map field.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class MessageContainingEnumCalledType : pb::IMessage<MessageContainingEnumCalledType> {
private static readonly pb::MessageParser<MessageContainingEnumCalledType> _parser = new pb::MessageParser<MessageContainingEnumCalledType>(() => new MessageContainingEnumCalledType());
@@ -1239,6 +1287,7 @@
return new MessageContainingEnumCalledType(this);
}
+ /// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 1;
private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec _map_type_codec
= new pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10);
@@ -1305,6 +1354,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the MessageContainingEnumCalledType message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
public enum Type {
@@ -1316,6 +1366,9 @@
}
+ /// <summary>
+ /// Previously, message cannot contain map field called "entry".
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class MessageContainingMapCalledEntry : pb::IMessage<MessageContainingMapCalledEntry> {
private static readonly pb::MessageParser<MessageContainingMapCalledEntry> _parser = new pb::MessageParser<MessageContainingMapCalledEntry>(() => new MessageContainingMapCalledEntry());
@@ -1343,6 +1396,7 @@
return new MessageContainingMapCalledEntry(this);
}
+ /// <summary>Field number for the "entry" field.</summary>
public const int EntryFieldNumber = 1;
private static readonly pbc::MapField<int, int>.Codec _map_entry_codec
= new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
index bf527ac..a55c66e 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_import_proto3.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class UnittestImportProto3 {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/unittest_import_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,13 +23,13 @@
static UnittestImportProto3() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Cixnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90",
- "bxIYcHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0GjNnb29nbGUvcHJvdG9idWYv",
- "dW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90bzMucHJvdG8iGgoNSW1wb3J0",
- "TWVzc2FnZRIJCgFkGAEgASgFKlkKCkltcG9ydEVudW0SGwoXSU1QT1JUX0VO",
- "VU1fVU5TUEVDSUZJRUQQABIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JB",
- "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl",
- "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv",
+ "Cixnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90",
+ "bxIYcHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0GjNnb29nbGUvcHJvdG9idWYv",
+ "dW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90bzMucHJvdG8iGgoNSW1wb3J0",
+ "TWVzc2FnZRIJCgFkGAEgASgFKlkKCkltcG9ydEVudW0SGwoXSU1QT1JUX0VO",
+ "VU1fVU5TUEVDSUZJRUQQABIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JB",
+ "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl",
+ "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv",
"Mw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3.Descriptor, },
@@ -76,6 +78,7 @@
return new ImportMessage(this);
}
+ /// <summary>Field number for the "d" field.</summary>
public const int DFieldNumber = 1;
private int d_;
public int D {
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
index ec46090..81696d7 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_import_public_proto3.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class UnittestImportPublicProto3 {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/unittest_import_public_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,9 +23,9 @@
static UnittestImportPublicProto3() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CjNnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90",
- "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ",
- "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1",
+ "CjNnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90",
+ "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ",
+ "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1",
"Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -62,6 +64,7 @@
return new PublicImportMessage(this);
}
+ /// <summary>Field number for the "e" field.</summary>
public const int EFieldNumber = 1;
private int e_;
public int E {
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
index 63119a3..addec05 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace UnitTest.Issues.TestProtos {
+ /// <summary>Holder for reflection information generated from unittest_issues.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class UnittestIssues {
#region Descriptor
+ /// <summary>File descriptor for unittest_issues.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,28 +23,28 @@
static UnittestIssues() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChV1bml0dGVzdF9pc3N1ZXMucHJvdG8SD3VuaXR0ZXN0X2lzc3VlcyInCghJ",
- "c3N1ZTMwNxobCgpOZXN0ZWRPbmNlGg0KC05lc3RlZFR3aWNlIrABChNOZWdh",
- "dGl2ZUVudW1NZXNzYWdlEiwKBXZhbHVlGAEgASgOMh0udW5pdHRlc3RfaXNz",
- "dWVzLk5lZ2F0aXZlRW51bRIxCgZ2YWx1ZXMYAiADKA4yHS51bml0dGVzdF9p",
- "c3N1ZXMuTmVnYXRpdmVFbnVtQgIQABI4Cg1wYWNrZWRfdmFsdWVzGAMgAygO",
- "Mh0udW5pdHRlc3RfaXNzdWVzLk5lZ2F0aXZlRW51bUICEAEiEQoPRGVwcmVj",
- "YXRlZENoaWxkIrkCChdEZXByZWNhdGVkRmllbGRzTWVzc2FnZRIaCg5Qcmlt",
- "aXRpdmVWYWx1ZRgBIAEoBUICGAESGgoOUHJpbWl0aXZlQXJyYXkYAiADKAVC",
- "AhgBEjoKDE1lc3NhZ2VWYWx1ZRgDIAEoCzIgLnVuaXR0ZXN0X2lzc3Vlcy5E",
- "ZXByZWNhdGVkQ2hpbGRCAhgBEjoKDE1lc3NhZ2VBcnJheRgEIAMoCzIgLnVu",
- "aXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgBEjYKCUVudW1WYWx1",
- "ZRgFIAEoDjIfLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkRW51bUICGAES",
- "NgoJRW51bUFycmF5GAYgAygOMh8udW5pdHRlc3RfaXNzdWVzLkRlcHJlY2F0",
- "ZWRFbnVtQgIYASIZCglJdGVtRmllbGQSDAoEaXRlbRgBIAEoBSJECg1SZXNl",
- "cnZlZE5hbWVzEg0KBXR5cGVzGAEgASgFEhIKCmRlc2NyaXB0b3IYAiABKAUa",
- "EAoOU29tZU5lc3RlZFR5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LnVu",
+ "aXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgBEjYKCUVudW1WYWx1",
+ "ZRgFIAEoDjIfLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkRW51bUICGAES",
+ "NgoJRW51bUFycmF5GAYgAygOMh8udW5pdHRlc3RfaXNzdWVzLkRlcHJlY2F0",
+ "ZWRFbnVtQgIYASIZCglJdGVtRmllbGQSDAoEaXRlbRgBIAEoBSJECg1SZXNl",
+ "cnZlZE5hbWVzEg0KBXR5cGVzGAEgASgFEhIKCmRlc2NyaXB0b3IYAiABKAUa",
+ "EAoOU29tZU5lc3RlZFR5cGUioAEKFVRlc3RKc29uRmllbGRPcmRlcmluZxIT",
+ "CgtwbGFpbl9pbnQzMhgEIAEoBRITCglvMV9zdHJpbmcYAiABKAlIABISCghv",
+ "MV9pbnQzMhgFIAEoBUgAEhQKDHBsYWluX3N0cmluZxgBIAEoCRISCghvMl9p",
+ "bnQzMhgGIAEoBUgBEhMKCW8yX3N0cmluZxgDIAEoCUgBQgQKAm8xQgQKAm8y",
+ "KlUKDE5lZ2F0aXZlRW51bRIWChJORUdBVElWRV9FTlVNX1pFUk8QABIWCglG",
+ "aXZlQmVsb3cQ+///////////ARIVCghNaW51c09uZRD///////////8BKi4K",
+ "DkRlcHJlY2F0ZWRFbnVtEhMKD0RFUFJFQ0FURURfWkVSTxAAEgcKA29uZRAB",
"Qh9IAaoCGlVuaXRUZXN0Lklzc3Vlcy5UZXN0UHJvdG9zYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -74,6 +76,10 @@
#endregion
#region Messages
+ /// <summary>
+ /// Issue 307: when generating doubly-nested types, any references
+ /// should be of the form A.Types.B.Types.C.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Issue307 : pb::IMessage<Issue307> {
private static readonly pb::MessageParser<Issue307> _parser = new pb::MessageParser<Issue307>(() => new Issue307());
@@ -149,6 +155,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the Issue307 message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -226,6 +233,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the NestedOnce message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -343,6 +351,7 @@
return new NegativeEnumMessage(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO;
public global::UnitTest.Issues.TestProtos.NegativeEnum Value {
@@ -352,6 +361,7 @@
}
}
+ /// <summary>Field number for the "values" field.</summary>
public const int ValuesFieldNumber = 2;
private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.NegativeEnum> _repeated_values_codec
= pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::UnitTest.Issues.TestProtos.NegativeEnum) x);
@@ -360,6 +370,7 @@
get { return values_; }
}
+ /// <summary>Field number for the "packed_values" field.</summary>
public const int PackedValuesFieldNumber = 3;
private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.NegativeEnum> _repeated_packedValues_codec
= pb::FieldCodec.ForEnum(26, x => (int) x, x => (global::UnitTest.Issues.TestProtos.NegativeEnum) x);
@@ -562,6 +573,7 @@
return new DeprecatedFieldsMessage(this);
}
+ /// <summary>Field number for the "PrimitiveValue" field.</summary>
public const int PrimitiveValueFieldNumber = 1;
private int primitiveValue_;
[global::System.ObsoleteAttribute()]
@@ -572,6 +584,7 @@
}
}
+ /// <summary>Field number for the "PrimitiveArray" field.</summary>
public const int PrimitiveArrayFieldNumber = 2;
private static readonly pb::FieldCodec<int> _repeated_primitiveArray_codec
= pb::FieldCodec.ForInt32(18);
@@ -581,6 +594,7 @@
get { return primitiveArray_; }
}
+ /// <summary>Field number for the "MessageValue" field.</summary>
public const int MessageValueFieldNumber = 3;
private global::UnitTest.Issues.TestProtos.DeprecatedChild messageValue_;
[global::System.ObsoleteAttribute()]
@@ -591,6 +605,7 @@
}
}
+ /// <summary>Field number for the "MessageArray" field.</summary>
public const int MessageArrayFieldNumber = 4;
private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.DeprecatedChild> _repeated_messageArray_codec
= pb::FieldCodec.ForMessage(34, global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser);
@@ -600,6 +615,7 @@
get { return messageArray_; }
}
+ /// <summary>Field number for the "EnumValue" field.</summary>
public const int EnumValueFieldNumber = 5;
private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO;
[global::System.ObsoleteAttribute()]
@@ -610,6 +626,7 @@
}
}
+ /// <summary>Field number for the "EnumArray" field.</summary>
public const int EnumArrayFieldNumber = 6;
private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.DeprecatedEnum> _repeated_enumArray_codec
= pb::FieldCodec.ForEnum(50, x => (int) x, x => (global::UnitTest.Issues.TestProtos.DeprecatedEnum) x);
@@ -752,6 +769,9 @@
}
+ /// <summary>
+ /// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ItemField : pb::IMessage<ItemField> {
private static readonly pb::MessageParser<ItemField> _parser = new pb::MessageParser<ItemField>(() => new ItemField());
@@ -779,6 +799,7 @@
return new ItemField(this);
}
+ /// <summary>Field number for the "item" field.</summary>
public const int ItemFieldNumber = 1;
private int item_;
public int Item {
@@ -882,6 +903,7 @@
return new ReservedNames(this);
}
+ /// <summary>Field number for the "types" field.</summary>
public const int Types_FieldNumber = 1;
private int types_;
public int Types_ {
@@ -891,6 +913,7 @@
}
}
+ /// <summary>Field number for the "descriptor" field.</summary>
public const int Descriptor_FieldNumber = 2;
private int descriptor_;
public int Descriptor_ {
@@ -981,8 +1004,12 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the ReservedNames message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
+ /// <summary>
+ /// Force a nested type called Types
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class SomeNestedType : pb::IMessage<SomeNestedType> {
private static readonly pb::MessageParser<SomeNestedType> _parser = new pb::MessageParser<SomeNestedType>(() => new SomeNestedType());
@@ -1064,6 +1091,18 @@
}
+ /// <summary>
+ /// These fields are deliberately not declared in numeric
+ /// order, and the oneof fields aren't contiguous either.
+ /// This allows for reasonably robust tests of JSON output
+ /// ordering.
+ /// TestFieldOrderings in unittest_proto3.proto is similar,
+ /// but doesn't include oneofs.
+ /// TODO: Consider adding oneofs to TestFieldOrderings, although
+ /// that will require fixing other tests in multiple platforms.
+ /// Alternatively, consider just adding this to
+ /// unittest_proto3.proto if multiple platforms want it.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestJsonFieldOrdering : pb::IMessage<TestJsonFieldOrdering> {
private static readonly pb::MessageParser<TestJsonFieldOrdering> _parser = new pb::MessageParser<TestJsonFieldOrdering>(() => new TestJsonFieldOrdering());
@@ -1110,6 +1149,7 @@
return new TestJsonFieldOrdering(this);
}
+ /// <summary>Field number for the "plain_int32" field.</summary>
public const int PlainInt32FieldNumber = 4;
private int plainInt32_;
public int PlainInt32 {
@@ -1119,6 +1159,7 @@
}
}
+ /// <summary>Field number for the "o1_string" field.</summary>
public const int O1StringFieldNumber = 2;
public string O1String {
get { return o1Case_ == O1OneofCase.O1String ? (string) o1_ : ""; }
@@ -1128,6 +1169,7 @@
}
}
+ /// <summary>Field number for the "o1_int32" field.</summary>
public const int O1Int32FieldNumber = 5;
public int O1Int32 {
get { return o1Case_ == O1OneofCase.O1Int32 ? (int) o1_ : 0; }
@@ -1137,6 +1179,7 @@
}
}
+ /// <summary>Field number for the "plain_string" field.</summary>
public const int PlainStringFieldNumber = 1;
private string plainString_ = "";
public string PlainString {
@@ -1146,6 +1189,7 @@
}
}
+ /// <summary>Field number for the "o2_int32" field.</summary>
public const int O2Int32FieldNumber = 6;
public int O2Int32 {
get { return o2Case_ == O2OneofCase.O2Int32 ? (int) o2_ : 0; }
@@ -1155,6 +1199,7 @@
}
}
+ /// <summary>Field number for the "o2_string" field.</summary>
public const int O2StringFieldNumber = 3;
public string O2String {
get { return o2Case_ == O2OneofCase.O2String ? (string) o2_ : ""; }
@@ -1165,6 +1210,7 @@
}
private object o1_;
+ /// <summary>Enum of possible cases for the "o1" oneof.</summary>
public enum O1OneofCase {
None = 0,
O1String = 2,
@@ -1181,6 +1227,7 @@
}
private object o2_;
+ /// <summary>Enum of possible cases for the "o2" oneof.</summary>
public enum O2OneofCase {
None = 0,
O2Int32 = 6,
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
index bf4590a..0c7b527 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_proto3.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class UnittestProto3 {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/unittest_proto3.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,132 +23,132 @@
static UnittestProto3() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfc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HEAIymQEK",
+ "C1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1Jl",
+ "cXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXIS",
+ "HS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5p",
+ "dHRlc3QuQmFyUmVzcG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB",
"+AEBqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3.Descriptor, },
@@ -197,6 +199,9 @@
FOREIGN_BAZ = 6,
}
+ /// <summary>
+ /// Test an enum that has multiple values with the same number.
+ /// </summary>
public enum TestEnumWithDupValue {
TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0,
FOO1 = 1,
@@ -206,6 +211,9 @@
BAR2 = 2,
}
+ /// <summary>
+ /// Test an enum with large, unordered values.
+ /// </summary>
public enum TestSparseEnum {
TEST_SPARSE_ENUM_UNSPECIFIED = 0,
SPARSE_A = 123,
@@ -213,12 +221,20 @@
SPARSE_C = 12589234,
SPARSE_D = -15,
SPARSE_E = -53452,
+ /// <summary>
+ /// In proto3, value 0 must be the first one specified
+ /// SPARSE_F = 0;
+ /// </summary>
SPARSE_G = 2,
}
#endregion
#region Messages
+ /// <summary>
+ /// This proto includes every type of field in both singular and repeated
+ /// forms.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes> {
private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes());
@@ -304,8 +320,12 @@
return new TestAllTypes(this);
}
+ /// <summary>Field number for the "single_int32" field.</summary>
public const int SingleInt32FieldNumber = 1;
private int singleInt32_;
+ /// <summary>
+ /// Singular
+ /// </summary>
public int SingleInt32 {
get { return singleInt32_; }
set {
@@ -313,6 +333,7 @@
}
}
+ /// <summary>Field number for the "single_int64" field.</summary>
public const int SingleInt64FieldNumber = 2;
private long singleInt64_;
public long SingleInt64 {
@@ -322,6 +343,7 @@
}
}
+ /// <summary>Field number for the "single_uint32" field.</summary>
public const int SingleUint32FieldNumber = 3;
private uint singleUint32_;
public uint SingleUint32 {
@@ -331,6 +353,7 @@
}
}
+ /// <summary>Field number for the "single_uint64" field.</summary>
public const int SingleUint64FieldNumber = 4;
private ulong singleUint64_;
public ulong SingleUint64 {
@@ -340,6 +363,7 @@
}
}
+ /// <summary>Field number for the "single_sint32" field.</summary>
public const int SingleSint32FieldNumber = 5;
private int singleSint32_;
public int SingleSint32 {
@@ -349,6 +373,7 @@
}
}
+ /// <summary>Field number for the "single_sint64" field.</summary>
public const int SingleSint64FieldNumber = 6;
private long singleSint64_;
public long SingleSint64 {
@@ -358,6 +383,7 @@
}
}
+ /// <summary>Field number for the "single_fixed32" field.</summary>
public const int SingleFixed32FieldNumber = 7;
private uint singleFixed32_;
public uint SingleFixed32 {
@@ -367,6 +393,7 @@
}
}
+ /// <summary>Field number for the "single_fixed64" field.</summary>
public const int SingleFixed64FieldNumber = 8;
private ulong singleFixed64_;
public ulong SingleFixed64 {
@@ -376,6 +403,7 @@
}
}
+ /// <summary>Field number for the "single_sfixed32" field.</summary>
public const int SingleSfixed32FieldNumber = 9;
private int singleSfixed32_;
public int SingleSfixed32 {
@@ -385,6 +413,7 @@
}
}
+ /// <summary>Field number for the "single_sfixed64" field.</summary>
public const int SingleSfixed64FieldNumber = 10;
private long singleSfixed64_;
public long SingleSfixed64 {
@@ -394,6 +423,7 @@
}
}
+ /// <summary>Field number for the "single_float" field.</summary>
public const int SingleFloatFieldNumber = 11;
private float singleFloat_;
public float SingleFloat {
@@ -403,6 +433,7 @@
}
}
+ /// <summary>Field number for the "single_double" field.</summary>
public const int SingleDoubleFieldNumber = 12;
private double singleDouble_;
public double SingleDouble {
@@ -412,6 +443,7 @@
}
}
+ /// <summary>Field number for the "single_bool" field.</summary>
public const int SingleBoolFieldNumber = 13;
private bool singleBool_;
public bool SingleBool {
@@ -421,6 +453,7 @@
}
}
+ /// <summary>Field number for the "single_string" field.</summary>
public const int SingleStringFieldNumber = 14;
private string singleString_ = "";
public string SingleString {
@@ -430,6 +463,7 @@
}
}
+ /// <summary>Field number for the "single_bytes" field.</summary>
public const int SingleBytesFieldNumber = 15;
private pb::ByteString singleBytes_ = pb::ByteString.Empty;
public pb::ByteString SingleBytes {
@@ -439,6 +473,7 @@
}
}
+ /// <summary>Field number for the "single_nested_message" field.</summary>
public const int SingleNestedMessageFieldNumber = 18;
private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage singleNestedMessage_;
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage SingleNestedMessage {
@@ -448,6 +483,7 @@
}
}
+ /// <summary>Field number for the "single_foreign_message" field.</summary>
public const int SingleForeignMessageFieldNumber = 19;
private global::Google.Protobuf.TestProtos.ForeignMessage singleForeignMessage_;
public global::Google.Protobuf.TestProtos.ForeignMessage SingleForeignMessage {
@@ -457,6 +493,7 @@
}
}
+ /// <summary>Field number for the "single_import_message" field.</summary>
public const int SingleImportMessageFieldNumber = 20;
private global::Google.Protobuf.TestProtos.ImportMessage singleImportMessage_;
public global::Google.Protobuf.TestProtos.ImportMessage SingleImportMessage {
@@ -466,6 +503,7 @@
}
}
+ /// <summary>Field number for the "single_nested_enum" field.</summary>
public const int SingleNestedEnumFieldNumber = 21;
private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum singleNestedEnum_ = global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.NESTED_ENUM_UNSPECIFIED;
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum SingleNestedEnum {
@@ -475,6 +513,7 @@
}
}
+ /// <summary>Field number for the "single_foreign_enum" field.</summary>
public const int SingleForeignEnumFieldNumber = 22;
private global::Google.Protobuf.TestProtos.ForeignEnum singleForeignEnum_ = global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED;
public global::Google.Protobuf.TestProtos.ForeignEnum SingleForeignEnum {
@@ -484,6 +523,7 @@
}
}
+ /// <summary>Field number for the "single_import_enum" field.</summary>
public const int SingleImportEnumFieldNumber = 23;
private global::Google.Protobuf.TestProtos.ImportEnum singleImportEnum_ = global::Google.Protobuf.TestProtos.ImportEnum.IMPORT_ENUM_UNSPECIFIED;
public global::Google.Protobuf.TestProtos.ImportEnum SingleImportEnum {
@@ -493,8 +533,12 @@
}
}
+ /// <summary>Field number for the "single_public_import_message" field.</summary>
public const int SinglePublicImportMessageFieldNumber = 26;
private global::Google.Protobuf.TestProtos.PublicImportMessage singlePublicImportMessage_;
+ /// <summary>
+ /// Defined in unittest_import_public.proto
+ /// </summary>
public global::Google.Protobuf.TestProtos.PublicImportMessage SinglePublicImportMessage {
get { return singlePublicImportMessage_; }
set {
@@ -502,14 +546,19 @@
}
}
+ /// <summary>Field number for the "repeated_int32" field.</summary>
public const int RepeatedInt32FieldNumber = 31;
private static readonly pb::FieldCodec<int> _repeated_repeatedInt32_codec
= pb::FieldCodec.ForInt32(250);
private readonly pbc::RepeatedField<int> repeatedInt32_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Repeated
+ /// </summary>
public pbc::RepeatedField<int> RepeatedInt32 {
get { return repeatedInt32_; }
}
+ /// <summary>Field number for the "repeated_int64" field.</summary>
public const int RepeatedInt64FieldNumber = 32;
private static readonly pb::FieldCodec<long> _repeated_repeatedInt64_codec
= pb::FieldCodec.ForInt64(258);
@@ -518,6 +567,7 @@
get { return repeatedInt64_; }
}
+ /// <summary>Field number for the "repeated_uint32" field.</summary>
public const int RepeatedUint32FieldNumber = 33;
private static readonly pb::FieldCodec<uint> _repeated_repeatedUint32_codec
= pb::FieldCodec.ForUInt32(266);
@@ -526,6 +576,7 @@
get { return repeatedUint32_; }
}
+ /// <summary>Field number for the "repeated_uint64" field.</summary>
public const int RepeatedUint64FieldNumber = 34;
private static readonly pb::FieldCodec<ulong> _repeated_repeatedUint64_codec
= pb::FieldCodec.ForUInt64(274);
@@ -534,6 +585,7 @@
get { return repeatedUint64_; }
}
+ /// <summary>Field number for the "repeated_sint32" field.</summary>
public const int RepeatedSint32FieldNumber = 35;
private static readonly pb::FieldCodec<int> _repeated_repeatedSint32_codec
= pb::FieldCodec.ForSInt32(282);
@@ -542,6 +594,7 @@
get { return repeatedSint32_; }
}
+ /// <summary>Field number for the "repeated_sint64" field.</summary>
public const int RepeatedSint64FieldNumber = 36;
private static readonly pb::FieldCodec<long> _repeated_repeatedSint64_codec
= pb::FieldCodec.ForSInt64(290);
@@ -550,6 +603,7 @@
get { return repeatedSint64_; }
}
+ /// <summary>Field number for the "repeated_fixed32" field.</summary>
public const int RepeatedFixed32FieldNumber = 37;
private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec
= pb::FieldCodec.ForFixed32(298);
@@ -558,6 +612,7 @@
get { return repeatedFixed32_; }
}
+ /// <summary>Field number for the "repeated_fixed64" field.</summary>
public const int RepeatedFixed64FieldNumber = 38;
private static readonly pb::FieldCodec<ulong> _repeated_repeatedFixed64_codec
= pb::FieldCodec.ForFixed64(306);
@@ -566,6 +621,7 @@
get { return repeatedFixed64_; }
}
+ /// <summary>Field number for the "repeated_sfixed32" field.</summary>
public const int RepeatedSfixed32FieldNumber = 39;
private static readonly pb::FieldCodec<int> _repeated_repeatedSfixed32_codec
= pb::FieldCodec.ForSFixed32(314);
@@ -574,6 +630,7 @@
get { return repeatedSfixed32_; }
}
+ /// <summary>Field number for the "repeated_sfixed64" field.</summary>
public const int RepeatedSfixed64FieldNumber = 40;
private static readonly pb::FieldCodec<long> _repeated_repeatedSfixed64_codec
= pb::FieldCodec.ForSFixed64(322);
@@ -582,6 +639,7 @@
get { return repeatedSfixed64_; }
}
+ /// <summary>Field number for the "repeated_float" field.</summary>
public const int RepeatedFloatFieldNumber = 41;
private static readonly pb::FieldCodec<float> _repeated_repeatedFloat_codec
= pb::FieldCodec.ForFloat(330);
@@ -590,6 +648,7 @@
get { return repeatedFloat_; }
}
+ /// <summary>Field number for the "repeated_double" field.</summary>
public const int RepeatedDoubleFieldNumber = 42;
private static readonly pb::FieldCodec<double> _repeated_repeatedDouble_codec
= pb::FieldCodec.ForDouble(338);
@@ -598,6 +657,7 @@
get { return repeatedDouble_; }
}
+ /// <summary>Field number for the "repeated_bool" field.</summary>
public const int RepeatedBoolFieldNumber = 43;
private static readonly pb::FieldCodec<bool> _repeated_repeatedBool_codec
= pb::FieldCodec.ForBool(346);
@@ -606,6 +666,7 @@
get { return repeatedBool_; }
}
+ /// <summary>Field number for the "repeated_string" field.</summary>
public const int RepeatedStringFieldNumber = 44;
private static readonly pb::FieldCodec<string> _repeated_repeatedString_codec
= pb::FieldCodec.ForString(354);
@@ -614,6 +675,7 @@
get { return repeatedString_; }
}
+ /// <summary>Field number for the "repeated_bytes" field.</summary>
public const int RepeatedBytesFieldNumber = 45;
private static readonly pb::FieldCodec<pb::ByteString> _repeated_repeatedBytes_codec
= pb::FieldCodec.ForBytes(362);
@@ -622,6 +684,7 @@
get { return repeatedBytes_; }
}
+ /// <summary>Field number for the "repeated_nested_message" field.</summary>
public const int RepeatedNestedMessageFieldNumber = 48;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage> _repeated_repeatedNestedMessage_codec
= pb::FieldCodec.ForMessage(386, global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage.Parser);
@@ -630,6 +693,7 @@
get { return repeatedNestedMessage_; }
}
+ /// <summary>Field number for the "repeated_foreign_message" field.</summary>
public const int RepeatedForeignMessageFieldNumber = 49;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignMessage> _repeated_repeatedForeignMessage_codec
= pb::FieldCodec.ForMessage(394, global::Google.Protobuf.TestProtos.ForeignMessage.Parser);
@@ -638,6 +702,7 @@
get { return repeatedForeignMessage_; }
}
+ /// <summary>Field number for the "repeated_import_message" field.</summary>
public const int RepeatedImportMessageFieldNumber = 50;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ImportMessage> _repeated_repeatedImportMessage_codec
= pb::FieldCodec.ForMessage(402, global::Google.Protobuf.TestProtos.ImportMessage.Parser);
@@ -646,6 +711,7 @@
get { return repeatedImportMessage_; }
}
+ /// <summary>Field number for the "repeated_nested_enum" field.</summary>
public const int RepeatedNestedEnumFieldNumber = 51;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum> _repeated_repeatedNestedEnum_codec
= pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) x);
@@ -654,6 +720,7 @@
get { return repeatedNestedEnum_; }
}
+ /// <summary>Field number for the "repeated_foreign_enum" field.</summary>
public const int RepeatedForeignEnumFieldNumber = 52;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_repeatedForeignEnum_codec
= pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
@@ -662,6 +729,7 @@
get { return repeatedForeignEnum_; }
}
+ /// <summary>Field number for the "repeated_import_enum" field.</summary>
public const int RepeatedImportEnumFieldNumber = 53;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ImportEnum> _repeated_repeatedImportEnum_codec
= pb::FieldCodec.ForEnum(426, x => (int) x, x => (global::Google.Protobuf.TestProtos.ImportEnum) x);
@@ -670,14 +738,19 @@
get { return repeatedImportEnum_; }
}
+ /// <summary>Field number for the "repeated_public_import_message" field.</summary>
public const int RepeatedPublicImportMessageFieldNumber = 54;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.PublicImportMessage> _repeated_repeatedPublicImportMessage_codec
= pb::FieldCodec.ForMessage(434, global::Google.Protobuf.TestProtos.PublicImportMessage.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.PublicImportMessage> repeatedPublicImportMessage_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.PublicImportMessage>();
+ /// <summary>
+ /// Defined in unittest_import_public.proto
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.TestProtos.PublicImportMessage> RepeatedPublicImportMessage {
get { return repeatedPublicImportMessage_; }
}
+ /// <summary>Field number for the "oneof_uint32" field.</summary>
public const int OneofUint32FieldNumber = 111;
public uint OneofUint32 {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; }
@@ -687,6 +760,7 @@
}
}
+ /// <summary>Field number for the "oneof_nested_message" field.</summary>
public const int OneofNestedMessageFieldNumber = 112;
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage OneofNestedMessage {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage) oneofField_ : null; }
@@ -696,6 +770,7 @@
}
}
+ /// <summary>Field number for the "oneof_string" field.</summary>
public const int OneofStringFieldNumber = 113;
public string OneofString {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; }
@@ -705,6 +780,7 @@
}
}
+ /// <summary>Field number for the "oneof_bytes" field.</summary>
public const int OneofBytesFieldNumber = 114;
public pb::ByteString OneofBytes {
get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; }
@@ -715,6 +791,7 @@
}
private object oneofField_;
+ /// <summary>Enum of possible cases for the "oneof_field" oneof.</summary>
public enum OneofFieldOneofCase {
None = 0,
OneofUint32 = 111,
@@ -1443,6 +1520,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the TestAllTypes message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
public enum NestedEnum {
@@ -1450,6 +1528,9 @@
FOO = 1,
BAR = 2,
BAZ = 3,
+ /// <summary>
+ /// Intentionally negative.
+ /// </summary>
NEG = -1,
}
@@ -1480,8 +1561,14 @@
return new NestedMessage(this);
}
+ /// <summary>Field number for the "bb" field.</summary>
public const int BbFieldNumber = 1;
private int bb_;
+ /// <summary>
+ /// The field name "b" fails to compile in proto1 because it conflicts with
+ /// a local variable named "b" in one of the generated methods. Doh.
+ /// This file needs to compile in proto1 to test backwards-compatibility.
+ /// </summary>
public int Bb {
get { return bb_; }
set {
@@ -1560,6 +1647,9 @@
}
+ /// <summary>
+ /// This proto includes a recusively nested message.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes> {
private static readonly pb::MessageParser<NestedTestAllTypes> _parser = new pb::MessageParser<NestedTestAllTypes>(() => new NestedTestAllTypes());
@@ -1589,6 +1679,7 @@
return new NestedTestAllTypes(this);
}
+ /// <summary>Field number for the "child" field.</summary>
public const int ChildFieldNumber = 1;
private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_;
public global::Google.Protobuf.TestProtos.NestedTestAllTypes Child {
@@ -1598,6 +1689,7 @@
}
}
+ /// <summary>Field number for the "payload" field.</summary>
public const int PayloadFieldNumber = 2;
private global::Google.Protobuf.TestProtos.TestAllTypes payload_;
public global::Google.Protobuf.TestProtos.TestAllTypes Payload {
@@ -1607,6 +1699,7 @@
}
}
+ /// <summary>Field number for the "repeated_child" field.</summary>
public const int RepeatedChildFieldNumber = 3;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.NestedTestAllTypes> _repeated_repeatedChild_codec
= pb::FieldCodec.ForMessage(26, global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser);
@@ -1745,6 +1838,7 @@
return new TestDeprecatedFields(this);
}
+ /// <summary>Field number for the "deprecated_int32" field.</summary>
public const int DeprecatedInt32FieldNumber = 1;
private int deprecatedInt32_;
[global::System.ObsoleteAttribute()]
@@ -1821,6 +1915,10 @@
}
+ /// <summary>
+ /// Define these after TestAllTypes to make sure the compiler can handle
+ /// that.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage> {
private static readonly pb::MessageParser<ForeignMessage> _parser = new pb::MessageParser<ForeignMessage>(() => new ForeignMessage());
@@ -1848,6 +1946,7 @@
return new ForeignMessage(this);
}
+ /// <summary>Field number for the "c" field.</summary>
public const int CFieldNumber = 1;
private int c_;
public int C {
@@ -1999,6 +2098,9 @@
}
+ /// <summary>
+ /// Test that we can use NestedMessage from outside TestAllTypes.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested> {
private static readonly pb::MessageParser<TestForeignNested> _parser = new pb::MessageParser<TestForeignNested>(() => new TestForeignNested());
@@ -2026,6 +2128,7 @@
return new TestForeignNested(this);
}
+ /// <summary>Field number for the "foreign_nested" field.</summary>
public const int ForeignNestedFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_;
public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested {
@@ -2107,6 +2210,9 @@
}
+ /// <summary>
+ /// Test that really large tag numbers don't break anything.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber> {
private static readonly pb::MessageParser<TestReallyLargeTagNumber> _parser = new pb::MessageParser<TestReallyLargeTagNumber>(() => new TestReallyLargeTagNumber());
@@ -2135,8 +2241,13 @@
return new TestReallyLargeTagNumber(this);
}
+ /// <summary>Field number for the "a" field.</summary>
public const int AFieldNumber = 1;
private int a_;
+ /// <summary>
+ /// The largest possible tag number is 2^28 - 1, since the wire format uses
+ /// three bits to communicate wire type.
+ /// </summary>
public int A {
get { return a_; }
set {
@@ -2144,6 +2255,7 @@
}
}
+ /// <summary>Field number for the "bb" field.</summary>
public const int BbFieldNumber = 268435455;
private int bb_;
public int Bb {
@@ -2263,6 +2375,7 @@
return new TestRecursiveMessage(this);
}
+ /// <summary>Field number for the "a" field.</summary>
public const int AFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_;
public global::Google.Protobuf.TestProtos.TestRecursiveMessage A {
@@ -2272,6 +2385,7 @@
}
}
+ /// <summary>Field number for the "i" field.</summary>
public const int IFieldNumber = 2;
private int i_;
public int I {
@@ -2369,6 +2483,9 @@
}
+ /// <summary>
+ /// Test that mutual recursion works.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA> {
private static readonly pb::MessageParser<TestMutualRecursionA> _parser = new pb::MessageParser<TestMutualRecursionA>(() => new TestMutualRecursionA());
@@ -2396,6 +2513,7 @@
return new TestMutualRecursionA(this);
}
+ /// <summary>Field number for the "bb" field.</summary>
public const int BbFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_;
public global::Google.Protobuf.TestProtos.TestMutualRecursionB Bb {
@@ -2505,6 +2623,7 @@
return new TestMutualRecursionB(this);
}
+ /// <summary>Field number for the "a" field.</summary>
public const int AFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_;
public global::Google.Protobuf.TestProtos.TestMutualRecursionA A {
@@ -2514,6 +2633,7 @@
}
}
+ /// <summary>Field number for the "optional_int32" field.</summary>
public const int OptionalInt32FieldNumber = 2;
private int optionalInt32_;
public int OptionalInt32 {
@@ -2611,6 +2731,10 @@
}
+ /// <summary>
+ /// Test message with CamelCase field names. This violates Protocol Buffer
+ /// standard style.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames> {
private static readonly pb::MessageParser<TestCamelCaseFieldNames> _parser = new pb::MessageParser<TestCamelCaseFieldNames>(() => new TestCamelCaseFieldNames());
@@ -2645,6 +2769,7 @@
return new TestCamelCaseFieldNames(this);
}
+ /// <summary>Field number for the "PrimitiveField" field.</summary>
public const int PrimitiveFieldFieldNumber = 1;
private int primitiveField_;
public int PrimitiveField {
@@ -2654,6 +2779,7 @@
}
}
+ /// <summary>Field number for the "StringField" field.</summary>
public const int StringFieldFieldNumber = 2;
private string stringField_ = "";
public string StringField {
@@ -2663,6 +2789,7 @@
}
}
+ /// <summary>Field number for the "EnumField" field.</summary>
public const int EnumFieldFieldNumber = 3;
private global::Google.Protobuf.TestProtos.ForeignEnum enumField_ = global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED;
public global::Google.Protobuf.TestProtos.ForeignEnum EnumField {
@@ -2672,6 +2799,7 @@
}
}
+ /// <summary>Field number for the "MessageField" field.</summary>
public const int MessageFieldFieldNumber = 4;
private global::Google.Protobuf.TestProtos.ForeignMessage messageField_;
public global::Google.Protobuf.TestProtos.ForeignMessage MessageField {
@@ -2681,6 +2809,7 @@
}
}
+ /// <summary>Field number for the "RepeatedPrimitiveField" field.</summary>
public const int RepeatedPrimitiveFieldFieldNumber = 7;
private static readonly pb::FieldCodec<int> _repeated_repeatedPrimitiveField_codec
= pb::FieldCodec.ForInt32(58);
@@ -2689,6 +2818,7 @@
get { return repeatedPrimitiveField_; }
}
+ /// <summary>Field number for the "RepeatedStringField" field.</summary>
public const int RepeatedStringFieldFieldNumber = 8;
private static readonly pb::FieldCodec<string> _repeated_repeatedStringField_codec
= pb::FieldCodec.ForString(66);
@@ -2697,6 +2827,7 @@
get { return repeatedStringField_; }
}
+ /// <summary>Field number for the "RepeatedEnumField" field.</summary>
public const int RepeatedEnumFieldFieldNumber = 9;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_repeatedEnumField_codec
= pb::FieldCodec.ForEnum(74, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
@@ -2705,6 +2836,7 @@
get { return repeatedEnumField_; }
}
+ /// <summary>Field number for the "RepeatedMessageField" field.</summary>
public const int RepeatedMessageFieldFieldNumber = 10;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignMessage> _repeated_repeatedMessageField_codec
= pb::FieldCodec.ForMessage(82, global::Google.Protobuf.TestProtos.ForeignMessage.Parser);
@@ -2871,6 +3003,10 @@
}
+ /// <summary>
+ /// We list fields out of order, to ensure that we're using field number and not
+ /// field index to determine serialization order.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings> {
private static readonly pb::MessageParser<TestFieldOrderings> _parser = new pb::MessageParser<TestFieldOrderings>(() => new TestFieldOrderings());
@@ -2901,6 +3037,7 @@
return new TestFieldOrderings(this);
}
+ /// <summary>Field number for the "my_string" field.</summary>
public const int MyStringFieldNumber = 11;
private string myString_ = "";
public string MyString {
@@ -2910,6 +3047,7 @@
}
}
+ /// <summary>Field number for the "my_int" field.</summary>
public const int MyIntFieldNumber = 1;
private long myInt_;
public long MyInt {
@@ -2919,6 +3057,7 @@
}
}
+ /// <summary>Field number for the "my_float" field.</summary>
public const int MyFloatFieldNumber = 101;
private float myFloat_;
public float MyFloat {
@@ -2928,6 +3067,7 @@
}
}
+ /// <summary>Field number for the "single_nested_message" field.</summary>
public const int SingleNestedMessageFieldNumber = 200;
private global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage singleNestedMessage_;
public global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage SingleNestedMessage {
@@ -3056,6 +3196,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the TestFieldOrderings message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3086,6 +3227,7 @@
return new NestedMessage(this);
}
+ /// <summary>Field number for the "oo" field.</summary>
public const int OoFieldNumber = 2;
private long oo_;
public long Oo {
@@ -3095,8 +3237,14 @@
}
}
+ /// <summary>Field number for the "bb" field.</summary>
public const int BbFieldNumber = 1;
private int bb_;
+ /// <summary>
+ /// The field name "b" fails to compile in proto1 because it conflicts with
+ /// a local variable named "b" in one of the generated methods. Doh.
+ /// This file needs to compile in proto1 to test backwards-compatibility.
+ /// </summary>
public int Bb {
get { return bb_; }
set {
@@ -3218,6 +3366,7 @@
return new SparseEnumMessage(this);
}
+ /// <summary>Field number for the "sparse_enum" field.</summary>
public const int SparseEnumFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED;
public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum {
@@ -3293,6 +3442,9 @@
}
+ /// <summary>
+ /// Test String and Bytes: string is for valid UTF-8 strings
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class OneString : pb::IMessage<OneString> {
private static readonly pb::MessageParser<OneString> _parser = new pb::MessageParser<OneString>(() => new OneString());
@@ -3320,6 +3472,7 @@
return new OneString(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private string data_ = "";
public string Data {
@@ -3422,6 +3575,7 @@
return new MoreString(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private static readonly pb::FieldCodec<string> _repeated_data_codec
= pb::FieldCodec.ForString(10);
@@ -3516,6 +3670,7 @@
return new OneBytes(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private pb::ByteString data_ = pb::ByteString.Empty;
public pb::ByteString Data {
@@ -3618,6 +3773,7 @@
return new MoreBytes(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private pb::ByteString data_ = pb::ByteString.Empty;
public pb::ByteString Data {
@@ -3693,6 +3849,9 @@
}
+ /// <summary>
+ /// Test int32, uint32, int64, uint64, and bool are all compatible
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Int32Message : pb::IMessage<Int32Message> {
private static readonly pb::MessageParser<Int32Message> _parser = new pb::MessageParser<Int32Message>(() => new Int32Message());
@@ -3720,6 +3879,7 @@
return new Int32Message(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private int data_;
public int Data {
@@ -3822,6 +3982,7 @@
return new Uint32Message(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private uint data_;
public uint Data {
@@ -3924,6 +4085,7 @@
return new Int64Message(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private long data_;
public long Data {
@@ -4026,6 +4188,7 @@
return new Uint64Message(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private ulong data_;
public ulong Data {
@@ -4128,6 +4291,7 @@
return new BoolMessage(this);
}
+ /// <summary>Field number for the "data" field.</summary>
public const int DataFieldNumber = 1;
private bool data_;
public bool Data {
@@ -4203,6 +4367,9 @@
}
+ /// <summary>
+ /// Test oneofs.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestOneof : pb::IMessage<TestOneof> {
private static readonly pb::MessageParser<TestOneof> _parser = new pb::MessageParser<TestOneof>(() => new TestOneof());
@@ -4241,6 +4408,7 @@
return new TestOneof(this);
}
+ /// <summary>Field number for the "foo_int" field.</summary>
public const int FooIntFieldNumber = 1;
public int FooInt {
get { return fooCase_ == FooOneofCase.FooInt ? (int) foo_ : 0; }
@@ -4250,6 +4418,7 @@
}
}
+ /// <summary>Field number for the "foo_string" field.</summary>
public const int FooStringFieldNumber = 2;
public string FooString {
get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; }
@@ -4259,6 +4428,7 @@
}
}
+ /// <summary>Field number for the "foo_message" field.</summary>
public const int FooMessageFieldNumber = 3;
public global::Google.Protobuf.TestProtos.TestAllTypes FooMessage {
get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes) foo_ : null; }
@@ -4269,6 +4439,7 @@
}
private object foo_;
+ /// <summary>Enum of possible cases for the "foo" oneof.</summary>
public enum FooOneofCase {
None = 0,
FooInt = 1,
@@ -4431,6 +4602,7 @@
return new TestPackedTypes(this);
}
+ /// <summary>Field number for the "packed_int32" field.</summary>
public const int PackedInt32FieldNumber = 90;
private static readonly pb::FieldCodec<int> _repeated_packedInt32_codec
= pb::FieldCodec.ForInt32(722);
@@ -4439,6 +4611,7 @@
get { return packedInt32_; }
}
+ /// <summary>Field number for the "packed_int64" field.</summary>
public const int PackedInt64FieldNumber = 91;
private static readonly pb::FieldCodec<long> _repeated_packedInt64_codec
= pb::FieldCodec.ForInt64(730);
@@ -4447,6 +4620,7 @@
get { return packedInt64_; }
}
+ /// <summary>Field number for the "packed_uint32" field.</summary>
public const int PackedUint32FieldNumber = 92;
private static readonly pb::FieldCodec<uint> _repeated_packedUint32_codec
= pb::FieldCodec.ForUInt32(738);
@@ -4455,6 +4629,7 @@
get { return packedUint32_; }
}
+ /// <summary>Field number for the "packed_uint64" field.</summary>
public const int PackedUint64FieldNumber = 93;
private static readonly pb::FieldCodec<ulong> _repeated_packedUint64_codec
= pb::FieldCodec.ForUInt64(746);
@@ -4463,6 +4638,7 @@
get { return packedUint64_; }
}
+ /// <summary>Field number for the "packed_sint32" field.</summary>
public const int PackedSint32FieldNumber = 94;
private static readonly pb::FieldCodec<int> _repeated_packedSint32_codec
= pb::FieldCodec.ForSInt32(754);
@@ -4471,6 +4647,7 @@
get { return packedSint32_; }
}
+ /// <summary>Field number for the "packed_sint64" field.</summary>
public const int PackedSint64FieldNumber = 95;
private static readonly pb::FieldCodec<long> _repeated_packedSint64_codec
= pb::FieldCodec.ForSInt64(762);
@@ -4479,6 +4656,7 @@
get { return packedSint64_; }
}
+ /// <summary>Field number for the "packed_fixed32" field.</summary>
public const int PackedFixed32FieldNumber = 96;
private static readonly pb::FieldCodec<uint> _repeated_packedFixed32_codec
= pb::FieldCodec.ForFixed32(770);
@@ -4487,6 +4665,7 @@
get { return packedFixed32_; }
}
+ /// <summary>Field number for the "packed_fixed64" field.</summary>
public const int PackedFixed64FieldNumber = 97;
private static readonly pb::FieldCodec<ulong> _repeated_packedFixed64_codec
= pb::FieldCodec.ForFixed64(778);
@@ -4495,6 +4674,7 @@
get { return packedFixed64_; }
}
+ /// <summary>Field number for the "packed_sfixed32" field.</summary>
public const int PackedSfixed32FieldNumber = 98;
private static readonly pb::FieldCodec<int> _repeated_packedSfixed32_codec
= pb::FieldCodec.ForSFixed32(786);
@@ -4503,6 +4683,7 @@
get { return packedSfixed32_; }
}
+ /// <summary>Field number for the "packed_sfixed64" field.</summary>
public const int PackedSfixed64FieldNumber = 99;
private static readonly pb::FieldCodec<long> _repeated_packedSfixed64_codec
= pb::FieldCodec.ForSFixed64(794);
@@ -4511,6 +4692,7 @@
get { return packedSfixed64_; }
}
+ /// <summary>Field number for the "packed_float" field.</summary>
public const int PackedFloatFieldNumber = 100;
private static readonly pb::FieldCodec<float> _repeated_packedFloat_codec
= pb::FieldCodec.ForFloat(802);
@@ -4519,6 +4701,7 @@
get { return packedFloat_; }
}
+ /// <summary>Field number for the "packed_double" field.</summary>
public const int PackedDoubleFieldNumber = 101;
private static readonly pb::FieldCodec<double> _repeated_packedDouble_codec
= pb::FieldCodec.ForDouble(810);
@@ -4527,6 +4710,7 @@
get { return packedDouble_; }
}
+ /// <summary>Field number for the "packed_bool" field.</summary>
public const int PackedBoolFieldNumber = 102;
private static readonly pb::FieldCodec<bool> _repeated_packedBool_codec
= pb::FieldCodec.ForBool(818);
@@ -4535,6 +4719,7 @@
get { return packedBool_; }
}
+ /// <summary>Field number for the "packed_enum" field.</summary>
public const int PackedEnumFieldNumber = 103;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_packedEnum_codec
= pb::FieldCodec.ForEnum(826, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
@@ -4733,6 +4918,10 @@
}
+ /// <summary>
+ /// A message with the same fields as TestPackedTypes, but without packing. Used
+ /// to test packed <-> unpacked wire compatibility.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes> {
private static readonly pb::MessageParser<TestUnpackedTypes> _parser = new pb::MessageParser<TestUnpackedTypes>(() => new TestUnpackedTypes());
@@ -4773,6 +4962,7 @@
return new TestUnpackedTypes(this);
}
+ /// <summary>Field number for the "unpacked_int32" field.</summary>
public const int UnpackedInt32FieldNumber = 90;
private static readonly pb::FieldCodec<int> _repeated_unpackedInt32_codec
= pb::FieldCodec.ForInt32(720);
@@ -4781,6 +4971,7 @@
get { return unpackedInt32_; }
}
+ /// <summary>Field number for the "unpacked_int64" field.</summary>
public const int UnpackedInt64FieldNumber = 91;
private static readonly pb::FieldCodec<long> _repeated_unpackedInt64_codec
= pb::FieldCodec.ForInt64(728);
@@ -4789,6 +4980,7 @@
get { return unpackedInt64_; }
}
+ /// <summary>Field number for the "unpacked_uint32" field.</summary>
public const int UnpackedUint32FieldNumber = 92;
private static readonly pb::FieldCodec<uint> _repeated_unpackedUint32_codec
= pb::FieldCodec.ForUInt32(736);
@@ -4797,6 +4989,7 @@
get { return unpackedUint32_; }
}
+ /// <summary>Field number for the "unpacked_uint64" field.</summary>
public const int UnpackedUint64FieldNumber = 93;
private static readonly pb::FieldCodec<ulong> _repeated_unpackedUint64_codec
= pb::FieldCodec.ForUInt64(744);
@@ -4805,6 +4998,7 @@
get { return unpackedUint64_; }
}
+ /// <summary>Field number for the "unpacked_sint32" field.</summary>
public const int UnpackedSint32FieldNumber = 94;
private static readonly pb::FieldCodec<int> _repeated_unpackedSint32_codec
= pb::FieldCodec.ForSInt32(752);
@@ -4813,6 +5007,7 @@
get { return unpackedSint32_; }
}
+ /// <summary>Field number for the "unpacked_sint64" field.</summary>
public const int UnpackedSint64FieldNumber = 95;
private static readonly pb::FieldCodec<long> _repeated_unpackedSint64_codec
= pb::FieldCodec.ForSInt64(760);
@@ -4821,6 +5016,7 @@
get { return unpackedSint64_; }
}
+ /// <summary>Field number for the "unpacked_fixed32" field.</summary>
public const int UnpackedFixed32FieldNumber = 96;
private static readonly pb::FieldCodec<uint> _repeated_unpackedFixed32_codec
= pb::FieldCodec.ForFixed32(773);
@@ -4829,6 +5025,7 @@
get { return unpackedFixed32_; }
}
+ /// <summary>Field number for the "unpacked_fixed64" field.</summary>
public const int UnpackedFixed64FieldNumber = 97;
private static readonly pb::FieldCodec<ulong> _repeated_unpackedFixed64_codec
= pb::FieldCodec.ForFixed64(777);
@@ -4837,6 +5034,7 @@
get { return unpackedFixed64_; }
}
+ /// <summary>Field number for the "unpacked_sfixed32" field.</summary>
public const int UnpackedSfixed32FieldNumber = 98;
private static readonly pb::FieldCodec<int> _repeated_unpackedSfixed32_codec
= pb::FieldCodec.ForSFixed32(789);
@@ -4845,6 +5043,7 @@
get { return unpackedSfixed32_; }
}
+ /// <summary>Field number for the "unpacked_sfixed64" field.</summary>
public const int UnpackedSfixed64FieldNumber = 99;
private static readonly pb::FieldCodec<long> _repeated_unpackedSfixed64_codec
= pb::FieldCodec.ForSFixed64(793);
@@ -4853,6 +5052,7 @@
get { return unpackedSfixed64_; }
}
+ /// <summary>Field number for the "unpacked_float" field.</summary>
public const int UnpackedFloatFieldNumber = 100;
private static readonly pb::FieldCodec<float> _repeated_unpackedFloat_codec
= pb::FieldCodec.ForFloat(805);
@@ -4861,6 +5061,7 @@
get { return unpackedFloat_; }
}
+ /// <summary>Field number for the "unpacked_double" field.</summary>
public const int UnpackedDoubleFieldNumber = 101;
private static readonly pb::FieldCodec<double> _repeated_unpackedDouble_codec
= pb::FieldCodec.ForDouble(809);
@@ -4869,6 +5070,7 @@
get { return unpackedDouble_; }
}
+ /// <summary>Field number for the "unpacked_bool" field.</summary>
public const int UnpackedBoolFieldNumber = 102;
private static readonly pb::FieldCodec<bool> _repeated_unpackedBool_codec
= pb::FieldCodec.ForBool(816);
@@ -4877,6 +5079,7 @@
get { return unpackedBool_; }
}
+ /// <summary>Field number for the "unpacked_enum" field.</summary>
public const int UnpackedEnumFieldNumber = 103;
private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_unpackedEnum_codec
= pb::FieldCodec.ForEnum(824, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
@@ -5107,30 +5310,45 @@
return new TestRepeatedScalarDifferentTagSizes(this);
}
+ /// <summary>Field number for the "repeated_fixed32" field.</summary>
public const int RepeatedFixed32FieldNumber = 12;
private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec
= pb::FieldCodec.ForFixed32(98);
private readonly pbc::RepeatedField<uint> repeatedFixed32_ = new pbc::RepeatedField<uint>();
+ /// <summary>
+ /// Parsing repeated fixed size values used to fail. This message needs to be
+ /// used in order to get a tag of the right size; all of the repeated fields
+ /// in TestAllTypes didn't trigger the check.
+ /// </summary>
public pbc::RepeatedField<uint> RepeatedFixed32 {
get { return repeatedFixed32_; }
}
+ /// <summary>Field number for the "repeated_int32" field.</summary>
public const int RepeatedInt32FieldNumber = 13;
private static readonly pb::FieldCodec<int> _repeated_repeatedInt32_codec
= pb::FieldCodec.ForInt32(106);
private readonly pbc::RepeatedField<int> repeatedInt32_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Check for a varint type, just for good measure.
+ /// </summary>
public pbc::RepeatedField<int> RepeatedInt32 {
get { return repeatedInt32_; }
}
+ /// <summary>Field number for the "repeated_fixed64" field.</summary>
public const int RepeatedFixed64FieldNumber = 2046;
private static readonly pb::FieldCodec<ulong> _repeated_repeatedFixed64_codec
= pb::FieldCodec.ForFixed64(16370);
private readonly pbc::RepeatedField<ulong> repeatedFixed64_ = new pbc::RepeatedField<ulong>();
+ /// <summary>
+ /// These have two-byte tags.
+ /// </summary>
public pbc::RepeatedField<ulong> RepeatedFixed64 {
get { return repeatedFixed64_; }
}
+ /// <summary>Field number for the "repeated_int64" field.</summary>
public const int RepeatedInt64FieldNumber = 2047;
private static readonly pb::FieldCodec<long> _repeated_repeatedInt64_codec
= pb::FieldCodec.ForInt64(16378);
@@ -5139,14 +5357,19 @@
get { return repeatedInt64_; }
}
+ /// <summary>Field number for the "repeated_float" field.</summary>
public const int RepeatedFloatFieldNumber = 262142;
private static readonly pb::FieldCodec<float> _repeated_repeatedFloat_codec
= pb::FieldCodec.ForFloat(2097138);
private readonly pbc::RepeatedField<float> repeatedFloat_ = new pbc::RepeatedField<float>();
+ /// <summary>
+ /// Three byte tags.
+ /// </summary>
public pbc::RepeatedField<float> RepeatedFloat {
get { return repeatedFloat_; }
}
+ /// <summary>Field number for the "repeated_uint64" field.</summary>
public const int RepeatedUint64FieldNumber = 262143;
private static readonly pb::FieldCodec<ulong> _repeated_repeatedUint64_codec
= pb::FieldCodec.ForUInt64(2097146);
@@ -5292,8 +5515,12 @@
return new TestCommentInjectionMessage(this);
}
+ /// <summary>Field number for the "a" field.</summary>
public const int AFieldNumber = 1;
private string a_ = "";
+ /// <summary>
+ /// */ <- This should not close the generated doc comment
+ /// </summary>
public string A {
get { return a_; }
set {
@@ -5367,6 +5594,9 @@
}
+ /// <summary>
+ /// Test that RPC services work.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class FooRequest : pb::IMessage<FooRequest> {
private static readonly pb::MessageParser<FooRequest> _parser = new pb::MessageParser<FooRequest>(() => new FooRequest());
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
index 16634e0..bd90ddd 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.TestProtos {
+ /// <summary>Holder for reflection information generated from google/protobuf/unittest_well_known_types.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class UnittestWellKnownTypes {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/unittest_well_known_types.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,141 +23,141 @@
static UnittestWellKnownTypes() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Ci9nb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfd2VsbF9rbm93bl90eXBlcy5w",
- "cm90bxIRcHJvdG9idWZfdW5pdHRlc3QaGWdvb2dsZS9wcm90b2J1Zi9hbnku",
- "cHJvdG8aGWdvb2dsZS9wcm90b2J1Zi9hcGkucHJvdG8aHmdvb2dsZS9wcm90",
- "b2J1Zi9kdXJhdGlvbi5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnBy",
- "b3RvGiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxokZ29vZ2xl",
- "L3Byb3RvYnVmL3NvdXJjZV9jb250ZXh0LnByb3RvGhxnb29nbGUvcHJvdG9i",
- "dWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnBy",
- "b3RvGhpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxoeZ29vZ2xlL3Byb3Rv",
- "YnVmL3dyYXBwZXJzLnByb3RvIpEHChJUZXN0V2VsbEtub3duVHlwZXMSJwoJ",
- "YW55X2ZpZWxkGAEgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFueRInCglhcGlf",
- "ZmllbGQYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQXBpEjEKDmR1cmF0aW9u",
- "X2ZpZWxkGAMgASgLMhkuZ29vZ2xlLnByb3RvYnVm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Zi5JbnQzMlZhbHVlOgI4ARpQChBVaW50MzJGaWVs",
+ "ZEVudHJ5EgsKA2tleRgBIAEoBRIrCgV2YWx1ZRgCIAEoCzIcLmdvb2dsZS5w",
+ "cm90b2J1Zi5VSW50MzJWYWx1ZToCOAEaTAoOQm9vbEZpZWxkRW50cnkSCwoD",
+ "a2V5GAEgASgFEikKBXZhbHVlGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkJv",
+ "b2xWYWx1ZToCOAEaUAoQU3RyaW5nRmllbGRFbnRyeRILCgNrZXkYASABKAUS",
+ "KwoFdmFsdWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWU6",
+ "AjgBGk4KD0J5dGVzRmllbGRFbnRyeRILCgNrZXkYASABKAUSKgoFdmFsdWUY",
+ "AiABKAsyGy5nb29nbGUucHJvdG9idWYuQnl0ZXNWYWx1ZToCOAFCOQoYY29t",
+ "Lmdvb2dsZS5wcm90b2J1Zi50ZXN0UAGqAhpHb29nbGUuUHJvdG9idWYuVGVz",
"dFByb3Rvc2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.Proto.Any.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Api.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Duration.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Empty.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.FieldMask.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.SourceContext.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Timestamp.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Type.Descriptor, global::Google.Protobuf.WellKnownTypes.Wrappers.Descriptor, },
@@ -170,6 +172,11 @@
}
#region Messages
+ /// <summary>
+ /// Test that we can include all well-known types.
+ /// Each wrapper type is included separately, as languages
+ /// map handle different wrappers in different ways.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class TestWellKnownTypes : pb::IMessage<TestWellKnownTypes> {
private static readonly pb::MessageParser<TestWellKnownTypes> _parser = new pb::MessageParser<TestWellKnownTypes>(() => new TestWellKnownTypes());
@@ -214,6 +221,7 @@
return new TestWellKnownTypes(this);
}
+ /// <summary>Field number for the "any_field" field.</summary>
public const int AnyFieldFieldNumber = 1;
private global::Google.Protobuf.WellKnownTypes.Any anyField_;
public global::Google.Protobuf.WellKnownTypes.Any AnyField {
@@ -223,6 +231,7 @@
}
}
+ /// <summary>Field number for the "api_field" field.</summary>
public const int ApiFieldFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Api apiField_;
public global::Google.Protobuf.WellKnownTypes.Api ApiField {
@@ -232,6 +241,7 @@
}
}
+ /// <summary>Field number for the "duration_field" field.</summary>
public const int DurationFieldFieldNumber = 3;
private global::Google.Protobuf.WellKnownTypes.Duration durationField_;
public global::Google.Protobuf.WellKnownTypes.Duration DurationField {
@@ -241,6 +251,7 @@
}
}
+ /// <summary>Field number for the "empty_field" field.</summary>
public const int EmptyFieldFieldNumber = 4;
private global::Google.Protobuf.WellKnownTypes.Empty emptyField_;
public global::Google.Protobuf.WellKnownTypes.Empty EmptyField {
@@ -250,6 +261,7 @@
}
}
+ /// <summary>Field number for the "field_mask_field" field.</summary>
public const int FieldMaskFieldFieldNumber = 5;
private global::Google.Protobuf.WellKnownTypes.FieldMask fieldMaskField_;
public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField {
@@ -259,6 +271,7 @@
}
}
+ /// <summary>Field number for the "source_context_field" field.</summary>
public const int SourceContextFieldFieldNumber = 6;
private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContextField_;
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField {
@@ -268,6 +281,7 @@
}
}
+ /// <summary>Field number for the "struct_field" field.</summary>
public const int StructFieldFieldNumber = 7;
private global::Google.Protobuf.WellKnownTypes.Struct structField_;
public global::Google.Protobuf.WellKnownTypes.Struct StructField {
@@ -277,6 +291,7 @@
}
}
+ /// <summary>Field number for the "timestamp_field" field.</summary>
public const int TimestampFieldFieldNumber = 8;
private global::Google.Protobuf.WellKnownTypes.Timestamp timestampField_;
public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField {
@@ -286,6 +301,7 @@
}
}
+ /// <summary>Field number for the "type_field" field.</summary>
public const int TypeFieldFieldNumber = 9;
private global::Google.Protobuf.WellKnownTypes.Type typeField_;
public global::Google.Protobuf.WellKnownTypes.Type TypeField {
@@ -295,6 +311,7 @@
}
}
+ /// <summary>Field number for the "double_field" field.</summary>
public const int DoubleFieldFieldNumber = 10;
private static readonly pb::FieldCodec<double?> _single_doubleField_codec = pb::FieldCodec.ForStructWrapper<double>(82);
private double? doubleField_;
@@ -305,6 +322,7 @@
}
}
+ /// <summary>Field number for the "float_field" field.</summary>
public const int FloatFieldFieldNumber = 11;
private static readonly pb::FieldCodec<float?> _single_floatField_codec = pb::FieldCodec.ForStructWrapper<float>(90);
private float? floatField_;
@@ -315,6 +333,7 @@
}
}
+ /// <summary>Field number for the "int64_field" field.</summary>
public const int Int64FieldFieldNumber = 12;
private static readonly pb::FieldCodec<long?> _single_int64Field_codec = pb::FieldCodec.ForStructWrapper<long>(98);
private long? int64Field_;
@@ -325,6 +344,7 @@
}
}
+ /// <summary>Field number for the "uint64_field" field.</summary>
public const int Uint64FieldFieldNumber = 13;
private static readonly pb::FieldCodec<ulong?> _single_uint64Field_codec = pb::FieldCodec.ForStructWrapper<ulong>(106);
private ulong? uint64Field_;
@@ -335,6 +355,7 @@
}
}
+ /// <summary>Field number for the "int32_field" field.</summary>
public const int Int32FieldFieldNumber = 14;
private static readonly pb::FieldCodec<int?> _single_int32Field_codec = pb::FieldCodec.ForStructWrapper<int>(114);
private int? int32Field_;
@@ -345,6 +366,7 @@
}
}
+ /// <summary>Field number for the "uint32_field" field.</summary>
public const int Uint32FieldFieldNumber = 15;
private static readonly pb::FieldCodec<uint?> _single_uint32Field_codec = pb::FieldCodec.ForStructWrapper<uint>(122);
private uint? uint32Field_;
@@ -355,6 +377,7 @@
}
}
+ /// <summary>Field number for the "bool_field" field.</summary>
public const int BoolFieldFieldNumber = 16;
private static readonly pb::FieldCodec<bool?> _single_boolField_codec = pb::FieldCodec.ForStructWrapper<bool>(130);
private bool? boolField_;
@@ -365,6 +388,7 @@
}
}
+ /// <summary>Field number for the "string_field" field.</summary>
public const int StringFieldFieldNumber = 17;
private static readonly pb::FieldCodec<string> _single_stringField_codec = pb::FieldCodec.ForClassWrapper<string>(138);
private string stringField_;
@@ -375,6 +399,7 @@
}
}
+ /// <summary>Field number for the "bytes_field" field.</summary>
public const int BytesFieldFieldNumber = 18;
private static readonly pb::FieldCodec<pb::ByteString> _single_bytesField_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
private pb::ByteString bytesField_;
@@ -813,6 +838,9 @@
}
+ /// <summary>
+ /// A repeated field for each well-known type.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class RepeatedWellKnownTypes : pb::IMessage<RepeatedWellKnownTypes> {
private static readonly pb::MessageParser<RepeatedWellKnownTypes> _parser = new pb::MessageParser<RepeatedWellKnownTypes>(() => new RepeatedWellKnownTypes());
@@ -857,6 +885,7 @@
return new RepeatedWellKnownTypes(this);
}
+ /// <summary>Field number for the "any_field" field.</summary>
public const int AnyFieldFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Any> _repeated_anyField_codec
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Any.Parser);
@@ -865,6 +894,7 @@
get { return anyField_; }
}
+ /// <summary>Field number for the "api_field" field.</summary>
public const int ApiFieldFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Api> _repeated_apiField_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser);
@@ -873,6 +903,7 @@
get { return apiField_; }
}
+ /// <summary>Field number for the "duration_field" field.</summary>
public const int DurationFieldFieldNumber = 3;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Duration> _repeated_durationField_codec
= pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Duration.Parser);
@@ -881,6 +912,7 @@
get { return durationField_; }
}
+ /// <summary>Field number for the "empty_field" field.</summary>
public const int EmptyFieldFieldNumber = 4;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Empty> _repeated_emptyField_codec
= pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Empty.Parser);
@@ -889,6 +921,7 @@
get { return emptyField_; }
}
+ /// <summary>Field number for the "field_mask_field" field.</summary>
public const int FieldMaskFieldFieldNumber = 5;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.FieldMask> _repeated_fieldMaskField_codec
= pb::FieldCodec.ForMessage(42, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser);
@@ -897,6 +930,7 @@
get { return fieldMaskField_; }
}
+ /// <summary>Field number for the "source_context_field" field.</summary>
public const int SourceContextFieldFieldNumber = 6;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.SourceContext> _repeated_sourceContextField_codec
= pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser);
@@ -905,6 +939,7 @@
get { return sourceContextField_; }
}
+ /// <summary>Field number for the "struct_field" field.</summary>
public const int StructFieldFieldNumber = 7;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Struct> _repeated_structField_codec
= pb::FieldCodec.ForMessage(58, global::Google.Protobuf.WellKnownTypes.Struct.Parser);
@@ -913,6 +948,7 @@
get { return structField_; }
}
+ /// <summary>Field number for the "timestamp_field" field.</summary>
public const int TimestampFieldFieldNumber = 8;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Timestamp> _repeated_timestampField_codec
= pb::FieldCodec.ForMessage(66, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser);
@@ -921,6 +957,7 @@
get { return timestampField_; }
}
+ /// <summary>Field number for the "type_field" field.</summary>
public const int TypeFieldFieldNumber = 9;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Type> _repeated_typeField_codec
= pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Type.Parser);
@@ -929,14 +966,19 @@
get { return typeField_; }
}
+ /// <summary>Field number for the "double_field" field.</summary>
public const int DoubleFieldFieldNumber = 10;
private static readonly pb::FieldCodec<double?> _repeated_doubleField_codec
= pb::FieldCodec.ForStructWrapper<double>(82);
private readonly pbc::RepeatedField<double?> doubleField_ = new pbc::RepeatedField<double?>();
+ /// <summary>
+ /// These don't actually make a lot of sense, but they're not prohibited...
+ /// </summary>
public pbc::RepeatedField<double?> DoubleField {
get { return doubleField_; }
}
+ /// <summary>Field number for the "float_field" field.</summary>
public const int FloatFieldFieldNumber = 11;
private static readonly pb::FieldCodec<float?> _repeated_floatField_codec
= pb::FieldCodec.ForStructWrapper<float>(90);
@@ -945,6 +987,7 @@
get { return floatField_; }
}
+ /// <summary>Field number for the "int64_field" field.</summary>
public const int Int64FieldFieldNumber = 12;
private static readonly pb::FieldCodec<long?> _repeated_int64Field_codec
= pb::FieldCodec.ForStructWrapper<long>(98);
@@ -953,6 +996,7 @@
get { return int64Field_; }
}
+ /// <summary>Field number for the "uint64_field" field.</summary>
public const int Uint64FieldFieldNumber = 13;
private static readonly pb::FieldCodec<ulong?> _repeated_uint64Field_codec
= pb::FieldCodec.ForStructWrapper<ulong>(106);
@@ -961,6 +1005,7 @@
get { return uint64Field_; }
}
+ /// <summary>Field number for the "int32_field" field.</summary>
public const int Int32FieldFieldNumber = 14;
private static readonly pb::FieldCodec<int?> _repeated_int32Field_codec
= pb::FieldCodec.ForStructWrapper<int>(114);
@@ -969,6 +1014,7 @@
get { return int32Field_; }
}
+ /// <summary>Field number for the "uint32_field" field.</summary>
public const int Uint32FieldFieldNumber = 15;
private static readonly pb::FieldCodec<uint?> _repeated_uint32Field_codec
= pb::FieldCodec.ForStructWrapper<uint>(122);
@@ -977,6 +1023,7 @@
get { return uint32Field_; }
}
+ /// <summary>Field number for the "bool_field" field.</summary>
public const int BoolFieldFieldNumber = 16;
private static readonly pb::FieldCodec<bool?> _repeated_boolField_codec
= pb::FieldCodec.ForStructWrapper<bool>(130);
@@ -985,6 +1032,7 @@
get { return boolField_; }
}
+ /// <summary>Field number for the "string_field" field.</summary>
public const int StringFieldFieldNumber = 17;
private static readonly pb::FieldCodec<string> _repeated_stringField_codec
= pb::FieldCodec.ForClassWrapper<string>(138);
@@ -993,6 +1041,7 @@
get { return stringField_; }
}
+ /// <summary>Field number for the "bytes_field" field.</summary>
public const int BytesFieldFieldNumber = 18;
private static readonly pb::FieldCodec<pb::ByteString> _repeated_bytesField_codec
= pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
@@ -1296,6 +1345,7 @@
return new OneofWellKnownTypes(this);
}
+ /// <summary>Field number for the "any_field" field.</summary>
public const int AnyFieldFieldNumber = 1;
public global::Google.Protobuf.WellKnownTypes.Any AnyField {
get { return oneofFieldCase_ == OneofFieldOneofCase.AnyField ? (global::Google.Protobuf.WellKnownTypes.Any) oneofField_ : null; }
@@ -1305,6 +1355,7 @@
}
}
+ /// <summary>Field number for the "api_field" field.</summary>
public const int ApiFieldFieldNumber = 2;
public global::Google.Protobuf.WellKnownTypes.Api ApiField {
get { return oneofFieldCase_ == OneofFieldOneofCase.ApiField ? (global::Google.Protobuf.WellKnownTypes.Api) oneofField_ : null; }
@@ -1314,6 +1365,7 @@
}
}
+ /// <summary>Field number for the "duration_field" field.</summary>
public const int DurationFieldFieldNumber = 3;
public global::Google.Protobuf.WellKnownTypes.Duration DurationField {
get { return oneofFieldCase_ == OneofFieldOneofCase.DurationField ? (global::Google.Protobuf.WellKnownTypes.Duration) oneofField_ : null; }
@@ -1323,6 +1375,7 @@
}
}
+ /// <summary>Field number for the "empty_field" field.</summary>
public const int EmptyFieldFieldNumber = 4;
public global::Google.Protobuf.WellKnownTypes.Empty EmptyField {
get { return oneofFieldCase_ == OneofFieldOneofCase.EmptyField ? (global::Google.Protobuf.WellKnownTypes.Empty) oneofField_ : null; }
@@ -1332,6 +1385,7 @@
}
}
+ /// <summary>Field number for the "field_mask_field" field.</summary>
public const int FieldMaskFieldFieldNumber = 5;
public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField {
get { return oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField ? (global::Google.Protobuf.WellKnownTypes.FieldMask) oneofField_ : null; }
@@ -1341,6 +1395,7 @@
}
}
+ /// <summary>Field number for the "source_context_field" field.</summary>
public const int SourceContextFieldFieldNumber = 6;
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField {
get { return oneofFieldCase_ == OneofFieldOneofCase.SourceContextField ? (global::Google.Protobuf.WellKnownTypes.SourceContext) oneofField_ : null; }
@@ -1350,6 +1405,7 @@
}
}
+ /// <summary>Field number for the "struct_field" field.</summary>
public const int StructFieldFieldNumber = 7;
public global::Google.Protobuf.WellKnownTypes.Struct StructField {
get { return oneofFieldCase_ == OneofFieldOneofCase.StructField ? (global::Google.Protobuf.WellKnownTypes.Struct) oneofField_ : null; }
@@ -1359,6 +1415,7 @@
}
}
+ /// <summary>Field number for the "timestamp_field" field.</summary>
public const int TimestampFieldFieldNumber = 8;
public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField {
get { return oneofFieldCase_ == OneofFieldOneofCase.TimestampField ? (global::Google.Protobuf.WellKnownTypes.Timestamp) oneofField_ : null; }
@@ -1368,6 +1425,7 @@
}
}
+ /// <summary>Field number for the "type_field" field.</summary>
public const int TypeFieldFieldNumber = 9;
public global::Google.Protobuf.WellKnownTypes.Type TypeField {
get { return oneofFieldCase_ == OneofFieldOneofCase.TypeField ? (global::Google.Protobuf.WellKnownTypes.Type) oneofField_ : null; }
@@ -1377,6 +1435,7 @@
}
}
+ /// <summary>Field number for the "double_field" field.</summary>
public const int DoubleFieldFieldNumber = 10;
private static readonly pb::FieldCodec<double?> _oneof_doubleField_codec = pb::FieldCodec.ForStructWrapper<double>(82);
public double? DoubleField {
@@ -1387,6 +1446,7 @@
}
}
+ /// <summary>Field number for the "float_field" field.</summary>
public const int FloatFieldFieldNumber = 11;
private static readonly pb::FieldCodec<float?> _oneof_floatField_codec = pb::FieldCodec.ForStructWrapper<float>(90);
public float? FloatField {
@@ -1397,6 +1457,7 @@
}
}
+ /// <summary>Field number for the "int64_field" field.</summary>
public const int Int64FieldFieldNumber = 12;
private static readonly pb::FieldCodec<long?> _oneof_int64Field_codec = pb::FieldCodec.ForStructWrapper<long>(98);
public long? Int64Field {
@@ -1407,6 +1468,7 @@
}
}
+ /// <summary>Field number for the "uint64_field" field.</summary>
public const int Uint64FieldFieldNumber = 13;
private static readonly pb::FieldCodec<ulong?> _oneof_uint64Field_codec = pb::FieldCodec.ForStructWrapper<ulong>(106);
public ulong? Uint64Field {
@@ -1417,6 +1479,7 @@
}
}
+ /// <summary>Field number for the "int32_field" field.</summary>
public const int Int32FieldFieldNumber = 14;
private static readonly pb::FieldCodec<int?> _oneof_int32Field_codec = pb::FieldCodec.ForStructWrapper<int>(114);
public int? Int32Field {
@@ -1427,6 +1490,7 @@
}
}
+ /// <summary>Field number for the "uint32_field" field.</summary>
public const int Uint32FieldFieldNumber = 15;
private static readonly pb::FieldCodec<uint?> _oneof_uint32Field_codec = pb::FieldCodec.ForStructWrapper<uint>(122);
public uint? Uint32Field {
@@ -1437,6 +1501,7 @@
}
}
+ /// <summary>Field number for the "bool_field" field.</summary>
public const int BoolFieldFieldNumber = 16;
private static readonly pb::FieldCodec<bool?> _oneof_boolField_codec = pb::FieldCodec.ForStructWrapper<bool>(130);
public bool? BoolField {
@@ -1447,6 +1512,7 @@
}
}
+ /// <summary>Field number for the "string_field" field.</summary>
public const int StringFieldFieldNumber = 17;
private static readonly pb::FieldCodec<string> _oneof_stringField_codec = pb::FieldCodec.ForClassWrapper<string>(138);
public string StringField {
@@ -1457,6 +1523,7 @@
}
}
+ /// <summary>Field number for the "bytes_field" field.</summary>
public const int BytesFieldFieldNumber = 18;
private static readonly pb::FieldCodec<pb::ByteString> _oneof_bytesField_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
public pb::ByteString BytesField {
@@ -1468,6 +1535,7 @@
}
private object oneofField_;
+ /// <summary>Enum of possible cases for the "oneof_field" oneof.</summary>
public enum OneofFieldOneofCase {
None = 0,
AnyField = 1,
@@ -1876,6 +1944,11 @@
}
+ /// <summary>
+ /// A map field for each well-known type. We only
+ /// need to worry about the value part of the map being the
+ /// well-known types, as messages can't be map keys.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class MapWellKnownTypes : pb::IMessage<MapWellKnownTypes> {
private static readonly pb::MessageParser<MapWellKnownTypes> _parser = new pb::MessageParser<MapWellKnownTypes>(() => new MapWellKnownTypes());
@@ -1920,6 +1993,7 @@
return new MapWellKnownTypes(this);
}
+ /// <summary>Field number for the "any_field" field.</summary>
public const int AnyFieldFieldNumber = 1;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec _map_anyField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10);
@@ -1928,6 +2002,7 @@
get { return anyField_; }
}
+ /// <summary>Field number for the "api_field" field.</summary>
public const int ApiFieldFieldNumber = 2;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api>.Codec _map_apiField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser), 18);
@@ -1936,6 +2011,7 @@
get { return apiField_; }
}
+ /// <summary>Field number for the "duration_field" field.</summary>
public const int DurationFieldFieldNumber = 3;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration>.Codec _map_durationField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Duration.Parser), 26);
@@ -1944,6 +2020,7 @@
get { return durationField_; }
}
+ /// <summary>Field number for the "empty_field" field.</summary>
public const int EmptyFieldFieldNumber = 4;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty>.Codec _map_emptyField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Empty.Parser), 34);
@@ -1952,6 +2029,7 @@
get { return emptyField_; }
}
+ /// <summary>Field number for the "field_mask_field" field.</summary>
public const int FieldMaskFieldFieldNumber = 5;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask>.Codec _map_fieldMaskField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser), 42);
@@ -1960,6 +2038,7 @@
get { return fieldMaskField_; }
}
+ /// <summary>Field number for the "source_context_field" field.</summary>
public const int SourceContextFieldFieldNumber = 6;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext>.Codec _map_sourceContextField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser), 50);
@@ -1968,6 +2047,7 @@
get { return sourceContextField_; }
}
+ /// <summary>Field number for the "struct_field" field.</summary>
public const int StructFieldFieldNumber = 7;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct>.Codec _map_structField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Struct.Parser), 58);
@@ -1976,6 +2056,7 @@
get { return structField_; }
}
+ /// <summary>Field number for the "timestamp_field" field.</summary>
public const int TimestampFieldFieldNumber = 8;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp>.Codec _map_timestampField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser), 66);
@@ -1984,6 +2065,7 @@
get { return timestampField_; }
}
+ /// <summary>Field number for the "type_field" field.</summary>
public const int TypeFieldFieldNumber = 9;
private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type>.Codec _map_typeField_codec
= new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Type.Parser), 74);
@@ -1992,6 +2074,7 @@
get { return typeField_; }
}
+ /// <summary>Field number for the "double_field" field.</summary>
public const int DoubleFieldFieldNumber = 10;
private static readonly pbc::MapField<int, double?>.Codec _map_doubleField_codec
= new pbc::MapField<int, double?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<double>(18), 82);
@@ -2000,6 +2083,7 @@
get { return doubleField_; }
}
+ /// <summary>Field number for the "float_field" field.</summary>
public const int FloatFieldFieldNumber = 11;
private static readonly pbc::MapField<int, float?>.Codec _map_floatField_codec
= new pbc::MapField<int, float?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<float>(18), 90);
@@ -2008,6 +2092,7 @@
get { return floatField_; }
}
+ /// <summary>Field number for the "int64_field" field.</summary>
public const int Int64FieldFieldNumber = 12;
private static readonly pbc::MapField<int, long?>.Codec _map_int64Field_codec
= new pbc::MapField<int, long?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<long>(18), 98);
@@ -2016,6 +2101,7 @@
get { return int64Field_; }
}
+ /// <summary>Field number for the "uint64_field" field.</summary>
public const int Uint64FieldFieldNumber = 13;
private static readonly pbc::MapField<int, ulong?>.Codec _map_uint64Field_codec
= new pbc::MapField<int, ulong?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<ulong>(18), 106);
@@ -2024,6 +2110,7 @@
get { return uint64Field_; }
}
+ /// <summary>Field number for the "int32_field" field.</summary>
public const int Int32FieldFieldNumber = 14;
private static readonly pbc::MapField<int, int?>.Codec _map_int32Field_codec
= new pbc::MapField<int, int?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<int>(18), 114);
@@ -2032,6 +2119,7 @@
get { return int32Field_; }
}
+ /// <summary>Field number for the "uint32_field" field.</summary>
public const int Uint32FieldFieldNumber = 15;
private static readonly pbc::MapField<int, uint?>.Codec _map_uint32Field_codec
= new pbc::MapField<int, uint?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<uint>(18), 122);
@@ -2040,6 +2128,7 @@
get { return uint32Field_; }
}
+ /// <summary>Field number for the "bool_field" field.</summary>
public const int BoolFieldFieldNumber = 16;
private static readonly pbc::MapField<int, bool?>.Codec _map_boolField_codec
= new pbc::MapField<int, bool?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<bool>(18), 130);
@@ -2048,6 +2137,7 @@
get { return boolField_; }
}
+ /// <summary>Field number for the "string_field" field.</summary>
public const int StringFieldFieldNumber = 17;
private static readonly pbc::MapField<int, string>.Codec _map_stringField_codec
= new pbc::MapField<int, string>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper<string>(18), 138);
@@ -2056,6 +2146,7 @@
get { return stringField_; }
}
+ /// <summary>Field number for the "bytes_field" field.</summary>
public const int BytesFieldFieldNumber = 18;
private static readonly pbc::MapField<int, pb::ByteString>.Codec _map_bytesField_codec
= new pbc::MapField<int, pb::ByteString>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper<pb::ByteString>(18), 146);
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
new file mode 100644
index 0000000..0a2b8b3
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
@@ -0,0 +1,66 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 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.
+#endregion
+
+using Google.Protobuf.TestProtos;
+using NUnit.Framework;
+
+namespace Google.Protobuf.WellKnownTypes
+{
+ public class AnyTest
+ {
+ [Test]
+ public void Pack()
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ var any = Any.Pack(message);
+ Assert.AreEqual("type.googleapis.com/protobuf_unittest.TestAllTypes", any.TypeUrl);
+ Assert.AreEqual(message.CalculateSize(), any.Value.Length);
+ }
+
+ [Test]
+ public void Unpack_WrongType()
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ var any = Any.Pack(message);
+ Assert.Throws<InvalidProtocolBufferException>(() => any.Unpack<TestOneof>());
+ }
+
+ [Test]
+ public void Unpack_Success()
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ var any = Any.Pack(message);
+ var unpacked = any.Unpack<TestAllTypes>();
+ Assert.AreEqual(message, unpacked);
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/CodedInputStream.cs b/csharp/src/Google.Protobuf/CodedInputStream.cs
index 82c6cea..65d0e71 100644
--- a/csharp/src/Google.Protobuf/CodedInputStream.cs
+++ b/csharp/src/Google.Protobuf/CodedInputStream.cs
@@ -38,7 +38,7 @@
namespace Google.Protobuf
{
/// <summary>
- /// Readings and decodes protocol message fields.
+ /// Reads and decodes protocol message fields.
/// </summary>
/// <remarks>
/// <para>
diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs
index 0fa63be..c0ed28a 100644
--- a/csharp/src/Google.Protobuf/Collections/MapField.cs
+++ b/csharp/src/Google.Protobuf/Collections/MapField.cs
@@ -35,6 +35,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
using Google.Protobuf.Compatibility;
namespace Google.Protobuf.Collections
@@ -45,10 +46,17 @@
/// <typeparam name="TKey">Key type in the map. Must be a type supported by Protocol Buffer map keys.</typeparam>
/// <typeparam name="TValue">Value type in the map. Must be a type supported by Protocol Buffers.</typeparam>
/// <remarks>
+ /// <para>
/// This implementation preserves insertion order for simplicity of testing
/// code using maps fields. Overwriting an existing entry does not change the
/// position of that entry within the map. Equality is not order-sensitive.
/// For string keys, the equality comparison is provided by <see cref="StringComparer.Ordinal" />.
+ /// </para>
+ /// <para>
+ /// This implementation does not generally prohibit the use of key/value types which are not
+ /// supported by Protocol Buffers (e.g. using a key type of <code>byte</code>) but nor does it guarantee
+ /// that all operations will work in such cases.
+ /// </para>
/// </remarks>
public sealed class MapField<TKey, TValue> : IDeepCloneable<MapField<TKey, TValue>>, IDictionary<TKey, TValue>, IEquatable<MapField<TKey, TValue>>, IDictionary
{
@@ -482,6 +490,17 @@
return size;
}
+ /// <summary>
+ /// Returns a string representation of this repeated field, in the same
+ /// way as it would be represented by the default JSON formatter.
+ /// </summary>
+ public override string ToString()
+ {
+ var builder = new StringBuilder();
+ JsonFormatter.Default.WriteDictionary(builder, this);
+ return builder.ToString();
+ }
+
#region IDictionary explicit interface implementation
void IDictionary.Add(object key, object value)
{
diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
index d9ced6e..e3f65af 100644
--- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
+++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Text;
using Google.Protobuf.Compatibility;
namespace Google.Protobuf.Collections
@@ -41,6 +42,10 @@
/// The contents of a repeated field: essentially, a collection with some extra
/// restrictions (no null values) and capabilities (deep cloning).
/// </summary>
+ /// <remarks>
+ /// This implementation does not generally prohibit the use of types which are not
+ /// supported by Protocol Buffers but nor does it guarantee that all operations will work in such cases.
+ /// </remarks>
/// <typeparam name="T">The element type of the repeated field.</typeparam>
public sealed class RepeatedField<T> : IList<T>, IList, IDeepCloneable<RepeatedField<T>>, IEquatable<RepeatedField<T>>
{
@@ -465,6 +470,17 @@
}
/// <summary>
+ /// Returns a string representation of this repeated field, in the same
+ /// way as it would be represented by the default JSON formatter.
+ /// </summary>
+ public override string ToString()
+ {
+ var builder = new StringBuilder();
+ JsonFormatter.Default.WriteList(builder, this);
+ return builder.ToString();
+ }
+
+ /// <summary>
/// Gets or sets the item at the specified index.
/// </summary>
/// <value>
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
index a17bf81..8c680d4 100644
--- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
@@ -118,6 +118,7 @@
<Compile Include="Reflection\SingleFieldAccessor.cs" />
<Compile Include="Preconditions.cs" />
<Compile Include="WellKnownTypes\Any.cs" />
+ <Compile Include="WellKnownTypes\AnyPartial.cs" />
<Compile Include="WellKnownTypes\Api.cs" />
<Compile Include="WellKnownTypes\Duration.cs" />
<Compile Include="WellKnownTypes\DurationPartial.cs" />
diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs
index 12bbdfd..3f9bd47 100644
--- a/csharp/src/Google.Protobuf/JsonFormatter.cs
+++ b/csharp/src/Google.Protobuf/JsonFormatter.cs
@@ -170,7 +170,7 @@
continue;
}
// Omit awkward (single) values such as unknown enum values
- if (!field.IsRepeated && !field.IsMap && !CanWriteSingleValue(accessor.Descriptor, value))
+ if (!field.IsRepeated && !field.IsMap && !CanWriteSingleValue(value))
{
continue;
}
@@ -182,7 +182,7 @@
}
WriteString(builder, ToCamelCase(accessor.Descriptor.Name));
builder.Append(": ");
- WriteValue(builder, accessor, value);
+ WriteValue(builder, value);
first = false;
}
builder.Append(first ? "}" : " }");
@@ -291,93 +291,81 @@
throw new ArgumentException("Invalid field type");
}
}
-
- private void WriteValue(StringBuilder builder, IFieldAccessor accessor, object value)
+
+ private void WriteValue(StringBuilder builder, object value)
{
- if (accessor.Descriptor.IsMap)
+ if (value == null)
{
- WriteDictionary(builder, accessor, (IDictionary) value);
+ WriteNull(builder);
}
- else if (accessor.Descriptor.IsRepeated)
+ else if (value is bool)
{
- WriteList(builder, accessor, (IList) value);
+ builder.Append((bool) value ? "true" : "false");
+ }
+ else if (value is ByteString)
+ {
+ // Nothing in Base64 needs escaping
+ builder.Append('"');
+ builder.Append(((ByteString) value).ToBase64());
+ builder.Append('"');
+ }
+ else if (value is string)
+ {
+ WriteString(builder, (string) value);
+ }
+ else if (value is IDictionary)
+ {
+ WriteDictionary(builder, (IDictionary) value);
+ }
+ else if (value is IList)
+ {
+ WriteList(builder, (IList) value);
+ }
+ else if (value is int || value is uint)
+ {
+ IFormattable formattable = (IFormattable) value;
+ builder.Append(formattable.ToString("d", CultureInfo.InvariantCulture));
+ }
+ else if (value is long || value is ulong)
+ {
+ builder.Append('"');
+ IFormattable formattable = (IFormattable) value;
+ builder.Append(formattable.ToString("d", CultureInfo.InvariantCulture));
+ builder.Append('"');
+ }
+ else if (value is System.Enum)
+ {
+ WriteString(builder, value.ToString());
+ }
+ else if (value is float || value is double)
+ {
+ string text = ((IFormattable) value).ToString("r", CultureInfo.InvariantCulture);
+ if (text == "NaN" || text == "Infinity" || text == "-Infinity")
+ {
+ builder.Append('"');
+ builder.Append(text);
+ builder.Append('"');
+ }
+ else
+ {
+ builder.Append(text);
+ }
+ }
+ else if (value is IMessage)
+ {
+ IMessage message = (IMessage) value;
+ if (message.Descriptor.IsWellKnownType)
+ {
+ WriteWellKnownTypeValue(builder, message.Descriptor, value, true);
+ }
+ else
+ {
+ WriteMessage(builder, (IMessage) value);
+ }
}
else
{
- WriteSingleValue(builder, accessor.Descriptor, value);
- }
- }
-
- private void WriteSingleValue(StringBuilder builder, FieldDescriptor descriptor, object value)
- {
- switch (descriptor.FieldType)
- {
- case FieldType.Bool:
- builder.Append((bool) value ? "true" : "false");
- break;
- case FieldType.Bytes:
- // Nothing in Base64 needs escaping
- builder.Append('"');
- builder.Append(((ByteString) value).ToBase64());
- builder.Append('"');
- break;
- case FieldType.String:
- WriteString(builder, (string) value);
- break;
- case FieldType.Fixed32:
- case FieldType.UInt32:
- case FieldType.SInt32:
- case FieldType.Int32:
- case FieldType.SFixed32:
- {
- IFormattable formattable = (IFormattable) value;
- builder.Append(formattable.ToString("d", CultureInfo.InvariantCulture));
- break;
- }
- case FieldType.Enum:
- EnumValueDescriptor enumValue = descriptor.EnumType.FindValueByNumber((int) value);
- // We will already have validated that this is a known value.
- WriteString(builder, enumValue.Name);
- break;
- case FieldType.Fixed64:
- case FieldType.UInt64:
- case FieldType.SFixed64:
- case FieldType.Int64:
- case FieldType.SInt64:
- {
- builder.Append('"');
- IFormattable formattable = (IFormattable) value;
- builder.Append(formattable.ToString("d", CultureInfo.InvariantCulture));
- builder.Append('"');
- break;
- }
- case FieldType.Double:
- case FieldType.Float:
- string text = ((IFormattable) value).ToString("r", CultureInfo.InvariantCulture);
- if (text == "NaN" || text == "Infinity" || text == "-Infinity")
- {
- builder.Append('"');
- builder.Append(text);
- builder.Append('"');
- }
- else
- {
- builder.Append(text);
- }
- break;
- case FieldType.Message:
- case FieldType.Group: // Never expect to get this, but...
- if (descriptor.MessageType.IsWellKnownType)
- {
- WriteWellKnownTypeValue(builder, descriptor.MessageType, value, true);
- }
- else
- {
- WriteMessage(builder, (IMessage) value);
- }
- break;
- default:
- throw new ArgumentException("Invalid field type: " + descriptor.FieldType);
+ throw new ArgumentException("Unable to format value of type " + value.GetType());
}
}
@@ -398,7 +386,7 @@
// so we can write it as if we were unconditionally writing the Value field for the wrapper type.
if (descriptor.File == Int32Value.Descriptor.File)
{
- WriteSingleValue(builder, descriptor.FindFieldByNumber(1), value);
+ WriteValue(builder, value);
return;
}
if (descriptor.FullName == Timestamp.Descriptor.FullName)
@@ -424,7 +412,7 @@
if (descriptor.FullName == ListValue.Descriptor.FullName)
{
var fieldAccessor = descriptor.Fields[ListValue.ValuesFieldNumber].Accessor;
- WriteList(builder, fieldAccessor, (IList) fieldAccessor.GetValue((IMessage) value));
+ WriteList(builder, (IList) fieldAccessor.GetValue((IMessage) value));
return;
}
if (descriptor.FullName == Value.Descriptor.FullName)
@@ -565,7 +553,7 @@
case Value.BoolValueFieldNumber:
case Value.StringValueFieldNumber:
case Value.NumberValueFieldNumber:
- WriteSingleValue(builder, specifiedField, value);
+ WriteValue(builder, value);
return;
case Value.StructValueFieldNumber:
case Value.ListValueFieldNumber:
@@ -581,13 +569,13 @@
}
}
- private void WriteList(StringBuilder builder, IFieldAccessor accessor, IList list)
+ internal void WriteList(StringBuilder builder, IList list)
{
builder.Append("[ ");
bool first = true;
foreach (var value in list)
{
- if (!CanWriteSingleValue(accessor.Descriptor, value))
+ if (!CanWriteSingleValue(value))
{
continue;
}
@@ -595,22 +583,20 @@
{
builder.Append(", ");
}
- WriteSingleValue(builder, accessor.Descriptor, value);
+ WriteValue(builder, value);
first = false;
}
builder.Append(first ? "]" : " ]");
}
- private void WriteDictionary(StringBuilder builder, IFieldAccessor accessor, IDictionary dictionary)
+ internal void WriteDictionary(StringBuilder builder, IDictionary dictionary)
{
builder.Append("{ ");
bool first = true;
- FieldDescriptor keyType = accessor.Descriptor.MessageType.FindFieldByNumber(1);
- FieldDescriptor valueType = accessor.Descriptor.MessageType.FindFieldByNumber(2);
// This will box each pair. Could use IDictionaryEnumerator, but that's ugly in terms of disposal.
foreach (DictionaryEntry pair in dictionary)
{
- if (!CanWriteSingleValue(valueType, pair.Value))
+ if (!CanWriteSingleValue(pair.Value))
{
continue;
}
@@ -619,32 +605,29 @@
builder.Append(", ");
}
string keyText;
- switch (keyType.FieldType)
+ if (pair.Key is string)
{
- case FieldType.String:
- keyText = (string) pair.Key;
- break;
- case FieldType.Bool:
- keyText = (bool) pair.Key ? "true" : "false";
- break;
- case FieldType.Fixed32:
- case FieldType.Fixed64:
- case FieldType.SFixed32:
- case FieldType.SFixed64:
- case FieldType.Int32:
- case FieldType.Int64:
- case FieldType.SInt32:
- case FieldType.SInt64:
- case FieldType.UInt32:
- case FieldType.UInt64:
- keyText = ((IFormattable) pair.Key).ToString("d", CultureInfo.InvariantCulture);
- break;
- default:
- throw new ArgumentException("Invalid key type: " + keyType.FieldType);
+ keyText = (string) pair.Key;
+ }
+ else if (pair.Key is bool)
+ {
+ keyText = (bool) pair.Key ? "true" : "false";
+ }
+ else if (pair.Key is int || pair.Key is uint | pair.Key is long || pair.Key is ulong)
+ {
+ keyText = ((IFormattable) pair.Key).ToString("d", CultureInfo.InvariantCulture);
+ }
+ else
+ {
+ if (pair.Key == null)
+ {
+ throw new ArgumentException("Dictionary has entry with null key");
+ }
+ throw new ArgumentException("Unhandled dictionary key type: " + pair.Key.GetType());
}
WriteString(builder, keyText);
builder.Append(": ");
- WriteSingleValue(builder, valueType, pair.Value);
+ WriteValue(builder, pair.Value);
first = false;
}
builder.Append(first ? "}" : " }");
@@ -655,12 +638,11 @@
/// Currently only relevant for enums, where unknown values can't be represented.
/// For repeated/map fields, this always returns true.
/// </summary>
- private bool CanWriteSingleValue(FieldDescriptor descriptor, object value)
+ private bool CanWriteSingleValue(object value)
{
- if (descriptor.FieldType == FieldType.Enum)
+ if (value is System.Enum)
{
- EnumValueDescriptor enumValue = descriptor.EnumType.FindValueByNumber((int) value);
- return enumValue != null;
+ return System.Enum.IsDefined(value.GetType(), value);
}
return true;
}
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
index 759955e..99ca4bf 100644
--- a/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
@@ -96,6 +96,8 @@
return descriptor;
}
+ // dependencies contains direct dependencies and any *public* dependencies
+ // of those dependencies (transitively)... so we don't need to recurse here.
foreach (FileDescriptor dependency in dependencies)
{
dependency.DescriptorPool.descriptorsByName.TryGetValue(fullName, out result);
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs
index f9158ca..1e6a77a 100644
--- a/csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.Reflection {
+ /// <summary>Holder for reflection information generated from google/protobuf/descriptor.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal static partial class DescriptorProtoFile {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/descriptor.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,117 +23,117 @@
static DescriptorProtoFile() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bxIPZ29vZ2xlLnBy",
- "b3RvYnVmIkcKEUZpbGVEZXNjcmlwdG9yU2V0EjIKBGZpbGUYASADKAsyJC5n",
- "b29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90byLbAwoTRmlsZURl",
- "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg8KB3BhY2thZ2UYAiABKAkS",
- "EgoKZGVwZW5kZW5jeRgDIAMoCRIZChFwdWJsaWNfZGVwZW5kZW5jeRgKIAMo",
- "BRIXCg93ZWFrX2RlcGVuZGVuY3kYCyADKAUSNgoMbWVzc2FnZV90eXBlGAQg",
- "AygLMiAuZ29vZ2xlLnByb3RvYnVmLkRlc2NyaXB0b3JQcm90bxI3CgllbnVt",
- "X3R5cGUYBSADKA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FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
@@ -160,6 +162,10 @@
}
#region Messages
+ /// <summary>
+ /// The protocol compiler can output a FileDescriptorSet containing the .proto
+ /// files it parses.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet> {
private static readonly pb::MessageParser<FileDescriptorSet> _parser = new pb::MessageParser<FileDescriptorSet>(() => new FileDescriptorSet());
@@ -187,6 +193,7 @@
return new FileDescriptorSet(this);
}
+ /// <summary>Field number for the "file" field.</summary>
public const int FileFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FileDescriptorProto> _repeated_file_codec
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser);
@@ -254,6 +261,9 @@
}
+ /// <summary>
+ /// Describes a complete .proto file.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto> {
private static readonly pb::MessageParser<FileDescriptorProto> _parser = new pb::MessageParser<FileDescriptorProto>(() => new FileDescriptorProto());
@@ -292,8 +302,12 @@
return new FileDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// file name, relative to root of source tree
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -301,8 +315,12 @@
}
}
+ /// <summary>Field number for the "package" field.</summary>
public const int PackageFieldNumber = 2;
private string package_ = "";
+ /// <summary>
+ /// e.g. "foo", "foo.bar", etc.
+ /// </summary>
public string Package {
get { return package_; }
set {
@@ -310,38 +328,56 @@
}
}
+ /// <summary>Field number for the "dependency" field.</summary>
public const int DependencyFieldNumber = 3;
private static readonly pb::FieldCodec<string> _repeated_dependency_codec
= pb::FieldCodec.ForString(26);
private readonly pbc::RepeatedField<string> dependency_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// Names of files imported by this file.
+ /// </summary>
public pbc::RepeatedField<string> Dependency {
get { return dependency_; }
}
+ /// <summary>Field number for the "public_dependency" field.</summary>
public const int PublicDependencyFieldNumber = 10;
private static readonly pb::FieldCodec<int> _repeated_publicDependency_codec
= pb::FieldCodec.ForInt32(80);
private readonly pbc::RepeatedField<int> publicDependency_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Indexes of the public imported files in the dependency list above.
+ /// </summary>
public pbc::RepeatedField<int> PublicDependency {
get { return publicDependency_; }
}
+ /// <summary>Field number for the "weak_dependency" field.</summary>
public const int WeakDependencyFieldNumber = 11;
private static readonly pb::FieldCodec<int> _repeated_weakDependency_codec
= pb::FieldCodec.ForInt32(88);
private readonly pbc::RepeatedField<int> weakDependency_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Indexes of the weak imported files in the dependency list.
+ /// For Google-internal migration only. Do not use.
+ /// </summary>
public pbc::RepeatedField<int> WeakDependency {
get { return weakDependency_; }
}
+ /// <summary>Field number for the "message_type" field.</summary>
public const int MessageTypeFieldNumber = 4;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_messageType_codec
= pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> messageType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>();
+ /// <summary>
+ /// All top-level definitions in this file.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> MessageType {
get { return messageType_; }
}
+ /// <summary>Field number for the "enum_type" field.</summary>
public const int EnumTypeFieldNumber = 5;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec
= pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser);
@@ -350,6 +386,7 @@
get { return enumType_; }
}
+ /// <summary>Field number for the "service" field.</summary>
public const int ServiceFieldNumber = 6;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.ServiceDescriptorProto> _repeated_service_codec
= pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser);
@@ -358,6 +395,7 @@
get { return service_; }
}
+ /// <summary>Field number for the "extension" field.</summary>
public const int ExtensionFieldNumber = 7;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec
= pb::FieldCodec.ForMessage(58, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
@@ -366,6 +404,7 @@
get { return extension_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 8;
private global::Google.Protobuf.Reflection.FileOptions options_;
public global::Google.Protobuf.Reflection.FileOptions Options {
@@ -375,8 +414,15 @@
}
}
+ /// <summary>Field number for the "source_code_info" field.</summary>
public const int SourceCodeInfoFieldNumber = 9;
private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_;
+ /// <summary>
+ /// This field contains optional information about the original source code.
+ /// You may safely remove this entire field without harming runtime
+ /// functionality of the descriptors -- the information is needed only by
+ /// development tools.
+ /// </summary>
public global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo {
get { return sourceCodeInfo_; }
set {
@@ -384,8 +430,13 @@
}
}
+ /// <summary>Field number for the "syntax" field.</summary>
public const int SyntaxFieldNumber = 12;
private string syntax_ = "";
+ /// <summary>
+ /// The syntax of the proto file.
+ /// The supported values are "proto2" and "proto3".
+ /// </summary>
public string Syntax {
get { return syntax_; }
set {
@@ -600,6 +651,9 @@
}
+ /// <summary>
+ /// Describes a message type.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class DescriptorProto : pb::IMessage<DescriptorProto> {
private static readonly pb::MessageParser<DescriptorProto> _parser = new pb::MessageParser<DescriptorProto>(() => new DescriptorProto());
@@ -636,6 +690,7 @@
return new DescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -645,6 +700,7 @@
}
}
+ /// <summary>Field number for the "field" field.</summary>
public const int FieldFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_field_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
@@ -653,6 +709,7 @@
get { return field_; }
}
+ /// <summary>Field number for the "extension" field.</summary>
public const int ExtensionFieldNumber = 6;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec
= pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
@@ -661,6 +718,7 @@
get { return extension_; }
}
+ /// <summary>Field number for the "nested_type" field.</summary>
public const int NestedTypeFieldNumber = 3;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_nestedType_codec
= pb::FieldCodec.ForMessage(26, global::Google.Protobuf.Reflection.DescriptorProto.Parser);
@@ -669,6 +727,7 @@
get { return nestedType_; }
}
+ /// <summary>Field number for the "enum_type" field.</summary>
public const int EnumTypeFieldNumber = 4;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec
= pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser);
@@ -677,6 +736,7 @@
get { return enumType_; }
}
+ /// <summary>Field number for the "extension_range" field.</summary>
public const int ExtensionRangeFieldNumber = 5;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> _repeated_extensionRange_codec
= pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser);
@@ -685,6 +745,7 @@
get { return extensionRange_; }
}
+ /// <summary>Field number for the "oneof_decl" field.</summary>
public const int OneofDeclFieldNumber = 8;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.OneofDescriptorProto> _repeated_oneofDecl_codec
= pb::FieldCodec.ForMessage(66, global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser);
@@ -693,6 +754,7 @@
get { return oneofDecl_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 7;
private global::Google.Protobuf.Reflection.MessageOptions options_;
public global::Google.Protobuf.Reflection.MessageOptions Options {
@@ -702,6 +764,7 @@
}
}
+ /// <summary>Field number for the "reserved_range" field.</summary>
public const int ReservedRangeFieldNumber = 9;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> _repeated_reservedRange_codec
= pb::FieldCodec.ForMessage(74, global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser);
@@ -710,10 +773,15 @@
get { return reservedRange_; }
}
+ /// <summary>Field number for the "reserved_name" field.</summary>
public const int ReservedNameFieldNumber = 10;
private static readonly pb::FieldCodec<string> _repeated_reservedName_codec
= pb::FieldCodec.ForString(82);
private readonly pbc::RepeatedField<string> reservedName_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// Reserved field names, which may not be used by fields in the same message.
+ /// A given name may only be reserved once.
+ /// </summary>
public pbc::RepeatedField<string> ReservedName {
get { return reservedName_; }
}
@@ -877,6 +945,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the DescriptorProto message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -907,6 +976,7 @@
return new ExtensionRange(this);
}
+ /// <summary>Field number for the "start" field.</summary>
public const int StartFieldNumber = 1;
private int start_;
public int Start {
@@ -916,6 +986,7 @@
}
}
+ /// <summary>Field number for the "end" field.</summary>
public const int EndFieldNumber = 2;
private int end_;
public int End {
@@ -1007,6 +1078,11 @@
}
+ /// <summary>
+ /// Range of reserved tag numbers. Reserved tag numbers may not be used by
+ /// fields or extension ranges in the same message. Reserved ranges may
+ /// not overlap.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class ReservedRange : pb::IMessage<ReservedRange> {
private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange());
@@ -1035,8 +1111,12 @@
return new ReservedRange(this);
}
+ /// <summary>Field number for the "start" field.</summary>
public const int StartFieldNumber = 1;
private int start_;
+ /// <summary>
+ /// Inclusive.
+ /// </summary>
public int Start {
get { return start_; }
set {
@@ -1044,8 +1124,12 @@
}
}
+ /// <summary>Field number for the "end" field.</summary>
public const int EndFieldNumber = 2;
private int end_;
+ /// <summary>
+ /// Exclusive.
+ /// </summary>
public int End {
get { return end_; }
set {
@@ -1140,6 +1224,9 @@
}
+ /// <summary>
+ /// Describes a field within a message.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto> {
private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto());
@@ -1175,6 +1262,7 @@
return new FieldDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -1184,6 +1272,7 @@
}
}
+ /// <summary>Field number for the "number" field.</summary>
public const int NumberFieldNumber = 3;
private int number_;
public int Number {
@@ -1193,6 +1282,7 @@
}
}
+ /// <summary>Field number for the "label" field.</summary>
public const int LabelFieldNumber = 4;
private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL;
public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label {
@@ -1202,8 +1292,13 @@
}
}
+ /// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 5;
private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE;
+ /// <summary>
+ /// If type_name is set, this need not be set. If both this and type_name
+ /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+ /// </summary>
public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type {
get { return type_; }
set {
@@ -1211,8 +1306,16 @@
}
}
+ /// <summary>Field number for the "type_name" field.</summary>
public const int TypeNameFieldNumber = 6;
private string typeName_ = "";
+ /// <summary>
+ /// For message and enum types, this is the name of the type. If the name
+ /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
+ /// rules are used to find the type (i.e. first the nested types within this
+ /// message are searched, then within the parent, on up to the root
+ /// namespace).
+ /// </summary>
public string TypeName {
get { return typeName_; }
set {
@@ -1220,8 +1323,13 @@
}
}
+ /// <summary>Field number for the "extendee" field.</summary>
public const int ExtendeeFieldNumber = 2;
private string extendee_ = "";
+ /// <summary>
+ /// For extensions, this is the name of the type being extended. It is
+ /// resolved in the same manner as type_name.
+ /// </summary>
public string Extendee {
get { return extendee_; }
set {
@@ -1229,8 +1337,16 @@
}
}
+ /// <summary>Field number for the "default_value" field.</summary>
public const int DefaultValueFieldNumber = 7;
private string defaultValue_ = "";
+ /// <summary>
+ /// For numeric types, contains the original text representation of the value.
+ /// For booleans, "true" or "false".
+ /// For strings, contains the default text contents (not escaped in any way).
+ /// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
+ /// TODO(kenton): Base-64 encode?
+ /// </summary>
public string DefaultValue {
get { return defaultValue_; }
set {
@@ -1238,8 +1354,13 @@
}
}
+ /// <summary>Field number for the "oneof_index" field.</summary>
public const int OneofIndexFieldNumber = 9;
private int oneofIndex_;
+ /// <summary>
+ /// If set, gives the index of a oneof in the containing type's oneof_decl
+ /// list. This field is a member of that oneof.
+ /// </summary>
public int OneofIndex {
get { return oneofIndex_; }
set {
@@ -1247,6 +1368,7 @@
}
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 8;
private global::Google.Protobuf.Reflection.FieldOptions options_;
public global::Google.Protobuf.Reflection.FieldOptions Options {
@@ -1455,32 +1577,66 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the FieldDescriptorProto message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
internal enum Type {
+ /// <summary>
+ /// 0 is reserved for errors.
+ /// Order is weird for historical reasons.
+ /// </summary>
TYPE_DOUBLE = 1,
TYPE_FLOAT = 2,
+ /// <summary>
+ /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
+ /// negative values are likely.
+ /// </summary>
TYPE_INT64 = 3,
TYPE_UINT64 = 4,
+ /// <summary>
+ /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
+ /// negative values are likely.
+ /// </summary>
TYPE_INT32 = 5,
TYPE_FIXED64 = 6,
TYPE_FIXED32 = 7,
TYPE_BOOL = 8,
TYPE_STRING = 9,
+ /// <summary>
+ /// Tag-delimited aggregate.
+ /// </summary>
TYPE_GROUP = 10,
+ /// <summary>
+ /// Length-delimited aggregate.
+ /// </summary>
TYPE_MESSAGE = 11,
+ /// <summary>
+ /// New in version 2.
+ /// </summary>
TYPE_BYTES = 12,
TYPE_UINT32 = 13,
TYPE_ENUM = 14,
TYPE_SFIXED32 = 15,
TYPE_SFIXED64 = 16,
+ /// <summary>
+ /// Uses ZigZag encoding.
+ /// </summary>
TYPE_SINT32 = 17,
+ /// <summary>
+ /// Uses ZigZag encoding.
+ /// </summary>
TYPE_SINT64 = 18,
}
internal enum Label {
+ /// <summary>
+ /// 0 is reserved for errors
+ /// </summary>
LABEL_OPTIONAL = 1,
LABEL_REQUIRED = 2,
+ /// <summary>
+ /// TODO(sanjay): Should we add LABEL_MAP?
+ /// </summary>
LABEL_REPEATED = 3,
}
@@ -1489,6 +1645,9 @@
}
+ /// <summary>
+ /// Describes a oneof.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto> {
private static readonly pb::MessageParser<OneofDescriptorProto> _parser = new pb::MessageParser<OneofDescriptorProto>(() => new OneofDescriptorProto());
@@ -1516,6 +1675,7 @@
return new OneofDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -1591,6 +1751,9 @@
}
+ /// <summary>
+ /// Describes an enum type.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto> {
private static readonly pb::MessageParser<EnumDescriptorProto> _parser = new pb::MessageParser<EnumDescriptorProto>(() => new EnumDescriptorProto());
@@ -1620,6 +1783,7 @@
return new EnumDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -1629,6 +1793,7 @@
}
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> _repeated_value_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser);
@@ -1637,6 +1802,7 @@
get { return value_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private global::Google.Protobuf.Reflection.EnumOptions options_;
public global::Google.Protobuf.Reflection.EnumOptions Options {
@@ -1743,6 +1909,9 @@
}
+ /// <summary>
+ /// Describes a value within an enum.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto> {
private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto());
@@ -1772,6 +1941,7 @@
return new EnumValueDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -1781,6 +1951,7 @@
}
}
+ /// <summary>Field number for the "number" field.</summary>
public const int NumberFieldNumber = 2;
private int number_;
public int Number {
@@ -1790,6 +1961,7 @@
}
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private global::Google.Protobuf.Reflection.EnumValueOptions options_;
public global::Google.Protobuf.Reflection.EnumValueOptions Options {
@@ -1903,6 +2075,9 @@
}
+ /// <summary>
+ /// Describes a service.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto> {
private static readonly pb::MessageParser<ServiceDescriptorProto> _parser = new pb::MessageParser<ServiceDescriptorProto>(() => new ServiceDescriptorProto());
@@ -1932,6 +2107,7 @@
return new ServiceDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -1941,6 +2117,7 @@
}
}
+ /// <summary>Field number for the "method" field.</summary>
public const int MethodFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.MethodDescriptorProto> _repeated_method_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser);
@@ -1949,6 +2126,7 @@
get { return method_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private global::Google.Protobuf.Reflection.ServiceOptions options_;
public global::Google.Protobuf.Reflection.ServiceOptions Options {
@@ -2055,6 +2233,9 @@
}
+ /// <summary>
+ /// Describes a method of a service.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto> {
private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto());
@@ -2087,6 +2268,7 @@
return new MethodDescriptorProto(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
@@ -2096,8 +2278,13 @@
}
}
+ /// <summary>Field number for the "input_type" field.</summary>
public const int InputTypeFieldNumber = 2;
private string inputType_ = "";
+ /// <summary>
+ /// Input and output type names. These are resolved in the same way as
+ /// FieldDescriptorProto.type_name, but must refer to a message type.
+ /// </summary>
public string InputType {
get { return inputType_; }
set {
@@ -2105,6 +2292,7 @@
}
}
+ /// <summary>Field number for the "output_type" field.</summary>
public const int OutputTypeFieldNumber = 3;
private string outputType_ = "";
public string OutputType {
@@ -2114,6 +2302,7 @@
}
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 4;
private global::Google.Protobuf.Reflection.MethodOptions options_;
public global::Google.Protobuf.Reflection.MethodOptions Options {
@@ -2123,8 +2312,12 @@
}
}
+ /// <summary>Field number for the "client_streaming" field.</summary>
public const int ClientStreamingFieldNumber = 5;
private bool clientStreaming_;
+ /// <summary>
+ /// Identifies if client streams multiple client messages
+ /// </summary>
public bool ClientStreaming {
get { return clientStreaming_; }
set {
@@ -2132,8 +2325,12 @@
}
}
+ /// <summary>Field number for the "server_streaming" field.</summary>
public const int ServerStreamingFieldNumber = 6;
private bool serverStreaming_;
+ /// <summary>
+ /// Identifies if server streams multiple server messages
+ /// </summary>
public bool ServerStreaming {
get { return serverStreaming_; }
set {
@@ -2335,8 +2532,15 @@
return new FileOptions(this);
}
+ /// <summary>Field number for the "java_package" field.</summary>
public const int JavaPackageFieldNumber = 1;
private string javaPackage_ = "";
+ /// <summary>
+ /// Sets the Java package where classes generated from this .proto will be
+ /// placed. By default, the proto package is used, but this is often
+ /// inappropriate because proto packages do not normally start with backwards
+ /// domain names.
+ /// </summary>
public string JavaPackage {
get { return javaPackage_; }
set {
@@ -2344,8 +2548,16 @@
}
}
+ /// <summary>Field number for the "java_outer_classname" field.</summary>
public const int JavaOuterClassnameFieldNumber = 8;
private string javaOuterClassname_ = "";
+ /// <summary>
+ /// If set, all the classes from the .proto file are wrapped in a single
+ /// outer class with the given name. This applies to both Proto1
+ /// (equivalent to the old "--one_java_file" option) and Proto2 (where
+ /// a .proto always translates to a single class, but you may want to
+ /// explicitly choose the class name).
+ /// </summary>
public string JavaOuterClassname {
get { return javaOuterClassname_; }
set {
@@ -2353,8 +2565,17 @@
}
}
+ /// <summary>Field number for the "java_multiple_files" field.</summary>
public const int JavaMultipleFilesFieldNumber = 10;
private bool javaMultipleFiles_;
+ /// <summary>
+ /// If set true, then the Java code generator will generate a separate .java
+ /// file for each top-level message, enum, and service defined in the .proto
+ /// file. Thus, these types will *not* be nested inside the outer class
+ /// named by java_outer_classname. However, the outer class will still be
+ /// generated to contain the file's getDescriptor() method as well as any
+ /// top-level extensions defined in the file.
+ /// </summary>
public bool JavaMultipleFiles {
get { return javaMultipleFiles_; }
set {
@@ -2362,8 +2583,23 @@
}
}
+ /// <summary>Field number for the "java_generate_equals_and_hash" field.</summary>
public const int JavaGenerateEqualsAndHashFieldNumber = 20;
private bool javaGenerateEqualsAndHash_;
+ /// <summary>
+ /// If set true, then the Java code generator will generate equals() and
+ /// hashCode() methods for all messages defined in the .proto file.
+ /// This increases generated code size, potentially substantially for large
+ /// protos, which may harm a memory-constrained application.
+ /// - In the full runtime this is 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.)
+ /// </summary>
public bool JavaGenerateEqualsAndHash {
get { return javaGenerateEqualsAndHash_; }
set {
@@ -2371,8 +2607,17 @@
}
}
+ /// <summary>Field number for the "java_string_check_utf8" field.</summary>
public const int JavaStringCheckUtf8FieldNumber = 27;
private bool javaStringCheckUtf8_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool JavaStringCheckUtf8 {
get { return javaStringCheckUtf8_; }
set {
@@ -2380,6 +2625,7 @@
}
}
+ /// <summary>Field number for the "optimize_for" field.</summary>
public const int OptimizeForFieldNumber = 9;
private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED;
public global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor {
@@ -2389,8 +2635,16 @@
}
}
+ /// <summary>Field number for the "go_package" field.</summary>
public const int GoPackageFieldNumber = 11;
private string goPackage_ = "";
+ /// <summary>
+ /// Sets the Go package where structs generated from this .proto will be
+ /// placed. If omitted, the Go package will be derived from the following:
+ /// - The basename of the package import path, if provided.
+ /// - Otherwise, the package statement in the .proto file, if present.
+ /// - Otherwise, the basename of the .proto file, without extension.
+ /// </summary>
public string GoPackage {
get { return goPackage_; }
set {
@@ -2398,8 +2652,20 @@
}
}
+ /// <summary>Field number for the "cc_generic_services" field.</summary>
public const int CcGenericServicesFieldNumber = 16;
private bool ccGenericServices_;
+ /// <summary>
+ /// Should generic services be generated in each language? "Generic" services
+ /// are not specific to any particular RPC system. They are generated by the
+ /// main code generators in each language (without additional plugins).
+ /// Generic services were the only kind of service generation supported by
+ /// early versions of google.protobuf.
+ /// Generic services are now considered deprecated in favor of using plugins
+ /// that generate code specific to your particular RPC system. Therefore,
+ /// these default to false. Old code which depends on generic services should
+ /// explicitly set them to true.
+ /// </summary>
public bool CcGenericServices {
get { return ccGenericServices_; }
set {
@@ -2407,6 +2673,7 @@
}
}
+ /// <summary>Field number for the "java_generic_services" field.</summary>
public const int JavaGenericServicesFieldNumber = 17;
private bool javaGenericServices_;
public bool JavaGenericServices {
@@ -2416,6 +2683,7 @@
}
}
+ /// <summary>Field number for the "py_generic_services" field.</summary>
public const int PyGenericServicesFieldNumber = 18;
private bool pyGenericServices_;
public bool PyGenericServices {
@@ -2425,8 +2693,15 @@
}
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 23;
private bool deprecated_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -2434,8 +2709,13 @@
}
}
+ /// <summary>Field number for the "cc_enable_arenas" field.</summary>
public const int CcEnableArenasFieldNumber = 31;
private bool ccEnableArenas_;
+ /// <summary>
+ /// Enables the use of arenas for the proto messages in this file. This applies
+ /// only to generated classes for C++.
+ /// </summary>
public bool CcEnableArenas {
get { return ccEnableArenas_; }
set {
@@ -2443,8 +2723,13 @@
}
}
+ /// <summary>Field number for the "objc_class_prefix" field.</summary>
public const int ObjcClassPrefixFieldNumber = 36;
private string objcClassPrefix_ = "";
+ /// <summary>
+ /// Sets the objective c class prefix which is prepended to all objective c
+ /// generated classes from this .proto. There is no default.
+ /// </summary>
public string ObjcClassPrefix {
get { return objcClassPrefix_; }
set {
@@ -2452,8 +2737,12 @@
}
}
+ /// <summary>Field number for the "csharp_namespace" field.</summary>
public const int CsharpNamespaceFieldNumber = 37;
private string csharpNamespace_ = "";
+ /// <summary>
+ /// Namespace for generated classes; defaults to the package.
+ /// </summary>
public string CsharpNamespace {
get { return csharpNamespace_; }
set {
@@ -2461,8 +2750,13 @@
}
}
+ /// <summary>Field number for the "javanano_use_deprecated_package" field.</summary>
public const int JavananoUseDeprecatedPackageFieldNumber = 38;
private bool javananoUseDeprecatedPackage_;
+ /// <summary>
+ /// Whether the nano proto compiler should generate in the deprecated non-nano
+ /// suffixed package.
+ /// </summary>
public bool JavananoUseDeprecatedPackage {
get { return javananoUseDeprecatedPackage_; }
set {
@@ -2470,10 +2764,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -2776,11 +3074,24 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the FileOptions message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
+ /// <summary>
+ /// Generated classes can be optimized for speed or code size.
+ /// </summary>
internal enum OptimizeMode {
+ /// <summary>
+ /// Generate complete code for parsing, serialization,
+ /// </summary>
SPEED = 1,
+ /// <summary>
+ /// etc.
+ /// </summary>
CODE_SIZE = 2,
+ /// <summary>
+ /// Generate code using MessageLite and the lite runtime.
+ /// </summary>
LITE_RUNTIME = 3,
}
@@ -2820,8 +3131,26 @@
return new MessageOptions(this);
}
+ /// <summary>Field number for the "message_set_wire_format" field.</summary>
public const int MessageSetWireFormatFieldNumber = 1;
private bool messageSetWireFormat_;
+ /// <summary>
+ /// Set true to use the old proto1 MessageSet wire format for extensions.
+ /// This is provided for backwards-compatibility with the MessageSet wire
+ /// format. You should not use this for any other reason: It's less
+ /// efficient, has fewer features, and is more complicated.
+ /// The message must be defined exactly as follows:
+ /// message Foo {
+ /// option message_set_wire_format = true;
+ /// extensions 4 to max;
+ /// }
+ /// Note that the message cannot have any defined fields; MessageSets only
+ /// have extensions.
+ /// All extensions of your type must be singular messages; e.g. they cannot
+ /// be int32s, enums, or repeated messages.
+ /// Because this is an option, the above two restrictions are not enforced by
+ /// the protocol compiler.
+ /// </summary>
public bool MessageSetWireFormat {
get { return messageSetWireFormat_; }
set {
@@ -2829,8 +3158,14 @@
}
}
+ /// <summary>Field number for the "no_standard_descriptor_accessor" field.</summary>
public const int NoStandardDescriptorAccessorFieldNumber = 2;
private bool noStandardDescriptorAccessor_;
+ /// <summary>
+ /// Disables the generation of the standard "descriptor()" accessor, which can
+ /// conflict with a field of the same name. This is meant to make migration
+ /// from proto1 easier; new code should avoid fields named "descriptor".
+ /// </summary>
public bool NoStandardDescriptorAccessor {
get { return noStandardDescriptorAccessor_; }
set {
@@ -2838,8 +3173,15 @@
}
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 3;
private bool deprecated_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -2847,8 +3189,29 @@
}
}
+ /// <summary>Field number for the "map_entry" field.</summary>
public const int MapEntryFieldNumber = 7;
private bool mapEntry_;
+ /// <summary>
+ /// Whether the message is an automatically generated map entry type for the
+ /// maps field.
+ /// For maps fields:
+ /// map<KeyType, ValueType> map_field = 1;
+ /// The parsed descriptor looks like:
+ /// message MapFieldEntry {
+ /// option map_entry = true;
+ /// optional KeyType key = 1;
+ /// optional ValueType value = 2;
+ /// }
+ /// repeated MapFieldEntry map_field = 1;
+ /// Implementations may choose not to generate the map_entry=true message, but
+ /// use a native map in the target language to hold the keys and values.
+ /// The reflection APIs in such implementions still need to work as
+ /// if the field is a repeated message field.
+ /// NOTE: Do not set the option in .proto files. Always use the maps syntax
+ /// instead. The option should only be implicitly set by the proto compiler
+ /// parser.
+ /// </summary>
public bool MapEntry {
get { return mapEntry_; }
set {
@@ -2856,10 +3219,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -3020,8 +3387,15 @@
return new FieldOptions(this);
}
+ /// <summary>Field number for the "ctype" field.</summary>
public const int CtypeFieldNumber = 1;
private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING;
+ /// <summary>
+ /// The ctype option instructs the C++ code generator to use a different
+ /// representation of the field than it normally would. See the specific
+ /// options below. This option is not yet implemented in the open source
+ /// release -- sorry, we'll try to include it in a future version!
+ /// </summary>
public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype {
get { return ctype_; }
set {
@@ -3029,8 +3403,16 @@
}
}
+ /// <summary>Field number for the "packed" field.</summary>
public const int PackedFieldNumber = 2;
private bool packed_;
+ /// <summary>
+ /// The packed option can be enabled for repeated primitive fields to enable
+ /// a more efficient representation on the wire. Rather than repeatedly
+ /// writing the tag and type for each element, the entire array is encoded as
+ /// a single length-delimited blob. In proto3, only explicit setting it to
+ /// false will avoid using packed encoding.
+ /// </summary>
public bool Packed {
get { return packed_; }
set {
@@ -3038,8 +3420,20 @@
}
}
+ /// <summary>Field number for the "jstype" field.</summary>
public const int JstypeFieldNumber = 6;
private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL;
+ /// <summary>
+ /// The jstype option determines the JavaScript type used for values of the
+ /// field. The option is permitted only for 64 bit integral and fixed types
+ /// (int64, uint64, sint64, fixed64, sfixed64). By default these types are
+ /// represented as JavaScript strings. This avoids loss of precision that can
+ /// happen when a large value is converted to a floating point JavaScript
+ /// numbers. Specifying JS_NUMBER for the jstype causes the generated
+ /// JavaScript code to use the JavaScript "number" type instead of strings.
+ /// This option is an enum to permit additional types to be added,
+ /// e.g. goog.math.Integer.
+ /// </summary>
public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype {
get { return jstype_; }
set {
@@ -3047,8 +3441,35 @@
}
}
+ /// <summary>Field number for the "lazy" field.</summary>
public const int LazyFieldNumber = 5;
private bool lazy_;
+ /// <summary>
+ /// Should this field be parsed lazily? Lazy applies only to message-type
+ /// fields. It means that when the outer message is initially parsed, the
+ /// inner message's contents will not be parsed but instead stored in encoded
+ /// form. The inner message will actually be parsed when it is first accessed.
+ /// This is only a hint. Implementations are free to choose whether to use
+ /// eager or lazy parsing regardless of the value of this option. However,
+ /// setting this option true suggests that the protocol author believes that
+ /// using lazy parsing on this field is worth the additional bookkeeping
+ /// overhead typically needed to implement it.
+ /// This option does not affect the public interface of any generated code;
+ /// all method signatures remain the same. Furthermore, thread-safety of the
+ /// interface is not affected by this option; const methods remain safe to
+ /// call from multiple threads concurrently, while non-const methods continue
+ /// to require exclusive access.
+ /// Note that implementations may choose not to check required fields within
+ /// a lazy sub-message. That is, calling IsInitialized() on the outher message
+ /// may return true even if the inner message has missing required fields.
+ /// This is necessary because otherwise the inner message would have to be
+ /// parsed in order to perform the check, defeating the purpose of lazy
+ /// parsing. An implementation which chooses not to check required fields
+ /// must be consistent about it. That is, for any particular sub-message, the
+ /// implementation must either *always* check its required fields, or *never*
+ /// check its required fields, regardless of whether or not the message has
+ /// been parsed.
+ /// </summary>
public bool Lazy {
get { return lazy_; }
set {
@@ -3056,8 +3477,15 @@
}
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 3;
private bool deprecated_;
+ /// <summary>
+ /// Is this field deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for accessors, or it will be completely ignored; in the very least, this
+ /// is a formalization for deprecating fields.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -3065,8 +3493,12 @@
}
}
+ /// <summary>Field number for the "weak" field.</summary>
public const int WeakFieldNumber = 10;
private bool weak_;
+ /// <summary>
+ /// For Google-internal migration only. Do not use.
+ /// </summary>
public bool Weak {
get { return weak_; }
set {
@@ -3074,10 +3506,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -3236,17 +3672,30 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the FieldOptions message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
internal enum CType {
+ /// <summary>
+ /// Default mode.
+ /// </summary>
STRING = 0,
CORD = 1,
STRING_PIECE = 2,
}
internal enum JSType {
+ /// <summary>
+ /// Use the default type.
+ /// </summary>
JS_NORMAL = 0,
+ /// <summary>
+ /// Use JavaScript strings.
+ /// </summary>
JS_STRING = 1,
+ /// <summary>
+ /// Use JavaScript numbers.
+ /// </summary>
JS_NUMBER = 2,
}
@@ -3284,8 +3733,13 @@
return new EnumOptions(this);
}
+ /// <summary>Field number for the "allow_alias" field.</summary>
public const int AllowAliasFieldNumber = 2;
private bool allowAlias_;
+ /// <summary>
+ /// Set this option to true to allow mapping different tag names to the same
+ /// value.
+ /// </summary>
public bool AllowAlias {
get { return allowAlias_; }
set {
@@ -3293,8 +3747,15 @@
}
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 3;
private bool deprecated_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -3302,10 +3763,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -3429,8 +3894,15 @@
return new EnumValueOptions(this);
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 1;
private bool deprecated_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -3438,10 +3910,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -3549,8 +4025,15 @@
return new ServiceOptions(this);
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 33;
private bool deprecated_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -3558,10 +4041,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -3669,8 +4156,15 @@
return new MethodOptions(this);
}
+ /// <summary>Field number for the "deprecated" field.</summary>
public const int DeprecatedFieldNumber = 33;
private bool deprecated_;
+ /// <summary>
+ /// 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.
+ /// </summary>
public bool Deprecated {
get { return deprecated_; }
set {
@@ -3678,10 +4172,14 @@
}
}
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
= pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
get { return uninterpretedOption_; }
}
@@ -3761,6 +4259,14 @@
}
+ /// <summary>
+ /// A message representing a option the parser does not recognize. This only
+ /// appears in options protos created by the compiler::Parser class.
+ /// DescriptorPool resolves these when building Descriptor objects. Therefore,
+ /// options protos in descriptor objects (e.g. returned by Descriptor::options(),
+ /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
+ /// in them.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption> {
private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption());
@@ -3794,6 +4300,7 @@
return new UninterpretedOption(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> _repeated_name_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser);
@@ -3802,8 +4309,13 @@
get { return name_; }
}
+ /// <summary>Field number for the "identifier_value" field.</summary>
public const int IdentifierValueFieldNumber = 3;
private string identifierValue_ = "";
+ /// <summary>
+ /// The value of the uninterpreted option, in whatever type the tokenizer
+ /// identified it as during parsing. Exactly one of these should be set.
+ /// </summary>
public string IdentifierValue {
get { return identifierValue_; }
set {
@@ -3811,6 +4323,7 @@
}
}
+ /// <summary>Field number for the "positive_int_value" field.</summary>
public const int PositiveIntValueFieldNumber = 4;
private ulong positiveIntValue_;
public ulong PositiveIntValue {
@@ -3820,6 +4333,7 @@
}
}
+ /// <summary>Field number for the "negative_int_value" field.</summary>
public const int NegativeIntValueFieldNumber = 5;
private long negativeIntValue_;
public long NegativeIntValue {
@@ -3829,6 +4343,7 @@
}
}
+ /// <summary>Field number for the "double_value" field.</summary>
public const int DoubleValueFieldNumber = 6;
private double doubleValue_;
public double DoubleValue {
@@ -3838,6 +4353,7 @@
}
}
+ /// <summary>Field number for the "string_value" field.</summary>
public const int StringValueFieldNumber = 7;
private pb::ByteString stringValue_ = pb::ByteString.Empty;
public pb::ByteString StringValue {
@@ -3847,6 +4363,7 @@
}
}
+ /// <summary>Field number for the "aggregate_value" field.</summary>
public const int AggregateValueFieldNumber = 8;
private string aggregateValue_ = "";
public string AggregateValue {
@@ -4010,8 +4527,16 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the UninterpretedOption message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
+ /// <summary>
+ /// The name of the uninterpreted option. Each string represents a segment in
+ /// a dot-separated name. is_extension is true iff a segment represents an
+ /// extension (denoted with parentheses in options specs in .proto files).
+ /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
+ /// "foo.(bar.baz).qux".
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class NamePart : pb::IMessage<NamePart> {
private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart());
@@ -4040,6 +4565,7 @@
return new NamePart(this);
}
+ /// <summary>Field number for the "name_part" field.</summary>
public const int NamePart_FieldNumber = 1;
private string namePart_ = "";
public string NamePart_ {
@@ -4049,6 +4575,7 @@
}
}
+ /// <summary>Field number for the "is_extension" field.</summary>
public const int IsExtensionFieldNumber = 2;
private bool isExtension_;
public bool IsExtension {
@@ -4145,6 +4672,10 @@
}
+ /// <summary>
+ /// Encapsulates information about the original source file from which a
+ /// FileDescriptorProto was generated.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo> {
private static readonly pb::MessageParser<SourceCodeInfo> _parser = new pb::MessageParser<SourceCodeInfo>(() => new SourceCodeInfo());
@@ -4172,10 +4703,54 @@
return new SourceCodeInfo(this);
}
+ /// <summary>Field number for the "location" field.</summary>
public const int LocationFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> _repeated_location_codec
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> location_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location>();
+ /// <summary>
+ /// A Location identifies a piece of source code in a .proto file which
+ /// corresponds to a particular definition. This information is intended
+ /// to be useful to IDEs, code indexers, documentation generators, and similar
+ /// tools.
+ /// For example, say we have a file like:
+ /// message Foo {
+ /// optional string foo = 1;
+ /// }
+ /// Let's look at just the field definition:
+ /// optional string foo = 1;
+ /// ^ ^^ ^^ ^ ^^^
+ /// a bc de f ghi
+ /// We have the following locations:
+ /// span path represents
+ /// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
+ /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
+ /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
+ /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
+ /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
+ /// Notes:
+ /// - A location may refer to a repeated field itself (i.e. not to any
+ /// particular index within it). This is used whenever a set of elements are
+ /// logically enclosed in a single code segment. For example, an entire
+ /// extend block (possibly containing multiple extension definitions) will
+ /// have an outer location whose path refers to the "extensions" repeated
+ /// field without an index.
+ /// - Multiple locations may have the same path. This happens when a single
+ /// logical declaration is spread out across multiple places. The most
+ /// obvious example is the "extend" block again -- there may be multiple
+ /// extend blocks in the same scope, each of which will have the same path.
+ /// - A location's span is not always a subset of its parent's span. For
+ /// example, the "extendee" of an extension declaration appears at the
+ /// beginning of the "extend" block and is shared by all extensions within
+ /// the block.
+ /// - Just because a location's span is a subset of some other location's span
+ /// does not mean that it is a descendent. For example, a "group" defines
+ /// both a type and a field in a single declaration. Thus, the locations
+ /// corresponding to the type and field and their components will overlap.
+ /// - Code which tries to interpret locations should probably be designed to
+ /// ignore those that it doesn't understand, as more types of locations could
+ /// be recorded in the future.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> Location {
get { return location_; }
}
@@ -4238,6 +4813,7 @@
}
#region Nested types
+ /// <summary>Container for nested types declared in the SourceCodeInfo message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4271,24 +4847,95 @@
return new Location(this);
}
+ /// <summary>Field number for the "path" field.</summary>
public const int PathFieldNumber = 1;
private static readonly pb::FieldCodec<int> _repeated_path_codec
= pb::FieldCodec.ForInt32(10);
private readonly pbc::RepeatedField<int> path_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Identifies which part of the FileDescriptorProto was defined at this
+ /// location.
+ /// Each element is a field number or an index. They form a path from
+ /// the root FileDescriptorProto to the place where the definition. For
+ /// example, this path:
+ /// [ 4, 3, 2, 7, 1 ]
+ /// refers to:
+ /// file.message_type(3) // 4, 3
+ /// .field(7) // 2, 7
+ /// .name() // 1
+ /// This is because FileDescriptorProto.message_type has field number 4:
+ /// repeated DescriptorProto message_type = 4;
+ /// and DescriptorProto.field has field number 2:
+ /// repeated FieldDescriptorProto field = 2;
+ /// and FieldDescriptorProto.name has field number 1:
+ /// optional string name = 1;
+ /// Thus, the above path gives the location of a field name. If we removed
+ /// the last element:
+ /// [ 4, 3, 2, 7 ]
+ /// this path refers to the whole field declaration (from the beginning
+ /// of the label to the terminating semicolon).
+ /// </summary>
public pbc::RepeatedField<int> Path {
get { return path_; }
}
+ /// <summary>Field number for the "span" field.</summary>
public const int SpanFieldNumber = 2;
private static readonly pb::FieldCodec<int> _repeated_span_codec
= pb::FieldCodec.ForInt32(18);
private readonly pbc::RepeatedField<int> span_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Always has exactly three or four elements: start line, start column,
+ /// end line (optional, otherwise assumed same as start line), end column.
+ /// These are packed into a single field for efficiency. Note that line
+ /// and column numbers are zero-based -- typically you will want to add
+ /// 1 to each before displaying to a user.
+ /// </summary>
public pbc::RepeatedField<int> Span {
get { return span_; }
}
+ /// <summary>Field number for the "leading_comments" field.</summary>
public const int LeadingCommentsFieldNumber = 3;
private string leadingComments_ = "";
+ /// <summary>
+ /// If this SourceCodeInfo represents a complete declaration, these are any
+ /// comments appearing before and after the declaration which appear to be
+ /// attached to the declaration.
+ /// A series of line comments appearing on consecutive lines, with no other
+ /// tokens appearing on those lines, will be treated as a single comment.
+ /// leading_detached_comments will keep paragraphs of comments that appear
+ /// before (but not connected to) the current element. Each paragraph,
+ /// separated by empty lines, will be one comment element in the repeated
+ /// field.
+ /// Only the comment content is provided; comment markers (e.g. //) are
+ /// stripped out. For block comments, leading whitespace and an asterisk
+ /// will be stripped from the beginning of each line other than the first.
+ /// Newlines are included in the output.
+ /// Examples:
+ /// optional int32 foo = 1; // Comment attached to foo.
+ /// // Comment attached to bar.
+ /// optional int32 bar = 2;
+ /// optional string baz = 3;
+ /// // Comment attached to baz.
+ /// // Another line attached to baz.
+ /// // Comment attached to qux.
+ /// //
+ /// // Another line attached to qux.
+ /// optional double qux = 4;
+ /// // Detached comment for corge. This is not leading or trailing comments
+ /// // to qux or corge because there are blank lines separating it from
+ /// // both.
+ /// // Detached comment for corge paragraph 2.
+ /// optional string corge = 5;
+ /// /* Block comment attached
+ /// * to corge. Leading asterisks
+ /// * will be removed. */
+ /// /* Block comment attached to
+ /// * grault. */
+ /// optional int32 grault = 6;
+ /// // ignored detached comments.
+ /// </summary>
public string LeadingComments {
get { return leadingComments_; }
set {
@@ -4296,6 +4943,7 @@
}
}
+ /// <summary>Field number for the "trailing_comments" field.</summary>
public const int TrailingCommentsFieldNumber = 4;
private string trailingComments_ = "";
public string TrailingComments {
@@ -4305,6 +4953,7 @@
}
}
+ /// <summary>Field number for the "leading_detached_comments" field.</summary>
public const int LeadingDetachedCommentsFieldNumber = 6;
private static readonly pb::FieldCodec<string> _repeated_leadingDetachedComments_codec
= pb::FieldCodec.ForString(50);
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
index 901cbf4..619a6ac 100644
--- a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
@@ -252,7 +252,7 @@
{
if (fieldType != FieldType.Message)
{
- throw new InvalidOperationException("MessageType is only valid for enum fields.");
+ throw new InvalidOperationException("MessageType is only valid for message fields.");
}
return messageType;
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
index 204b37c..4a70401 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/any.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Any {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/any.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,9 +25,9 @@
static Any() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi",
- "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQksKE2Nv",
- "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAGgAQGiAgNHUEKqAh5Hb29n",
+ "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi",
+ "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQksKE2Nv",
+ "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAGgAQGiAgNHUEKqAh5Hb29n",
"bGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -38,6 +40,33 @@
}
}
#region Messages
+ /// <summary>
+ /// `Any` contains an arbitrary serialized message along with a URL
+ /// that describes the type of the serialized message.
+ /// JSON
+ /// ====
+ /// The JSON representation of an `Any` value uses the regular
+ /// representation of the deserialized, embedded message, with an
+ /// additional field `@type` which contains the type URL. Example:
+ /// package google.profile;
+ /// message Person {
+ /// string first_name = 1;
+ /// string last_name = 2;
+ /// }
+ /// {
+ /// "@type": "type.googleapis.com/google.profile.Person",
+ /// "firstName": <string>,
+ /// "lastName": <string>
+ /// }
+ /// If the embedded message type is well-known and has a custom JSON
+ /// representation, that representation will be embedded adding a field
+ /// `value` which holds the custom JSON in addition to the the `@type`
+ /// field. Example (for message [google.protobuf.Duration][google.protobuf.Duration]):
+ /// {
+ /// "@type": "type.googleapis.com/google.protobuf.Duration",
+ /// "value": "1.212s"
+ /// }
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Any : pb::IMessage<Any> {
private static readonly pb::MessageParser<Any> _parser = new pb::MessageParser<Any>(() => new Any());
@@ -66,8 +95,27 @@
return new Any(this);
}
+ /// <summary>Field number for the "type_url" field.</summary>
public const int TypeUrlFieldNumber = 1;
private string typeUrl_ = "";
+ /// <summary>
+ /// A URL/resource name whose content describes the type of the
+ /// serialized message.
+ /// For URLs which use the schema `http`, `https`, or no schema, the
+ /// following restrictions and interpretations apply:
+ /// * If no schema is provided, `https` is assumed.
+ /// * The last segment of the URL's path must represent the fully
+ /// qualified name of the type (as in `path/google.protobuf.Duration`).
+ /// * An HTTP GET on the URL must yield a [google.protobuf.Type][google.protobuf.Type]
+ /// value in binary format, or produce an error.
+ /// * Applications are allowed to cache lookup results based on the
+ /// URL, or have them precompiled into a binary to avoid any
+ /// lookup. Therefore, binary compatibility needs to be preserved
+ /// on changes to types. (Use versioned type names to manage
+ /// breaking changes.)
+ /// Schemas other than `http`, `https` (or the empty schema) might be
+ /// used with implementation specific semantics.
+ /// </summary>
public string TypeUrl {
get { return typeUrl_; }
set {
@@ -75,8 +123,12 @@
}
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 2;
private pb::ByteString value_ = pb::ByteString.Empty;
+ /// <summary>
+ /// Must be valid serialized data of the above specified type.
+ /// </summary>
public pb::ByteString Value {
get { return value_; }
set {
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs
new file mode 100644
index 0000000..082f743
--- /dev/null
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs
@@ -0,0 +1,79 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 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.
+#endregion
+
+using Google.Protobuf.Reflection;
+
+namespace Google.Protobuf.WellKnownTypes
+{
+ public partial class Any
+ {
+ // This could be moved to MessageDescriptor if we wanted to, but keeping it here means
+ // all the Any-specific code is in the same place.
+ private static string GetTypeUrl(MessageDescriptor descriptor)
+ {
+ return "type.googleapis.com/" + descriptor.FullName;
+ }
+
+ /// <summary>
+ /// Unpacks the content of this Any message into the target message type,
+ /// which must match the type URL within this Any message.
+ /// </summary>
+ /// <typeparam name="T">The type of message to unpack the content into.</typeparam>
+ /// <returns>The unpacked message.</returns>
+ /// <exception cref="InvalidProtocolBufferException">The target message type doesn't match the type URL in this message</exception>
+ public T Unpack<T>() where T : IMessage, new()
+ {
+ // Note: this doesn't perform as well is it might. We could take a MessageParser<T> in an alternative overload,
+ // which would be expected to perform slightly better... although the difference is likely to be negligible.
+ T target = new T();
+ string targetTypeUrl = GetTypeUrl(target.Descriptor);
+ if (TypeUrl != targetTypeUrl)
+ {
+ throw new InvalidProtocolBufferException(string.Format("Type url for {0} is {1}; Any message's type url is {2}",
+ target.Descriptor.Name, targetTypeUrl, TypeUrl));
+ }
+ target.MergeFrom(Value);
+ return target;
+ }
+
+ /// <summary>
+ /// Packs the specified message into an Any message.
+ /// </summary>
+ /// <param name="message">The message to pack.</param>
+ /// <returns>An Any message with the content and type URL of <paramref name="message"/>.</returns>
+ public static Any Pack(IMessage message)
+ {
+ Preconditions.CheckNotNull(message, "message");
+ return new Any { TypeUrl = GetTypeUrl(message.Descriptor), Value = message.ToByteString() };
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
index a5f9509..2c64314 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/api.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Api {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/api.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,24 +25,28 @@
static Api() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvEg9nb29nbGUucHJvdG9idWYa",
- "JGdvb2dsZS9wcm90b2J1Zi9zb3VyY2VfY29udGV4dC5wcm90bxoaZ29vZ2xl",
- "L3Byb3RvYnVmL3R5cGUucHJvdG8isAEKA0FwaRIMCgRuYW1lGAEgASgJEigK",
- "B21ldGhvZHMYAiADKAs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lN5bnRheCLVAQoGTWV0aG9kEgwKBG5hbWUYASABKAkSGAoQcmVxdWVz",
+ "dF90eXBlX3VybBgCIAEoCRIZChFyZXF1ZXN0X3N0cmVhbWluZxgDIAEoCBIZ",
+ "ChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25zZV9zdHJlYW1p",
+ "bmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5P",
+ "cHRpb24SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRh",
+ "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCSwoTY29t",
+ "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAaABAaICA0dQQqoCHkdvb2ds",
+ "ZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.Proto.SourceContext.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.Type.Descriptor, },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), new[]{ "Name", "Methods", "Options", "Version", "SourceContext" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options" }, null, null, null)
+ new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), new[]{ "Name", "Methods", "Options", "Version", "SourceContext", "Mixins", "Syntax" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options", "Syntax" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), new[]{ "Name", "Root" }, null, null, null)
}));
}
#endregion
@@ -48,6 +54,9 @@
}
}
#region Messages
+ /// <summary>
+ /// Api is a light-weight descriptor for a protocol buffer service.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Api : pb::IMessage<Api> {
private static readonly pb::MessageParser<Api> _parser = new pb::MessageParser<Api>(() => new Api());
@@ -73,14 +82,21 @@
options_ = other.options_.Clone();
version_ = other.version_;
SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null;
+ mixins_ = other.mixins_.Clone();
+ syntax_ = other.syntax_;
}
public Api Clone() {
return new Api(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// The fully qualified name of this api, including package name
+ /// followed by the api's simple name.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -88,24 +104,53 @@
}
}
+ /// <summary>Field number for the "methods" field.</summary>
public const int MethodsFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Method> _repeated_methods_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Method.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method> methods_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method>();
+ /// <summary>
+ /// The methods of this api, in unspecified order.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method> Methods {
get { return methods_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec
= pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>();
+ /// <summary>
+ /// Any metadata attached to the API.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options {
get { return options_; }
}
+ /// <summary>Field number for the "version" field.</summary>
public const int VersionFieldNumber = 4;
private string version_ = "";
+ /// <summary>
+ /// A version string for this api. If specified, must have the form
+ /// `major-version.minor-version`, as in `1.10`. If the minor version
+ /// is omitted, it defaults to zero. If the entire version field is
+ /// empty, the major version is derived from the package name, as
+ /// outlined below. If the field is not empty, the version in the
+ /// package name will be verified to be consistent with what is
+ /// provided here.
+ /// The versioning schema uses [semantic
+ /// versioning](http://semver.org) where the major version number
+ /// indicates a breaking change and the minor version an additive,
+ /// non-breaking change. Both version numbers are signals to users
+ /// what to expect from different versions, and should be carefully
+ /// chosen based on the product plan.
+ /// The major version is also reflected in the package name of the
+ /// API, which must end in `v<major-version>`, as in
+ /// `google.feature.v1`. For major versions 0 and 1, the suffix can
+ /// be omitted. Zero major versions must only be used for
+ /// experimental, none-GA apis.
+ /// </summary>
public string Version {
get { return version_; }
set {
@@ -113,8 +158,13 @@
}
}
+ /// <summary>Field number for the "source_context" field.</summary>
public const int SourceContextFieldNumber = 5;
private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_;
+ /// <summary>
+ /// Source context for the protocol buffer service represented by this
+ /// message.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext {
get { return sourceContext_; }
set {
@@ -122,6 +172,31 @@
}
}
+ /// <summary>Field number for the "mixins" field.</summary>
+ public const int MixinsFieldNumber = 6;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Mixin> _repeated_mixins_codec
+ = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Mixin.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin> mixins_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin>();
+ /// <summary>
+ /// Included APIs. See [Mixin][].
+ /// </summary>
+ public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin> Mixins {
+ get { return mixins_; }
+ }
+
+ /// <summary>Field number for the "syntax" field.</summary>
+ public const int SyntaxFieldNumber = 7;
+ private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2;
+ /// <summary>
+ /// The source syntax of the service.
+ /// </summary>
+ public global::Google.Protobuf.WellKnownTypes.Syntax Syntax {
+ get { return syntax_; }
+ set {
+ syntax_ = value;
+ }
+ }
+
public override bool Equals(object other) {
return Equals(other as Api);
}
@@ -138,6 +213,8 @@
if(!options_.Equals(other.options_)) return false;
if (Version != other.Version) return false;
if (!object.Equals(SourceContext, other.SourceContext)) return false;
+ if(!mixins_.Equals(other.mixins_)) return false;
+ if (Syntax != other.Syntax) return false;
return true;
}
@@ -148,6 +225,8 @@
hash ^= options_.GetHashCode();
if (Version.Length != 0) hash ^= Version.GetHashCode();
if (sourceContext_ != null) hash ^= SourceContext.GetHashCode();
+ hash ^= mixins_.GetHashCode();
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode();
return hash;
}
@@ -170,6 +249,11 @@
output.WriteRawTag(42);
output.WriteMessage(SourceContext);
}
+ mixins_.WriteTo(output, _repeated_mixins_codec);
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ output.WriteRawTag(56);
+ output.WriteEnum((int) Syntax);
+ }
}
public int CalculateSize() {
@@ -185,6 +269,10 @@
if (sourceContext_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext);
}
+ size += mixins_.CalculateSize(_repeated_mixins_codec);
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
+ }
return size;
}
@@ -206,6 +294,10 @@
}
SourceContext.MergeFrom(other.SourceContext);
}
+ mixins_.Add(other.mixins_);
+ if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ Syntax = other.Syntax;
+ }
}
public void MergeFrom(pb::CodedInputStream input) {
@@ -238,12 +330,23 @@
input.ReadMessage(sourceContext_);
break;
}
+ case 50: {
+ mixins_.AddEntriesFrom(input, _repeated_mixins_codec);
+ break;
+ }
+ case 56: {
+ syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
+ break;
+ }
}
}
}
}
+ /// <summary>
+ /// Method represents a method of an api.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Method : pb::IMessage<Method> {
private static readonly pb::MessageParser<Method> _parser = new pb::MessageParser<Method>(() => new Method());
@@ -270,14 +373,19 @@
responseTypeUrl_ = other.responseTypeUrl_;
responseStreaming_ = other.responseStreaming_;
options_ = other.options_.Clone();
+ syntax_ = other.syntax_;
}
public Method Clone() {
return new Method(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// The simple name of this method.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -285,8 +393,12 @@
}
}
+ /// <summary>Field number for the "request_type_url" field.</summary>
public const int RequestTypeUrlFieldNumber = 2;
private string requestTypeUrl_ = "";
+ /// <summary>
+ /// A URL of the input message type.
+ /// </summary>
public string RequestTypeUrl {
get { return requestTypeUrl_; }
set {
@@ -294,8 +406,12 @@
}
}
+ /// <summary>Field number for the "request_streaming" field.</summary>
public const int RequestStreamingFieldNumber = 3;
private bool requestStreaming_;
+ /// <summary>
+ /// If true, the request is streamed.
+ /// </summary>
public bool RequestStreaming {
get { return requestStreaming_; }
set {
@@ -303,8 +419,12 @@
}
}
+ /// <summary>Field number for the "response_type_url" field.</summary>
public const int ResponseTypeUrlFieldNumber = 4;
private string responseTypeUrl_ = "";
+ /// <summary>
+ /// The URL of the output message type.
+ /// </summary>
public string ResponseTypeUrl {
get { return responseTypeUrl_; }
set {
@@ -312,8 +432,12 @@
}
}
+ /// <summary>Field number for the "response_streaming" field.</summary>
public const int ResponseStreamingFieldNumber = 5;
private bool responseStreaming_;
+ /// <summary>
+ /// If true, the response is streamed.
+ /// </summary>
public bool ResponseStreaming {
get { return responseStreaming_; }
set {
@@ -321,14 +445,31 @@
}
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 6;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec
= pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Option.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>();
+ /// <summary>
+ /// Any metadata attached to the method.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options {
get { return options_; }
}
+ /// <summary>Field number for the "syntax" field.</summary>
+ public const int SyntaxFieldNumber = 7;
+ private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2;
+ /// <summary>
+ /// The source syntax of this method.
+ /// </summary>
+ public global::Google.Protobuf.WellKnownTypes.Syntax Syntax {
+ get { return syntax_; }
+ set {
+ syntax_ = value;
+ }
+ }
+
public override bool Equals(object other) {
return Equals(other as Method);
}
@@ -346,6 +487,7 @@
if (ResponseTypeUrl != other.ResponseTypeUrl) return false;
if (ResponseStreaming != other.ResponseStreaming) return false;
if(!options_.Equals(other.options_)) return false;
+ if (Syntax != other.Syntax) return false;
return true;
}
@@ -357,6 +499,7 @@
if (ResponseTypeUrl.Length != 0) hash ^= ResponseTypeUrl.GetHashCode();
if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode();
hash ^= options_.GetHashCode();
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode();
return hash;
}
@@ -386,6 +529,10 @@
output.WriteBool(ResponseStreaming);
}
options_.WriteTo(output, _repeated_options_codec);
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ output.WriteRawTag(56);
+ output.WriteEnum((int) Syntax);
+ }
}
public int CalculateSize() {
@@ -406,6 +553,9 @@
size += 1 + 1;
}
size += options_.CalculateSize(_repeated_options_codec);
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
+ }
return size;
}
@@ -429,6 +579,9 @@
ResponseStreaming = other.ResponseStreaming;
}
options_.Add(other.options_);
+ if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ Syntax = other.Syntax;
+ }
}
public void MergeFrom(pb::CodedInputStream input) {
@@ -462,6 +615,211 @@
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
+ case 56: {
+ syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Declares an API to be included in this API. The including API must
+ /// redeclare all the methods from the included API, but documentation
+ /// and options are inherited as follows:
+ /// - If after comment and whitespace stripping, the documentation
+ /// string of the redeclared method is empty, it will be inherited
+ /// from the original method.
+ /// - Each annotation belonging to the service config (http,
+ /// visibility) which is not set in the redeclared method will be
+ /// inherited.
+ /// - If an http annotation is inherited, the path pattern will be
+ /// modified as follows. Any version prefix will be replaced by the
+ /// version of the including API plus the [root][] path if specified.
+ /// Example of a simple mixin:
+ /// package google.acl.v1;
+ /// service AccessControl {
+ /// // Get the underlying ACL object.
+ /// rpc GetAcl(GetAclRequest) returns (Acl) {
+ /// option (google.api.http).get = "/v1/{resource=**}:getAcl";
+ /// }
+ /// }
+ /// package google.storage.v2;
+ /// service Storage {
+ /// // (-- see AccessControl.GetAcl --)
+ /// rpc GetAcl(GetAclRequest) returns (Acl);
+ /// // Get a data record.
+ /// rpc GetData(GetDataRequest) returns (Data) {
+ /// option (google.api.http).get = "/v2/{resource=**}";
+ /// }
+ /// }
+ /// Example of a mixin configuration:
+ /// apis:
+ /// - name: google.storage.v2.Storage
+ /// mixins:
+ /// - name: google.acl.v1.AccessControl
+ /// The mixin construct implies that all methods in `AccessControl` are
+ /// also declared with same name and request/response types in
+ /// `Storage`. A documentation generator or annotation processor will
+ /// see the effective `Storage.GetAcl` method after inherting
+ /// documentation and annotations as follows:
+ /// service Storage {
+ /// // Get the underlying ACL object.
+ /// rpc GetAcl(GetAclRequest) returns (Acl) {
+ /// option (google.api.http).get = "/v2/{resource=**}:getAcl";
+ /// }
+ /// ...
+ /// }
+ /// Note how the version in the path pattern changed from `v1` to `v2`.
+ /// If the `root` field in the mixin is specified, it should be a
+ /// relative path under which inherited HTTP paths are placed. Example:
+ /// apis:
+ /// - name: google.storage.v2.Storage
+ /// mixins:
+ /// - name: google.acl.v1.AccessControl
+ /// root: acls
+ /// This implies the following inherited HTTP annotation:
+ /// service Storage {
+ /// // Get the underlying ACL object.
+ /// rpc GetAcl(GetAclRequest) returns (Acl) {
+ /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
+ /// }
+ /// ...
+ /// }
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public sealed partial class Mixin : pb::IMessage<Mixin> {
+ private static readonly pb::MessageParser<Mixin> _parser = new pb::MessageParser<Mixin>(() => new Mixin());
+ public static pb::MessageParser<Mixin> Parser { get { return _parser; } }
+
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.WellKnownTypes.Proto.Api.Descriptor.MessageTypes[2]; }
+ }
+
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ public Mixin() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public Mixin(Mixin other) : this() {
+ name_ = other.name_;
+ root_ = other.root_;
+ }
+
+ public Mixin Clone() {
+ return new Mixin(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ /// <summary>
+ /// The fully qualified name of the API which is included.
+ /// </summary>
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::Preconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "root" field.</summary>
+ public const int RootFieldNumber = 2;
+ private string root_ = "";
+ /// <summary>
+ /// If non-empty specifies a path under which inherited HTTP paths
+ /// are rooted.
+ /// </summary>
+ public string Root {
+ get { return root_; }
+ set {
+ root_ = pb::Preconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as Mixin);
+ }
+
+ public bool Equals(Mixin other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if (Root != other.Root) return false;
+ return true;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (Root.Length != 0) hash ^= Root.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ if (Root.Length != 0) {
+ output.WriteRawTag(18);
+ output.WriteString(Root);
+ }
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ if (Root.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Root);
+ }
+ return size;
+ }
+
+ public void MergeFrom(Mixin other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ if (other.Root.Length != 0) {
+ Root = other.Root;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ Root = input.ReadString();
+ break;
+ }
}
}
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
index aa34f2d..39251e2 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Duration {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/duration.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,10 +25,10 @@
static Duration() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90",
- "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg",
- "ASgFQlAKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAaAB",
- "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv",
+ "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90",
+ "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg",
+ "ASgFQlAKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAaAB",
+ "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv",
"dG8z"));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -39,6 +41,40 @@
}
}
#region Messages
+ /// <summary>
+ /// A Duration represents a signed, fixed-length span of time represented
+ /// as a count of seconds and fractions of seconds at nanosecond
+ /// resolution. It is independent of any calendar and concepts like "day"
+ /// or "month". It is related to Timestamp in that the difference between
+ /// two Timestamp values is a Duration and it can be added or subtracted
+ /// from a Timestamp. Range is approximately +-10,000 years.
+ /// Example 1: Compute Duration from two Timestamps in pseudo code.
+ /// Timestamp start = ...;
+ /// Timestamp end = ...;
+ /// Duration duration = ...;
+ /// duration.seconds = end.seconds - start.seconds;
+ /// duration.nanos = end.nanos - start.nanos;
+ /// if (duration.seconds < 0 && duration.nanos > 0) {
+ /// duration.seconds += 1;
+ /// duration.nanos -= 1000000000;
+ /// } else if (durations.seconds > 0 && duration.nanos < 0) {
+ /// duration.seconds -= 1;
+ /// duration.nanos += 1000000000;
+ /// }
+ /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
+ /// Timestamp start = ...;
+ /// Duration duration = ...;
+ /// Timestamp end = ...;
+ /// end.seconds = start.seconds + duration.seconds;
+ /// end.nanos = start.nanos + duration.nanos;
+ /// if (end.nanos < 0) {
+ /// end.seconds -= 1;
+ /// end.nanos += 1000000000;
+ /// } else if (end.nanos >= 1000000000) {
+ /// end.seconds += 1;
+ /// end.nanos -= 1000000000;
+ /// }
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Duration : pb::IMessage<Duration> {
private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
@@ -67,8 +103,13 @@
return new Duration(this);
}
+ /// <summary>Field number for the "seconds" field.</summary>
public const int SecondsFieldNumber = 1;
private long seconds_;
+ /// <summary>
+ /// Signed seconds of the span of time. Must be from -315,576,000,000
+ /// to +315,576,000,000 inclusive.
+ /// </summary>
public long Seconds {
get { return seconds_; }
set {
@@ -76,8 +117,17 @@
}
}
+ /// <summary>Field number for the "nanos" field.</summary>
public const int NanosFieldNumber = 2;
private int nanos_;
+ /// <summary>
+ /// Signed fractions of a second at nanosecond resolution of the span
+ /// of time. Durations less than one second are represented with a 0
+ /// `seconds` field and a positive or negative `nanos` field. For durations
+ /// of one second or more, a non-zero value for the `nanos` field must be
+ /// of the same sign as the `seconds` field. Must be from -999,999,999
+ /// to +999,999,999 inclusive.
+ /// </summary>
public int Nanos {
get { return nanos_; }
set {
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
index 7d699c1..18223a9 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/empty.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Empty {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/empty.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,10 +25,10 @@
static Empty() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1",
- "ZiIHCgVFbXB0eUJKChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv",
- "UAGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy",
- "b3RvMw=="));
+ "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1",
+ "ZiIHCgVFbXB0eUJNChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv",
+ "UAGgAQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNi",
+ "BnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
@@ -38,6 +40,15 @@
}
}
#region Messages
+ /// <summary>
+ /// A generic empty message that you can re-use to avoid defining duplicated
+ /// empty messages in your APIs. A typical example is to use it as the request
+ /// or the response type of an API method. For instance:
+ /// service Foo {
+ /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
+ /// }
+ /// The JSON representation for `Empty` is empty JSON object `{}`.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Empty : pb::IMessage<Empty> {
private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty());
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
index 0dac440..33c814e 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/field_mask.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class FieldMask {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/field_mask.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,10 +25,10 @@
static FieldMask() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy",
- "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJOChNjb20uZ29v",
- "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABogIDR1BCqgIeR29vZ2xl",
- "LlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM="));
+ "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy",
+ "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJRChNjb20uZ29v",
+ "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABoAEBogIDR1BCqgIeR29v",
+ "Z2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
@@ -38,6 +40,103 @@
}
}
#region Messages
+ /// <summary>
+ /// `FieldMask` represents a set of symbolic field paths, for example:
+ /// paths: "f.a"
+ /// paths: "f.b.d"
+ /// Here `f` represents a field in some root message, `a` and `b`
+ /// fields in the message found in `f`, and `d` a field found in the
+ /// message in `f.b`.
+ /// Field masks are used to specify a subset of fields that should be
+ /// returned by a get operation or modified by an update operation.
+ /// Field masks also have a custom JSON encoding (see below).
+ /// # Field Masks in Projections
+ /// When used in the context of a projection, a response message or
+ /// sub-message is filtered by the API to only contain those fields as
+ /// specified in the mask. For example, if the mask in the previous
+ /// example is applied to a response message as follows:
+ /// f {
+ /// a : 22
+ /// b {
+ /// d : 1
+ /// x : 2
+ /// }
+ /// y : 13
+ /// }
+ /// z: 8
+ /// The result will not contain specific values for fields x,y and z
+ /// (there value will be set to the default, and omitted in proto text
+ /// output):
+ /// f {
+ /// a : 22
+ /// b {
+ /// d : 1
+ /// }
+ /// }
+ /// A repeated field is not allowed except at the last position of a
+ /// field mask.
+ /// If a FieldMask object is not present in a get operation, the
+ /// operation applies to all fields (as if a FieldMask of all fields
+ /// had been specified).
+ /// Note that a field mask does not necessarily applies to the
+ /// top-level response message. In case of a REST get operation, the
+ /// field mask applies directly to the response, but in case of a REST
+ /// list operation, the mask instead applies to each individual message
+ /// in the returned resource list. In case of a REST custom method,
+ /// other definitions may be used. Where the mask applies will be
+ /// clearly documented together with its declaration in the API. In
+ /// any case, the effect on the returned resource/resources is required
+ /// behavior for APIs.
+ /// # Field Masks in Update Operations
+ /// A field mask in update operations specifies which fields of the
+ /// targeted resource are going to be updated. The API is required
+ /// to only change the values of the fields as specified in the mask
+ /// and leave the others untouched. If a resource is passed in to
+ /// describe the updated values, the API ignores the values of all
+ /// fields not covered by the mask.
+ /// In order to reset a field's value to the default, the field must
+ /// be in the mask and set to the default value in the provided resource.
+ /// Hence, in order to reset all fields of a resource, provide a default
+ /// instance of the resource and set all fields in the mask, or do
+ /// not provide a mask as described below.
+ /// If a field mask is not present on update, the operation applies to
+ /// all fields (as if a field mask of all fields has been specified).
+ /// Note that in the presence of schema evolution, this may mean that
+ /// fields the client does not know and has therefore not filled into
+ /// the request will be reset to their default. If this is unwanted
+ /// behavior, a specific service may require a client to always specify
+ /// a field mask, producing an error if not.
+ /// As with get operations, the location of the resource which
+ /// describes the updated values in the request message depends on the
+ /// operation kind. In any case, the effect of the field mask is
+ /// required to be honored by the API.
+ /// ## Considerations for HTTP REST
+ /// The HTTP kind of an update operation which uses a field mask must
+ /// be set to PATCH instead of PUT in order to satisfy HTTP semantics
+ /// (PUT must only be used for full updates).
+ /// # JSON Encoding of Field Masks
+ /// In JSON, a field mask is encoded as a single string where paths are
+ /// separated by a comma. Fields name in each path are converted
+ /// to/from lower-camel naming conventions.
+ /// As an example, consider the following message declarations:
+ /// message Profile {
+ /// User user = 1;
+ /// Photo photo = 2;
+ /// }
+ /// message User {
+ /// string display_name = 1;
+ /// string address = 2;
+ /// }
+ /// In proto a field mask for `Profile` may look as such:
+ /// mask {
+ /// paths: "user.display_name"
+ /// paths: "photo"
+ /// }
+ /// In JSON, the same mask is represented as below:
+ /// {
+ /// mask: "user.displayName,photo"
+ /// }
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class FieldMask : pb::IMessage<FieldMask> {
private static readonly pb::MessageParser<FieldMask> _parser = new pb::MessageParser<FieldMask>(() => new FieldMask());
@@ -65,10 +164,14 @@
return new FieldMask(this);
}
+ /// <summary>Field number for the "paths" field.</summary>
public const int PathsFieldNumber = 1;
private static readonly pb::FieldCodec<string> _repeated_paths_codec
= pb::FieldCodec.ForString(10);
private readonly pbc::RepeatedField<string> paths_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// The set of field mask paths.
+ /// </summary>
public pbc::RepeatedField<string> Paths {
get { return paths_; }
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
index 8347999..d87c54b 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/source_context.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class SourceContext {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/source_context.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,11 +25,11 @@
static SourceContext() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds",
- "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo",
- "CUJSChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q",
- "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv",
- "dG8z"));
+ "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds",
+ "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo",
+ "CUJVChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q",
+ "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG",
+ "cHJvdG8z"));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
@@ -39,6 +41,10 @@
}
}
#region Messages
+ /// <summary>
+ /// `SourceContext` represents information about the source of a
+ /// protobuf element, like the file in which it is defined.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class SourceContext : pb::IMessage<SourceContext> {
private static readonly pb::MessageParser<SourceContext> _parser = new pb::MessageParser<SourceContext>(() => new SourceContext());
@@ -66,8 +72,13 @@
return new SourceContext(this);
}
+ /// <summary>Field number for the "file_name" field.</summary>
public const int FileNameFieldNumber = 1;
private string fileName_ = "";
+ /// <summary>
+ /// The path-qualified name of the .proto file that contained the associated
+ /// protobuf element. For example: `"google/protobuf/source.proto"`.
+ /// </summary>
public string FileName {
get { return fileName_; }
set {
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
index 1e8a823..a9961be 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/struct.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Struct {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/struct.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,19 +25,19 @@
static Struct() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i",
- "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i",
- "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB",
- "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC",
- "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv",
- "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM",
- "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K",
- "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI",
- "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW",
- "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW",
- "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W",
- "QUxVRRAAQk4KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAGg",
- "AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy",
+ "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i",
+ "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i",
+ "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB",
+ "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC",
+ "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv",
+ "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM",
+ "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K",
+ "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI",
+ "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW",
+ "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW",
+ "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W",
+ "QUxVRRAAQk4KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAGg",
+ "AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -50,13 +52,30 @@
}
}
#region Enums
+ /// <summary>
+ /// `NullValue` is a singleton enumeration to represent the null value for the
+ /// `Value` type union.
+ /// The JSON representation for `NullValue` is JSON `null`.
+ /// </summary>
public enum NullValue {
+ /// <summary>
+ /// Null value.
+ /// </summary>
NULL_VALUE = 0,
}
#endregion
#region Messages
+ /// <summary>
+ /// `Struct` represents a structured data value, consisting of fields
+ /// which map to dynamically typed values. In some languages, `Struct`
+ /// might be supported by a native representation. For example, in
+ /// scripting languages like JS a struct is represented as an
+ /// object. The details of that representation are described together
+ /// with the proto support for the language.
+ /// The JSON representation for `Struct` is JSON object.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Struct : pb::IMessage<Struct> {
private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct());
@@ -84,10 +103,14 @@
return new Struct(this);
}
+ /// <summary>Field number for the "fields" field.</summary>
public const int FieldsFieldNumber = 1;
private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_fields_codec
= new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10);
private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> fields_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>();
+ /// <summary>
+ /// Map of dynamically typed values.
+ /// </summary>
public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Fields {
get { return fields_; }
}
@@ -151,6 +174,13 @@
}
+ /// <summary>
+ /// `Value` represents a dynamically typed value which can be either
+ /// null, a number, a string, a boolean, a recursive struct value, or a
+ /// list of values. A producer of value is expected to set one of that
+ /// variants, absence of any variant indicates an error.
+ /// The JSON representation for `Value` is JSON value.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Value : pb::IMessage<Value> {
private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value());
@@ -198,7 +228,11 @@
return new Value(this);
}
+ /// <summary>Field number for the "null_value" field.</summary>
public const int NullValueFieldNumber = 1;
+ /// <summary>
+ /// Represents a null value.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.NullValue NullValue {
get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : global::Google.Protobuf.WellKnownTypes.NullValue.NULL_VALUE; }
set {
@@ -207,7 +241,11 @@
}
}
+ /// <summary>Field number for the "number_value" field.</summary>
public const int NumberValueFieldNumber = 2;
+ /// <summary>
+ /// Represents a double value.
+ /// </summary>
public double NumberValue {
get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; }
set {
@@ -216,7 +254,11 @@
}
}
+ /// <summary>Field number for the "string_value" field.</summary>
public const int StringValueFieldNumber = 3;
+ /// <summary>
+ /// Represents a string value.
+ /// </summary>
public string StringValue {
get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; }
set {
@@ -225,7 +267,11 @@
}
}
+ /// <summary>Field number for the "bool_value" field.</summary>
public const int BoolValueFieldNumber = 4;
+ /// <summary>
+ /// Represents a boolean value.
+ /// </summary>
public bool BoolValue {
get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; }
set {
@@ -234,7 +280,11 @@
}
}
+ /// <summary>Field number for the "struct_value" field.</summary>
public const int StructValueFieldNumber = 5;
+ /// <summary>
+ /// Represents a structured value.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.Struct StructValue {
get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; }
set {
@@ -243,7 +293,11 @@
}
}
+ /// <summary>Field number for the "list_value" field.</summary>
public const int ListValueFieldNumber = 6;
+ /// <summary>
+ /// Represents a repeated `Value`.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.ListValue ListValue {
get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; }
set {
@@ -253,6 +307,7 @@
}
private object kind_;
+ /// <summary>Enum of possible cases for the "kind" oneof.</summary>
public enum KindOneofCase {
None = 0,
NullValue = 1,
@@ -432,6 +487,10 @@
}
+ /// <summary>
+ /// `ListValue` is a wrapper around a repeated field of values.
+ /// The JSON representation for `ListValue` is JSON array.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ListValue : pb::IMessage<ListValue> {
private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue());
@@ -459,10 +518,14 @@
return new ListValue(this);
}
+ /// <summary>Field number for the "values" field.</summary>
public const int ValuesFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Value> _repeated_values_codec
= pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> values_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value>();
+ /// <summary>
+ /// Repeated field of dynamically typed values.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> Values {
get { return values_; }
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
index d7c0954..f372f8f 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/timestamp.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Timestamp {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/timestamp.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,10 +25,10 @@
static Timestamp() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv",
- "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY",
- "AiABKAVCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q",
- "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG",
+ "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv",
+ "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY",
+ "AiABKAVCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q",
+ "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG",
"cHJvdG8z"));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
@@ -39,6 +41,47 @@
}
}
#region Messages
+ /// <summary>
+ /// A Timestamp represents a point in time independent of any time zone
+ /// or calendar, represented as seconds and fractions of seconds at
+ /// nanosecond resolution in UTC Epoch time. It is encoded using the
+ /// Proleptic Gregorian Calendar which extends the Gregorian calendar
+ /// backwards to year one. It is encoded assuming all minutes are 60
+ /// seconds long, i.e. leap seconds are "smeared" so that no leap second
+ /// table is needed for interpretation. Range is from
+ /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
+ /// By restricting to that range, we ensure that we can convert to
+ /// and from RFC 3339 date strings.
+ /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
+ /// Example 1: Compute Timestamp from POSIX `time()`.
+ /// Timestamp timestamp;
+ /// timestamp.set_seconds(time(NULL));
+ /// timestamp.set_nanos(0);
+ /// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+ /// struct timeval tv;
+ /// gettimeofday(&tv, NULL);
+ /// Timestamp timestamp;
+ /// timestamp.set_seconds(tv.tv_sec);
+ /// timestamp.set_nanos(tv.tv_usec * 1000);
+ /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+ /// FILETIME ft;
+ /// GetSystemTimeAsFileTime(&ft);
+ /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+ /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+ /// Timestamp timestamp;
+ /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+ /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+ /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+ /// long millis = System.currentTimeMillis();
+ /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+ /// .setNanos((int) ((millis % 1000) * 1000000)).build();
+ /// Example 5: Compute Timestamp from current time in Python.
+ /// now = time.time()
+ /// seconds = int(now)
+ /// nanos = int((now - seconds) * 10**9)
+ /// timestamp = Timestamp(seconds=seconds, nanos=nanos)
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Timestamp : pb::IMessage<Timestamp> {
private static readonly pb::MessageParser<Timestamp> _parser = new pb::MessageParser<Timestamp>(() => new Timestamp());
@@ -67,8 +110,14 @@
return new Timestamp(this);
}
+ /// <summary>Field number for the "seconds" field.</summary>
public const int SecondsFieldNumber = 1;
private long seconds_;
+ /// <summary>
+ /// Represents seconds of UTC time since Unix epoch
+ /// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
+ /// 9999-12-31T23:59:59Z inclusive.
+ /// </summary>
public long Seconds {
get { return seconds_; }
set {
@@ -76,8 +125,15 @@
}
}
+ /// <summary>Field number for the "nanos" field.</summary>
public const int NanosFieldNumber = 2;
private int nanos_;
+ /// <summary>
+ /// Non-negative fractions of a second at nanosecond resolution. Negative
+ /// second values with fractions must still have non-negative nanos values
+ /// that count forward in time. Must be from 0 to 999,999,999
+ /// inclusive.
+ /// </summary>
public int Nanos {
get { return nanos_; }
set {
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
index ff2ecc5..3be9085 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
@@ -11,10 +11,12 @@
namespace Proto {
+ /// <summary>Holder for reflection information generated from google/protobuf/type.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Type {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/type.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -23,43 +25,46 @@
static Type() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVm",
- "Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvGiRnb29nbGUvcHJvdG9idWYv",
- "c291cmNlX2NvbnRleHQucHJvdG8irgEKBFR5cGUSDAoEbmFtZRgBIAEoCRIm",
- "CgZmaWVsZHMYAiADKAsyFi5nb29nbGUucHJvdG9idWYuRmllbGQSDgoGb25l",
- "b2ZzGAMgAygJEigKB29wdGlvbnMYBCADKAsyFy5nb29nbGUucHJvdG9idWYu",
- "T3B0aW9uEjYKDnNvdXJjZV9jb250ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3Rv",
- "YnVmLlNvdXJjZUNvbnRleHQimwUKBUZpZWxkEikKBGtpbmQYASABKA4yGy5n",
- "b29nbGUucHJvdG9idWYuRmllbGQuS2luZBI3CgtjYXJkaW5hbGl0eRgCIAEo",
- "DjIiLmdvb2dsZS5wcm90b2J1Zi5GaWVsZC5DYXJkaW5hbGl0eRIOCgZudW1i",
- "ZXIYAyABKAUSDAoEbmFtZRgEIAEoCRIQCgh0eXBlX3VybBgGIAEoCRITCgtv",
- "bmVvZl9pbmRleBgHIAEoBRIOCgZwYWNrZWQYCCABKAgSKAoHb3B0aW9ucxgJ",
- "IAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb24iuAIKBEtpbmQSEAoMVFlQ",
- "RV9VTktOT1dOEAASDwoLVFlQRV9ET1VCTEUQARIOCgpUWVBFX0ZMT0FUEAIS",
-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dvb2dsZS5wcm90b2J1ZkIJVHlwZVByb3RvUAGgAQGiAgNHUEKqAh5H",
+ "b29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.Proto.Any.Descriptor, global::Google.Protobuf.WellKnownTypes.Proto.SourceContext.Descriptor, },
- new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null),
- new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), new[]{ "Name", "Enumvalue", "Options", "SourceContext" }, null, null, null),
+ new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedCodeInfo[] {
+ new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), new[]{ "Name", "Number", "Options" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), new[]{ "Name", "Value" }, null, null, null)
}));
@@ -68,7 +73,27 @@
}
}
+ #region Enums
+ /// <summary>
+ /// Syntax specifies the syntax in which a service element was defined.
+ /// </summary>
+ public enum Syntax {
+ /// <summary>
+ /// Syntax "proto2"
+ /// </summary>
+ SYNTAX_PROTO2 = 0,
+ /// <summary>
+ /// Syntax "proto3"
+ /// </summary>
+ SYNTAX_PROTO3 = 1,
+ }
+
+ #endregion
+
#region Messages
+ /// <summary>
+ /// A light-weight descriptor for a proto message type.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Type : pb::IMessage<Type> {
private static readonly pb::MessageParser<Type> _parser = new pb::MessageParser<Type>(() => new Type());
@@ -94,14 +119,19 @@
oneofs_ = other.oneofs_.Clone();
options_ = other.options_.Clone();
SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null;
+ syntax_ = other.syntax_;
}
public Type Clone() {
return new Type(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// The fully qualified message name.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -109,32 +139,48 @@
}
}
+ /// <summary>Field number for the "fields" field.</summary>
public const int FieldsFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Field> _repeated_fields_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> fields_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field>();
+ /// <summary>
+ /// The list of fields.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> Fields {
get { return fields_; }
}
+ /// <summary>Field number for the "oneofs" field.</summary>
public const int OneofsFieldNumber = 3;
private static readonly pb::FieldCodec<string> _repeated_oneofs_codec
= pb::FieldCodec.ForString(26);
private readonly pbc::RepeatedField<string> oneofs_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// The list of oneof definitions.
+ /// </summary>
public pbc::RepeatedField<string> Oneofs {
get { return oneofs_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 4;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec
= pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>();
+ /// <summary>
+ /// The proto options.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options {
get { return options_; }
}
+ /// <summary>Field number for the "source_context" field.</summary>
public const int SourceContextFieldNumber = 5;
private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_;
+ /// <summary>
+ /// The source context.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext {
get { return sourceContext_; }
set {
@@ -142,6 +188,19 @@
}
}
+ /// <summary>Field number for the "syntax" field.</summary>
+ public const int SyntaxFieldNumber = 6;
+ private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2;
+ /// <summary>
+ /// The source syntax.
+ /// </summary>
+ public global::Google.Protobuf.WellKnownTypes.Syntax Syntax {
+ get { return syntax_; }
+ set {
+ syntax_ = value;
+ }
+ }
+
public override bool Equals(object other) {
return Equals(other as Type);
}
@@ -158,6 +217,7 @@
if(!oneofs_.Equals(other.oneofs_)) return false;
if(!options_.Equals(other.options_)) return false;
if (!object.Equals(SourceContext, other.SourceContext)) return false;
+ if (Syntax != other.Syntax) return false;
return true;
}
@@ -168,6 +228,7 @@
hash ^= oneofs_.GetHashCode();
hash ^= options_.GetHashCode();
if (sourceContext_ != null) hash ^= SourceContext.GetHashCode();
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode();
return hash;
}
@@ -187,6 +248,10 @@
output.WriteRawTag(42);
output.WriteMessage(SourceContext);
}
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ output.WriteRawTag(48);
+ output.WriteEnum((int) Syntax);
+ }
}
public int CalculateSize() {
@@ -200,6 +265,9 @@
if (sourceContext_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext);
}
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
+ }
return size;
}
@@ -219,6 +287,9 @@
}
SourceContext.MergeFrom(other.SourceContext);
}
+ if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ Syntax = other.Syntax;
+ }
}
public void MergeFrom(pb::CodedInputStream input) {
@@ -251,12 +322,19 @@
input.ReadMessage(sourceContext_);
break;
}
+ case 48: {
+ syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
+ break;
+ }
}
}
}
}
+ /// <summary>
+ /// Field represents a single field of a message type.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Field : pb::IMessage<Field> {
private static readonly pb::MessageParser<Field> _parser = new pb::MessageParser<Field>(() => new Field());
@@ -285,14 +363,19 @@
oneofIndex_ = other.oneofIndex_;
packed_ = other.packed_;
options_ = other.options_.Clone();
+ jsonName_ = other.jsonName_;
}
public Field Clone() {
return new Field(this);
}
+ /// <summary>Field number for the "kind" field.</summary>
public const int KindFieldNumber = 1;
private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN;
+ /// <summary>
+ /// The field kind.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind {
get { return kind_; }
set {
@@ -300,8 +383,12 @@
}
}
+ /// <summary>Field number for the "cardinality" field.</summary>
public const int CardinalityFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN;
+ /// <summary>
+ /// The field cardinality, i.e. optional/required/repeated.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality {
get { return cardinality_; }
set {
@@ -309,8 +396,12 @@
}
}
+ /// <summary>Field number for the "number" field.</summary>
public const int NumberFieldNumber = 3;
private int number_;
+ /// <summary>
+ /// The proto field number.
+ /// </summary>
public int Number {
get { return number_; }
set {
@@ -318,8 +409,12 @@
}
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 4;
private string name_ = "";
+ /// <summary>
+ /// The field name.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -327,8 +422,13 @@
}
}
+ /// <summary>Field number for the "type_url" field.</summary>
public const int TypeUrlFieldNumber = 6;
private string typeUrl_ = "";
+ /// <summary>
+ /// The type URL (without the scheme) when the type is MESSAGE or ENUM,
+ /// such as `type.googleapis.com/google.protobuf.Empty`.
+ /// </summary>
public string TypeUrl {
get { return typeUrl_; }
set {
@@ -336,8 +436,12 @@
}
}
+ /// <summary>Field number for the "oneof_index" field.</summary>
public const int OneofIndexFieldNumber = 7;
private int oneofIndex_;
+ /// <summary>
+ /// Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
+ /// </summary>
public int OneofIndex {
get { return oneofIndex_; }
set {
@@ -345,8 +449,12 @@
}
}
+ /// <summary>Field number for the "packed" field.</summary>
public const int PackedFieldNumber = 8;
private bool packed_;
+ /// <summary>
+ /// Whether to use alternative packed wire representation.
+ /// </summary>
public bool Packed {
get { return packed_; }
set {
@@ -354,14 +462,31 @@
}
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 9;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec
= pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>();
+ /// <summary>
+ /// The proto options.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options {
get { return options_; }
}
+ /// <summary>Field number for the "json_name" field.</summary>
+ public const int JsonNameFieldNumber = 10;
+ private string jsonName_ = "";
+ /// <summary>
+ /// The JSON name for this field.
+ /// </summary>
+ public string JsonName {
+ get { return jsonName_; }
+ set {
+ jsonName_ = pb::Preconditions.CheckNotNull(value, "value");
+ }
+ }
+
public override bool Equals(object other) {
return Equals(other as Field);
}
@@ -381,6 +506,7 @@
if (OneofIndex != other.OneofIndex) return false;
if (Packed != other.Packed) return false;
if(!options_.Equals(other.options_)) return false;
+ if (JsonName != other.JsonName) return false;
return true;
}
@@ -394,6 +520,7 @@
if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode();
if (Packed != false) hash ^= Packed.GetHashCode();
hash ^= options_.GetHashCode();
+ if (JsonName.Length != 0) hash ^= JsonName.GetHashCode();
return hash;
}
@@ -431,6 +558,10 @@
output.WriteBool(Packed);
}
options_.WriteTo(output, _repeated_options_codec);
+ if (JsonName.Length != 0) {
+ output.WriteRawTag(82);
+ output.WriteString(JsonName);
+ }
}
public int CalculateSize() {
@@ -457,6 +588,9 @@
size += 1 + 1;
}
size += options_.CalculateSize(_repeated_options_codec);
+ if (JsonName.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName);
+ }
return size;
}
@@ -486,6 +620,9 @@
Packed = other.Packed;
}
options_.Add(other.options_);
+ if (other.JsonName.Length != 0) {
+ JsonName = other.JsonName;
+ }
}
public void MergeFrom(pb::CodedInputStream input) {
@@ -527,38 +664,120 @@
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
+ case 82: {
+ JsonName = input.ReadString();
+ break;
+ }
}
}
}
#region Nested types
+ /// <summary>Container for nested types declared in the Field message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
+ /// <summary>
+ /// Kind represents a basic field type.
+ /// </summary>
public enum Kind {
+ /// <summary>
+ /// Field type unknown.
+ /// </summary>
TYPE_UNKNOWN = 0,
+ /// <summary>
+ /// Field type double.
+ /// </summary>
TYPE_DOUBLE = 1,
+ /// <summary>
+ /// Field type float.
+ /// </summary>
TYPE_FLOAT = 2,
+ /// <summary>
+ /// Field type int64.
+ /// </summary>
TYPE_INT64 = 3,
+ /// <summary>
+ /// Field type uint64.
+ /// </summary>
TYPE_UINT64 = 4,
+ /// <summary>
+ /// Field type int32.
+ /// </summary>
TYPE_INT32 = 5,
+ /// <summary>
+ /// Field type fixed64.
+ /// </summary>
TYPE_FIXED64 = 6,
+ /// <summary>
+ /// Field type fixed32.
+ /// </summary>
TYPE_FIXED32 = 7,
+ /// <summary>
+ /// Field type bool.
+ /// </summary>
TYPE_BOOL = 8,
+ /// <summary>
+ /// Field type string.
+ /// </summary>
TYPE_STRING = 9,
+ /// <summary>
+ /// Field type group (deprecated proto2 type)
+ /// </summary>
+ TYPE_GROUP = 10,
+ /// <summary>
+ /// Field type message.
+ /// </summary>
TYPE_MESSAGE = 11,
+ /// <summary>
+ /// Field type bytes.
+ /// </summary>
TYPE_BYTES = 12,
+ /// <summary>
+ /// Field type uint32.
+ /// </summary>
TYPE_UINT32 = 13,
+ /// <summary>
+ /// Field type enum.
+ /// </summary>
TYPE_ENUM = 14,
+ /// <summary>
+ /// Field type sfixed32.
+ /// </summary>
TYPE_SFIXED32 = 15,
+ /// <summary>
+ /// Field type sfixed64.
+ /// </summary>
TYPE_SFIXED64 = 16,
+ /// <summary>
+ /// Field type sint32.
+ /// </summary>
TYPE_SINT32 = 17,
+ /// <summary>
+ /// Field type sint64.
+ /// </summary>
TYPE_SINT64 = 18,
}
+ /// <summary>
+ /// Cardinality represents whether a field is optional, required, or
+ /// repeated.
+ /// </summary>
public enum Cardinality {
+ /// <summary>
+ /// The field cardinality is unknown. Typically an error condition.
+ /// </summary>
CARDINALITY_UNKNOWN = 0,
+ /// <summary>
+ /// For optional fields.
+ /// </summary>
CARDINALITY_OPTIONAL = 1,
+ /// <summary>
+ /// For required fields. Not used for proto3.
+ /// </summary>
CARDINALITY_REQUIRED = 2,
+ /// <summary>
+ /// For repeated fields.
+ /// </summary>
CARDINALITY_REPEATED = 3,
}
@@ -567,6 +786,9 @@
}
+ /// <summary>
+ /// Enum type definition.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Enum : pb::IMessage<Enum> {
private static readonly pb::MessageParser<Enum> _parser = new pb::MessageParser<Enum>(() => new Enum());
@@ -591,14 +813,19 @@
enumvalue_ = other.enumvalue_.Clone();
options_ = other.options_.Clone();
SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null;
+ syntax_ = other.syntax_;
}
public Enum Clone() {
return new Enum(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// Enum type name.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -606,24 +833,36 @@
}
}
+ /// <summary>Field number for the "enumvalue" field.</summary>
public const int EnumvalueFieldNumber = 2;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.EnumValue> _repeated_enumvalue_codec
= pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> enumvalue_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue>();
+ /// <summary>
+ /// Enum value definitions.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> Enumvalue {
get { return enumvalue_; }
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec
= pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>();
+ /// <summary>
+ /// Proto options for the enum type.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options {
get { return options_; }
}
+ /// <summary>Field number for the "source_context" field.</summary>
public const int SourceContextFieldNumber = 4;
private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_;
+ /// <summary>
+ /// The source context.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext {
get { return sourceContext_; }
set {
@@ -631,6 +870,19 @@
}
}
+ /// <summary>Field number for the "syntax" field.</summary>
+ public const int SyntaxFieldNumber = 5;
+ private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2;
+ /// <summary>
+ /// The source syntax.
+ /// </summary>
+ public global::Google.Protobuf.WellKnownTypes.Syntax Syntax {
+ get { return syntax_; }
+ set {
+ syntax_ = value;
+ }
+ }
+
public override bool Equals(object other) {
return Equals(other as Enum);
}
@@ -646,6 +898,7 @@
if(!enumvalue_.Equals(other.enumvalue_)) return false;
if(!options_.Equals(other.options_)) return false;
if (!object.Equals(SourceContext, other.SourceContext)) return false;
+ if (Syntax != other.Syntax) return false;
return true;
}
@@ -655,6 +908,7 @@
hash ^= enumvalue_.GetHashCode();
hash ^= options_.GetHashCode();
if (sourceContext_ != null) hash ^= SourceContext.GetHashCode();
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode();
return hash;
}
@@ -673,6 +927,10 @@
output.WriteRawTag(34);
output.WriteMessage(SourceContext);
}
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ output.WriteRawTag(40);
+ output.WriteEnum((int) Syntax);
+ }
}
public int CalculateSize() {
@@ -685,6 +943,9 @@
if (sourceContext_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext);
}
+ if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax);
+ }
return size;
}
@@ -703,6 +964,9 @@
}
SourceContext.MergeFrom(other.SourceContext);
}
+ if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) {
+ Syntax = other.Syntax;
+ }
}
public void MergeFrom(pb::CodedInputStream input) {
@@ -731,12 +995,19 @@
input.ReadMessage(sourceContext_);
break;
}
+ case 40: {
+ syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
+ break;
+ }
}
}
}
}
+ /// <summary>
+ /// Enum value definition.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class EnumValue : pb::IMessage<EnumValue> {
private static readonly pb::MessageParser<EnumValue> _parser = new pb::MessageParser<EnumValue>(() => new EnumValue());
@@ -766,8 +1037,12 @@
return new EnumValue(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// Enum value name.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -775,8 +1050,12 @@
}
}
+ /// <summary>Field number for the "number" field.</summary>
public const int NumberFieldNumber = 2;
private int number_;
+ /// <summary>
+ /// Enum value number.
+ /// </summary>
public int Number {
get { return number_; }
set {
@@ -784,10 +1063,14 @@
}
}
+ /// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec
= pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>();
+ /// <summary>
+ /// Proto options for the enum value.
+ /// </summary>
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options {
get { return options_; }
}
@@ -883,6 +1166,9 @@
}
+ /// <summary>
+ /// Proto option attached to messages/fields/enums etc.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Option : pb::IMessage<Option> {
private static readonly pb::MessageParser<Option> _parser = new pb::MessageParser<Option>(() => new Option());
@@ -911,8 +1197,12 @@
return new Option(this);
}
+ /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
+ /// <summary>
+ /// Proto option name.
+ /// </summary>
public string Name {
get { return name_; }
set {
@@ -920,8 +1210,12 @@
}
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Any value_;
+ /// <summary>
+ /// Proto option value.
+ /// </summary>
public global::Google.Protobuf.WellKnownTypes.Any Value {
get { return value_; }
set {
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
index 9ecaf47..d26395f 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
@@ -9,10 +9,12 @@
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.WellKnownTypes {
+ /// <summary>Holder for reflection information generated from google/protobuf/wrappers.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Wrappers {
#region Descriptor
+ /// <summary>File descriptor for google/protobuf/wrappers.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
@@ -21,15 +23,15 @@
static Wrappers() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90",
- "b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZh",
- "bHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASAB",
- "KAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1",
- "ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEo",
- "DSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUS",
- "DQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEJN",
- "ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAGiAgNHUEKq",
- "Ah5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw=="));
+ "Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90",
+ "b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZh",
+ "bHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASAB",
+ "KAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1",
+ "ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEo",
+ "DSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUS",
+ "DQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEJQ",
+ "ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAGgAQGiAgNH",
+ "UEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
@@ -48,6 +50,10 @@
}
#region Messages
+ /// <summary>
+ /// Wrapper message for `double`.
+ /// The JSON representation for `DoubleValue` is JSON number.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class DoubleValue : pb::IMessage<DoubleValue> {
private static readonly pb::MessageParser<DoubleValue> _parser = new pb::MessageParser<DoubleValue>(() => new DoubleValue());
@@ -75,8 +81,12 @@
return new DoubleValue(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private double value_;
+ /// <summary>
+ /// The double value.
+ /// </summary>
public double Value {
get { return value_; }
set {
@@ -150,6 +160,10 @@
}
+ /// <summary>
+ /// Wrapper message for `float`.
+ /// The JSON representation for `FloatValue` is JSON number.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class FloatValue : pb::IMessage<FloatValue> {
private static readonly pb::MessageParser<FloatValue> _parser = new pb::MessageParser<FloatValue>(() => new FloatValue());
@@ -177,8 +191,12 @@
return new FloatValue(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private float value_;
+ /// <summary>
+ /// The float value.
+ /// </summary>
public float Value {
get { return value_; }
set {
@@ -252,6 +270,10 @@
}
+ /// <summary>
+ /// Wrapper message for `int64`.
+ /// The JSON representation for `Int64Value` is JSON string.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Int64Value : pb::IMessage<Int64Value> {
private static readonly pb::MessageParser<Int64Value> _parser = new pb::MessageParser<Int64Value>(() => new Int64Value());
@@ -279,8 +301,12 @@
return new Int64Value(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private long value_;
+ /// <summary>
+ /// The int64 value.
+ /// </summary>
public long Value {
get { return value_; }
set {
@@ -354,6 +380,10 @@
}
+ /// <summary>
+ /// Wrapper message for `uint64`.
+ /// The JSON representation for `UInt64Value` is JSON string.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class UInt64Value : pb::IMessage<UInt64Value> {
private static readonly pb::MessageParser<UInt64Value> _parser = new pb::MessageParser<UInt64Value>(() => new UInt64Value());
@@ -381,8 +411,12 @@
return new UInt64Value(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private ulong value_;
+ /// <summary>
+ /// The uint64 value.
+ /// </summary>
public ulong Value {
get { return value_; }
set {
@@ -456,6 +490,10 @@
}
+ /// <summary>
+ /// Wrapper message for `int32`.
+ /// The JSON representation for `Int32Value` is JSON number.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Int32Value : pb::IMessage<Int32Value> {
private static readonly pb::MessageParser<Int32Value> _parser = new pb::MessageParser<Int32Value>(() => new Int32Value());
@@ -483,8 +521,12 @@
return new Int32Value(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private int value_;
+ /// <summary>
+ /// The int32 value.
+ /// </summary>
public int Value {
get { return value_; }
set {
@@ -558,6 +600,10 @@
}
+ /// <summary>
+ /// Wrapper message for `uint32`.
+ /// The JSON representation for `UInt32Value` is JSON number.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class UInt32Value : pb::IMessage<UInt32Value> {
private static readonly pb::MessageParser<UInt32Value> _parser = new pb::MessageParser<UInt32Value>(() => new UInt32Value());
@@ -585,8 +631,12 @@
return new UInt32Value(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private uint value_;
+ /// <summary>
+ /// The uint32 value.
+ /// </summary>
public uint Value {
get { return value_; }
set {
@@ -660,6 +710,10 @@
}
+ /// <summary>
+ /// Wrapper message for `bool`.
+ /// The JSON representation for `BoolValue` is JSON `true` and `false`.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class BoolValue : pb::IMessage<BoolValue> {
private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue());
@@ -687,8 +741,12 @@
return new BoolValue(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private bool value_;
+ /// <summary>
+ /// The bool value.
+ /// </summary>
public bool Value {
get { return value_; }
set {
@@ -762,6 +820,10 @@
}
+ /// <summary>
+ /// Wrapper message for `string`.
+ /// The JSON representation for `StringValue` is JSON string.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class StringValue : pb::IMessage<StringValue> {
private static readonly pb::MessageParser<StringValue> _parser = new pb::MessageParser<StringValue>(() => new StringValue());
@@ -789,8 +851,12 @@
return new StringValue(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private string value_ = "";
+ /// <summary>
+ /// The string value.
+ /// </summary>
public string Value {
get { return value_; }
set {
@@ -864,6 +930,10 @@
}
+ /// <summary>
+ /// Wrapper message for `bytes`.
+ /// The JSON representation for `BytesValue` is JSON string.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class BytesValue : pb::IMessage<BytesValue> {
private static readonly pb::MessageParser<BytesValue> _parser = new pb::MessageParser<BytesValue>(() => new BytesValue());
@@ -891,8 +961,12 @@
return new BytesValue(this);
}
+ /// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 1;
private pb::ByteString value_ = pb::ByteString.Empty;
+ /// <summary>
+ /// The bytes value.
+ /// </summary>
public pb::ByteString Value {
get { return value_; }
set {
diff --git a/generate_descriptor_proto.sh b/generate_descriptor_proto.sh
index b6e6e07..cd90689 100755
--- a/generate_descriptor_proto.sh
+++ b/generate_descriptor_proto.sh
@@ -92,3 +92,8 @@
PROCESS_ROUND=$((PROCESS_ROUND + 1))
done
cd ..
+
+if test -x objectivec/generate_descriptors_proto.sh; then
+ echo "Generating messages for objc."
+ objectivec/generate_descriptors_proto.sh $@
+fi
diff --git a/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java
index a535b71..4316efe 100644
--- a/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java
+++ b/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java
@@ -62,9 +62,8 @@
private static final long serialVersionUID = 1L;
- /** For use by generated code only. */
- protected UnknownFieldSetLite unknownFields =
- UnknownFieldSetLite.getDefaultInstance();
+ /** For use by generated code only. Lazily initialized to reduce allocations. */
+ protected UnknownFieldSetLite unknownFields = null;
/** For use by generated code only. */
protected int memoizedSerializedSize = -1;
@@ -84,19 +83,56 @@
return (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER);
}
+ // The general strategy for unknown fields is to use an UnknownFieldSetLite that is treated as
+ // mutable during the parsing constructor and immutable after. This allows us to avoid
+ // any unnecessary intermediary allocations while reducing the generated code size.
+
/**
- * Called by subclasses to parse an unknown field. For use by generated code
- * only.
+ * Lazily initializes unknown fields.
+ */
+ private final void ensureUnknownFieldsInitialized() {
+ if (unknownFields == null) {
+ unknownFields = UnknownFieldSetLite.newInstance();
+ }
+ }
+
+ /**
+ * Called by subclasses to parse an unknown field. For use by generated code only.
+ *
* @return {@code true} unless the tag is an end-group tag.
*/
- protected static boolean parseUnknownField(
- CodedInputStream input,
- UnknownFieldSetLite.Builder unknownFields,
- ExtensionRegistryLite extensionRegistry,
- int tag) throws IOException {
+ protected boolean parseUnknownField(int tag, CodedInputStream input) throws IOException {
+ ensureUnknownFieldsInitialized();
return unknownFields.mergeFieldFrom(tag, input);
}
+ /**
+ * Called by subclasses to parse an unknown field. For use by generated code only.
+ */
+ protected void mergeVarintField(int tag, int value) {
+ ensureUnknownFieldsInitialized();
+ unknownFields.mergeVarintField(tag, value);
+ }
+
+ /**
+ * Called by subclasses to parse an unknown field. For use by generated code only.
+ */
+ protected void mergeLengthDelimitedField(int fieldNumber, ByteString value) {
+ ensureUnknownFieldsInitialized();
+ unknownFields.mergeLengthDelimitedField(fieldNumber, value);
+ }
+
+ /**
+ * Called by subclasses to complete parsing. For use by generated code only.
+ */
+ protected void doneParsing() {
+ if (unknownFields == null) {
+ unknownFields = UnknownFieldSetLite.getDefaultInstance();
+ } else {
+ unknownFields.makeImmutable();
+ }
+ }
+
public final boolean isInitialized() {
return dynamicMethod(MethodToInvoke.IS_INITIALIZED, Boolean.TRUE) != null;
}
@@ -171,7 +207,7 @@
* <p>For use by generated code only.
*/
protected final void mergeUnknownFields(UnknownFieldSetLite unknownFields) {
- this.unknownFields = UnknownFieldSetLite.concat(this.unknownFields, unknownFields);
+ this.unknownFields = UnknownFieldSetLite.mutableCopyOf(this.unknownFields, unknownFields);
}
@SuppressWarnings("unchecked")
@@ -225,7 +261,13 @@
//@Override (Java 1.6 override semantics, but we must support 1.5)
public MessageType buildPartial() {
+ if (isBuilt) {
+ return instance;
+ }
+
instance.dynamicMethod(MethodToInvoke.MAKE_IMMUTABLE);
+ instance.unknownFields.makeImmutable();
+
isBuilt = true;
return instance;
}
@@ -249,18 +291,6 @@
public MessageType getDefaultInstanceForType() {
return defaultInstance;
}
-
- /**
- * Called by subclasses to parse an unknown field.
- * @return {@code true} unless the tag is an end-group tag.
- */
- protected boolean parseUnknownField(
- CodedInputStream input,
- UnknownFieldSetLite.Builder unknownFields,
- ExtensionRegistryLite extensionRegistry,
- int tag) throws IOException {
- return unknownFields.mergeFieldFrom(tag, input);
- }
public BuilderType mergeFrom(
com.google.protobuf.CodedInputStream input,
@@ -334,6 +364,130 @@
extensions.mergeFrom(((ExtendableMessage) other).extensions);
}
+ /**
+ * Parse an unknown field or an extension. For use by generated code only.
+ *
+ * <p>For use by generated code only.
+ *
+ * @return {@code true} unless the tag is an end-group tag.
+ */
+ protected <MessageType extends MessageLite> boolean parseUnknownField(
+ MessageType defaultInstance,
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry,
+ int tag) throws IOException {
+ int wireType = WireFormat.getTagWireType(tag);
+ int fieldNumber = WireFormat.getTagFieldNumber(tag);
+
+ // TODO(dweis): How much bytecode would be saved by not requiring the generated code to
+ // provide the default instance?
+ GeneratedExtension<MessageType, ?> extension = extensionRegistry.findLiteExtensionByNumber(
+ defaultInstance, fieldNumber);
+
+ boolean unknown = false;
+ boolean packed = false;
+ if (extension == null) {
+ unknown = true; // Unknown field.
+ } else if (wireType == FieldSet.getWireFormatForFieldType(
+ extension.descriptor.getLiteType(),
+ false /* isPacked */)) {
+ packed = false; // Normal, unpacked value.
+ } else if (extension.descriptor.isRepeated &&
+ extension.descriptor.type.isPackable() &&
+ wireType == FieldSet.getWireFormatForFieldType(
+ extension.descriptor.getLiteType(),
+ true /* isPacked */)) {
+ packed = true; // Packed value.
+ } else {
+ unknown = true; // Wrong wire type.
+ }
+
+ if (unknown) { // Unknown field or wrong wire type. Skip.
+ return parseUnknownField(tag, input);
+ }
+
+ if (packed) {
+ int length = input.readRawVarint32();
+ int limit = input.pushLimit(length);
+ if (extension.descriptor.getLiteType() == WireFormat.FieldType.ENUM) {
+ while (input.getBytesUntilLimit() > 0) {
+ int rawValue = input.readEnum();
+ Object value =
+ extension.descriptor.getEnumType().findValueByNumber(rawValue);
+ if (value == null) {
+ // If the number isn't recognized as a valid value for this
+ // enum, drop it (don't even add it to unknownFields).
+ return true;
+ }
+ extensions.addRepeatedField(extension.descriptor,
+ extension.singularToFieldSetType(value));
+ }
+ } else {
+ while (input.getBytesUntilLimit() > 0) {
+ Object value =
+ FieldSet.readPrimitiveField(input,
+ extension.descriptor.getLiteType(),
+ /*checkUtf8=*/ false);
+ extensions.addRepeatedField(extension.descriptor, value);
+ }
+ }
+ input.popLimit(limit);
+ } else {
+ Object value;
+ switch (extension.descriptor.getLiteJavaType()) {
+ case MESSAGE: {
+ MessageLite.Builder subBuilder = null;
+ if (!extension.descriptor.isRepeated()) {
+ MessageLite existingValue =
+ (MessageLite) extensions.getField(extension.descriptor);
+ if (existingValue != null) {
+ subBuilder = existingValue.toBuilder();
+ }
+ }
+ if (subBuilder == null) {
+ subBuilder = extension.getMessageDefaultInstance()
+ .newBuilderForType();
+ }
+ if (extension.descriptor.getLiteType() ==
+ WireFormat.FieldType.GROUP) {
+ input.readGroup(extension.getNumber(),
+ subBuilder, extensionRegistry);
+ } else {
+ input.readMessage(subBuilder, extensionRegistry);
+ }
+ value = subBuilder.build();
+ break;
+ }
+ case ENUM:
+ int rawValue = input.readEnum();
+ value = extension.descriptor.getEnumType()
+ .findValueByNumber(rawValue);
+ // If the number isn't recognized as a valid value for this enum,
+ // write it to unknown fields object.
+ if (value == null) {
+ mergeVarintField(fieldNumber, rawValue);
+ return true;
+ }
+ break;
+ default:
+ value = FieldSet.readPrimitiveField(input,
+ extension.descriptor.getLiteType(),
+ /*checkUtf8=*/ false);
+ break;
+ }
+
+ if (extension.descriptor.isRepeated()) {
+ extensions.addRepeatedField(extension.descriptor,
+ extension.singularToFieldSetType(value));
+ } else {
+ extensions.setField(extension.descriptor,
+ extension.singularToFieldSetType(value));
+ }
+ }
+
+ return true;
+ }
+
private void verifyExtensionContainingType(
final GeneratedExtension<MessageType, ?> extension) {
if (extension.getContainingTypeDefaultInstance() !=
@@ -404,11 +558,10 @@
}
- /**
- * Used by parsing constructors in generated classes.
- */
- protected static void makeExtensionsImmutable(
- FieldSet<ExtensionDescriptor> extensions) {
+ @Override
+ protected final void doneParsing() {
+ super.doneParsing();
+
extensions.makeImmutable();
}
@@ -619,131 +772,6 @@
}
}
- //-----------------------------------------------------------------
-
- /**
- * Parse an unknown field or an extension. For use by generated code only.
- * @return {@code true} unless the tag is an end-group tag.
- */
- protected static <MessageType extends MessageLite>
- boolean parseUnknownField(
- FieldSet<ExtensionDescriptor> extensions,
- MessageType defaultInstance,
- CodedInputStream input,
- UnknownFieldSetLite.Builder unknownFields,
- ExtensionRegistryLite extensionRegistry,
- int tag) throws IOException {
- int wireType = WireFormat.getTagWireType(tag);
- int fieldNumber = WireFormat.getTagFieldNumber(tag);
-
- GeneratedExtension<MessageType, ?> extension =
- extensionRegistry.findLiteExtensionByNumber(
- defaultInstance, fieldNumber);
-
- boolean unknown = false;
- boolean packed = false;
- if (extension == null) {
- unknown = true; // Unknown field.
- } else if (wireType == FieldSet.getWireFormatForFieldType(
- extension.descriptor.getLiteType(),
- false /* isPacked */)) {
- packed = false; // Normal, unpacked value.
- } else if (extension.descriptor.isRepeated &&
- extension.descriptor.type.isPackable() &&
- wireType == FieldSet.getWireFormatForFieldType(
- extension.descriptor.getLiteType(),
- true /* isPacked */)) {
- packed = true; // Packed value.
- } else {
- unknown = true; // Wrong wire type.
- }
-
- if (unknown) { // Unknown field or wrong wire type. Skip.
- return unknownFields.mergeFieldFrom(tag, input);
- }
-
- if (packed) {
- int length = input.readRawVarint32();
- int limit = input.pushLimit(length);
- if (extension.descriptor.getLiteType() == WireFormat.FieldType.ENUM) {
- while (input.getBytesUntilLimit() > 0) {
- int rawValue = input.readEnum();
- Object value =
- extension.descriptor.getEnumType().findValueByNumber(rawValue);
- if (value == null) {
- // If the number isn't recognized as a valid value for this
- // enum, drop it (don't even add it to unknownFields).
- return true;
- }
- extensions.addRepeatedField(extension.descriptor,
- extension.singularToFieldSetType(value));
- }
- } else {
- while (input.getBytesUntilLimit() > 0) {
- Object value =
- FieldSet.readPrimitiveField(input,
- extension.descriptor.getLiteType(),
- /*checkUtf8=*/ false);
- extensions.addRepeatedField(extension.descriptor, value);
- }
- }
- input.popLimit(limit);
- } else {
- Object value;
- switch (extension.descriptor.getLiteJavaType()) {
- case MESSAGE: {
- MessageLite.Builder subBuilder = null;
- if (!extension.descriptor.isRepeated()) {
- MessageLite existingValue =
- (MessageLite) extensions.getField(extension.descriptor);
- if (existingValue != null) {
- subBuilder = existingValue.toBuilder();
- }
- }
- if (subBuilder == null) {
- subBuilder = extension.getMessageDefaultInstance()
- .newBuilderForType();
- }
- if (extension.descriptor.getLiteType() ==
- WireFormat.FieldType.GROUP) {
- input.readGroup(extension.getNumber(),
- subBuilder, extensionRegistry);
- } else {
- input.readMessage(subBuilder, extensionRegistry);
- }
- value = subBuilder.build();
- break;
- }
- case ENUM:
- int rawValue = input.readEnum();
- value = extension.descriptor.getEnumType()
- .findValueByNumber(rawValue);
- // If the number isn't recognized as a valid value for this enum,
- // write it to unknown fields object.
- if (value == null) {
- unknownFields.mergeVarintField(fieldNumber, rawValue);
- return true;
- }
- break;
- default:
- value = FieldSet.readPrimitiveField(input,
- extension.descriptor.getLiteType(),
- /*checkUtf8=*/ false);
- break;
- }
-
- if (extension.descriptor.isRepeated()) {
- extensions.addRepeatedField(extension.descriptor,
- extension.singularToFieldSetType(value));
- } else {
- extensions.setField(extension.descriptor,
- extension.singularToFieldSetType(value));
- }
- }
-
- return true;
- }
-
// -----------------------------------------------------------------
/** For use by generated code only. */
@@ -893,7 +921,7 @@
extends ExtensionLite<ContainingType, Type> {
/**
- * Create a new isntance with the given parameters.
+ * Create a new instance with the given parameters.
*
* The last parameter {@code singularType} is only needed for enum types.
* We store integer values for enum types in a {@link ExtendableMessage}
@@ -905,7 +933,7 @@
final Type defaultValue,
final MessageLite messageDefaultInstance,
final ExtensionDescriptor descriptor,
- Class singularType) {
+ final Class singularType) {
// Defensive checks to verify the correct initialization order of
// GeneratedExtensions and their related GeneratedMessages.
if (containingTypeDefaultInstance == null) {
@@ -921,24 +949,12 @@
this.defaultValue = defaultValue;
this.messageDefaultInstance = messageDefaultInstance;
this.descriptor = descriptor;
-
- // Use Java reflection to invoke the static method {@code valueOf} of
- // enum types in order to convert integers to concrete enum objects.
- this.singularType = singularType;
- if (Internal.EnumLite.class.isAssignableFrom(singularType)) {
- this.enumValueOf = getMethodOrDie(
- singularType, "valueOf", int.class);
- } else {
- this.enumValueOf = null;
- }
}
final ContainingType containingTypeDefaultInstance;
final Type defaultValue;
final MessageLite messageDefaultInstance;
final ExtensionDescriptor descriptor;
- final Class singularType;
- final Method enumValueOf;
/**
* Default instance of the type being extended, used to identify that type.
@@ -980,7 +996,7 @@
Object singularFromFieldSetType(final Object value) {
if (descriptor.getLiteJavaType() == WireFormat.JavaType.ENUM) {
- return invokeOrDie(enumValueOf, null, (Integer) value);
+ return descriptor.enumTypeMap.findValueByNumber((Integer) value);
} else {
return value;
}
diff --git a/java/src/main/java/com/google/protobuf/TextFormat.java b/java/src/main/java/com/google/protobuf/TextFormat.java
index b4f4ce7..44d036c 100644
--- a/java/src/main/java/com/google/protobuf/TextFormat.java
+++ b/java/src/main/java/com/google/protobuf/TextFormat.java
@@ -119,6 +119,21 @@
}
/**
+ * Generates a human readable form of the field, useful for debugging
+ * and other purposes, with no newline characters.
+ */
+ public static String shortDebugString(final FieldDescriptor field,
+ final Object value) {
+ try {
+ final StringBuilder sb = new StringBuilder();
+ SINGLE_LINE_PRINTER.printField(field, value, new TextGenerator(sb));
+ return sb.toString().trim();
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ /**
* Generates a human readable form of the unknown fields, useful for debugging
* and other purposes, with no newline characters.
*/
diff --git a/java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java b/java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
index 45d5fc3..435ad4d 100644
--- a/java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
+++ b/java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
@@ -45,12 +45,13 @@
* @author dweis@google.com (Daniel Weis)
*/
public final class UnknownFieldSetLite {
-
- private static final int[] EMPTY_INT_ARRAY = new int[0];
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+ // Arbitrarily chosen.
+ // TODO(dweis): Tune this number?
+ private static final int MIN_CAPACITY = 8;
private static final UnknownFieldSetLite DEFAULT_INSTANCE =
- new UnknownFieldSetLite(0, EMPTY_INT_ARRAY, EMPTY_OBJECT_ARRAY);
+ new UnknownFieldSetLite(0, new int[0], new Object[0], false /* isMutable */);
/**
* Get an empty {@code UnknownFieldSetLite}.
@@ -62,25 +63,32 @@
}
/**
- * Create a new {@link Builder}.
+ * Returns an empty {@code UnknownFieldSetLite.Builder}.
*
* <p>For use by generated code only.
*/
public static Builder newBuilder() {
return new Builder();
}
+
+ /**
+ * Returns a new mutable instance.
+ */
+ static UnknownFieldSetLite newInstance() {
+ return new UnknownFieldSetLite();
+ }
/**
- * Returns an {@code UnknownFieldSetLite} that is the composite of {@code first} and
+ * Returns a mutable {@code UnknownFieldSetLite} that is the composite of {@code first} and
* {@code second}.
*/
- static UnknownFieldSetLite concat(UnknownFieldSetLite first, UnknownFieldSetLite second) {
+ static UnknownFieldSetLite mutableCopyOf(UnknownFieldSetLite first, UnknownFieldSetLite second) {
int count = first.count + second.count;
int[] tags = Arrays.copyOf(first.tags, count);
System.arraycopy(second.tags, 0, tags, first.count, second.count);
Object[] objects = Arrays.copyOf(first.objects, count);
System.arraycopy(second.objects, 0, objects, first.count, second.count);
- return new UnknownFieldSetLite(count, tags, objects);
+ return new UnknownFieldSetLite(count, tags, objects, true /* isMutable */);
}
/**
@@ -102,14 +110,45 @@
* The lazily computed serialized size of the set.
*/
private int memoizedSerializedSize = -1;
+
+ /**
+ * Indicates that this object is mutable.
+ */
+ private boolean isMutable;
/**
+ * Constructs a mutable {@code UnknownFieldSetLite}.
+ */
+ private UnknownFieldSetLite() {
+ this(0, new int[MIN_CAPACITY], new Object[MIN_CAPACITY], true /* isMutable */);
+ }
+
+ /**
* Constructs the {@code UnknownFieldSetLite}.
*/
- private UnknownFieldSetLite(int count, int[] tags, Object[] objects) {
+ private UnknownFieldSetLite(int count, int[] tags, Object[] objects, boolean isMutable) {
this.count = count;
this.tags = tags;
this.objects = objects;
+ this.isMutable = isMutable;
+ }
+
+ /**
+ * Marks this object as immutable.
+ *
+ * <p>Future calls to methods that attempt to modify this object will throw.
+ */
+ public void makeImmutable() {
+ this.isMutable = false;
+ }
+
+ /**
+ * Throws an {@link UnsupportedOperationException} if immutable.
+ */
+ void checkMutable() {
+ if (!isMutable) {
+ throw new UnsupportedOperationException();
+ }
}
/**
@@ -223,6 +262,114 @@
return hashCode;
}
+ private void storeField(int tag, Object value) {
+ ensureCapacity();
+
+ tags[count] = tag;
+ objects[count] = value;
+ count++;
+ }
+
+ /**
+ * Ensures that our arrays are long enough to store more metadata.
+ */
+ private void ensureCapacity() {
+ if (count == tags.length) {
+ int increment = count < (MIN_CAPACITY / 2) ? MIN_CAPACITY : count >> 1;
+ int newLength = count + increment;
+
+ tags = Arrays.copyOf(tags, newLength);
+ objects = Arrays.copyOf(objects, newLength);
+ }
+ }
+
+ /**
+ * Parse a single field from {@code input} and merge it into this set.
+ *
+ * <p>For use by generated code only.
+ *
+ * @param tag The field's tag number, which was already parsed.
+ * @return {@code false} if the tag is an end group tag.
+ */
+ boolean mergeFieldFrom(final int tag, final CodedInputStream input) throws IOException {
+ checkMutable();
+ final int fieldNumber = WireFormat.getTagFieldNumber(tag);
+ switch (WireFormat.getTagWireType(tag)) {
+ case WireFormat.WIRETYPE_VARINT:
+ storeField(tag, input.readInt64());
+ return true;
+ case WireFormat.WIRETYPE_FIXED32:
+ storeField(tag, input.readFixed32());
+ return true;
+ case WireFormat.WIRETYPE_FIXED64:
+ storeField(tag, input.readFixed64());
+ return true;
+ case WireFormat.WIRETYPE_LENGTH_DELIMITED:
+ storeField(tag, input.readBytes());
+ return true;
+ case WireFormat.WIRETYPE_START_GROUP:
+ final UnknownFieldSetLite subFieldSet = new UnknownFieldSetLite();
+ subFieldSet.mergeFrom(input);
+ input.checkLastTagWas(
+ WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
+ storeField(tag, subFieldSet);
+ return true;
+ case WireFormat.WIRETYPE_END_GROUP:
+ return false;
+ default:
+ throw InvalidProtocolBufferException.invalidWireType();
+ }
+ }
+
+ /**
+ * Convenience method for merging a new field containing a single varint
+ * value. This is used in particular when an unknown enum value is
+ * encountered.
+ *
+ * <p>For use by generated code only.
+ */
+ UnknownFieldSetLite mergeVarintField(int fieldNumber, int value) {
+ checkMutable();
+ if (fieldNumber == 0) {
+ throw new IllegalArgumentException("Zero is not a valid field number.");
+ }
+
+ storeField(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_VARINT), (long) value);
+
+ return this;
+ }
+
+ /**
+ * Convenience method for merging a length-delimited field.
+ *
+ * <p>For use by generated code only.
+ */
+ UnknownFieldSetLite mergeLengthDelimitedField(final int fieldNumber, final ByteString value) {
+ checkMutable();
+ if (fieldNumber == 0) {
+ throw new IllegalArgumentException("Zero is not a valid field number.");
+ }
+
+ storeField(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED), value);
+
+ return this;
+ }
+
+ /**
+ * Parse an entire message from {@code input} and merge its fields into
+ * this set.
+ */
+ private UnknownFieldSetLite mergeFrom(final CodedInputStream input) throws IOException {
+ // Ensures initialization in mergeFieldFrom.
+ while (true) {
+ final int tag = input.readTag();
+ if (tag == 0 || !mergeFieldFrom(tag, input)) {
+ break;
+ }
+ }
+ return this;
+ }
+
/**
* Builder for {@link UnknownFieldSetLite}s.
*
@@ -230,54 +377,27 @@
*
* <p>For use by generated code only.
*/
+ // TODO(dweis): Update the mutable API to no longer need this builder and delete.
public static final class Builder {
-
- // Arbitrarily chosen.
- // TODO(dweis): Tune this number?
- private static final int MIN_CAPACITY = 8;
-
- private int count = 0;
- private int[] tags = EMPTY_INT_ARRAY;
- private Object[] objects = EMPTY_OBJECT_ARRAY;
- private boolean built;
-
- /**
- * Constructs a {@code Builder}.
- */
- private Builder() {}
+ private UnknownFieldSetLite set;
+
+ private Builder() {
+ this.set = null;
+ }
/**
* Ensures internal state is initialized for use.
*/
private void ensureNotBuilt() {
- if (built) {
- throw new IllegalStateException("Do not reuse UnknownFieldSetLite Builders.");
+ if (set == null) {
+ set = new UnknownFieldSetLite();
}
- }
-
- private void storeField(int tag, Object value) {
- ensureCapacity();
- tags[count] = tag;
- objects[count] = value;
- count++;
+ set.checkMutable();
}
/**
- * Ensures that our arrays are long enough to store more metadata.
- */
- private void ensureCapacity() {
- if (count == tags.length) {
- int increment = count < (MIN_CAPACITY / 2) ? MIN_CAPACITY : count >> 1;
- int newLength = count + increment;
-
- tags = Arrays.copyOf(tags, newLength);
- objects = Arrays.copyOf(objects, newLength);
- }
- }
-
- /**
* Parse a single field from {@code input} and merge it into this set.
*
* <p>For use by generated code only.
@@ -285,36 +405,9 @@
* @param tag The field's tag number, which was already parsed.
* @return {@code false} if the tag is an end group tag.
*/
- public boolean mergeFieldFrom(final int tag, final CodedInputStream input)
- throws IOException {
+ boolean mergeFieldFrom(final int tag, final CodedInputStream input) throws IOException {
ensureNotBuilt();
-
- final int fieldNumber = WireFormat.getTagFieldNumber(tag);
- switch (WireFormat.getTagWireType(tag)) {
- case WireFormat.WIRETYPE_VARINT:
- storeField(tag, input.readInt64());
- return true;
- case WireFormat.WIRETYPE_FIXED32:
- storeField(tag, input.readFixed32());
- return true;
- case WireFormat.WIRETYPE_FIXED64:
- storeField(tag, input.readFixed64());
- return true;
- case WireFormat.WIRETYPE_LENGTH_DELIMITED:
- storeField(tag, input.readBytes());
- return true;
- case WireFormat.WIRETYPE_START_GROUP:
- final Builder subBuilder = newBuilder();
- subBuilder.mergeFrom(input);
- input.checkLastTagWas(
- WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
- storeField(tag, subBuilder.build());
- return true;
- case WireFormat.WIRETYPE_END_GROUP:
- return false;
- default:
- throw InvalidProtocolBufferException.invalidWireType();
- }
+ return set.mergeFieldFrom(tag, input);
}
/**
@@ -324,71 +417,42 @@
*
* <p>For use by generated code only.
*/
- public Builder mergeVarintField(int fieldNumber, int value) {
- if (fieldNumber == 0) {
- throw new IllegalArgumentException("Zero is not a valid field number.");
- }
+ Builder mergeVarintField(int fieldNumber, int value) {
ensureNotBuilt();
-
- storeField(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_VARINT), (long) value);
-
+ set.mergeVarintField(fieldNumber, value);
return this;
}
-
+
/**
* Convenience method for merging a length-delimited field.
*
* <p>For use by generated code only.
*/
- public Builder mergeLengthDelimitedField(
- final int fieldNumber, final ByteString value) {
- if (fieldNumber == 0) {
- throw new IllegalArgumentException("Zero is not a valid field number.");
- }
- ensureNotBuilt();
-
- storeField(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED), value);
-
+ public Builder mergeLengthDelimitedField(final int fieldNumber, final ByteString value) {
+ ensureNotBuilt();
+ set.mergeLengthDelimitedField(fieldNumber, value);
return this;
}
/**
- * Parse an entire message from {@code input} and merge its fields into
- * this set.
- */
- private Builder mergeFrom(final CodedInputStream input) throws IOException {
- // Ensures initialization in mergeFieldFrom.
- while (true) {
- final int tag = input.readTag();
- if (tag == 0 || !mergeFieldFrom(tag, input)) {
- break;
- }
- }
- return this;
- }
-
- /**
* Build the {@link UnknownFieldSetLite} and return it.
*
* <p>Once {@code build()} has been called, the {@code Builder} will no
* longer be usable. Calling any method after {@code build()} will result
- * in undefined behavior and can cause a {@code IllegalStateException} to be
- * thrown.
+ * in undefined behavior and can cause an
+ * {@code UnsupportedOperationException} to be thrown.
*
* <p>For use by generated code only.
*/
public UnknownFieldSetLite build() {
- if (built) {
- throw new IllegalStateException("Do not reuse UnknownFieldSetLite Builders.");
- }
-
- built = true;
-
- if (count == 0) {
+ if (set == null) {
return DEFAULT_INSTANCE;
}
+
+ set.checkMutable();
+ set.makeImmutable();
- return new UnknownFieldSetLite(count, tags, objects);
+ return set;
}
}
}
diff --git a/java/src/main/java/com/google/protobuf/Utf8.java b/java/src/main/java/com/google/protobuf/Utf8.java
index 0699778..48c7e9e 100644
--- a/java/src/main/java/com/google/protobuf/Utf8.java
+++ b/java/src/main/java/com/google/protobuf/Utf8.java
@@ -360,8 +360,8 @@
static class UnpairedSurrogateException extends IllegalArgumentException {
- private UnpairedSurrogateException(int index) {
- super("Unpaired surrogate at index " + index);
+ private UnpairedSurrogateException(int index, int length) {
+ super("Unpaired surrogate at index " + index + " of " + length);
}
}
@@ -417,7 +417,7 @@
// Check that we have a well-formed surrogate pair.
int cp = Character.codePointAt(sequence, i);
if (cp < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
- throw new UnpairedSurrogateException(i);
+ throw new UnpairedSurrogateException(i, utf16Length);
}
i++;
}
@@ -457,7 +457,7 @@
final char low;
if (i + 1 == sequence.length()
|| !Character.isSurrogatePair(c, (low = sequence.charAt(++i)))) {
- throw new UnpairedSurrogateException((i - 1));
+ throw new UnpairedSurrogateException((i - 1), utf16Length);
}
int codePoint = Character.toCodePoint(c, low);
bytes[j++] = (byte) ((0xF << 4) | (codePoint >>> 18));
@@ -470,7 +470,7 @@
if ((Character.MIN_SURROGATE <= c && c <= Character.MAX_SURROGATE)
&& (i + 1 == sequence.length()
|| !Character.isSurrogatePair(c, sequence.charAt(i + 1)))) {
- throw new UnpairedSurrogateException(i);
+ throw new UnpairedSurrogateException(i, utf16Length);
}
throw new ArrayIndexOutOfBoundsException("Failed writing " + c + " at index " + j);
}
diff --git a/java/src/test/java/com/google/protobuf/DescriptorsTest.java b/java/src/test/java/com/google/protobuf/DescriptorsTest.java
index edd7fc4..30da248 100644
--- a/java/src/test/java/com/google/protobuf/DescriptorsTest.java
+++ b/java/src/test/java/com/google/protobuf/DescriptorsTest.java
@@ -46,6 +46,7 @@
import com.google.protobuf.Descriptors.ServiceDescriptor;
import com.google.protobuf.test.UnittestImport;
import com.google.protobuf.test.UnittestImport.ImportEnum;
+import com.google.protobuf.test.UnittestImport.ImportEnumForMap;
import protobuf_unittest.TestCustomOptions;
import protobuf_unittest.UnittestCustomOptions;
import protobuf_unittest.UnittestProto;
@@ -115,7 +116,8 @@
assertEquals(enumType, file.findEnumTypeByName("ForeignEnum"));
assertNull(file.findEnumTypeByName("NoSuchType"));
assertNull(file.findEnumTypeByName("protobuf_unittest.ForeignEnum"));
- assertEquals(Arrays.asList(ImportEnum.getDescriptor()),
+ assertEquals(Arrays.asList(ImportEnum.getDescriptor(),
+ ImportEnumForMap.getDescriptor()),
UnittestImport.getDescriptor().getEnumTypes());
for (int i = 0; i < file.getEnumTypes().size(); i++) {
assertEquals(i, file.getEnumTypes().get(i).getIndex());
diff --git a/java/src/test/java/com/google/protobuf/TextFormatTest.java b/java/src/test/java/com/google/protobuf/TextFormatTest.java
index 8294b86..1df4fad 100644
--- a/java/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -830,6 +830,22 @@
.build()));
}
+ public void testShortDebugString_field() {
+ final FieldDescriptor dataField =
+ OneString.getDescriptor().findFieldByName("data");
+ assertEquals(
+ "data: \"test data\"",
+ TextFormat.shortDebugString(dataField, "test data"));
+
+ final FieldDescriptor optionalField =
+ TestAllTypes.getDescriptor().findFieldByName("optional_nested_message");
+ final Object value = NestedMessage.newBuilder().setBb(42).build();
+
+ assertEquals(
+ "optional_nested_message { bb: 42 }",
+ TextFormat.shortDebugString(optionalField, value));
+ }
+
public void testShortDebugString_unknown() {
assertEquals("5: 1 5: 0x00000002 5: 0x0000000000000003 5: \"4\" 5 { 10: 5 }"
+ " 8: 1 8: 2 8: 3 15: 12379813812177893520 15: 0xabcd1234 15:"
diff --git a/java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java b/java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java
index e76b4a6..dc98737 100644
--- a/java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java
+++ b/java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java
@@ -30,6 +30,8 @@
package com.google.protobuf;
+import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
+import com.google.protobuf.UnittestLite.TestAllTypesLite;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar;
import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo;
@@ -52,7 +54,40 @@
UnknownFieldSetLite.newBuilder()
.build());
}
+
+ public void testBuilderReuse() throws IOException {
+ UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
+ builder.mergeVarintField(10, 2);
+ builder.build();
+ try {
+ builder.build();
+ fail();
+ } catch (UnsupportedOperationException e) {
+ // Expected.
+ }
+
+ try {
+ builder.mergeFieldFrom(0, CodedInputStream.newInstance(new byte[0]));
+ fail();
+ } catch (UnsupportedOperationException e) {
+ // Expected.
+ }
+
+ try {
+ builder.mergeVarintField(5, 1);
+ fail();
+ } catch (UnsupportedOperationException e) {
+ // Expected.
+ }
+ }
+
+ public void testBuilderReuse_empty() {
+ UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
+ builder.build();
+ builder.build();
+ }
+
public void testDefaultInstance() {
UnknownFieldSetLite unknownFields = UnknownFieldSetLite.getDefaultInstance();
@@ -67,10 +102,10 @@
CodedInputStream input = CodedInputStream.newInstance(foo.toByteArray());
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
- builder.mergeFieldFrom(input.readTag(), input);
+ UnknownFieldSetLite instance = UnknownFieldSetLite.newInstance();
+ instance.mergeFieldFrom(input.readTag(), input);
- assertEquals(foo.toByteString(), toByteString(builder.build()));
+ assertEquals(foo.toByteString(), toByteString(instance));
}
public void testSerializedSize() throws IOException {
@@ -80,18 +115,18 @@
CodedInputStream input = CodedInputStream.newInstance(foo.toByteArray());
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
- builder.mergeFieldFrom(input.readTag(), input);
+ UnknownFieldSetLite instance = UnknownFieldSetLite.newInstance();
+ instance.mergeFieldFrom(input.readTag(), input);
- assertEquals(foo.toByteString().size(), builder.build().getSerializedSize());
+ assertEquals(foo.toByteString().size(), instance.getSerializedSize());
}
public void testMergeVarintField() throws IOException {
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
- builder.mergeVarintField(10, 2);
+ UnknownFieldSetLite unknownFields = UnknownFieldSetLite.newInstance();
+ unknownFields.mergeVarintField(10, 2);
CodedInputStream input =
- CodedInputStream.newInstance(toByteString(builder.build()).toByteArray());
+ CodedInputStream.newInstance(toByteString(unknownFields).toByteArray());
int tag = input.readTag();
assertEquals(10, WireFormat.getTagFieldNumber(tag));
@@ -101,11 +136,11 @@
}
public void testMergeVarintField_negative() throws IOException {
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
+ UnknownFieldSetLite builder = UnknownFieldSetLite.newInstance();
builder.mergeVarintField(10, -6);
CodedInputStream input =
- CodedInputStream.newInstance(toByteString(builder.build()).toByteArray());
+ CodedInputStream.newInstance(toByteString(builder).toByteArray());
int tag = input.readTag();
assertEquals(10, WireFormat.getTagFieldNumber(tag));
@@ -115,13 +150,11 @@
}
public void testEqualsAndHashCode() {
- UnknownFieldSetLite.Builder builder1 = UnknownFieldSetLite.newBuilder();
- builder1.mergeVarintField(10, 2);
- UnknownFieldSetLite unknownFields1 = builder1.build();
+ UnknownFieldSetLite unknownFields1 = UnknownFieldSetLite.newInstance();
+ unknownFields1.mergeVarintField(10, 2);
- UnknownFieldSetLite.Builder builder2 = UnknownFieldSetLite.newBuilder();
- builder2.mergeVarintField(10, 2);
- UnknownFieldSetLite unknownFields2 = builder2.build();
+ UnknownFieldSetLite unknownFields2 = UnknownFieldSetLite.newInstance();
+ unknownFields2.mergeVarintField(10, 2);
assertEquals(unknownFields1, unknownFields2);
assertEquals(unknownFields1.hashCode(), unknownFields2.hashCode());
@@ -129,12 +162,11 @@
assertFalse(unknownFields1.hashCode() == UnknownFieldSetLite.getDefaultInstance().hashCode());
}
- public void testConcat() throws IOException {
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
- builder.mergeVarintField(10, 2);
- UnknownFieldSetLite unknownFields = builder.build();
-
- unknownFields = UnknownFieldSetLite.concat(unknownFields, unknownFields);
+ public void testMutableCopyOf() throws IOException {
+ UnknownFieldSetLite unknownFields = UnknownFieldSetLite.newInstance();
+ unknownFields.mergeVarintField(10, 2);
+ unknownFields = UnknownFieldSetLite.mutableCopyOf(unknownFields, unknownFields);
+ unknownFields.checkMutable();
CodedInputStream input =
CodedInputStream.newInstance(toByteString(unknownFields).toByteArray());
@@ -151,53 +183,15 @@
assertTrue(input.isAtEnd());
}
- public void testConcat_empty() {
- UnknownFieldSetLite unknownFields = UnknownFieldSetLite.concat(
+ public void testMutableCopyOf_empty() {
+ UnknownFieldSetLite unknownFields = UnknownFieldSetLite.mutableCopyOf(
UnknownFieldSetLite.getDefaultInstance(), UnknownFieldSetLite.getDefaultInstance());
+ unknownFields.checkMutable();
assertEquals(0, unknownFields.getSerializedSize());
assertEquals(ByteString.EMPTY, toByteString(unknownFields));
}
- public void testBuilderReuse() throws IOException {
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
- builder.mergeVarintField(10, 2);
- builder.build();
-
- try {
- builder.build();
- fail();
- } catch (IllegalStateException e) {
- // Expected.
- }
-
- try {
- builder.mergeFieldFrom(0, CodedInputStream.newInstance(new byte[0]));
- fail();
- } catch (IllegalStateException e) {
- // Expected.
- }
-
- try {
- builder.mergeVarintField(5, 1);
- fail();
- } catch (IllegalStateException e) {
- // Expected.
- }
- }
-
- public void testBuilderReuse_empty() {
- UnknownFieldSetLite.Builder builder = UnknownFieldSetLite.newBuilder();
- builder.build();
-
- try {
- builder.build();
- fail();
- } catch (IllegalStateException e) {
- // Expected.
- }
- }
-
public void testRoundTrips() throws InvalidProtocolBufferException {
Foo foo = Foo.newBuilder()
.setValue(1)
@@ -301,6 +295,64 @@
// Expected.
}
}
+
+ public void testMakeImmutable() throws Exception {
+ UnknownFieldSetLite unknownFields = UnknownFieldSetLite.newInstance();
+ unknownFields.makeImmutable();
+
+ try {
+ unknownFields.mergeVarintField(1, 1);
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+
+ try {
+ unknownFields.mergeLengthDelimitedField(2, ByteString.copyFromUtf8("hello"));
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+
+ try {
+ unknownFields.mergeFieldFrom(1, CodedInputStream.newInstance(new byte[0]));
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+ }
+
+ public void testEndToEnd() throws Exception {
+ TestAllTypesLite testAllTypes = TestAllTypesLite.getDefaultInstance();
+ try {
+ testAllTypes.unknownFields.checkMutable();
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+
+ testAllTypes = TestAllTypesLite.parseFrom(new byte[0]);
+ try {
+ testAllTypes.unknownFields.checkMutable();
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+
+ testAllTypes = TestAllTypesLite.newBuilder().build();
+ try {
+ testAllTypes.unknownFields.checkMutable();
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+
+ testAllTypes = TestAllTypesLite.newBuilder()
+ .setDefaultBool(true)
+ .build();
+ try {
+ testAllTypes.unknownFields.checkMutable();
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+
+ TestAllExtensionsLite testAllExtensions = TestAllExtensionsLite.newBuilder()
+ .mergeFrom(TestAllExtensionsLite.newBuilder()
+ .setExtension(UnittestLite.optionalInt32ExtensionLite, 2)
+ .build().toByteArray())
+ .build();
+ try {
+ testAllExtensions.unknownFields.checkMutable();
+ fail();
+ } catch (UnsupportedOperationException expected) {}
+ }
private ByteString toByteString(UnknownFieldSetLite unknownFields) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
diff --git a/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto b/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto
index dc08261..8c37c03 100644
--- a/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto
+++ b/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto
@@ -140,11 +140,11 @@
optional bytes bytes_field_count = 14;
optional TestMessage message_field_count = 15;
- repeated int32 Int32Field = 21;
- repeated TestEnum EnumField = 22;
- repeated string StringField = 23;
- repeated bytes BytesField = 24;
- repeated TestMessage MessageField = 25;
+ repeated int32 Int32Field = 21; // NO_PROTO3
+ repeated TestEnum EnumField = 22; // NO_PROTO3
+ repeated string StringField = 23; // NO_PROTO3
+ repeated bytes BytesField = 24; // NO_PROTO3
+ repeated TestMessage MessageField = 25; // NO_PROTO3
// This field conflicts with "int32_field" as they both generate
// the method getInt32FieldList().
diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh
index 2192b76..c38fce7 100755
--- a/objectivec/DevTools/full_mac_build.sh
+++ b/objectivec/DevTools/full_mac_build.sh
@@ -202,9 +202,9 @@
# Don't need to worry about form factors or retina/non retina;
# just pick a mix of OS Versions and 32/64 bit.
-destination "platform=iOS Simulator,name=iPhone 4s,OS=7.1" # 32bit
- -destination "platform=iOS Simulator,name=iPhone 6,OS=8.3" # 64bit
+ -destination "platform=iOS Simulator,name=iPhone 6,OS=8.4" # 64bit
-destination "platform=iOS Simulator,name=iPad 2,OS=7.1" # 32bit
- -destination "platform=iOS Simulator,name=iPad Air,OS=8.3" # 64bit
+ -destination "platform=iOS Simulator,name=iPad Air,OS=8.4" # 64bit
)
header "Doing Xcode iOS build/tests - Debug"
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Debug test
diff --git a/objectivec/GPBBootstrap.h b/objectivec/GPBBootstrap.h
index 3dd2de8..c49c7e2 100644
--- a/objectivec/GPBBootstrap.h
+++ b/objectivec/GPBBootstrap.h
@@ -46,12 +46,20 @@
// Used in the generated code to give sizes to enums. int32_t was chosen based
// on the fact that Protocol Buffers enums are limited to this range.
-// The complexity and double definition here are so we get the nice name
-// for objective C, but also define the name with a trailing underscore so
-// the Swift bridge will have one where the names line up to support short
-// names since they are scoped to the enum.
-// https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html#//apple_ref/doc/uid/TP40014216-CH8-XID_11
-#define GPB_ENUM(X) NS_ENUM(int32_t, X)
+#if !__has_feature(objc_fixed_enum)
+ #error All supported Xcode versions should support objc_fixed_enum.
+#endif
+// If the headers are imported into Objective-C++, we can run into an issue
+// where the defintion of NS_ENUM (really CF_ENUM) changes based on the C++
+// standard that is in effect. If it isn't C++11 or higher, the definition
+// doesn't allow us to forward declare. We work around this one case by
+// providing a local definition. The default case has to use NS_ENUM for the
+// magic that is Swift bridging of enums.
+#if (__cplusplus && __cplusplus < 201103L)
+ #define GPB_ENUM(X) enum X : int32_t X; enum X : int32_t
+#else
+ #define GPB_ENUM(X) NS_ENUM(int32_t, X)
+#endif
// GPB_ENUM_FWD_DECLARE is used for forward declaring enums, ex:
// GPB_ENUM_FWD_DECLARE(Foo_Enum)
// @property (nonatomic) Foo_Enum value;
diff --git a/objectivec/GPBDictionary.h b/objectivec/GPBDictionary.h
index cc4a698..6961cfc 100644
--- a/objectivec/GPBDictionary.h
+++ b/objectivec/GPBDictionary.h
@@ -360,30 +360,30 @@
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint32_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint32_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(uint32_t)key;
+- (id)objectForKey:(uint32_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint32_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint32_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(uint32_t)key;
+- (void)setObject:(id)object forKey:(uint32_t)key;
-- (void)removeValueForKey:(uint32_t)aKey;
+- (void)removeObjectForKey:(uint32_t)aKey;
- (void)removeAll;
@end
@@ -706,30 +706,30 @@
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int32_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int32_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(int32_t)key;
+- (id)objectForKey:(int32_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int32_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int32_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(int32_t)key;
+- (void)setObject:(id)object forKey:(int32_t)key;
-- (void)removeValueForKey:(int32_t)aKey;
+- (void)removeObjectForKey:(int32_t)aKey;
- (void)removeAll;
@end
@@ -1052,30 +1052,30 @@
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint64_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint64_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(uint64_t)key;
+- (id)objectForKey:(uint64_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint64_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint64_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(uint64_t)key;
+- (void)setObject:(id)object forKey:(uint64_t)key;
-- (void)removeValueForKey:(uint64_t)aKey;
+- (void)removeObjectForKey:(uint64_t)aKey;
- (void)removeAll;
@end
@@ -1398,30 +1398,30 @@
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int64_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int64_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(int64_t)key;
+- (id)objectForKey:(int64_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int64_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int64_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(int64_t)key;
+- (void)setObject:(id)object forKey:(int64_t)key;
-- (void)removeValueForKey:(int64_t)aKey;
+- (void)removeObjectForKey:(int64_t)aKey;
- (void)removeAll;
@end
@@ -1744,30 +1744,30 @@
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(BOOL)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(BOOL)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(BOOL)key;
+- (id)objectForKey:(BOOL)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(BOOL key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(BOOL key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(BOOL)key;
+- (void)setObject:(id)object forKey:(BOOL)key;
-- (void)removeValueForKey:(BOOL)aKey;
+- (void)removeObjectForKey:(BOOL)aKey;
- (void)removeAll;
@end
@@ -2107,13 +2107,13 @@
//%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double)
//%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t)
//%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD)
+//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD, value)
//%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT)
+//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, object)
//%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
//%- (BOOL)valueForKey:(KEY_TYPE)key value:(nullable VALUE_TYPE *)value;
//%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE)
-//%- (VALUE_TYPE)valueForKey:(KEY_TYPE)key;
+//%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
//%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE)
//%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
//%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD()
@@ -2122,7 +2122,7 @@
// Nothing
//%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT()
//%GPB_UNSAFE_UNRETAINED ##
-//%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
@@ -2130,25 +2130,25 @@
//%@property(nonatomic, readonly) NSUInteger count;
//%
//%+ (instancetype)dictionary;
-//%+ (instancetype)dictionaryWithValue:(VALUE_TYPE)value
-//% forKey:(KEY_TYPE##KisP$S##KisP)key;
-//%+ (instancetype)dictionaryWithValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
-//% count:(NSUInteger)count;
+//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME
+//% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
+//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME##s
+//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
+//% ##VNAME$S## count:(NSUInteger)count;
//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
//%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
//%
-//%- (instancetype)initWithValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
-//% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+//%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME##s
+//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
+//% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
//%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
//%- (instancetype)initWithCapacity:(NSUInteger)numItems;
//%
-//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%
//%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
//%
-//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%
//%@end
//%
@@ -2189,7 +2189,7 @@
//%// is not a valid enumerator as defined by validationFunc. If the actual value is
//%// desired, use "raw" version of the method.
//%
-//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, value)
//%
//%// These methods bypass the validationFunc to provide access to values that were not
//%// known at the time the binary was compiled.
@@ -2206,21 +2206,21 @@
//%// to the default value. Use the rawValue methods below to assign non enumerator
//%// values.
//%
-//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, value)
//%
//%@end
//%
-//%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE)
//%
-//%- (void)enumerateKeysAndValuesUsingBlock:
-//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop))block;
+//%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock:
+//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block;
-//%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
-//%- (void)setValue:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key;
+//%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
+//%- (void)set##VNAME$u##:(VALUE_TYPE)##VNAME forKey:(KEY_TYPE##KisP$S##KisP)key;
//%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
-//%- (void)removeValueForKey:(KEY_TYPE##KisP$S##KisP)aKey;
+//%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
//%- (void)removeAll;
//%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m
index df63427..31ee410 100644
--- a/objectivec/GPBDictionary.m
+++ b/objectivec/GPBDictionary.m
@@ -479,6 +479,12 @@
case GPBDataTypeBytes:
value.valueData = [GPBEmptyNSData() retain];
break;
+#if defined(__clang_analyzer__)
+ case GPBDataTypeGroup:
+ // Maps can't really have Groups as the value type, but this case is needed
+ // so the analyzer won't report the posibility of send nil in for the value
+ // in the NSMutableDictionary case below.
+#endif
case GPBDataTypeMessage: {
value.valueMessage = [[field.msgClass alloc] init];
break;
@@ -491,7 +497,8 @@
if ((keyDataType == GPBDataTypeString) && GPBDataTypeIsObject(valueDataType)) {
// mapDictionary is an NSMutableDictionary
- [mapDictionary setObject:value.valueString forKey:key.valueString];
+ [(NSMutableDictionary *)mapDictionary setObject:value.valueString
+ forKey:key.valueString];
} else {
if (valueDataType == GPBDataTypeEnum) {
if (GPBHasPreservingUnknownEnumSemantics([parentMessage descriptor].file.syntax) ||
@@ -536,12 +543,12 @@
//%DICTIONARY_KEY_TO_ENUM_IMPL(KEY_NAME, KEY_TYPE, KisP, Enum, int32_t, KHELPER)
//%PDDM-DEFINE DICTIONARY_KEY_TO_POD_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER)
-//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, POD)
+//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, POD, value)
//%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_IMPL(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, , VALUE_NAME, VALUE_TYPE, POD, OBJECT)
+//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, , VALUE_NAME, VALUE_TYPE, POD, OBJECT, object)
-//%PDDM-DEFINE DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER)
+//%PDDM-DEFINE DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@implementation GPB##KEY_NAME##VALUE_NAME##Dictionary {
@@ -550,30 +557,30 @@
//%}
//%
//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+//% return [[[self alloc] initWith##VNAME$u##s:NULL forKeys:NULL count:0] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValue:(VALUE_TYPE)value
-//% forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME
+//% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key {
+//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count:
//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithValues:&value
-//% KEY_NAME$S VALUE_NAME$S forKeys:&key
-//% KEY_NAME$S VALUE_NAME$S count:1] autorelease];
+//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:&##VNAME
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:&key
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:1] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
-//% count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##s
+//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
+//% ##VNAME$S## count:(NSUInteger)count {
+//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count:
//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithValues:values
+//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:##VNAME##s
//% KEY_NAME$S VALUE_NAME$S forKeys:keys
//% KEY_NAME$S VALUE_NAME$S count:count] autorelease];
//%}
//%
//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//% // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
//% // on to get the type correct.
//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
//%}
@@ -583,18 +590,18 @@
//%}
//%
//%- (instancetype)init {
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
-//%- (instancetype)initWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
-//% count:(NSUInteger)count {
+//%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##s
+//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
+//% ##VNAME$S## count:(NSUInteger)count {
//% self = [super init];
//% if (self) {
//% _dictionary = [[NSMutableDictionary alloc] init];
-//% if (count && values && keys) {
+//% if (count && VNAME##s && keys) {
//% for (NSUInteger i = 0; i < count; ++i) {
-//% [_dictionary setObject:WRAPPED##VHELPER(values[i]) forKey:WRAPPED##KHELPER(keys[i])];
+//% [_dictionary setObject:WRAPPED##VHELPER(VNAME##s[i]) forKey:WRAPPED##KHELPER(keys[i])];
//% }
//% }
//% }
@@ -602,7 +609,7 @@
//%}
//%
//%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary {
-//% self = [self initWithValues:NULL forKeys:NULL count:0];
+//% self = [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//% if (self) {
//% if (dictionary) {
//% [_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -613,14 +620,14 @@
//%
//%- (instancetype)initWithCapacity:(NSUInteger)numItems {
//% #pragma unused(numItems)
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
-//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, )
+//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, )
//%
//%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_NAME, VALUE_TYPE, KHELPER)
//%
-//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, )
+//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, )
//%
//%@end
//%
@@ -730,7 +737,7 @@
//% return [self initWithValidationFunction:func rawValues:NULL forKeys:NULL count:0];
//%}
//%
-//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, Raw)
+//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, value, Raw)
//%
//%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key value:(VALUE_TYPE *)value {
//% NSNumber *wrapped = [_dictionary objectForKey:WRAPPED##KHELPER(key)];
@@ -766,7 +773,7 @@
//% }];
//%}
//%
-//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, Raw)
+//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, value, Raw)
//%
//%- (void)setValue:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key {
//% if (!_validationFunc(value)) {
@@ -784,7 +791,7 @@
//%@end
//%
-//%PDDM-DEFINE DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, ACCESSOR_NAME)
+//%PDDM-DEFINE DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ACCESSOR_NAME)
//%- (void)dealloc {
//% NSAssert(!_autocreator,
//% @"%@: Autocreator must be cleared before release, autocreator: %@",
@@ -819,12 +826,12 @@
//% return _dictionary.count;
//%}
//%
-//%- (void)enumerateKeysAnd##ACCESSOR_NAME##ValuesUsingBlock:
-//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop))block {
+//%- (void)enumerateKeysAnd##ACCESSOR_NAME##VNAME$u##sUsingBlock:
+//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block {
//% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey,
-//% ENUM_TYPE##VHELPER(VALUE_TYPE)##aValue,
+//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u,
//% BOOL *stop) {
-//% block(UNWRAP##KEY_NAME(aKey), UNWRAP##VALUE_NAME(aValue), stop);
+//% block(UNWRAP##KEY_NAME(aKey), UNWRAP##VALUE_NAME(a##VNAME$u), stop);
//% }];
//%}
//%
@@ -838,11 +845,11 @@
//% GPBDataType keyDataType = field.mapKeyDataType;
//% __block size_t result = 0;
//% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey,
-//% ENUM_TYPE##VHELPER(VALUE_TYPE)##aValue,
+//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u##,
//% BOOL *stop) {
//% #pragma unused(stop)
//% size_t msgSize = ComputeDict##KEY_NAME##FieldSize(UNWRAP##KEY_NAME(aKey), kMapKeyFieldNumber, keyDataType);
-//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(aValue), kMapValueFieldNumber, valueDataType);
+//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType);
//% result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
//% }];
//% size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -856,18 +863,18 @@
//% GPBDataType keyDataType = field.mapKeyDataType;
//% uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
//% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey,
-//% ENUM_TYPE##VHELPER(VALUE_TYPE)##aValue,
+//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u,
//% BOOL *stop) {
//% #pragma unused(stop)
//% // Write the tag.
//% [outputStream writeInt32NoTag:tag];
//% // Write the size of the message.
//% size_t msgSize = ComputeDict##KEY_NAME##FieldSize(UNWRAP##KEY_NAME(aKey), kMapKeyFieldNumber, keyDataType);
-//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(aValue), kMapValueFieldNumber, valueDataType);
+//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType);
//% [outputStream writeInt32NoTag:(int32_t)msgSize];
//% // Write the fields.
//% WriteDict##KEY_NAME##Field(outputStream, UNWRAP##KEY_NAME(aKey), kMapKeyFieldNumber, keyDataType);
-//% WriteDict##VALUE_NAME##Field(outputStream, UNWRAP##VALUE_NAME(aValue), kMapValueFieldNumber, valueDataType);
+//% WriteDict##VALUE_NAME##Field(outputStream, UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType);
//% }];
//%}
//%
@@ -877,12 +884,12 @@
//%}
//%
//%- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
-//% [self enumerateKeysAnd##ACCESSOR_NAME##ValuesUsingBlock:^(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop) {
+//% [self enumerateKeysAnd##ACCESSOR_NAME##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop) {
//% #pragma unused(stop)
-//% block(TEXT_FORMAT_OBJ##KEY_NAME(key), TEXT_FORMAT_OBJ##VALUE_NAME(value));
+//% block(TEXT_FORMAT_OBJ##KEY_NAME(key), TEXT_FORMAT_OBJ##VALUE_NAME(VNAME));
//% }];
//%}
-//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, ACCESSOR_NAME)
+//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ACCESSOR_NAME)
//%- (void)add##ACCESSOR_NAME##EntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary {
//% if (otherDictionary) {
//% [_dictionary addEntriesFromDictionary:otherDictionary->_dictionary];
@@ -892,14 +899,14 @@
//% }
//%}
//%
-//%- (void)set##ACCESSOR_NAME##Value:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% [_dictionary setObject:WRAPPED##VHELPER(value) forKey:WRAPPED##KHELPER(key)];
+//%- (void)set##ACCESSOR_NAME##VNAME$u##:(VALUE_TYPE)VNAME forKey:(KEY_TYPE##KisP$S##KisP)key {
+//% [_dictionary setObject:WRAPPED##VHELPER(VNAME) forKey:WRAPPED##KHELPER(key)];
//% if (_autocreator) {
//% GPBAutocreatedDictionaryModified(_autocreator, self);
//% }
//%}
//%
-//%- (void)removeValueForKey:(KEY_TYPE##KisP$S##KisP)aKey {
+//%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey {
//% [_dictionary removeObjectForKey:WRAPPED##KHELPER(aKey)];
//%}
//%
@@ -912,11 +919,11 @@
//
//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_POD_IMPL(VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, POD)
+//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, POD, value)
//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_OBJECT_IMPL(VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, OBJECT)
+//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, OBJECT, object)
-//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, HELPER)
+//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, HELPER, VNAME)
//%#pragma mark - Bool -> VALUE_NAME
//%
//%@implementation GPBBool##VALUE_NAME##Dictionary {
@@ -925,30 +932,30 @@
//%BOOL_DICT_HAS_STORAGE_##HELPER()}
//%
//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+//% return [[[self alloc] initWith##VNAME$u##s:NULL forKeys:NULL count:0] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValue:(VALUE_TYPE)value
-//% forKey:(BOOL)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)VNAME
+//% ##VNAME$S## forKey:(BOOL)key {
+//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count:
//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithValues:&value
-//% VALUE_NAME$S forKeys:&key
-//% VALUE_NAME$S count:1] autorelease];
+//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:&##VNAME
+//% VALUE_NAME$S ##VNAME$S## forKeys:&key
+//% VALUE_NAME$S ##VNAME$S## count:1] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const BOOL [])keys
-//% count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##s
+//% ##VNAME$S## forKeys:(const BOOL [])keys
+//% ##VNAME$S## count:(NSUInteger)count {
+//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count:
//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithValues:values
-//% VALUE_NAME$S forKeys:keys
-//% VALUE_NAME$S count:count] autorelease];
+//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:##VNAME##s
+//% VALUE_NAME$S ##VNAME$S## forKeys:keys
+//% VALUE_NAME$S ##VNAME$S## count:count] autorelease];
//%}
//%
//%+ (instancetype)dictionaryWithDictionary:(GPBBool##VALUE_NAME##Dictionary *)dictionary {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//% // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
//% // on to get the type correct.
//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
//%}
@@ -958,14 +965,14 @@
//%}
//%
//%- (instancetype)init {
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
//%BOOL_DICT_INITS_##HELPER(VALUE_NAME, VALUE_TYPE)
//%
//%- (instancetype)initWithCapacity:(NSUInteger)numItems {
//% #pragma unused(numItems)
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
//%BOOL_DICT_DEALLOC##HELPER()
@@ -1025,8 +1032,8 @@
//% }
//%}
//%
-//%- (void)enumerateKeysAndValuesUsingBlock:
-//% (void (^)(BOOL key, VALUE_TYPE value, BOOL *stop))block {
+//%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock:
+//% (void (^)(BOOL key, VALUE_TYPE VNAME, BOOL *stop))block {
//% BOOL stop = NO;
//% if (BOOL_DICT_HAS##HELPER(0, )) {
//% block(NO, _values[0], &stop);
@@ -1282,7 +1289,7 @@
//
//%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_NAME, VALUE_TYPE, KHELPER)
-//%- (VALUE_TYPE)valueForKey:(KEY_TYPE)key {
+//%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key {
//% VALUE_TYPE result = [_dictionary objectForKey:WRAPPED##KHELPER(key)];
//% return result;
//%}
@@ -1361,22 +1368,22 @@
//%PDDM-DEFINE BOOL_DICT_HAS_STORAGE_OBJECT()
// Empty
//%PDDM-DEFINE BOOL_DICT_INITS_OBJECT(VALUE_NAME, VALUE_TYPE)
-//%- (instancetype)initWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const BOOL [])keys
-//% count:(NSUInteger)count {
+//%- (instancetype)initWithObjects:(const VALUE_TYPE [])objects
+//% forKeys:(const BOOL [])keys
+//% count:(NSUInteger)count {
//% self = [super init];
//% if (self) {
//% for (NSUInteger i = 0; i < count; ++i) {
//% int idx = keys[i] ? 1 : 0;
//% [_values[idx] release];
-//% _values[idx] = (VALUE_TYPE)[values[i] retain];
+//% _values[idx] = (VALUE_TYPE)[objects[i] retain];
//% }
//% }
//% return self;
//%}
//%
//%- (instancetype)initWithDictionary:(GPBBool##VALUE_NAME##Dictionary *)dictionary {
-//% self = [self initWithValues:NULL forKeys:NULL count:0];
+//% self = [self initWithObjects:NULL forKeys:NULL count:0];
//% if (self) {
//% if (dictionary) {
//% _values[0] = [dictionary->_values[0] retain];
@@ -1399,7 +1406,7 @@
//%PDDM-DEFINE BOOL_DICT_HASOBJECT(IDX, REF)
//%REF##_values[IDX] != nil
//%PDDM-DEFINE BOOL_VALUE_FOR_KEY_OBJECT(VALUE_TYPE)
-//%- (VALUE_TYPE)valueForKey:(BOOL)key {
+//%- (VALUE_TYPE)objectForKey:(BOOL)key {
//% return _values[key ? 1 : 0];
//%}
//%PDDM-DEFINE BOOL_SET_GPBVALUE_FOR_KEY_OBJECT(VALUE_NAME, VALUE_TYPE, VisP)
@@ -1425,16 +1432,16 @@
//% }
//%}
//%
-//%- (void)setValue:(VALUE_TYPE)value forKey:(BOOL)key {
+//%- (void)setObject:(VALUE_TYPE)object forKey:(BOOL)key {
//% int idx = (key ? 1 : 0);
//% [_values[idx] release];
-//% _values[idx] = [value retain];
+//% _values[idx] = [object retain];
//% if (_autocreator) {
//% GPBAutocreatedDictionaryModified(_autocreator, self);
//% }
//%}
//%
-//%- (void)removeValueForKey:(BOOL)aKey {
+//%- (void)removeObjectForKey:(BOOL)aKey {
//% int idx = (aKey ? 1 : 0);
//% [_values[idx] release];
//% _values[idx] = nil;
@@ -1484,7 +1491,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -1690,7 +1697,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -1896,7 +1903,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2102,7 +2109,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2308,7 +2315,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2514,7 +2521,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2720,7 +2727,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3188,30 +3195,30 @@
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint32_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObjects:(const id [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3221,18 +3228,18 @@
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -3240,7 +3247,7 @@
}
- (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -3251,7 +3258,7 @@
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -3288,12 +3295,12 @@
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint32_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint32_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey unsignedIntValue], aValue, stop);
+ block([aKey unsignedIntValue], aObject, stop);
}];
}
@@ -3330,11 +3337,11 @@
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictUInt32FieldSize([aKey unsignedIntValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -3348,18 +3355,18 @@
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictUInt32FieldSize([aKey unsignedIntValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictUInt32Field(outputStream, [aKey unsignedIntValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -3369,13 +3376,13 @@
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(uint32_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%u", key], value);
+ block([NSString stringWithFormat:@"%u", key], object);
}];
}
-- (id)valueForKey:(uint32_t)key {
+- (id)objectForKey:(uint32_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -3389,14 +3396,14 @@
}
}
-- (void)setValue:(id)value forKey:(uint32_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(uint32_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(uint32_t)aKey {
+- (void)removeObjectForKey:(uint32_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -3440,7 +3447,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3646,7 +3653,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3852,7 +3859,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4058,7 +4065,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4264,7 +4271,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4470,7 +4477,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4676,7 +4683,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5144,30 +5151,30 @@
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int32_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBInt32ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObjects:(const id [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBInt32ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt32ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5177,18 +5184,18 @@
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -5196,7 +5203,7 @@
}
- (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -5207,7 +5214,7 @@
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -5244,12 +5251,12 @@
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int32_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int32_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey intValue], aValue, stop);
+ block([aKey intValue], aObject, stop);
}];
}
@@ -5286,11 +5293,11 @@
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictInt32FieldSize([aKey intValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -5304,18 +5311,18 @@
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictInt32FieldSize([aKey intValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictInt32Field(outputStream, [aKey intValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -5325,13 +5332,13 @@
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(int32_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(int32_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%d", key], value);
+ block([NSString stringWithFormat:@"%d", key], object);
}];
}
-- (id)valueForKey:(int32_t)key {
+- (id)objectForKey:(int32_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -5345,14 +5352,14 @@
}
}
-- (void)setValue:(id)value forKey:(int32_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(int32_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(int32_t)aKey {
+- (void)removeObjectForKey:(int32_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -5396,7 +5403,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5602,7 +5609,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5808,7 +5815,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6014,7 +6021,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6220,7 +6227,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6426,7 +6433,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6632,7 +6639,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7100,30 +7107,30 @@
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint64_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObjects:(const id [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7133,18 +7140,18 @@
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -7152,7 +7159,7 @@
}
- (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -7163,7 +7170,7 @@
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -7200,12 +7207,12 @@
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint64_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint64_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey unsignedLongLongValue], aValue, stop);
+ block([aKey unsignedLongLongValue], aObject, stop);
}];
}
@@ -7242,11 +7249,11 @@
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictUInt64FieldSize([aKey unsignedLongLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -7260,18 +7267,18 @@
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictUInt64FieldSize([aKey unsignedLongLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictUInt64Field(outputStream, [aKey unsignedLongLongValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -7281,13 +7288,13 @@
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(uint64_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%llu", key], value);
+ block([NSString stringWithFormat:@"%llu", key], object);
}];
}
-- (id)valueForKey:(uint64_t)key {
+- (id)objectForKey:(uint64_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -7301,14 +7308,14 @@
}
}
-- (void)setValue:(id)value forKey:(uint64_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(uint64_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(uint64_t)aKey {
+- (void)removeObjectForKey:(uint64_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -7352,7 +7359,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7558,7 +7565,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7764,7 +7771,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7970,7 +7977,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -8176,7 +8183,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -8382,7 +8389,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -8588,7 +8595,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9056,30 +9063,30 @@
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int64_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBInt64ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObjects:(const id [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBInt64ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBInt64ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9089,18 +9096,18 @@
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -9108,7 +9115,7 @@
}
- (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -9119,7 +9126,7 @@
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -9156,12 +9163,12 @@
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int64_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int64_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey longLongValue], aValue, stop);
+ block([aKey longLongValue], aObject, stop);
}];
}
@@ -9198,11 +9205,11 @@
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictInt64FieldSize([aKey longLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -9216,18 +9223,18 @@
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictInt64FieldSize([aKey longLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictInt64Field(outputStream, [aKey longLongValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -9237,13 +9244,13 @@
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(int64_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(int64_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%lld", key], value);
+ block([NSString stringWithFormat:@"%lld", key], object);
}];
}
-- (id)valueForKey:(int64_t)key {
+- (id)objectForKey:(int64_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -9257,14 +9264,14 @@
}
}
-- (void)setValue:(id)value forKey:(int64_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(int64_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(int64_t)aKey {
+- (void)removeObjectForKey:(int64_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -9308,7 +9315,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringUInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9514,7 +9521,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9720,7 +9727,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringUInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9926,7 +9933,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -10132,7 +10139,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringBoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -10338,7 +10345,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringFloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -10544,7 +10551,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBStringDoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11042,7 +11049,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11283,7 +11290,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11524,7 +11531,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11765,7 +11772,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12006,7 +12013,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolBoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12247,7 +12254,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolFloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12488,7 +12495,7 @@
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12705,30 +12712,30 @@
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(BOOL)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBBoolObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObjects:(const id [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithValues:values
- forKeys:keys
- count:count] autorelease];
+ return [[(GPBBoolObjectDictionary*)[self alloc] initWithObjects:objects
+ forKeys:keys
+ count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+ // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
// on to get the type correct.
return [[(GPBBoolObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12738,25 +12745,25 @@
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
for (NSUInteger i = 0; i < count; ++i) {
int idx = keys[i] ? 1 : 0;
[_values[idx] release];
- _values[idx] = (id)[values[i] retain];
+ _values[idx] = (id)[objects[i] retain];
}
}
return self;
}
- (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
_values[0] = [dictionary->_values[0] retain];
@@ -12768,7 +12775,7 @@
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -12822,7 +12829,7 @@
return ((_values[0] != nil) ? 1 : 0) + ((_values[1] != nil) ? 1 : 0);
}
-- (id)valueForKey:(BOOL)key {
+- (id)objectForKey:(BOOL)key {
return _values[key ? 1 : 0];
}
@@ -12842,8 +12849,8 @@
}
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(BOOL key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(BOOL key, id object, BOOL *stop))block {
BOOL stop = NO;
if (_values[0] != nil) {
block(NO, _values[0], &stop);
@@ -12924,16 +12931,16 @@
}
}
-- (void)setValue:(id)value forKey:(BOOL)key {
+- (void)setObject:(id)object forKey:(BOOL)key {
int idx = (key ? 1 : 0);
[_values[idx] release];
- _values[idx] = [value retain];
+ _values[idx] = [object retain];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(BOOL)aKey {
+- (void)removeObjectForKey:(BOOL)aKey {
int idx = (aKey ? 1 : 0);
[_values[idx] release];
_values[idx] = nil;
diff --git a/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
index b0a0712..08d0b7e 100644
--- a/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
+++ b/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
@@ -58,6 +58,7 @@
F4487C831AAF6AB300531423 /* GPBMessageTests+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = F4487C821AAF6AB300531423 /* GPBMessageTests+Merge.m */; };
F45C69CC16DFD08D0081955B /* GPBExtensionInternals.m in Sources */ = {isa = PBXBuildFile; fileRef = F45C69CB16DFD08D0081955B /* GPBExtensionInternals.m */; };
F45E57C71AE6DC6A000B7D99 /* text_format_map_unittest_data.txt in Resources */ = {isa = PBXBuildFile; fileRef = F45E57C61AE6DC6A000B7D99 /* text_format_map_unittest_data.txt */; };
+ F4B51B1E1BBC610700744318 /* GPBObjectiveCPlusPlusTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4B51B1D1BBC610700744318 /* GPBObjectiveCPlusPlusTest.mm */; };
F4E675971B21D0000054530B /* Any.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E675871B21D0000054530B /* Any.pbobjc.m */; };
F4E675991B21D0000054530B /* Api.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E675891B21D0000054530B /* Api.pbobjc.m */; };
F4E6759B1B21D0000054530B /* Empty.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E6758B1B21D0000054530B /* Empty.pbobjc.m */; };
@@ -193,6 +194,7 @@
F45C69CB16DFD08D0081955B /* GPBExtensionInternals.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBExtensionInternals.m; sourceTree = "<group>"; };
F45E57C61AE6DC6A000B7D99 /* text_format_map_unittest_data.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = text_format_map_unittest_data.txt; sourceTree = "<group>"; };
F4AC9E1D1A8BEB3500BD6E83 /* unittest_cycle.proto */ = {isa = PBXFileReference; lastKnownFileType = text; path = unittest_cycle.proto; sourceTree = "<group>"; };
+ F4B51B1D1BBC610700744318 /* GPBObjectiveCPlusPlusTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPBObjectiveCPlusPlusTest.mm; sourceTree = "<group>"; };
F4B6B8AF1A9CC98000892426 /* GPBUnknownField_PackagePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBUnknownField_PackagePrivate.h; sourceTree = "<group>"; };
F4B6B8B21A9CCBDA00892426 /* GPBUnknownFieldSet_PackagePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBUnknownFieldSet_PackagePrivate.h; sourceTree = "<group>"; };
F4B6B8B61A9CD1DE00892426 /* GPBExtensionInternals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBExtensionInternals.h; sourceTree = "<group>"; };
@@ -415,6 +417,7 @@
F4487C821AAF6AB300531423 /* GPBMessageTests+Merge.m */,
F4487C741AADF7F500531423 /* GPBMessageTests+Runtime.m */,
F4487C7E1AAF62CD00531423 /* GPBMessageTests+Serialization.m */,
+ F4B51B1D1BBC610700744318 /* GPBObjectiveCPlusPlusTest.mm */,
F41C175C1833D3310064ED4D /* GPBPerfTests.m */,
8BA9364418DA5F4B0056FA2A /* GPBStringTests.m */,
8B4248BA1A8C256A00BC1EC6 /* GPBSwiftTests.swift */,
@@ -668,6 +671,7 @@
8BBEA4AA147C727D00C4ADB7 /* GPBCodedOuputStreamTests.m in Sources */,
F4E675B21B21D0A70054530B /* SourceContext.pbobjc.m in Sources */,
8BBEA4AC147C727D00C4ADB7 /* GPBMessageTests.m in Sources */,
+ F4B51B1E1BBC610700744318 /* GPBObjectiveCPlusPlusTest.mm in Sources */,
F4487C7F1AAF62CD00531423 /* GPBMessageTests+Serialization.m in Sources */,
8B4248DC1A92933A00BC1EC6 /* GPBWellKnownTypesTest.m in Sources */,
F4E675B01B21D0A70054530B /* Empty.pbobjc.m in Sources */,
diff --git a/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
index 23e9f16..14e5103 100644
--- a/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
+++ b/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
@@ -66,6 +66,7 @@
F4487C851AAF6AC500531423 /* GPBMessageTests+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = F4487C841AAF6AC500531423 /* GPBMessageTests+Merge.m */; };
F45C69CC16DFD08D0081955B /* GPBExtensionInternals.m in Sources */ = {isa = PBXBuildFile; fileRef = F45C69CB16DFD08D0081955B /* GPBExtensionInternals.m */; };
F45E57C91AE6DC98000B7D99 /* text_format_map_unittest_data.txt in Resources */ = {isa = PBXBuildFile; fileRef = F45E57C81AE6DC98000B7D99 /* text_format_map_unittest_data.txt */; };
+ F4B51B1C1BBC5C7100744318 /* GPBObjectiveCPlusPlusTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4B51B1B1BBC5C7100744318 /* GPBObjectiveCPlusPlusTest.mm */; };
F4E675C81B21D1610054530B /* Any.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E675B71B21D1440054530B /* Any.pbobjc.m */; };
F4E675C91B21D1610054530B /* Api.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E675B91B21D1440054530B /* Api.pbobjc.m */; };
F4E675CA1B21D1610054530B /* Empty.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = F4E675BC1B21D1440054530B /* Empty.pbobjc.m */; };
@@ -214,6 +215,7 @@
F45C69CB16DFD08D0081955B /* GPBExtensionInternals.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBExtensionInternals.m; sourceTree = "<group>"; };
F45E57C81AE6DC98000B7D99 /* text_format_map_unittest_data.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = text_format_map_unittest_data.txt; sourceTree = "<group>"; };
F4AC9E1C1A8BEB1000BD6E83 /* unittest_cycle.proto */ = {isa = PBXFileReference; lastKnownFileType = text; path = unittest_cycle.proto; sourceTree = "<group>"; };
+ F4B51B1B1BBC5C7100744318 /* GPBObjectiveCPlusPlusTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPBObjectiveCPlusPlusTest.mm; sourceTree = "<group>"; };
F4B6B8B01A9CC99500892426 /* GPBUnknownField_PackagePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBUnknownField_PackagePrivate.h; sourceTree = "<group>"; };
F4B6B8B11A9CCBBB00892426 /* GPBUnknownFieldSet_PackagePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBUnknownFieldSet_PackagePrivate.h; sourceTree = "<group>"; };
F4B6B8B31A9CD1C600892426 /* GPBExtensionInternals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBExtensionInternals.h; sourceTree = "<group>"; };
@@ -453,6 +455,7 @@
F4487C841AAF6AC500531423 /* GPBMessageTests+Merge.m */,
F4487C761AADF84900531423 /* GPBMessageTests+Runtime.m */,
F4487C801AAF62FC00531423 /* GPBMessageTests+Serialization.m */,
+ F4B51B1B1BBC5C7100744318 /* GPBObjectiveCPlusPlusTest.mm */,
F41C175C1833D3310064ED4D /* GPBPerfTests.m */,
8BA9364418DA5F4B0056FA2A /* GPBStringTests.m */,
8B4248B31A8BD96E00BC1EC6 /* GPBSwiftTests.swift */,
@@ -770,6 +773,7 @@
F4E675CE1B21D1610054530B /* Type.pbobjc.m in Sources */,
F4353D1F1AB88243005A6198 /* GPBDescriptorTests.m in Sources */,
F4E675CF1B21D1610054530B /* Wrappers.pbobjc.m in Sources */,
+ F4B51B1C1BBC5C7100744318 /* GPBObjectiveCPlusPlusTest.mm in Sources */,
F4E675C81B21D1610054530B /* Any.pbobjc.m in Sources */,
8B4248B41A8BD96E00BC1EC6 /* GPBSwiftTests.swift in Sources */,
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */,
diff --git a/objectivec/Tests/GPBDictionaryTests+Bool.m b/objectivec/Tests/GPBDictionaryTests+Bool.m
index 43650f5..8b1900f 100644
--- a/objectivec/Tests/GPBDictionaryTests+Bool.m
+++ b/objectivec/Tests/GPBDictionaryTests+Bool.m
@@ -167,10 +167,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -468,10 +468,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -769,10 +769,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1070,10 +1070,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1371,10 +1371,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1672,10 +1672,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1973,10 +1973,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -2161,46 +2161,46 @@
GPBBoolObjectDictionary *dict = [[GPBBoolObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:YES]);
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:YES]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBBoolObjectDictionary *dict = [GPBBoolObjectDictionary dictionaryWithValue:@"abc" forKey:YES];
+ GPBBoolObjectDictionary *dict = [GPBBoolObjectDictionary dictionaryWithObject:@"abc" forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertNil([dict valueForKey:NO]);
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertNil([dict objectForKey:NO]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, YES);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
__block NSUInteger idx = 0;
BOOL *seenKeys = malloc(2 * sizeof(BOOL));
- id *seenValues = malloc(2 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(2 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 2U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -2209,18 +2209,18 @@
for (int j = 0; (j < 2) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 0) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -2231,33 +2231,33 @@
- (void)testEquality {
const BOOL kKeys1[] = { YES, NO };
const BOOL kKeys2[] = { NO, YES };
- const id kValues1[] = { @"abc", @"def" };
- const id kValues2[] = { @"def", @"abc" };
- const id kValues3[] = { @"def" };
+ const id kObjects1[] = { @"abc", @"def" };
+ const id kObjects2[] = { @"def", @"abc" };
+ const id kObjects3[] = { @"def" };
GPBBoolObjectDictionary *dict1 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBBoolObjectDictionary *dict1prime =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBBoolObjectDictionary *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBBoolObjectDictionary *dict3 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBBoolObjectDictionary *dict4 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -2266,10 +2266,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -2284,11 +2284,11 @@
- (void)testCopy {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBBoolObjectDictionary *dict2 = [dict copy];
@@ -2305,11 +2305,11 @@
- (void)testDictionaryFromDictionary {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBBoolObjectDictionary *dict2 =
@@ -2327,85 +2327,85 @@
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:YES];
+ [dict setObject:@"abc" forKey:YES];
XCTAssertEqual(dict.count, 1U);
const BOOL kKeys[] = { NO };
- const id kValues[] = { @"def" };
+ const id kObjects[] = { @"def" };
GPBBoolObjectDictionary *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
[dict2 release];
}
- (void)testRemove {
const BOOL kKeys[] = { YES, NO};
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 2U);
- [dict removeValueForKey:NO];
+ [dict removeObjectForKey:NO];
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertNil([dict valueForKey:NO]);
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertNil([dict objectForKey:NO]);
// Remove again does nothing.
- [dict removeValueForKey:NO];
+ [dict removeObjectForKey:NO];
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertNil([dict valueForKey:NO]);
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertNil([dict objectForKey:NO]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:YES]);
- XCTAssertNil([dict valueForKey:NO]);
+ XCTAssertNil([dict objectForKey:YES]);
+ XCTAssertNil([dict objectForKey:NO]);
[dict release];
}
- (void)testInplaceMutation {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
- [dict setValue:@"def" forKey:YES];
+ [dict setObject:@"def" forKey:YES];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"def");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"def");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
- [dict setValue:@"abc" forKey:NO];
+ [dict setObject:@"abc" forKey:NO];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"def");
- XCTAssertEqualObjects([dict valueForKey:NO], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"def");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"abc");
const BOOL kKeys2[] = { NO, YES };
- const id kValues2[] = { @"def", @"abc" };
+ const id kObjects2[] = { @"def", @"abc" };
GPBBoolObjectDictionary *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+Int32.m b/objectivec/Tests/GPBDictionaryTests+Int32.m
index 1ee099e..21d3f07 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int32.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int32.m
@@ -211,10 +211,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@
GPBInt32ObjectDictionary *dict = [[GPBInt32ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:11]);
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:11]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBInt32ObjectDictionary *dict = [GPBInt32ObjectDictionary dictionaryWithValue:@"abc" forKey:11];
+ GPBInt32ObjectDictionary *dict = [GPBInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 11);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const int32_t kKeys[] = { 11, 12, 13 };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertNil([dict valueForKey:14]);
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertNil([dict objectForKey:14]);
__block NSUInteger idx = 0;
int32_t *seenKeys = malloc(3 * sizeof(int32_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@
- (void)testEquality {
const int32_t kKeys1[] = { 11, 12, 13, 14 };
const int32_t kKeys2[] = { 12, 11, 14 };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict1 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBInt32ObjectDictionary *dict1prime =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBInt32ObjectDictionary *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBInt32ObjectDictionary *dict3 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBInt32ObjectDictionary *dict4 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@
- (void)testCopy {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt32ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@
- (void)testDictionaryFromDictionary {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt32ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:11];
+ [dict setObject:@"abc" forKey:11];
XCTAssertEqual(dict.count, 1U);
const int32_t kKeys[] = { 12, 13, 14 };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
[dict2 release];
}
- (void)testRemove {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:12];
+ [dict removeObjectForKey:12];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:12];
+ [dict removeObjectForKey:12];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
- [dict removeValueForKey:14];
+ [dict removeObjectForKey:14];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertNil([dict valueForKey:14]);
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertNil([dict objectForKey:14]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:11]);
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertNil([dict valueForKey:13]);
- XCTAssertNil([dict valueForKey:14]);
+ XCTAssertNil([dict objectForKey:11]);
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertNil([dict objectForKey:13]);
+ XCTAssertNil([dict objectForKey:14]);
[dict release];
}
- (void)testInplaceMutation {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
- [dict setValue:@"jkl" forKey:11];
+ [dict setObject:@"jkl" forKey:11];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
- [dict setValue:@"def" forKey:14];
+ [dict setObject:@"def" forKey:14];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"def");
+ XCTAssertEqualObjects([dict objectForKey:11], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"def");
const int32_t kKeys2[] = { 12, 13 };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBInt32ObjectDictionary *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:12], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:13], @"abc");
- XCTAssertEqualObjects([dict valueForKey:14], @"def");
+ XCTAssertEqualObjects([dict objectForKey:11], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:12], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:13], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:14], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+Int64.m b/objectivec/Tests/GPBDictionaryTests+Int64.m
index 4a94e03..27f77f2 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int64.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int64.m
@@ -211,10 +211,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@
GPBInt64ObjectDictionary *dict = [[GPBInt64ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:21LL]);
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:21LL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBInt64ObjectDictionary *dict = [GPBInt64ObjectDictionary dictionaryWithValue:@"abc" forKey:21LL];
+ GPBInt64ObjectDictionary *dict = [GPBInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 21LL);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const int64_t kKeys[] = { 21LL, 22LL, 23LL };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertNil([dict valueForKey:24LL]);
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertNil([dict objectForKey:24LL]);
__block NSUInteger idx = 0;
int64_t *seenKeys = malloc(3 * sizeof(int64_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@
- (void)testEquality {
const int64_t kKeys1[] = { 21LL, 22LL, 23LL, 24LL };
const int64_t kKeys2[] = { 22LL, 21LL, 24LL };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict1 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBInt64ObjectDictionary *dict1prime =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBInt64ObjectDictionary *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBInt64ObjectDictionary *dict3 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBInt64ObjectDictionary *dict4 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@
- (void)testCopy {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt64ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@
- (void)testDictionaryFromDictionary {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt64ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:21LL];
+ [dict setObject:@"abc" forKey:21LL];
XCTAssertEqual(dict.count, 1U);
const int64_t kKeys[] = { 22LL, 23LL, 24LL };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
[dict2 release];
}
- (void)testRemove {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:22LL];
+ [dict removeObjectForKey:22LL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:22LL];
+ [dict removeObjectForKey:22LL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
- [dict removeValueForKey:24LL];
+ [dict removeObjectForKey:24LL];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertNil([dict valueForKey:24LL]);
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertNil([dict objectForKey:24LL]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:21LL]);
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertNil([dict valueForKey:23LL]);
- XCTAssertNil([dict valueForKey:24LL]);
+ XCTAssertNil([dict objectForKey:21LL]);
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertNil([dict objectForKey:23LL]);
+ XCTAssertNil([dict objectForKey:24LL]);
[dict release];
}
- (void)testInplaceMutation {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
- [dict setValue:@"jkl" forKey:21LL];
+ [dict setObject:@"jkl" forKey:21LL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
- [dict setValue:@"def" forKey:24LL];
+ [dict setObject:@"def" forKey:24LL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"def");
const int64_t kKeys2[] = { 22LL, 23LL };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBInt64ObjectDictionary *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+String.m b/objectivec/Tests/GPBDictionaryTests+String.m
index 09fbc60..bfa10b1 100644
--- a/objectivec/Tests/GPBDictionaryTests+String.m
+++ b/objectivec/Tests/GPBDictionaryTests+String.m
@@ -211,10 +211,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt32.m b/objectivec/Tests/GPBDictionaryTests+UInt32.m
index f8d280f..c7c5765 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt32.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt32.m
@@ -211,10 +211,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@
GPBUInt32ObjectDictionary *dict = [[GPBUInt32ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:1U]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:1U]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBUInt32ObjectDictionary *dict = [GPBUInt32ObjectDictionary dictionaryWithValue:@"abc" forKey:1U];
+ GPBUInt32ObjectDictionary *dict = [GPBUInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 1U);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const uint32_t kKeys[] = { 1U, 2U, 3U };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertNil([dict valueForKey:4U]);
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertNil([dict objectForKey:4U]);
__block NSUInteger idx = 0;
uint32_t *seenKeys = malloc(3 * sizeof(uint32_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@
- (void)testEquality {
const uint32_t kKeys1[] = { 1U, 2U, 3U, 4U };
const uint32_t kKeys2[] = { 2U, 1U, 4U };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict1 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBUInt32ObjectDictionary *dict1prime =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBUInt32ObjectDictionary *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBUInt32ObjectDictionary *dict3 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBUInt32ObjectDictionary *dict4 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@
- (void)testCopy {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt32ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@
- (void)testDictionaryFromDictionary {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt32ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:1U];
+ [dict setObject:@"abc" forKey:1U];
XCTAssertEqual(dict.count, 1U);
const uint32_t kKeys[] = { 2U, 3U, 4U };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
[dict2 release];
}
- (void)testRemove {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:2U];
+ [dict removeObjectForKey:2U];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:2U];
+ [dict removeObjectForKey:2U];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
- [dict removeValueForKey:4U];
+ [dict removeObjectForKey:4U];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertNil([dict valueForKey:4U]);
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertNil([dict objectForKey:4U]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:1U]);
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertNil([dict valueForKey:3U]);
- XCTAssertNil([dict valueForKey:4U]);
+ XCTAssertNil([dict objectForKey:1U]);
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertNil([dict objectForKey:3U]);
+ XCTAssertNil([dict objectForKey:4U]);
[dict release];
}
- (void)testInplaceMutation {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
- [dict setValue:@"jkl" forKey:1U];
+ [dict setObject:@"jkl" forKey:1U];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
- [dict setValue:@"def" forKey:4U];
+ [dict setObject:@"def" forKey:4U];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"def");
const uint32_t kKeys2[] = { 2U, 3U };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBUInt32ObjectDictionary *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:2U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:3U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:4U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt64.m b/objectivec/Tests/GPBDictionaryTests+UInt64.m
index cebd6df..b64d3a9 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt64.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt64.m
@@ -211,10 +211,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@
GPBUInt64ObjectDictionary *dict = [[GPBUInt64ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:31ULL]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:31ULL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBUInt64ObjectDictionary *dict = [GPBUInt64ObjectDictionary dictionaryWithValue:@"abc" forKey:31ULL];
+ GPBUInt64ObjectDictionary *dict = [GPBUInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 31ULL);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertNil([dict valueForKey:34ULL]);
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertNil([dict objectForKey:34ULL]);
__block NSUInteger idx = 0;
uint64_t *seenKeys = malloc(3 * sizeof(uint64_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@
- (void)testEquality {
const uint64_t kKeys1[] = { 31ULL, 32ULL, 33ULL, 34ULL };
const uint64_t kKeys2[] = { 32ULL, 31ULL, 34ULL };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict1 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBUInt64ObjectDictionary *dict1prime =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBUInt64ObjectDictionary *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBUInt64ObjectDictionary *dict3 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBUInt64ObjectDictionary *dict4 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@
- (void)testCopy {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt64ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@
- (void)testDictionaryFromDictionary {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt64ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:31ULL];
+ [dict setObject:@"abc" forKey:31ULL];
XCTAssertEqual(dict.count, 1U);
const uint64_t kKeys[] = { 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
[dict2 release];
}
- (void)testRemove {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:32ULL];
+ [dict removeObjectForKey:32ULL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:32ULL];
+ [dict removeObjectForKey:32ULL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
- [dict removeValueForKey:34ULL];
+ [dict removeObjectForKey:34ULL];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertNil([dict valueForKey:34ULL]);
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertNil([dict objectForKey:34ULL]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:31ULL]);
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertNil([dict valueForKey:33ULL]);
- XCTAssertNil([dict valueForKey:34ULL]);
+ XCTAssertNil([dict objectForKey:31ULL]);
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertNil([dict objectForKey:33ULL]);
+ XCTAssertNil([dict objectForKey:34ULL]);
[dict release];
}
- (void)testInplaceMutation {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
- [dict setValue:@"jkl" forKey:31ULL];
+ [dict setObject:@"jkl" forKey:31ULL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
- [dict setValue:@"def" forKey:34ULL];
+ [dict setObject:@"def" forKey:34ULL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"def");
const uint64_t kKeys2[] = { 32ULL, 33ULL };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBUInt64ObjectDictionary *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests.pddm b/objectivec/Tests/GPBDictionaryTests.pddm
index ee26fac..ada93c6 100644
--- a/objectivec/Tests/GPBDictionaryTests.pddm
+++ b/objectivec/Tests/GPBDictionaryTests.pddm
@@ -45,12 +45,12 @@
//%TESTS_FOR_ENUM_VALUE_RAW_ADDITIONS(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4)
//%PDDM-DEFINE TESTS_FOR_POD_VALUE(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
-//%TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, , POD, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
+//%TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, , value, POD, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
//%PDDM-DEFINE TESTS_FOR_POD_KEY_OBJECT_VALUE(KEY_NAME, KEY_TYPE, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VAL1, VAL2, VAL3, VAL4)
-//%TESTS_COMMON(KEY_NAME, KEY_TYPE, , , KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, Objects, OBJECT, , VAL1, VAL2, VAL3, VAL4)
+//%TESTS_COMMON(KEY_NAME, KEY_TYPE, , , KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, Objects, object, OBJECT, , VAL1, VAL2, VAL3, VAL4)
-//%PDDM-DEFINE TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VSUFFIX, VHELPER, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
+//%PDDM-DEFINE TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VSUFFIX, VNAME, VHELPER, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@interface GPB##KEY_NAME##VALUE_NAME##DictionaryTests : XCTestCase
@@ -63,47 +63,47 @@
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 0U);
//%VALUE_NOT_FOUND##VHELPER(dict, KEY1)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue, stop)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u, stop)
//% XCTFail(@"Shouldn't get here!");
//% }];
//% [dict release];
//%}
//%
//%- (void)testOne {
-//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValue:VAL1 forKey:KEY1];
+//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VNAME$u##:VAL1 forKey:KEY1];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 1U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
//% XCTAssertEqual##KSUFFIX(aKey, KEY1);
-//% XCTAssertEqual##VSUFFIX(aValue, VAL1);
+//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
//%}
//%
//%- (void)testBasics {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 3U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY4)
//%
//% __block NSUInteger idx = 0;
//% KEY_TYPE KisP##*seenKeys = malloc(3 * sizeof(KEY_TYPE##KisP));
-//% VALUE_TYPE *seenValues = malloc(3 * sizeof(VALUE_TYPE));
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% VALUE_TYPE *seen##VNAME$u##s = malloc(3 * sizeof(VALUE_TYPE));
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
//% XCTAssertLessThan(idx, 3U);
//% seenKeys[idx] = aKey;
-//% seenValues[idx] = aValue;
+//% seen##VNAME$u##s[idx] = a##VNAME$u##;
//% XCTAssertNotEqual(stop, NULL);
//% ++idx;
//% }];
@@ -112,18 +112,18 @@
//% for (int j = 0; (j < 3) && !foundKey; ++j) {
//% if (COMPARE_KEYS##KSUFFIX(kKeys[i], seenKeys[j])) {
//% foundKey = YES;
-//% XCTAssertEqual##VSUFFIX(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+//% XCTAssertEqual##VSUFFIX(k##VNAME$u##s[i], seen##VNAME$u##s[j], @"i = %d, j = %d", i, j);
//% }
//% }
//% XCTAssertTrue(foundKey, @"i = %d", i);
//% }
//% free(seenKeys);
-//% free(seenValues);
+//% free(seen##VNAME$u##s);
//%
//% // Stopping the enumeration.
//% idx = 0;
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u)
//% if (idx == 1) *stop = YES;
//% XCTAssertNotEqual(idx, 2U);
//% ++idx;
@@ -134,33 +134,33 @@
//%- (void)testEquality {
//% const KEY_TYPE KisP##kKeys1[] = { KEY1, KEY2, KEY3, KEY4 };
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY1, KEY4 };
-//% const VALUE_TYPE kValues1[] = { VAL1, VAL2, VAL3 };
-//% const VALUE_TYPE kValues2[] = { VAL1, VAL4, VAL3 };
-//% const VALUE_TYPE kValues3[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s1[] = { VAL1, VAL2, VAL3 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL1, VAL4, VAL3 };
+//% const VALUE_TYPE k##VNAME$u##s3[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1prime =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1prime);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict3 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict3);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict4 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues3
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues3)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s3
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s3)];
//% XCTAssertNotNil(dict4);
//%
//% // 1/1Prime should be different objects, but equal.
@@ -169,10 +169,10 @@
//% // Equal, so they must have same hash.
//% XCTAssertEqual([dict1 hash], [dict1prime hash]);
//%
-//% // 2 is save keys, different values; not equal.
+//% // 2 is same keys, different ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict2);
//%
-//% // 3 is different keys, samae values; not equal.
+//% // 3 is different keys, same ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict3);
//%
//% // 4 extra pair; not equal
@@ -187,11 +187,11 @@
//%
//%- (void)testCopy {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 = [dict copy];
@@ -208,11 +208,11 @@
//%
//%- (void)testDictionaryFromDictionary {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
@@ -230,56 +230,56 @@
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
-//% [dict setValue:VAL1 forKey:KEY1];
+//% [dict set##VNAME$u##:VAL1 forKey:KEY1];
//% XCTAssertEqual(dict.count, 1U);
//%
//% const KEY_TYPE KisP##kKeys[] = { KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict2);
//% [dict add##VACCESSOR##EntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 4U);
//%
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//% [dict2 release];
//%}
//%
//%- (void)testRemove {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 4U);
//%
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 3U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
//% // Remove again does nothing.
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 3U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
-//% [dict removeValueForKey:KEY4];
+//% [dict remove##VNAME$u##ForKey:KEY4];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY4)
//%
//% [dict removeAll];
@@ -293,45 +293,45 @@
//%
//%- (void)testInplaceMutation {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 4U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
-//% [dict setValue:VAL4 forKey:KEY1];
+//% [dict set##VNAME$u##:VAL4 forKey:KEY1];
//% XCTAssertEqual(dict.count, 4U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL4)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
-//% [dict setValue:VAL2 forKey:KEY4];
+//% [dict set##VNAME$u##:VAL2 forKey:KEY4];
//% XCTAssertEqual(dict.count, 4U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL4)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL2)
//%
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY3 };
-//% const VALUE_TYPE kValues2[] = { VAL3, VAL1 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL3, VAL1 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% [dict add##VACCESSOR##EntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 4U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL4)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL2)
//%
//% [dict2 release];
//% [dict release];
@@ -466,10 +466,10 @@
//% // Equal, so they must have same hash.
//% XCTAssertEqual([dict1 hash], [dict1prime hash]);
//%
-//% // 2 is save keys, different values; not equal.
+//% // 2 is same keys, different values; not equal.
//% XCTAssertNotEqualObjects(dict1, dict2);
//%
-//% // 3 is different keys, samae values; not equal.
+//% // 3 is different keys, same values; not equal.
//% XCTAssertNotEqualObjects(dict1, dict3);
//%
//% // 4 extra pair; not equal
@@ -709,9 +709,9 @@
//%PDDM-DEFINE DECLARE_VALUE_STORAGEOBJECT(VALUE_TYPE, NAME)
// Empty
//%PDDM-DEFINE VALUE_NOT_FOUNDOBJECT(DICT, KEY)
-//% XCTAssertNil([DICT valueForKey:KEY]);
+//% XCTAssertNil([DICT objectForKey:KEY]);
//%PDDM-DEFINE TEST_VALUEOBJECT(DICT, STORAGE, KEY, VALUE)
-//% XCTAssertEqualObjects([DICT valueForKey:KEY], VALUE);
+//% XCTAssertEqualObjects([DICT objectForKey:KEY], VALUE);
//%PDDM-DEFINE COMPARE_KEYSObjects(KEY1, KEY2)
//%[KEY1 isEqual:KEY2]
@@ -768,12 +768,12 @@
//TODO(thomasvl): enum tests
//%PDDM-DEFINE BOOL_TESTS_FOR_POD_VALUE(VALUE_NAME, VALUE_TYPE, VAL1, VAL2)
-//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, , POD, VAL1, VAL2)
+//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, , value, POD, VAL1, VAL2)
//%PDDM-DEFINE TESTS_FOR_BOOL_KEY_OBJECT_VALUE(VALUE_NAME, VALUE_TYPE, VAL1, VAL2)
-//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, Objects, OBJECT, VAL1, VAL2)
+//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, Objects, object, OBJECT, VAL1, VAL2)
-//%PDDM-DEFINE BOOL_TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, VALUE_NAME, VALUE_TYPE, VSUFFIX, VHELPER, VAL1, VAL2)
+//%PDDM-DEFINE BOOL_TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, VALUE_NAME, VALUE_TYPE, VSUFFIX, VNAME, VHELPER, VAL1, VAL2)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@interface GPB##KEY_NAME##VALUE_NAME##DictionaryTests : XCTestCase
@@ -786,45 +786,45 @@
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 0U);
//%VALUE_NOT_FOUND##VHELPER(dict, KEY1)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue, stop)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u##, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u##, stop)
//% XCTFail(@"Shouldn't get here!");
//% }];
//% [dict release];
//%}
//%
//%- (void)testOne {
-//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValue:VAL1 forKey:KEY1];
+//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VNAME$u##:VAL1 forKey:KEY1];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 1U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
//% XCTAssertEqual##KSUFFIX(aKey, KEY1);
-//% XCTAssertEqual##VSUFFIX(aValue, VAL1);
+//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
//%}
//%
//%- (void)testBasics {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 2U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
//% __block NSUInteger idx = 0;
//% KEY_TYPE KisP##*seenKeys = malloc(2 * sizeof(KEY_TYPE##KisP));
-//% VALUE_TYPE *seenValues = malloc(2 * sizeof(VALUE_TYPE));
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% VALUE_TYPE *seen##VNAME$u##s = malloc(2 * sizeof(VALUE_TYPE));
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u##, BOOL *stop) {
//% XCTAssertLessThan(idx, 2U);
//% seenKeys[idx] = aKey;
-//% seenValues[idx] = aValue;
+//% seen##VNAME$u##s[idx] = a##VNAME$u;
//% XCTAssertNotEqual(stop, NULL);
//% ++idx;
//% }];
@@ -833,18 +833,18 @@
//% for (int j = 0; (j < 2) && !foundKey; ++j) {
//% if (COMPARE_KEYS##KSUFFIX(kKeys[i], seenKeys[j])) {
//% foundKey = YES;
-//% XCTAssertEqual##VSUFFIX(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+//% XCTAssertEqual##VSUFFIX(k##VNAME$u##s[i], seen##VNAME$u##s[j], @"i = %d, j = %d", i, j);
//% }
//% }
//% XCTAssertTrue(foundKey, @"i = %d", i);
//% }
//% free(seenKeys);
-//% free(seenValues);
+//% free(seen##VNAME$u##s);
//%
//% // Stopping the enumeration.
//% idx = 0;
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u##, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u)
//% if (idx == 0) *stop = YES;
//% XCTAssertNotEqual(idx, 2U);
//% ++idx;
@@ -855,33 +855,33 @@
//%- (void)testEquality {
//% const KEY_TYPE KisP##kKeys1[] = { KEY1, KEY2 };
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY1 };
-//% const VALUE_TYPE kValues1[] = { VAL1, VAL2 };
-//% const VALUE_TYPE kValues2[] = { VAL2, VAL1 };
-//% const VALUE_TYPE kValues3[] = { VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s1[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL2, VAL1 };
+//% const VALUE_TYPE k##VNAME$u##s3[] = { VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1prime =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1prime);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict3 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict3);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict4 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues3
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues3)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s3
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s3)];
//% XCTAssertNotNil(dict4);
//%
//% // 1/1Prime should be different objects, but equal.
@@ -890,10 +890,10 @@
//% // Equal, so they must have same hash.
//% XCTAssertEqual([dict1 hash], [dict1prime hash]);
//%
-//% // 2 is save keys, different values; not equal.
+//% // 2 is same keys, different ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict2);
//%
-//% // 3 is different keys, samae values; not equal.
+//% // 3 is different keys, same ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict3);
//%
//% // 4 Fewer pairs; not equal
@@ -908,11 +908,11 @@
//%
//%- (void)testCopy {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 = [dict copy];
@@ -929,11 +929,11 @@
//%
//%- (void)testDictionaryFromDictionary {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
@@ -951,43 +951,43 @@
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
-//% [dict setValue:VAL1 forKey:KEY1];
+//% [dict set##VNAME$u:VAL1 forKey:KEY1];
//% XCTAssertEqual(dict.count, 1U);
//%
//% const KEY_TYPE KisP##kKeys[] = { KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict2);
//% [dict addEntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 2U);
//%
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//% [dict2 release];
//%}
//%
//%- (void)testRemove {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2};
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 2U);
//%
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 1U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
//%
//% // Remove again does nothing.
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 1U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
//%
//% [dict removeAll];
@@ -999,37 +999,37 @@
//%
//%- (void)testInplaceMutation {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 2U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
-//% [dict setValue:VAL2 forKey:KEY1];
+//% [dict set##VNAME$u##:VAL2 forKey:KEY1];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
-//% [dict setValue:VAL1 forKey:KEY2];
+//% [dict set##VNAME$u##:VAL1 forKey:KEY2];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL1)
//%
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY1 };
-//% const VALUE_TYPE kValues2[] = { VAL2, VAL1 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL2, VAL1 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% [dict addEntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
//% [dict2 release];
//% [dict release];
diff --git a/objectivec/Tests/GPBMessageTests+Merge.m b/objectivec/Tests/GPBMessageTests+Merge.m
index 3b6fdbd..a3908aa 100644
--- a/objectivec/Tests/GPBMessageTests+Merge.m
+++ b/objectivec/Tests/GPBMessageTests+Merge.m
@@ -676,20 +676,21 @@
TestAllTypes *subMsg = [TestAllTypes message];
subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:100];
msg1.mapInt32Message = [GPBInt32ObjectDictionary dictionary];
- [msg1.mapInt32Message setValue:subMsg forKey:0];
+ [msg1.mapInt32Message setObject:subMsg forKey:0];
subMsg = nil;
subMsg = [TestAllTypes message];
subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:101];
msg2.mapInt32Message = [GPBInt32ObjectDictionary dictionary];
- [msg2.mapInt32Message setValue:subMsg forKey:0];
+
+ [msg2.mapInt32Message setObject:subMsg forKey:0];
subMsg = nil;
[msg1 mergeFrom:msg2];
// Checks repeated field is overwritten.
XCTAssertEqual(msg1.mapInt32Message.count, 1U);
- subMsg = [msg1.mapInt32Message valueForKey:0];
+ subMsg = [msg1.mapInt32Message objectForKey:0];
XCTAssertNotNil(subMsg);
XCTAssertEqual(subMsg.repeatedInt32Array.count, 1U);
XCTAssertEqual([subMsg.repeatedInt32Array valueAtIndex:0], 101);
diff --git a/objectivec/Tests/GPBMessageTests+Runtime.m b/objectivec/Tests/GPBMessageTests+Runtime.m
index 8942a84..e536bfe 100644
--- a/objectivec/Tests/GPBMessageTests+Runtime.m
+++ b/objectivec/Tests/GPBMessageTests+Runtime.m
@@ -2059,9 +2059,9 @@
// Ensure the messages are unique per map.
[msg1.mapInt32ForeignMessage
- enumerateKeysAndValuesUsingBlock:^(int32_t key, id value, BOOL *stop) {
+ enumerateKeysAndObjectsUsingBlock:^(int32_t key, id value, BOOL *stop) {
#pragma unused(stop)
- ForeignMessage *subMsg2 = [msg2.mapInt32ForeignMessage valueForKey:key];
+ ForeignMessage *subMsg2 = [msg2.mapInt32ForeignMessage objectForKey:key];
XCTAssertNotEqual(value, subMsg2); // Ptr compare, new object.
}];
}
@@ -2075,7 +2075,7 @@
// Add an uninitialized message.
TestRequired *subMsg = [[TestRequired alloc] init];
msg.mapField = [GPBInt32ObjectDictionary dictionary];
- [msg.mapField setValue:subMsg forKey:0];
+ [msg.mapField setObject:subMsg forKey:0];
XCTAssertFalse(msg.initialized);
// Initialize uninitialized message
diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m
index ae4be9e..4dcca7a 100644
--- a/objectivec/Tests/GPBMessageTests+Serialization.m
+++ b/objectivec/Tests/GPBMessageTests+Serialization.m
@@ -994,16 +994,16 @@
val2.optionalInt32 = 129;
[msg.mapStringMessage setValue:val1 forKey:@"228"];
[msg.mapStringMessage setValue:val2 forKey:@"2029"];
- [msg.mapInt32Bytes setValue:DataFromCStr("1030 bytes") forKey:230];
- [msg.mapInt32Bytes setValue:DataFromCStr("131") forKey:2031];
+ [msg.mapInt32Bytes setObject:DataFromCStr("1030 bytes") forKey:230];
+ [msg.mapInt32Bytes setObject:DataFromCStr("131") forKey:2031];
[msg.mapInt32Enum setValue:Message2_Enum_Bar forKey:232];
[msg.mapInt32Enum setValue:Message2_Enum_Baz forKey:2033];
Message2 *val3 = [[Message2 alloc] init];
val3.optionalInt32 = 1034;
Message2 *val4 = [[Message2 alloc] init];
val4.optionalInt32 = 135;
- [msg.mapInt32Message setValue:val3 forKey:234];
- [msg.mapInt32Message setValue:val4 forKey:2035];
+ [msg.mapInt32Message setObject:val3 forKey:234];
+ [msg.mapInt32Message setObject:val4 forKey:2035];
NSData *data = [msg data];
Message2 *msg2 = [[Message2 alloc] initWithData:data error:NULL];
diff --git a/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm b/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm
new file mode 100644
index 0000000..9ba8fd0
--- /dev/null
+++ b/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm
@@ -0,0 +1,69 @@
+// 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.
+
+
+#import "GPBTestUtilities.h"
+
+
+//
+// This is just a compile test (here to make sure things never regress).
+//
+// Objective C++ can run into issues with how the NS_ENUM/CF_ENUM declartion
+// works because of the C++ spec being used for that compilation unit. So
+// the fact that these imports all work without errors/warning means things
+// are still good.
+//
+// The "well know types" should have cross file enums needing imports.
+#import "GPBProtocolBuffers.h"
+// Some of the tests explicitly use cross file enums also.
+#import "google/protobuf/Unittest.pbobjc.h"
+#import "google/protobuf/UnittestImport.pbobjc.h"
+
+// Sanity check the conditions of the test within the Xcode project.
+#if !__cplusplus
+ #error This isn't compiled as Objective C++?
+#elif __cplusplus >= 201103L
+ // If this trips, it means the Xcode default might have change (or someone
+ // edited the testing project) and it might be time to revisit the GPB_ENUM
+ // define in GPBBootstrap.h.
+ #warning Did the Xcode default for C++ spec change?
+#endif
+
+
+// Dummy XCTest.
+@interface GPBObjectiveCPlusPlusTests : GPBTestCase
+@end
+
+@implementation GPBObjectiveCPlusPlusTests
+- (void)testCPlusPlus {
+ // Nothing, This was a compile test.
+ XCTAssertTrue(YES);
+}
+@end
diff --git a/objectivec/Tests/GPBTestUtilities.m b/objectivec/Tests/GPBTestUtilities.m
index 3d85c74..726761a 100644
--- a/objectivec/Tests/GPBTestUtilities.m
+++ b/objectivec/Tests/GPBTestUtilities.m
@@ -1110,7 +1110,7 @@
[dataStr release];
NSData *data = [[NSData alloc] initWithUint32_gpbtu:i + 1];
- [message.mapInt32Bytes setValue:data forKey:113 + i * 100];
+ [message.mapInt32Bytes setObject:data forKey:113 + i * 100];
[data release];
[message.mapInt32Enum
@@ -1119,7 +1119,7 @@
ForeignMessage *subMsg = [[ForeignMessage alloc] init];
subMsg.c = i + 1;
- [message.mapInt32ForeignMessage setValue:subMsg forKey:115 + i * 100];
+ [message.mapInt32ForeignMessage setObject:subMsg forKey:115 + i * 100];
[subMsg release];
}
}
diff --git a/objectivec/Tests/GPBWireFormatTests.m b/objectivec/Tests/GPBWireFormatTests.m
index c124421..3fab20b 100644
--- a/objectivec/Tests/GPBWireFormatTests.m
+++ b/objectivec/Tests/GPBWireFormatTests.m
@@ -167,12 +167,12 @@
XCTAssertEqual([raw.itemArray[2] typeId], kUnknownTypeId);
TestMessageSetExtension1* message1 =
- [TestMessageSetExtension1 parseFromData:[raw.itemArray[0] message]
+ [TestMessageSetExtension1 parseFromData:[((RawMessageSet_Item*)raw.itemArray[0]) message]
error:NULL];
XCTAssertEqual(message1.i, 123);
TestMessageSetExtension2* message2 =
- [TestMessageSetExtension2 parseFromData:[raw.itemArray[1] message]
+ [TestMessageSetExtension2 parseFromData:[((RawMessageSet_Item*)raw.itemArray[1]) message]
error:NULL];
XCTAssertEqualObjects(message2.str, @"foo");
diff --git a/objectivec/google/protobuf/Descriptor.pbobjc.h b/objectivec/google/protobuf/Descriptor.pbobjc.h
index 2a86a7e..70cb744 100644
--- a/objectivec/google/protobuf/Descriptor.pbobjc.h
+++ b/objectivec/google/protobuf/Descriptor.pbobjc.h
@@ -344,6 +344,7 @@
GPBFieldDescriptorProto_FieldNumber_DefaultValue = 7,
GPBFieldDescriptorProto_FieldNumber_Options = 8,
GPBFieldDescriptorProto_FieldNumber_OneofIndex = 9,
+ GPBFieldDescriptorProto_FieldNumber_JsonName = 10,
};
// Describes a field within a message.
@@ -389,6 +390,13 @@
@property(nonatomic, readwrite) BOOL hasOneofIndex;
@property(nonatomic, readwrite) int32_t oneofIndex;
+// JSON name of this field. The value is set by protocol compiler. If the
+// user has set a "json_name" option on this field, that option's value
+// will be used. Otherwise, it's deduced from the field's name by converting
+// it to camelCase.
+@property(nonatomic, readwrite) BOOL hasJsonName;
+@property(nonatomic, readwrite, copy, null_resettable) NSString *jsonName;
+
@property(nonatomic, readwrite) BOOL hasOptions;
@property(nonatomic, readwrite, strong, null_resettable) GPBFieldOptions *options;
diff --git a/objectivec/google/protobuf/Descriptor.pbobjc.m b/objectivec/google/protobuf/Descriptor.pbobjc.m
index 8d69867..e3e44c4 100644
--- a/objectivec/google/protobuf/Descriptor.pbobjc.m
+++ b/objectivec/google/protobuf/Descriptor.pbobjc.m
@@ -578,6 +578,7 @@
@dynamic hasExtendee, extendee;
@dynamic hasDefaultValue, defaultValue;
@dynamic hasOneofIndex, oneofIndex;
+@dynamic hasJsonName, jsonName;
@dynamic hasOptions, options;
typedef struct GPBFieldDescriptorProto__storage_ {
@@ -591,6 +592,7 @@
NSString *typeName;
NSString *defaultValue;
GPBFieldOptions *options;
+ NSString *jsonName;
} GPBFieldDescriptorProto__storage_;
// This method is threadsafe because it is initially called
@@ -679,7 +681,7 @@
{
.name = "options",
.number = GPBFieldDescriptorProto_FieldNumber_Options,
- .hasIndex = 8,
+ .hasIndex = 9,
.flags = GPBFieldOptional,
.dataType = GPBDataTypeMessage,
.offset = offsetof(GPBFieldDescriptorProto__storage_, options),
@@ -698,6 +700,17 @@
.dataTypeSpecific.className = NULL,
.fieldOptions = NULL,
},
+ {
+ .name = "jsonName",
+ .number = GPBFieldDescriptorProto_FieldNumber_JsonName,
+ .hasIndex = 8,
+ .flags = GPBFieldOptional,
+ .dataType = GPBDataTypeString,
+ .offset = offsetof(GPBFieldDescriptorProto__storage_, jsonName),
+ .defaultValue.valueString = nil,
+ .dataTypeSpecific.className = NULL,
+ .fieldOptions = NULL,
+ },
};
static GPBMessageEnumDescription enums[] = {
{ .enumDescriptorFunc = GPBFieldDescriptorProto_Type_EnumDescriptor },
diff --git a/protobuf.bzl b/protobuf.bzl
new file mode 100644
index 0000000..79dabd0
--- /dev/null
+++ b/protobuf.bzl
@@ -0,0 +1,127 @@
+# -*- mode: python; -*- PYTHON-PREPROCESSING-REQUIRED
+
+def _gen_dir(ctx):
+ if not ctx.attr.include:
+ return ctx.label.package
+ if not ctx.label.package:
+ return ctx.attr.include
+ return ctx.label.package + '/' + ctx.attr.include
+
+def _cc_outs(srcs):
+ return [s[:-len(".proto")] + ".pb.h" for s in srcs] + \
+ [s[:-len(".proto")] + ".pb.cc" for s in srcs]
+
+def _py_outs(srcs):
+ return [s[:-len(".proto")] + "_pb2.py" for s in srcs]
+
+def _proto_gen_impl(ctx):
+ """General implementation for generating protos"""
+ srcs = ctx.files.srcs
+ deps = []
+ deps += ctx.files.srcs
+ gen_dir = _gen_dir(ctx)
+ import_flags = ["-I" + gen_dir]
+ for dep in ctx.attr.deps:
+ import_flags += dep.proto.import_flags
+ deps += dep.proto.deps
+
+ args = []
+ if ctx.attr.gen_cc:
+ args += ["--cpp_out=" + ctx.var["GENDIR"] + "/" + gen_dir]
+ if ctx.attr.gen_py:
+ args += ["--python_out=" + ctx.var["GENDIR"] + "/" + gen_dir]
+
+ if args:
+ ctx.action(
+ inputs=srcs + deps,
+ outputs=ctx.outputs.outs,
+ arguments=args + import_flags + [s.path for s in srcs],
+ executable=ctx.executable.protoc,
+ )
+
+ return struct(
+ proto=struct(
+ srcs=srcs,
+ import_flags=import_flags,
+ deps=deps,
+ ),
+ )
+
+_proto_gen = rule(
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ "deps": attr.label_list(providers = ["proto"]),
+ "include": attr.string(),
+ "protoc": attr.label(
+ executable = True,
+ single_file = True,
+ mandatory = True,
+ ),
+ "gen_cc": attr.bool(),
+ "gen_py": attr.bool(),
+ "outs": attr.output_list(),
+ },
+ output_to_genfiles = True,
+ implementation = _proto_gen_impl,
+)
+
+def cc_proto_library(
+ name,
+ srcs=[],
+ deps=[],
+ cc_libs=[],
+ include="",
+ protoc=":protoc",
+ internal_bootstrap_hack=False,
+ **kargs):
+ """Bazel rule to create a C++ protobuf library from proto source files
+
+ Args:
+ name: the name of the cc_proto_library.
+ srcs: the .proto files of the cc_proto_library.
+ deps: a list of dependency labels; must be cc_proto_library.
+ cc_libs: a list of other cc_library targets depended by the generated
+ cc_library.
+ include: a string indicating the include path of the .proto files.
+ protoc: the label of the protocol compiler to generate the sources.
+ internal_bootstrap_hack: a flag indicate the cc_proto_library is used only
+ for bootstraping. When it is set to True, no files will be generated.
+ The rule will simply be a provider for .proto files, so that other
+ cc_proto_library can depend on it.
+ **kargs: other keyword arguments that are passed to cc_library.
+
+ """
+
+ if internal_bootstrap_hack:
+ # For pre-checked-in generated files, we add the internal_bootstrap_hack
+ # which will skip the codegen action.
+ _proto_gen(
+ name=name + "_genproto",
+ srcs=srcs,
+ deps=[s + "_genproto" for s in deps],
+ include=include,
+ protoc=protoc,
+ )
+ # An empty cc_library to make rule dependency consistent.
+ native.cc_library(
+ name=name,
+ **kargs)
+ return
+
+ outs = _cc_outs(srcs)
+ _proto_gen(
+ name=name + "_genproto",
+ srcs=srcs,
+ deps=[s + "_genproto" for s in deps],
+ include=include,
+ protoc=protoc,
+ gen_cc=1,
+ outs=outs,
+ )
+
+ native.cc_library(
+ name=name,
+ srcs=outs,
+ deps=cc_libs + deps,
+ includes=[include],
+ **kargs)
diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py
index 95b703f..2bf3653 100755
--- a/python/google/protobuf/descriptor.py
+++ b/python/google/protobuf/descriptor.py
@@ -28,8 +28,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2007 Google Inc. All Rights Reserved.
-
"""Descriptors essentially contain exactly the information found in a .proto
file, in types that make this information accessible in Python.
"""
@@ -40,7 +38,6 @@
from google.protobuf.internal import api_implementation
-
_USE_C_DESCRIPTORS = False
if api_implementation.Type() == 'cpp':
# Used by MakeDescriptor in cpp mode
@@ -221,6 +218,9 @@
fields_by_name: (dict str -> FieldDescriptor) Same FieldDescriptor
objects as in |fields|, but indexed by "name" attribute in each
FieldDescriptor.
+ fields_by_camelcase_name: (dict str -> FieldDescriptor) Same
+ FieldDescriptor objects as in |fields|, but indexed by
+ "camelcase_name" attribute in each FieldDescriptor.
nested_types: (list of Descriptors) Descriptor references
for all protocol message types nested within this one.
@@ -292,6 +292,7 @@
field.containing_type = self
self.fields_by_number = dict((f.number, f) for f in fields)
self.fields_by_name = dict((f.name, f) for f in fields)
+ self._fields_by_camelcase_name = None
self.nested_types = nested_types
for nested_type in nested_types:
@@ -317,6 +318,13 @@
oneof.containing_type = self
self.syntax = syntax or "proto2"
+ @property
+ def fields_by_camelcase_name(self):
+ if self._fields_by_camelcase_name is None:
+ self._fields_by_camelcase_name = dict(
+ (f.camelcase_name, f) for f in self.fields)
+ return self._fields_by_camelcase_name
+
def EnumValueName(self, enum, value):
"""Returns the string name of an enum value.
@@ -365,6 +373,7 @@
name: (str) Name of this field, exactly as it appears in .proto.
full_name: (str) Name of this field, including containing scope. This is
particularly relevant for extensions.
+ camelcase_name: (str) Camelcase name of this field.
index: (int) Dense, 0-indexed index giving the order that this
field textually appears within its message in the .proto file.
number: (int) Tag number declared for this field in the .proto file.
@@ -509,6 +518,7 @@
super(FieldDescriptor, self).__init__(options, 'FieldOptions')
self.name = name
self.full_name = full_name
+ self._camelcase_name = None
self.index = index
self.number = number
self.type = type
@@ -530,6 +540,12 @@
else:
self._cdescriptor = None
+ @property
+ def camelcase_name(self):
+ if self._camelcase_name is None:
+ self._camelcase_name = _ToCamelCase(self.name)
+ return self._camelcase_name
+
@staticmethod
def ProtoTypeToCppProtoType(proto_type):
"""Converts from a Python proto type to a C++ Proto Type.
@@ -822,6 +838,27 @@
return message
+def _ToCamelCase(name):
+ """Converts name to camel-case and returns it."""
+ capitalize_next = False
+ result = []
+
+ for c in name:
+ if c == '_':
+ if result:
+ capitalize_next = True
+ elif capitalize_next:
+ result.append(c.upper())
+ capitalize_next = False
+ else:
+ result += c
+
+ # Lower-case the first letter.
+ if result and result[0].isupper():
+ result[0] = result[0].lower()
+ return ''.join(result)
+
+
def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True,
syntax=None):
"""Make a protobuf Descriptor given a DescriptorProto protobuf.
diff --git a/python/google/protobuf/internal/decoder.py b/python/google/protobuf/internal/decoder.py
index 4fd7a86..31869e4 100755
--- a/python/google/protobuf/internal/decoder.py
+++ b/python/google/protobuf/internal/decoder.py
@@ -28,8 +28,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2009 Google Inc. All Rights Reserved.
-
"""Code for decoding protocol buffer primitives.
This code is very similar to encoder.py -- read the docs for that module first.
diff --git a/python/google/protobuf/internal/descriptor_pool_test.py b/python/google/protobuf/internal/descriptor_pool_test.py
index 2a482fb..da9a78d 100644
--- a/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/python/google/protobuf/internal/descriptor_pool_test.py
@@ -35,11 +35,11 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
import os
+
try:
import unittest2 as unittest
except ImportError:
import unittest
-
from google.protobuf import unittest_pb2
from google.protobuf import descriptor_pb2
from google.protobuf.internal import api_implementation
@@ -47,6 +47,7 @@
from google.protobuf.internal import descriptor_pool_test2_pb2
from google.protobuf.internal import factory_test1_pb2
from google.protobuf.internal import factory_test2_pb2
+from google.protobuf.internal import test_util
from google.protobuf import descriptor
from google.protobuf import descriptor_database
from google.protobuf import descriptor_pool
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py
index 34843a6..99afee6 100755
--- a/python/google/protobuf/internal/descriptor_test.py
+++ b/python/google/protobuf/internal/descriptor_test.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
@@ -36,20 +36,20 @@
import sys
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_custom_options_pb2
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_pb2
from google.protobuf import descriptor_pb2
from google.protobuf.internal import api_implementation
+from google.protobuf.internal import test_util
from google.protobuf import descriptor
from google.protobuf import symbol_database
from google.protobuf import text_format
-try:
- import unittest2 as unittest
-except ImportError:
- import unittest
-
TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII = """
name: 'TestEmptyMessage'
@@ -425,10 +425,12 @@
self.CheckDescriptorSequence(message_descriptor.fields)
self.CheckDescriptorMapping(message_descriptor.fields_by_name)
self.CheckDescriptorMapping(message_descriptor.fields_by_number)
+ self.CheckDescriptorMapping(message_descriptor.fields_by_camelcase_name)
def CheckFieldDescriptor(self, field_descriptor):
# Basic properties
self.assertEqual(field_descriptor.name, 'optional_int32')
+ self.assertEqual(field_descriptor.camelcase_name, 'optionalInt32')
self.assertEqual(field_descriptor.full_name,
'protobuf_unittest.TestAllTypes.optional_int32')
self.assertEqual(field_descriptor.containing_type.name, 'TestAllTypes')
@@ -437,6 +439,10 @@
self.assertEqual(
field_descriptor.containing_type.fields_by_name['optional_int32'],
field_descriptor)
+ self.assertEqual(
+ field_descriptor.containing_type.fields_by_camelcase_name[
+ 'optionalInt32'],
+ field_descriptor)
self.assertIn(field_descriptor, [field_descriptor])
self.assertIn(field_descriptor, {field_descriptor: None})
@@ -481,6 +487,9 @@
self.CheckMessageDescriptor(message_descriptor)
field_descriptor = message_descriptor.fields_by_name['optional_int32']
self.CheckFieldDescriptor(field_descriptor)
+ field_descriptor = message_descriptor.fields_by_camelcase_name[
+ 'optionalInt32']
+ self.CheckFieldDescriptor(field_descriptor)
def testCppDescriptorContainer(self):
# Check that the collection is still valid even if the parent disappeared.
@@ -779,5 +788,20 @@
self.assertEqual(101,
options.Extensions[unittest_custom_options_pb2.msgopt].i)
+ def testCamelcaseName(self):
+ descriptor_proto = descriptor_pb2.DescriptorProto()
+ descriptor_proto.name = 'Bar'
+ names = ['foo_foo', 'FooBar', 'fooBaz', 'fooFoo', 'foobar']
+ camelcase_names = ['fooFoo', 'fooBar', 'fooBaz', 'fooFoo', 'foobar']
+ for index in range(len(names)):
+ field = descriptor_proto.field.add()
+ field.number = index + 1
+ field.name = names[index]
+ result = descriptor.MakeDescriptor(descriptor_proto)
+ for index in range(len(camelcase_names)):
+ self.assertEqual(result.fields[index].camelcase_name,
+ camelcase_names[index])
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/python/google/protobuf/internal/encoder.py b/python/google/protobuf/internal/encoder.py
index d72cd29..48ef2df 100755
--- a/python/google/protobuf/internal/encoder.py
+++ b/python/google/protobuf/internal/encoder.py
@@ -28,8 +28,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2009 Google Inc. All Rights Reserved.
-
"""Code for encoding protocol message primitives.
Contains the logic for encoding every logical protocol field type
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
new file mode 100644
index 0000000..4e2f35e
--- /dev/null
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -0,0 +1,525 @@
+#! /usr/bin/env python
+#
+# 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.
+
+"""Test for google.protobuf.json_format."""
+
+__author__ = 'jieluo@google.com (Jie Luo)'
+
+import json
+import math
+import sys
+
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+from google.protobuf import json_format
+from google.protobuf.util import json_format_proto3_pb2
+
+
+class JsonFormatBase(unittest.TestCase):
+
+ def FillAllFields(self, message):
+ message.int32_value = 20
+ message.int64_value = -20
+ message.uint32_value = 3120987654
+ message.uint64_value = 12345678900
+ message.float_value = float('-inf')
+ message.double_value = 3.1415
+ message.bool_value = True
+ message.string_value = 'foo'
+ message.bytes_value = b'bar'
+ message.message_value.value = 10
+ message.enum_value = json_format_proto3_pb2.BAR
+ # Repeated
+ message.repeated_int32_value.append(0x7FFFFFFF)
+ message.repeated_int32_value.append(-2147483648)
+ message.repeated_int64_value.append(9007199254740992)
+ message.repeated_int64_value.append(-9007199254740992)
+ message.repeated_uint32_value.append(0xFFFFFFF)
+ message.repeated_uint32_value.append(0x7FFFFFF)
+ message.repeated_uint64_value.append(9007199254740992)
+ message.repeated_uint64_value.append(9007199254740991)
+ message.repeated_float_value.append(0)
+
+ message.repeated_double_value.append(1E-15)
+ message.repeated_double_value.append(float('inf'))
+ message.repeated_bool_value.append(True)
+ message.repeated_bool_value.append(False)
+ message.repeated_string_value.append('Few symbols!#$,;')
+ message.repeated_string_value.append('bar')
+ message.repeated_bytes_value.append(b'foo')
+ message.repeated_bytes_value.append(b'bar')
+ message.repeated_message_value.add().value = 10
+ message.repeated_message_value.add().value = 11
+ message.repeated_enum_value.append(json_format_proto3_pb2.FOO)
+ message.repeated_enum_value.append(json_format_proto3_pb2.BAR)
+ self.message = message
+
+ def CheckParseBack(self, message, parsed_message):
+ json_format.Parse(json_format.MessageToJson(message),
+ parsed_message)
+ self.assertEqual(message, parsed_message)
+
+ def CheckError(self, text, error_message):
+ message = json_format_proto3_pb2.TestMessage()
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ error_message,
+ json_format.Parse, text, message)
+
+
+class JsonFormatTest(JsonFormatBase):
+
+ def testEmptyMessageToJson(self):
+ message = json_format_proto3_pb2.TestMessage()
+ self.assertEqual(json_format.MessageToJson(message),
+ '{}')
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ self.CheckParseBack(message, parsed_message)
+
+ def testPartialMessageToJson(self):
+ message = json_format_proto3_pb2.TestMessage(
+ string_value='test',
+ repeated_int32_value=[89, 4])
+ self.assertEqual(json.loads(json_format.MessageToJson(message)),
+ json.loads('{"stringValue": "test", '
+ '"repeatedInt32Value": [89, 4]}'))
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ self.CheckParseBack(message, parsed_message)
+
+ def testAllFieldsToJson(self):
+ message = json_format_proto3_pb2.TestMessage()
+ text = ('{"int32Value": 20, '
+ '"int64Value": "-20", '
+ '"uint32Value": 3120987654,'
+ '"uint64Value": "12345678900",'
+ '"floatValue": "-Infinity",'
+ '"doubleValue": 3.1415,'
+ '"boolValue": true,'
+ '"stringValue": "foo",'
+ '"bytesValue": "YmFy",'
+ '"messageValue": {"value": 10},'
+ '"enumValue": "BAR",'
+ '"repeatedInt32Value": [2147483647, -2147483648],'
+ '"repeatedInt64Value": ["9007199254740992", "-9007199254740992"],'
+ '"repeatedUint32Value": [268435455, 134217727],'
+ '"repeatedUint64Value": ["9007199254740992", "9007199254740991"],'
+ '"repeatedFloatValue": [0],'
+ '"repeatedDoubleValue": [1e-15, "Infinity"],'
+ '"repeatedBoolValue": [true, false],'
+ '"repeatedStringValue": ["Few symbols!#$,;", "bar"],'
+ '"repeatedBytesValue": ["Zm9v", "YmFy"],'
+ '"repeatedMessageValue": [{"value": 10}, {"value": 11}],'
+ '"repeatedEnumValue": ["FOO", "BAR"]'
+ '}')
+ self.FillAllFields(message)
+ self.assertEqual(
+ json.loads(json_format.MessageToJson(message)),
+ json.loads(text))
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ json_format.Parse(text, parsed_message)
+ self.assertEqual(message, parsed_message)
+
+ def testJsonEscapeString(self):
+ message = json_format_proto3_pb2.TestMessage()
+ if sys.version_info[0] < 3:
+ message.string_value = '&\n<\"\r>\b\t\f\\\001/\xe2\x80\xa8\xe2\x80\xa9'
+ else:
+ message.string_value = '&\n<\"\r>\b\t\f\\\001/'
+ message.string_value += (b'\xe2\x80\xa8\xe2\x80\xa9').decode('utf-8')
+ self.assertEqual(
+ json_format.MessageToJson(message),
+ '{\n "stringValue": '
+ '"&\\n<\\\"\\r>\\b\\t\\f\\\\\\u0001/\\u2028\\u2029"\n}')
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ self.CheckParseBack(message, parsed_message)
+ text = u'{"int32Value": "\u0031"}'
+ json_format.Parse(text, message)
+ self.assertEqual(message.int32_value, 1)
+
+ def testAlwaysSeriliaze(self):
+ message = json_format_proto3_pb2.TestMessage(
+ string_value='foo')
+ self.assertEqual(
+ json.loads(json_format.MessageToJson(message, True)),
+ json.loads('{'
+ '"repeatedStringValue": [],'
+ '"stringValue": "foo",'
+ '"repeatedBoolValue": [],'
+ '"repeatedUint32Value": [],'
+ '"repeatedInt32Value": [],'
+ '"enumValue": "FOO",'
+ '"int32Value": 0,'
+ '"floatValue": 0,'
+ '"int64Value": "0",'
+ '"uint32Value": 0,'
+ '"repeatedBytesValue": [],'
+ '"repeatedUint64Value": [],'
+ '"repeatedDoubleValue": [],'
+ '"bytesValue": "",'
+ '"boolValue": false,'
+ '"repeatedEnumValue": [],'
+ '"uint64Value": "0",'
+ '"doubleValue": 0,'
+ '"repeatedFloatValue": [],'
+ '"repeatedInt64Value": [],'
+ '"repeatedMessageValue": []}'))
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ self.CheckParseBack(message, parsed_message)
+
+ def testMapFields(self):
+ message = json_format_proto3_pb2.TestMap()
+ message.bool_map[True] = 1
+ message.bool_map[False] = 2
+ message.int32_map[1] = 2
+ message.int32_map[2] = 3
+ message.int64_map[1] = 2
+ message.int64_map[2] = 3
+ message.uint32_map[1] = 2
+ message.uint32_map[2] = 3
+ message.uint64_map[1] = 2
+ message.uint64_map[2] = 3
+ message.string_map['1'] = 2
+ message.string_map['null'] = 3
+ self.assertEqual(
+ json.loads(json_format.MessageToJson(message, True)),
+ json.loads('{'
+ '"boolMap": {"false": 2, "true": 1},'
+ '"int32Map": {"1": 2, "2": 3},'
+ '"int64Map": {"1": 2, "2": 3},'
+ '"uint32Map": {"1": 2, "2": 3},'
+ '"uint64Map": {"1": 2, "2": 3},'
+ '"stringMap": {"1": 2, "null": 3}'
+ '}'))
+ parsed_message = json_format_proto3_pb2.TestMap()
+ self.CheckParseBack(message, parsed_message)
+
+ def testOneofFields(self):
+ message = json_format_proto3_pb2.TestOneof()
+ # Always print does not affect oneof fields.
+ self.assertEqual(
+ json_format.MessageToJson(message, True),
+ '{}')
+ message.oneof_int32_value = 0
+ self.assertEqual(
+ json_format.MessageToJson(message, True),
+ '{\n'
+ ' "oneofInt32Value": 0\n'
+ '}')
+ parsed_message = json_format_proto3_pb2.TestOneof()
+ self.CheckParseBack(message, parsed_message)
+
+ def testTimestampMessage(self):
+ message = json_format_proto3_pb2.TestTimestamp()
+ message.value.seconds = 0
+ message.value.nanos = 0
+ message.repeated_value.add().seconds = 20
+ message.repeated_value[0].nanos = 1
+ message.repeated_value.add().seconds = 0
+ message.repeated_value[1].nanos = 10000
+ message.repeated_value.add().seconds = 100000000
+ message.repeated_value[2].nanos = 0
+ # Maximum time
+ message.repeated_value.add().seconds = 253402300799
+ message.repeated_value[3].nanos = 999999999
+ # Minimum time
+ message.repeated_value.add().seconds = -62135596800
+ message.repeated_value[4].nanos = 0
+ self.assertEqual(
+ json.loads(json_format.MessageToJson(message, True)),
+ json.loads('{'
+ '"value": "1970-01-01T00:00:00Z",'
+ '"repeatedValue": ['
+ ' "1970-01-01T00:00:20.000000001Z",'
+ ' "1970-01-01T00:00:00.000010Z",'
+ ' "1973-03-03T09:46:40Z",'
+ ' "9999-12-31T23:59:59.999999999Z",'
+ ' "0001-01-01T00:00:00Z"'
+ ']'
+ '}'))
+ parsed_message = json_format_proto3_pb2.TestTimestamp()
+ self.CheckParseBack(message, parsed_message)
+ text = (r'{"value": "1972-01-01T01:00:00.01+08:00",'
+ r'"repeatedValue":['
+ r' "1972-01-01T01:00:00.01+08:30",'
+ r' "1972-01-01T01:00:00.01-01:23"]}')
+ json_format.Parse(text, parsed_message)
+ self.assertEqual(parsed_message.value.seconds, 63104400)
+ self.assertEqual(parsed_message.value.nanos, 10000000)
+ self.assertEqual(parsed_message.repeated_value[0].seconds, 63106200)
+ self.assertEqual(parsed_message.repeated_value[1].seconds, 63070620)
+
+ def testDurationMessage(self):
+ message = json_format_proto3_pb2.TestDuration()
+ message.value.seconds = 1
+ message.repeated_value.add().seconds = 0
+ message.repeated_value[0].nanos = 10
+ message.repeated_value.add().seconds = -1
+ message.repeated_value[1].nanos = -1000
+ message.repeated_value.add().seconds = 10
+ message.repeated_value[2].nanos = 11000000
+ message.repeated_value.add().seconds = -315576000000
+ message.repeated_value.add().seconds = 315576000000
+ self.assertEqual(
+ json.loads(json_format.MessageToJson(message, True)),
+ json.loads('{'
+ '"value": "1s",'
+ '"repeatedValue": ['
+ ' "0.000000010s",'
+ ' "-1.000001s",'
+ ' "10.011s",'
+ ' "-315576000000s",'
+ ' "315576000000s"'
+ ']'
+ '}'))
+ parsed_message = json_format_proto3_pb2.TestDuration()
+ self.CheckParseBack(message, parsed_message)
+
+ def testFieldMaskMessage(self):
+ message = json_format_proto3_pb2.TestFieldMask()
+ message.value.paths.append('foo.bar')
+ message.value.paths.append('bar')
+ self.assertEqual(
+ json_format.MessageToJson(message, True),
+ '{\n'
+ ' "value": "foo.bar,bar"\n'
+ '}')
+ parsed_message = json_format_proto3_pb2.TestFieldMask()
+ self.CheckParseBack(message, parsed_message)
+
+ def testWrapperMessage(self):
+ message = json_format_proto3_pb2.TestWrapper()
+ message.bool_value.value = False
+ message.int32_value.value = 0
+ message.string_value.value = ''
+ message.bytes_value.value = b''
+ message.repeated_bool_value.add().value = True
+ message.repeated_bool_value.add().value = False
+ self.assertEqual(
+ json.loads(json_format.MessageToJson(message, True)),
+ json.loads('{\n'
+ ' "int32Value": 0,'
+ ' "boolValue": false,'
+ ' "stringValue": "",'
+ ' "bytesValue": "",'
+ ' "repeatedBoolValue": [true, false],'
+ ' "repeatedInt32Value": [],'
+ ' "repeatedUint32Value": [],'
+ ' "repeatedFloatValue": [],'
+ ' "repeatedDoubleValue": [],'
+ ' "repeatedBytesValue": [],'
+ ' "repeatedInt64Value": [],'
+ ' "repeatedUint64Value": [],'
+ ' "repeatedStringValue": []'
+ '}'))
+ parsed_message = json_format_proto3_pb2.TestWrapper()
+ self.CheckParseBack(message, parsed_message)
+
+ def testParseNull(self):
+ message = json_format_proto3_pb2.TestMessage()
+ message.repeated_int32_value.append(1)
+ message.repeated_int32_value.append(2)
+ message.repeated_int32_value.append(3)
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ self.FillAllFields(parsed_message)
+ json_format.Parse('{"int32Value": null, '
+ '"int64Value": null, '
+ '"uint32Value": null,'
+ '"uint64Value": null,'
+ '"floatValue": null,'
+ '"doubleValue": null,'
+ '"boolValue": null,'
+ '"stringValue": null,'
+ '"bytesValue": null,'
+ '"messageValue": null,'
+ '"enumValue": null,'
+ '"repeatedInt32Value": [1, 2, null, 3],'
+ '"repeatedInt64Value": null,'
+ '"repeatedUint32Value": null,'
+ '"repeatedUint64Value": null,'
+ '"repeatedFloatValue": null,'
+ '"repeatedDoubleValue": null,'
+ '"repeatedBoolValue": null,'
+ '"repeatedStringValue": null,'
+ '"repeatedBytesValue": null,'
+ '"repeatedMessageValue": null,'
+ '"repeatedEnumValue": null'
+ '}',
+ parsed_message)
+ self.assertEqual(message, parsed_message)
+
+ def testNanFloat(self):
+ message = json_format_proto3_pb2.TestMessage()
+ message.float_value = float('nan')
+ text = '{\n "floatValue": "NaN"\n}'
+ self.assertEqual(json_format.MessageToJson(message), text)
+ parsed_message = json_format_proto3_pb2.TestMessage()
+ json_format.Parse(text, parsed_message)
+ self.assertTrue(math.isnan(parsed_message.float_value))
+
+ def testParseEmptyText(self):
+ self.CheckError('',
+ r'Failed to load JSON: (Expecting value)|(No JSON)')
+
+ def testParseBadEnumValue(self):
+ self.CheckError(
+ '{"enumValue": 1}',
+ 'Enum value must be a string literal with double quotes. '
+ 'Type "proto3.EnumType" has no value named 1.')
+ self.CheckError(
+ '{"enumValue": "baz"}',
+ 'Enum value must be a string literal with double quotes. '
+ 'Type "proto3.EnumType" has no value named baz.')
+
+ def testParseBadIdentifer(self):
+ self.CheckError('{int32Value: 1}',
+ (r'Failed to load JSON: Expecting property name'
+ r'( enclosed in double quotes)?: line 1'))
+ self.CheckError('{"unknownName": 1}',
+ 'Message type "proto3.TestMessage" has no field named '
+ '"unknownName".')
+
+ def testDuplicateField(self):
+ self.CheckError('{"int32Value": 1,\n"int32Value":2}',
+ 'Failed to load JSON: duplicate key int32Value')
+
+ def testInvalidBoolValue(self):
+ self.CheckError('{"boolValue": 1}',
+ 'Failed to parse boolValue field: '
+ 'Expected true or false without quotes.')
+ self.CheckError('{"boolValue": "true"}',
+ 'Failed to parse boolValue field: '
+ 'Expected true or false without quotes.')
+
+ def testInvalidIntegerValue(self):
+ message = json_format_proto3_pb2.TestMessage()
+ text = '{"int32Value": 0x12345}'
+ self.assertRaises(json_format.ParseError,
+ json_format.Parse, text, message)
+ self.CheckError('{"int32Value": 012345}',
+ (r'Failed to load JSON: Expecting \'?,\'? delimiter: '
+ r'line 1'))
+ self.CheckError('{"int32Value": 1.0}',
+ 'Failed to parse int32Value field: '
+ 'Couldn\'t parse integer: 1.0')
+ self.CheckError('{"int32Value": " 1 "}',
+ 'Failed to parse int32Value field: '
+ 'Couldn\'t parse integer: " 1 "')
+ self.CheckError('{"int32Value": 12345678901234567890}',
+ 'Failed to parse int32Value field: Value out of range: '
+ '12345678901234567890')
+ self.CheckError('{"int32Value": 1e5}',
+ 'Failed to parse int32Value field: '
+ 'Couldn\'t parse integer: 100000.0')
+ self.CheckError('{"uint32Value": -1}',
+ 'Failed to parse uint32Value field: Value out of range: -1')
+
+ def testInvalidFloatValue(self):
+ self.CheckError('{"floatValue": "nan"}',
+ 'Failed to parse floatValue field: Couldn\'t '
+ 'parse float "nan", use "NaN" instead')
+
+ def testInvalidBytesValue(self):
+ self.CheckError('{"bytesValue": "AQI"}',
+ 'Failed to parse bytesValue field: Incorrect padding')
+ self.CheckError('{"bytesValue": "AQI*"}',
+ 'Failed to parse bytesValue field: Incorrect padding')
+
+ def testInvalidMap(self):
+ message = json_format_proto3_pb2.TestMap()
+ text = '{"int32Map": {"null": 2, "2": 3}}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'Failed to parse int32Map field: Couldn\'t parse integer: "null"',
+ json_format.Parse, text, message)
+ text = '{"int32Map": {1: 2, "2": 3}}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ (r'Failed to load JSON: Expecting property name'
+ r'( enclosed in double quotes)?: line 1'),
+ json_format.Parse, text, message)
+ text = r'{"stringMap": {"a": 3, "\u0061": 2}}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'Failed to load JSON: duplicate key a',
+ json_format.Parse, text, message)
+ text = '{"boolMap": {"null": 1}}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'Failed to parse boolMap field: Expect "true" or "false", not null.',
+ json_format.Parse, text, message)
+
+ def testInvalidTimestamp(self):
+ message = json_format_proto3_pb2.TestTimestamp()
+ text = '{"value": "10000-01-01T00:00:00.00Z"}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'time data \'10000-01-01T00:00:00\' does not match'
+ ' format \'%Y-%m-%dT%H:%M:%S\'',
+ json_format.Parse, text, message)
+ text = '{"value": "1970-01-01T00:00:00.0123456789012Z"}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'Failed to parse value field: Failed to parse Timestamp: '
+ 'nanos 0123456789012 more than 9 fractional digits.',
+ json_format.Parse, text, message)
+ text = '{"value": "1972-01-01T01:00:00.01+08"}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ (r'Failed to parse value field: Invalid timezone offset value: \+08'),
+ json_format.Parse, text, message)
+ # Time smaller than minimum time.
+ text = '{"value": "0000-01-01T00:00:00Z"}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'Failed to parse value field: year is out of range',
+ json_format.Parse, text, message)
+ # Time bigger than maxinum time.
+ message.value.seconds = 253402300800
+ self.assertRaisesRegexp(
+ json_format.SerializeToJsonError,
+ 'Failed to serialize value field: year is out of range',
+ json_format.MessageToJson, message)
+
+ def testInvalidOneof(self):
+ message = json_format_proto3_pb2.TestOneof()
+ text = '{"oneofInt32Value": 1, "oneofStringValue": "2"}'
+ self.assertRaisesRegexp(
+ json_format.ParseError,
+ 'Message type "proto3.TestOneof"'
+ ' should not have multiple "oneof_value" oneof fields.',
+ json_format.Parse, text, message)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/python/google/protobuf/internal/message_factory_test.py b/python/google/protobuf/internal/message_factory_test.py
index 0d880a7..d760b89 100644
--- a/python/google/protobuf/internal/message_factory_test.py
+++ b/python/google/protobuf/internal/message_factory_test.py
@@ -45,7 +45,6 @@
from google.protobuf import descriptor_pool
from google.protobuf import message_factory
-
class MessageFactoryTest(unittest.TestCase):
def setUp(self):
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
index d99b89b..13c3caa 100755
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -43,17 +43,14 @@
__author__ = 'gps@google.com (Gregory P. Smith)'
+
import collections
import copy
import math
import operator
import pickle
-import sys
-
import six
-
-if six.PY3:
- long = int
+import sys
try:
import unittest2 as unittest
@@ -68,6 +65,9 @@
from google.protobuf.internal import test_util
from google.protobuf import message
+if six.PY3:
+ long = int
+
# Python pre-2.6 does not have isinf() or isnan() functions, so we have
# to provide our own.
def isnan(val):
@@ -442,7 +442,7 @@
message.repeated_nested_message.add().bb = 24
message.repeated_nested_message.add().bb = 10
message.repeated_nested_message.sort(key=lambda z: z.bb // 10)
- self.assertEquals(
+ self.assertEqual(
[13, 11, 10, 21, 20, 24, 33],
[n.bb for n in message.repeated_nested_message])
@@ -451,7 +451,7 @@
pb = message.SerializeToString()
message.Clear()
message.MergeFromString(pb)
- self.assertEquals(
+ self.assertEqual(
[13, 11, 10, 21, 20, 24, 33],
[n.bb for n in message.repeated_nested_message])
@@ -914,7 +914,6 @@
with self.assertRaises(pickle.PickleError) as _:
pickle.dumps(m.repeated_int32, pickle.HIGHEST_PROTOCOL)
-
def testSortEmptyRepeatedCompositeContainer(self, message_module):
"""Exercise a scenario that has led to segfaults in the past.
"""
diff --git a/python/google/protobuf/internal/missing_enum_values.proto b/python/google/protobuf/internal/missing_enum_values.proto
index 161fc5e..1850be5 100644
--- a/python/google/protobuf/internal/missing_enum_values.proto
+++ b/python/google/protobuf/internal/missing_enum_values.proto
@@ -50,3 +50,7 @@
repeated NestedEnum repeated_nested_enum = 2;
repeated NestedEnum packed_nested_enum = 3 [packed = true];
}
+
+message JustString {
+ required string dummy = 1;
+}
diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py
index 1eda10f..822ad89 100644
--- a/python/google/protobuf/internal/proto_builder_test.py
+++ b/python/google/protobuf/internal/proto_builder_test.py
@@ -34,14 +34,12 @@
try:
from collections import OrderedDict
-except ImportError:
+except ImportError:
from ordereddict import OrderedDict #PY26
-
try:
- import unittest2 as unittest #PY26
+ import unittest2 as unittest
except ImportError:
import unittest
-
from google.protobuf import descriptor_pb2
from google.protobuf import descriptor_pool
from google.protobuf import proto_builder
diff --git a/python/google/protobuf/internal/python_message.py b/python/google/protobuf/internal/python_message.py
index 4e5032a..2b87f70 100755
--- a/python/google/protobuf/internal/python_message.py
+++ b/python/google/protobuf/internal/python_message.py
@@ -28,8 +28,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2007 Google Inc. All Rights Reserved.
-#
# This code is meant to work on Python 2.4 and above only.
#
# TODO(robinson): Helpers for verbose, common checks like seeing if a
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
index 2661135..8621d61 100755
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -38,14 +38,13 @@
import copy
import gc
import operator
+import six
import struct
+
try:
import unittest2 as unittest
except ImportError:
import unittest
-
-import six
-
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2
@@ -1799,7 +1798,6 @@
# Just check the default value.
self.assertEqual(57, msg.inner.value)
-
# Since we had so many tests for protocol buffer equality, we broke these out
# into separate TestCase classes.
diff --git a/python/google/protobuf/internal/symbol_database_test.py b/python/google/protobuf/internal/symbol_database_test.py
index 9744226..0cb935a 100644
--- a/python/google/protobuf/internal/symbol_database_test.py
+++ b/python/google/protobuf/internal/symbol_database_test.py
@@ -37,22 +37,27 @@
except ImportError:
import unittest
from google.protobuf import unittest_pb2
+from google.protobuf import descriptor
from google.protobuf import symbol_database
-
class SymbolDatabaseTest(unittest.TestCase):
def _Database(self):
- db = symbol_database.SymbolDatabase()
- # Register representative types from unittest_pb2.
- db.RegisterFileDescriptor(unittest_pb2.DESCRIPTOR)
- db.RegisterMessage(unittest_pb2.TestAllTypes)
- db.RegisterMessage(unittest_pb2.TestAllTypes.NestedMessage)
- db.RegisterMessage(unittest_pb2.TestAllTypes.OptionalGroup)
- db.RegisterMessage(unittest_pb2.TestAllTypes.RepeatedGroup)
- db.RegisterEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR)
- db.RegisterEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR)
- return db
+ # TODO(b/17734095): Remove this difference when the C++ implementation
+ # supports multiple databases.
+ if descriptor._USE_C_DESCRIPTORS:
+ return symbol_database.Default()
+ else:
+ db = symbol_database.SymbolDatabase()
+ # Register representative types from unittest_pb2.
+ db.RegisterFileDescriptor(unittest_pb2.DESCRIPTOR)
+ db.RegisterMessage(unittest_pb2.TestAllTypes)
+ db.RegisterMessage(unittest_pb2.TestAllTypes.NestedMessage)
+ db.RegisterMessage(unittest_pb2.TestAllTypes.OptionalGroup)
+ db.RegisterMessage(unittest_pb2.TestAllTypes.RepeatedGroup)
+ db.RegisterEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR)
+ db.RegisterEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR)
+ return db
def testGetPrototype(self):
instance = self._Database().GetPrototype(
diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py
index d332b77..cca0ee6 100755
--- a/python/google/protobuf/internal/text_format_test.py
+++ b/python/google/protobuf/internal/text_format_test.py
@@ -34,6 +34,7 @@
__author__ = 'kenton@google.com (Kenton Varda)'
+
import re
import six
import string
@@ -389,7 +390,7 @@
# Ideally the schemas would be made more similar so these tests could pass.
class OnlyWorksWithProto2RightNowTests(TextFormatBase):
- def testPrintAllFieldsPointy(self, message_module):
+ def testPrintAllFieldsPointy(self):
message = unittest_pb2.TestAllTypes()
test_util.SetAllFields(message)
self.CompareToGoldenFile(
diff --git a/python/google/protobuf/internal/type_checkers.py b/python/google/protobuf/internal/type_checkers.py
index 8fa3d8c..f30ca6a 100755
--- a/python/google/protobuf/internal/type_checkers.py
+++ b/python/google/protobuf/internal/type_checkers.py
@@ -28,8 +28,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2008 Google Inc. All Rights Reserved.
-
"""Provides type checking routines.
This module defines type checking utilities in the forms of dictionaries:
@@ -52,6 +50,7 @@
if six.PY3:
long = int
+from google.protobuf.internal import api_implementation
from google.protobuf.internal import decoder
from google.protobuf.internal import encoder
from google.protobuf.internal import wire_format
diff --git a/python/google/protobuf/internal/unknown_fields_test.py b/python/google/protobuf/internal/unknown_fields_test.py
index 011d3b5..9685b8b 100755
--- a/python/google/protobuf/internal/unknown_fields_test.py
+++ b/python/google/protobuf/internal/unknown_fields_test.py
@@ -39,7 +39,6 @@
import unittest2 as unittest
except ImportError:
import unittest
-
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2
from google.protobuf import unittest_proto3_arena_pb2
@@ -262,6 +261,19 @@
decoder(value, 0, len(value), self.message, result_dict)
return result_dict[field_descriptor]
+ def testUnknownParseMismatchEnumValue(self):
+ just_string = missing_enum_values_pb2.JustString()
+ just_string.dummy = 'blah'
+
+ missing = missing_enum_values_pb2.TestEnumValues()
+ # The parse is invalid, storing the string proto into the set of
+ # unknown fields.
+ missing.ParseFromString(just_string.SerializeToString())
+
+ # Fetching the enum field shouldn't crash, instead returning the
+ # default value.
+ self.assertEqual(missing.optional_nested_enum, 0)
+
@SkipIfCppImplementation
def testUnknownEnumValue(self):
self.assertFalse(self.missing_message.HasField('optional_nested_enum'))
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
new file mode 100644
index 0000000..09110e0
--- /dev/null
+++ b/python/google/protobuf/json_format.py
@@ -0,0 +1,601 @@
+# 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.
+
+"""Contains routines for printing protocol messages in JSON format."""
+
+__author__ = 'jieluo@google.com (Jie Luo)'
+
+import base64
+from datetime import datetime
+import json
+import math
+import re
+
+from google.protobuf import descriptor
+
+_TIMESTAMPFOMAT = '%Y-%m-%dT%H:%M:%S'
+_NUMBER = re.compile(u'[0-9+-][0-9e.+-]*')
+_INTEGER = re.compile(u'[0-9+-]')
+_INT_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_INT32,
+ descriptor.FieldDescriptor.CPPTYPE_UINT32,
+ descriptor.FieldDescriptor.CPPTYPE_INT64,
+ descriptor.FieldDescriptor.CPPTYPE_UINT64])
+_INT64_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_INT64,
+ descriptor.FieldDescriptor.CPPTYPE_UINT64])
+_FLOAT_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_FLOAT,
+ descriptor.FieldDescriptor.CPPTYPE_DOUBLE])
+if str is bytes:
+ _UNICODETYPE = unicode
+else:
+ _UNICODETYPE = str
+
+
+class SerializeToJsonError(Exception):
+ """Thrown if serialization to JSON fails."""
+
+
+class ParseError(Exception):
+ """Thrown in case of parsing error."""
+
+
+def MessageToJson(message, including_default_value_fields=False):
+ """Converts protobuf message to JSON format.
+
+ Args:
+ message: The protocol buffers message instance to serialize.
+ including_default_value_fields: If True, singular primitive fields,
+ repeated fields, and map fields will always be serialized. If
+ False, only serialize non-empty fields. Singular message fields
+ and oneof fields are not affected by this option.
+
+ Returns:
+ A string containing the JSON formatted protocol buffer message.
+ """
+ js = _MessageToJsonObject(message, including_default_value_fields)
+ return json.dumps(js, indent=2)
+
+
+def _MessageToJsonObject(message, including_default_value_fields):
+ """Converts message to an object according to Proto3 JSON Specification."""
+ message_descriptor = message.DESCRIPTOR
+ if _IsTimestampMessage(message_descriptor):
+ return _TimestampMessageToJsonObject(message)
+ if _IsDurationMessage(message_descriptor):
+ return _DurationMessageToJsonObject(message)
+ if _IsFieldMaskMessage(message_descriptor):
+ return _FieldMaskMessageToJsonObject(message)
+ if _IsWrapperMessage(message_descriptor):
+ return _WrapperMessageToJsonObject(message)
+ return _RegularMessageToJsonObject(message, including_default_value_fields)
+
+
+def _IsMapEntry(field):
+ return (field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and
+ field.message_type.has_options and
+ field.message_type.GetOptions().map_entry)
+
+
+def _RegularMessageToJsonObject(message, including_default_value_fields):
+ """Converts normal message according to Proto3 JSON Specification."""
+ js = {}
+ fields = message.ListFields()
+
+ try:
+ for field, value in fields:
+ name = field.camelcase_name
+ if _IsMapEntry(field):
+ # Convert a map field.
+ js_map = {}
+ for key in value:
+ js_map[key] = _ConvertFieldToJsonObject(
+ field.message_type.fields_by_name['value'],
+ value[key], including_default_value_fields)
+ js[name] = js_map
+ elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
+ # Convert a repeated field.
+ repeated = []
+ for element in value:
+ repeated.append(_ConvertFieldToJsonObject(
+ field, element, including_default_value_fields))
+ js[name] = repeated
+ else:
+ js[name] = _ConvertFieldToJsonObject(
+ field, value, including_default_value_fields)
+
+ # Serialize default value if including_default_value_fields is True.
+ if including_default_value_fields:
+ message_descriptor = message.DESCRIPTOR
+ for field in message_descriptor.fields:
+ # Singular message fields and oneof fields will not be affected.
+ if ((field.label != descriptor.FieldDescriptor.LABEL_REPEATED and
+ field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE) or
+ field.containing_oneof):
+ continue
+ name = field.camelcase_name
+ if name in js:
+ # Skip the field which has been serailized already.
+ continue
+ if _IsMapEntry(field):
+ js[name] = {}
+ elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
+ js[name] = []
+ else:
+ js[name] = _ConvertFieldToJsonObject(field, field.default_value)
+
+ except ValueError as e:
+ raise SerializeToJsonError(
+ 'Failed to serialize {0} field: {1}'.format(field.name, e))
+
+ return js
+
+
+def _ConvertFieldToJsonObject(
+ field, value, including_default_value_fields=False):
+ """Converts field value according to Proto3 JSON Specification."""
+ if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
+ return _MessageToJsonObject(value, including_default_value_fields)
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
+ enum_value = field.enum_type.values_by_number.get(value, None)
+ if enum_value is not None:
+ return enum_value.name
+ else:
+ raise SerializeToJsonError('Enum field contains an integer value '
+ 'which can not mapped to an enum value.')
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
+ if field.type == descriptor.FieldDescriptor.TYPE_BYTES:
+ # Use base64 Data encoding for bytes
+ return base64.b64encode(value).decode('utf-8')
+ else:
+ return value
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL:
+ if value:
+ return True
+ else:
+ return False
+ elif field.cpp_type in _INT64_TYPES:
+ return str(value)
+ elif field.cpp_type in _FLOAT_TYPES:
+ if math.isinf(value):
+ if value < 0.0:
+ return '-Infinity'
+ else:
+ return 'Infinity'
+ if math.isnan(value):
+ return 'NaN'
+ return value
+
+
+def _IsTimestampMessage(message_descriptor):
+ return (message_descriptor.name == 'Timestamp' and
+ message_descriptor.file.name == 'google/protobuf/timestamp.proto')
+
+
+def _TimestampMessageToJsonObject(message):
+ """Converts Timestamp message according to Proto3 JSON Specification."""
+ nanos = message.nanos % 1e9
+ dt = datetime.utcfromtimestamp(
+ message.seconds + (message.nanos - nanos) / 1e9)
+ result = dt.isoformat()
+ if (nanos % 1e9) == 0:
+ # If there are 0 fractional digits, the fractional
+ # point '.' should be omitted when serializing.
+ return result + 'Z'
+ if (nanos % 1e6) == 0:
+ # Serialize 3 fractional digits.
+ return result + '.%03dZ' % (nanos / 1e6)
+ if (nanos % 1e3) == 0:
+ # Serialize 6 fractional digits.
+ return result + '.%06dZ' % (nanos / 1e3)
+ # Serialize 9 fractional digits.
+ return result + '.%09dZ' % nanos
+
+
+def _IsDurationMessage(message_descriptor):
+ return (message_descriptor.name == 'Duration' and
+ message_descriptor.file.name == 'google/protobuf/duration.proto')
+
+
+def _DurationMessageToJsonObject(message):
+ """Converts Duration message according to Proto3 JSON Specification."""
+ if message.seconds < 0 or message.nanos < 0:
+ result = '-'
+ seconds = - message.seconds + int((0 - message.nanos) / 1e9)
+ nanos = (0 - message.nanos) % 1e9
+ else:
+ result = ''
+ seconds = message.seconds + int(message.nanos / 1e9)
+ nanos = message.nanos % 1e9
+ result += '%d' % seconds
+ if (nanos % 1e9) == 0:
+ # If there are 0 fractional digits, the fractional
+ # point '.' should be omitted when serializing.
+ return result + 's'
+ if (nanos % 1e6) == 0:
+ # Serialize 3 fractional digits.
+ return result + '.%03ds' % (nanos / 1e6)
+ if (nanos % 1e3) == 0:
+ # Serialize 6 fractional digits.
+ return result + '.%06ds' % (nanos / 1e3)
+ # Serialize 9 fractional digits.
+ return result + '.%09ds' % nanos
+
+
+def _IsFieldMaskMessage(message_descriptor):
+ return (message_descriptor.name == 'FieldMask' and
+ message_descriptor.file.name == 'google/protobuf/field_mask.proto')
+
+
+def _FieldMaskMessageToJsonObject(message):
+ """Converts FieldMask message according to Proto3 JSON Specification."""
+ result = ''
+ first = True
+ for path in message.paths:
+ if not first:
+ result += ','
+ result += path
+ first = False
+ return result
+
+
+def _IsWrapperMessage(message_descriptor):
+ return message_descriptor.file.name == 'google/protobuf/wrappers.proto'
+
+
+def _WrapperMessageToJsonObject(message):
+ return _ConvertFieldToJsonObject(
+ message.DESCRIPTOR.fields_by_name['value'], message.value)
+
+
+def _DuplicateChecker(js):
+ result = {}
+ for name, value in js:
+ if name in result:
+ raise ParseError('Failed to load JSON: duplicate key ' + name)
+ result[name] = value
+ return result
+
+
+def Parse(text, message):
+ """Parses a JSON representation of a protocol message into a message.
+
+ Args:
+ text: Message JSON representation.
+ message: A protocol beffer message to merge into.
+
+ Returns:
+ The same message passed as argument.
+
+ Raises::
+ ParseError: On JSON parsing problems.
+ """
+ if not isinstance(text, _UNICODETYPE): text = text.decode('utf-8')
+ try:
+ js = json.loads(text, object_pairs_hook=_DuplicateChecker)
+ except ValueError as e:
+ raise ParseError('Failed to load JSON: ' + str(e))
+ _ConvertFieldValuePair(js, message)
+ return message
+
+
+def _ConvertFieldValuePair(js, message):
+ """Convert field value pairs into regular message.
+
+ Args:
+ js: A JSON object to convert the field value pairs.
+ message: A regular protocol message to record the data.
+
+ Raises:
+ ParseError: In case of problems converting.
+ """
+ names = []
+ message_descriptor = message.DESCRIPTOR
+ for name in js:
+ try:
+ field = message_descriptor.fields_by_camelcase_name.get(name, None)
+ if not field:
+ raise ParseError(
+ 'Message type "{0}" has no field named "{1}".'.format(
+ message_descriptor.full_name, name))
+ if name in names:
+ raise ParseError(
+ 'Message type "{0}" should not have multiple "{1}" fields.'.format(
+ message.DESCRIPTOR.full_name, name))
+ names.append(name)
+ # Check no other oneof field is parsed.
+ if field.containing_oneof is not None:
+ oneof_name = field.containing_oneof.name
+ if oneof_name in names:
+ raise ParseError('Message type "{0}" should not have multiple "{1}" '
+ 'oneof fields.'.format(
+ message.DESCRIPTOR.full_name, oneof_name))
+ names.append(oneof_name)
+
+ value = js[name]
+ if value is None:
+ message.ClearField(field.name)
+ continue
+
+ # Parse field value.
+ if _IsMapEntry(field):
+ message.ClearField(field.name)
+ _ConvertMapFieldValue(value, message, field)
+ elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
+ message.ClearField(field.name)
+ if not isinstance(value, list):
+ raise ParseError('repeated field {0} must be in [] which is '
+ '{1}'.format(name, value))
+ for item in value:
+ if item is None:
+ continue
+ if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
+ sub_message = getattr(message, field.name).add()
+ _ConvertMessage(item, sub_message)
+ else:
+ getattr(message, field.name).append(
+ _ConvertScalarFieldValue(item, field))
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
+ sub_message = getattr(message, field.name)
+ _ConvertMessage(value, sub_message)
+ else:
+ setattr(message, field.name, _ConvertScalarFieldValue(value, field))
+ except ParseError as e:
+ if field and field.containing_oneof is None:
+ raise ParseError('Failed to parse {0} field: {1}'.format(name, e))
+ else:
+ raise ParseError(str(e))
+ except ValueError as e:
+ raise ParseError('Failed to parse {0} field: {1}'.format(name, e))
+ except TypeError as e:
+ raise ParseError('Failed to parse {0} field: {1}'.format(name, e))
+
+
+def _ConvertMessage(value, message):
+ """Convert a JSON object into a message.
+
+ Args:
+ value: A JSON object.
+ message: A WKT or regular protocol message to record the data.
+
+ Raises:
+ ParseError: In case of convert problems.
+ """
+ message_descriptor = message.DESCRIPTOR
+ if _IsTimestampMessage(message_descriptor):
+ _ConvertTimestampMessage(value, message)
+ elif _IsDurationMessage(message_descriptor):
+ _ConvertDurationMessage(value, message)
+ elif _IsFieldMaskMessage(message_descriptor):
+ _ConvertFieldMaskMessage(value, message)
+ elif _IsWrapperMessage(message_descriptor):
+ _ConvertWrapperMessage(value, message)
+ else:
+ _ConvertFieldValuePair(value, message)
+
+
+def _ConvertTimestampMessage(value, message):
+ """Convert a JSON representation into Timestamp message."""
+ timezone_offset = value.find('Z')
+ if timezone_offset == -1:
+ timezone_offset = value.find('+')
+ if timezone_offset == -1:
+ timezone_offset = value.rfind('-')
+ if timezone_offset == -1:
+ raise ParseError(
+ 'Failed to parse timestamp: missing valid timezone offset.')
+ time_value = value[0:timezone_offset]
+ # Parse datetime and nanos
+ point_position = time_value.find('.')
+ if point_position == -1:
+ second_value = time_value
+ nano_value = ''
+ else:
+ second_value = time_value[:point_position]
+ nano_value = time_value[point_position + 1:]
+ date_object = datetime.strptime(second_value, _TIMESTAMPFOMAT)
+ seconds = (date_object - datetime(1970, 1, 1)).total_seconds()
+ if len(nano_value) > 9:
+ raise ParseError(
+ 'Failed to parse Timestamp: nanos {0} more than '
+ '9 fractional digits.'.format(nano_value))
+ if nano_value:
+ nanos = round(float('0.' + nano_value) * 1e9)
+ else:
+ nanos = 0
+ # Parse timezone offsets
+ if value[timezone_offset] == 'Z':
+ if len(value) != timezone_offset + 1:
+ raise ParseError(
+ 'Failed to parse timestamp: invalid trailing data {0}.'.format(value))
+ else:
+ timezone = value[timezone_offset:]
+ pos = timezone.find(':')
+ if pos == -1:
+ raise ParseError(
+ 'Invalid timezone offset value: ' + timezone)
+ if timezone[0] == '+':
+ seconds += (int(timezone[1:pos])*60+int(timezone[pos+1:]))*60
+ else:
+ seconds -= (int(timezone[1:pos])*60+int(timezone[pos+1:]))*60
+ # Set seconds and nanos
+ message.seconds = int(seconds)
+ message.nanos = int(nanos)
+
+
+def _ConvertDurationMessage(value, message):
+ """Convert a JSON representation into Duration message."""
+ if value[-1] != 's':
+ raise ParseError(
+ 'Duration must end with letter "s": ' + value)
+ try:
+ duration = float(value[:-1])
+ except ValueError:
+ raise ParseError(
+ 'Couldn\'t parse duration: ' + value)
+ message.seconds = int(duration)
+ message.nanos = int(round((duration - message.seconds) * 1e9))
+
+
+def _ConvertFieldMaskMessage(value, message):
+ """Convert a JSON representation into FieldMask message."""
+ for path in value.split(','):
+ message.paths.append(path)
+
+
+def _ConvertWrapperMessage(value, message):
+ """Convert a JSON representation into Wrapper message."""
+ field = message.DESCRIPTOR.fields_by_name['value']
+ setattr(message, 'value', _ConvertScalarFieldValue(value, field))
+
+
+def _ConvertMapFieldValue(value, message, field):
+ """Convert map field value for a message map field.
+
+ Args:
+ value: A JSON object to convert the map field value.
+ message: A protocol message to record the converted data.
+ field: The descriptor of the map field to be converted.
+
+ Raises:
+ ParseError: In case of convert problems.
+ """
+ if not isinstance(value, dict):
+ raise ParseError(
+ 'Map fieled {0} must be in {} which is {1}.'.format(field.name, value))
+ key_field = field.message_type.fields_by_name['key']
+ value_field = field.message_type.fields_by_name['value']
+ for key in value:
+ key_value = _ConvertScalarFieldValue(key, key_field, True)
+ if value_field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
+ _ConvertMessage(value[key], getattr(message, field.name)[key_value])
+ else:
+ getattr(message, field.name)[key_value] = _ConvertScalarFieldValue(
+ value[key], value_field)
+
+
+def _ConvertScalarFieldValue(value, field, require_quote=False):
+ """Convert a single scalar field value.
+
+ Args:
+ value: A scalar value to convert the scalar field value.
+ field: The descriptor of the field to convert.
+ require_quote: If True, '"' is required for the field value.
+
+ Returns:
+ The converted scalar field value
+
+ Raises:
+ ParseError: In case of convert problems.
+ """
+ if field.cpp_type in _INT_TYPES:
+ return _ConvertInteger(value)
+ elif field.cpp_type in _FLOAT_TYPES:
+ return _ConvertFloat(value)
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL:
+ return _ConvertBool(value, require_quote)
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
+ if field.type == descriptor.FieldDescriptor.TYPE_BYTES:
+ return base64.b64decode(value)
+ else:
+ return value
+ elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
+ # Convert an enum value.
+ enum_value = field.enum_type.values_by_name.get(value, None)
+ if enum_value is None:
+ raise ParseError(
+ 'Enum value must be a string literal with double quotes. '
+ 'Type "{0}" has no value named {1}.'.format(
+ field.enum_type.full_name, value))
+ return enum_value.number
+
+
+def _ConvertInteger(value):
+ """Convert an integer.
+
+ Args:
+ value: A scalar value to convert.
+
+ Returns:
+ The integer value.
+
+ Raises:
+ ParseError: If an integer couldn't be consumed.
+ """
+ if isinstance(value, float):
+ raise ParseError('Couldn\'t parse integer: {0}'.format(value))
+
+ if isinstance(value, _UNICODETYPE) and not _INTEGER.match(value):
+ raise ParseError('Couldn\'t parse integer: "{0}"'.format(value))
+
+ return int(value)
+
+
+def _ConvertFloat(value):
+ """Convert an floating point number."""
+ if value == 'nan':
+ raise ParseError('Couldn\'t parse float "nan", use "NaN" instead')
+ try:
+ # Assume Python compatible syntax.
+ return float(value)
+ except ValueError:
+ # Check alternative spellings.
+ if value == '-Infinity':
+ return float('-inf')
+ elif value == 'Infinity':
+ return float('inf')
+ elif value == 'NaN':
+ return float('nan')
+ else:
+ raise ParseError('Couldn\'t parse float: {0}'.format(value))
+
+
+def _ConvertBool(value, require_quote):
+ """Convert a boolean value.
+
+ Args:
+ value: A scalar value to convert.
+ require_quote: If True, '"' is required for the boolean value.
+
+ Returns:
+ The bool parsed.
+
+ Raises:
+ ParseError: If a boolean value couldn't be consumed.
+ """
+ if require_quote:
+ if value == 'true':
+ return True
+ elif value == 'false':
+ return False
+ else:
+ raise ParseError('Expect "true" or "false", not {0}.'.format(value))
+
+ if not isinstance(value, bool):
+ raise ParseError('Expected true or false without quotes.')
+ return value
diff --git a/python/google/protobuf/message_factory.py b/python/google/protobuf/message_factory.py
index 36062a5..9cd9c2a 100644
--- a/python/google/protobuf/message_factory.py
+++ b/python/google/protobuf/message_factory.py
@@ -28,8 +28,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2012 Google Inc. All Rights Reserved.
-
"""Provides a factory class for generating dynamic messages.
The easiest way to use this class is if you have access to the FileDescriptor
diff --git a/python/google/protobuf/proto_builder.py b/python/google/protobuf/proto_builder.py
index 700e3c2..736caed 100644
--- a/python/google/protobuf/proto_builder.py
+++ b/python/google/protobuf/proto_builder.py
@@ -48,7 +48,7 @@
factory: a MessageFactory instance.
full_name: str, the fully qualified name of the proto type.
Returns:
- a class, for the type identified by full_name.
+ A class, for the type identified by full_name.
Raises:
KeyError, if the proto is not found in the factory's descriptor pool.
"""
@@ -57,7 +57,7 @@
return proto_cls
-def MakeSimpleProtoClass(fields, full_name, pool=None):
+def MakeSimpleProtoClass(fields, full_name=None, pool=None):
"""Create a Protobuf class whose fields are basic types.
Note: this doesn't validate field names!
@@ -66,18 +66,20 @@
fields: dict of {name: field_type} mappings for each field in the proto. If
this is an OrderedDict the order will be maintained, otherwise the
fields will be sorted by name.
- full_name: str, the fully-qualified name of the proto type.
+ full_name: optional str, the fully-qualified name of the proto type.
pool: optional DescriptorPool instance.
Returns:
a class, the new protobuf class with a FileDescriptor.
"""
factory = message_factory.MessageFactory(pool=pool)
- try:
- proto_cls = _GetMessageFromFactory(factory, full_name)
- return proto_cls
- except KeyError:
- # The factory's DescriptorPool doesn't know about this class yet.
- pass
+
+ if full_name is not None:
+ try:
+ proto_cls = _GetMessageFromFactory(factory, full_name)
+ return proto_cls
+ except KeyError:
+ # The factory's DescriptorPool doesn't know about this class yet.
+ pass
# Get a list of (name, field_type) tuples from the fields dict. If fields was
# an OrderedDict we keep the order, but otherwise we sort the field to ensure
@@ -94,6 +96,25 @@
fields_hash.update(str(f_type).encode('utf-8'))
proto_file_name = fields_hash.hexdigest() + '.proto'
+ # If the proto is anonymous, use the same hash to name it.
+ if full_name is None:
+ full_name = ('net.proto2.python.public.proto_builder.AnonymousProto_' +
+ fields_hash.hexdigest())
+ try:
+ proto_cls = _GetMessageFromFactory(factory, full_name)
+ return proto_cls
+ except KeyError:
+ # The factory's DescriptorPool doesn't know about this class yet.
+ pass
+
+ # This is the first time we see this proto: add a new descriptor to the pool.
+ factory.pool.Add(
+ _MakeFileDescriptorProto(proto_file_name, full_name, field_items))
+ return _GetMessageFromFactory(factory, full_name)
+
+
+def _MakeFileDescriptorProto(proto_file_name, full_name, field_items):
+ """Populate FileDescriptorProto for MessageFactory's DescriptorPool."""
package, name = full_name.rsplit('.', 1)
file_proto = descriptor_pb2.FileDescriptorProto()
file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name)
@@ -106,6 +127,4 @@
field_proto.number = f_number
field_proto.label = descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL
field_proto.type = f_type
-
- factory.pool.Add(file_proto)
- return _GetMessageFromFactory(factory, full_name)
+ return file_proto
diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc
index 3806643..b238fd0 100644
--- a/python/google/protobuf/pyext/descriptor.cc
+++ b/python/google/protobuf/pyext/descriptor.cc
@@ -223,8 +223,7 @@
options.SerializeToString(&serialized);
io::CodedInputStream input(
reinterpret_cast<const uint8*>(serialized.c_str()), serialized.size());
- input.SetExtensionRegistry(pool->pool,
- GetDescriptorPool()->message_factory);
+ input.SetExtensionRegistry(pool->pool, pool->message_factory);
bool success = cmsg->message->MergePartialFromCodedStream(&input);
if (!success) {
PyErr_Format(PyExc_ValueError, "Error parsing Options message");
@@ -414,8 +413,14 @@
}
static PyObject* GetConcreteClass(PyBaseDescriptor* self, void *closure) {
+ // Retuns the canonical class for the given descriptor.
+ // This is the class that was registered with the primary descriptor pool
+ // which contains this descriptor.
+ // This might not be the one you expect! For example the returned object does
+ // not know about extensions defined in a custom pool.
PyObject* concrete_class(cdescriptor_pool::GetMessageClass(
- GetDescriptorPool(), _GetDescriptor(self)));
+ GetDescriptorPool_FromPool(_GetDescriptor(self)->file()->pool()),
+ _GetDescriptor(self)));
Py_XINCREF(concrete_class);
return concrete_class;
}
@@ -424,6 +429,11 @@
return NewMessageFieldsByName(_GetDescriptor(self));
}
+static PyObject* GetFieldsByCamelcaseName(PyBaseDescriptor* self,
+ void *closure) {
+ return NewMessageFieldsByCamelcaseName(_GetDescriptor(self));
+}
+
static PyObject* GetFieldsByNumber(PyBaseDescriptor* self, void *closure) {
return NewMessageFieldsByNumber(_GetDescriptor(self));
}
@@ -564,6 +574,8 @@
{ "fields", (getter)GetFieldsSeq, NULL, "Fields sequence"},
{ "fields_by_name", (getter)GetFieldsByName, NULL, "Fields by name"},
+ { "fields_by_camelcase_name", (getter)GetFieldsByCamelcaseName, NULL,
+ "Fields by camelCase name"},
{ "fields_by_number", (getter)GetFieldsByNumber, NULL, "Fields by number"},
{ "nested_types", (getter)GetNestedTypesSeq, NULL, "Nested types sequence"},
{ "nested_types_by_name", (getter)GetNestedTypesByName, NULL,
@@ -662,6 +674,10 @@
return PyString_FromCppString(_GetDescriptor(self)->name());
}
+static PyObject* GetCamelcaseName(PyBaseDescriptor* self, void *closure) {
+ return PyString_FromCppString(_GetDescriptor(self)->camelcase_name());
+}
+
static PyObject* GetType(PyBaseDescriptor *self, void *closure) {
return PyInt_FromLong(_GetDescriptor(self)->type());
}
@@ -850,6 +866,7 @@
static PyGetSetDef Getters[] = {
{ "full_name", (getter)GetFullName, NULL, "Full name"},
{ "name", (getter)GetName, NULL, "Unqualified name"},
+ { "camelcase_name", (getter)GetCamelcaseName, NULL, "Camelcase name"},
{ "type", (getter)GetType, NULL, "C++ Type"},
{ "cpp_type", (getter)GetCppType, NULL, "C++ Type"},
{ "label", (getter)GetLabel, NULL, "Label"},
@@ -1070,6 +1087,15 @@
&PyEnumDescriptor_Type, enum_descriptor, NULL);
}
+const EnumDescriptor* PyEnumDescriptor_AsDescriptor(PyObject* obj) {
+ if (!PyObject_TypeCheck(obj, &PyEnumDescriptor_Type)) {
+ PyErr_SetString(PyExc_TypeError, "Not an EnumDescriptor");
+ return NULL;
+ }
+ return reinterpret_cast<const EnumDescriptor*>(
+ reinterpret_cast<PyBaseDescriptor*>(obj)->descriptor);
+}
+
namespace enumvalue_descriptor {
// Unchecked accessor to the C++ pointer.
@@ -1359,6 +1385,15 @@
return py_descriptor;
}
+const FileDescriptor* PyFileDescriptor_AsDescriptor(PyObject* obj) {
+ if (!PyObject_TypeCheck(obj, &PyFileDescriptor_Type)) {
+ PyErr_SetString(PyExc_TypeError, "Not a FileDescriptor");
+ return NULL;
+ }
+ return reinterpret_cast<const FileDescriptor*>(
+ reinterpret_cast<PyBaseDescriptor*>(obj)->descriptor);
+}
+
namespace oneof_descriptor {
// Unchecked accessor to the C++ pointer.
diff --git a/python/google/protobuf/pyext/descriptor.h b/python/google/protobuf/pyext/descriptor.h
index b255040..eb99df1 100644
--- a/python/google/protobuf/pyext/descriptor.h
+++ b/python/google/protobuf/pyext/descriptor.h
@@ -72,6 +72,8 @@
// exception set.
const Descriptor* PyMessageDescriptor_AsDescriptor(PyObject* obj);
const FieldDescriptor* PyFieldDescriptor_AsDescriptor(PyObject* obj);
+const EnumDescriptor* PyEnumDescriptor_AsDescriptor(PyObject* obj);
+const FileDescriptor* PyFileDescriptor_AsDescriptor(PyObject* obj);
// Returns the raw C++ pointer.
const void* PyDescriptor_AsVoidPtr(PyObject* obj);
diff --git a/python/google/protobuf/pyext/descriptor_containers.cc b/python/google/protobuf/pyext/descriptor_containers.cc
index 92e11e3..b20f5e4 100644
--- a/python/google/protobuf/pyext/descriptor_containers.cc
+++ b/python/google/protobuf/pyext/descriptor_containers.cc
@@ -79,9 +79,12 @@
typedef int (*CountMethod)(PyContainer* self);
typedef const void* (*GetByIndexMethod)(PyContainer* self, int index);
typedef const void* (*GetByNameMethod)(PyContainer* self, const string& name);
+typedef const void* (*GetByCamelcaseNameMethod)(PyContainer* self,
+ const string& name);
typedef const void* (*GetByNumberMethod)(PyContainer* self, int index);
typedef PyObject* (*NewObjectFromItemMethod)(const void* descriptor);
typedef const string& (*GetItemNameMethod)(const void* descriptor);
+typedef const string& (*GetItemCamelcaseNameMethod)(const void* descriptor);
typedef int (*GetItemNumberMethod)(const void* descriptor);
typedef int (*GetItemIndexMethod)(const void* descriptor);
@@ -95,6 +98,9 @@
// Retrieve item by name (usually a call to some 'FindByName' method).
// Used by "by_name" mappings.
GetByNameMethod get_by_name_fn;
+ // Retrieve item by camelcase name (usually a call to some
+ // 'FindByCamelcaseName' method). Used by "by_camelcase_name" mappings.
+ GetByCamelcaseNameMethod get_by_camelcase_name_fn;
// Retrieve item by declared number (field tag, or enum value).
// Used by "by_number" mappings.
GetByNumberMethod get_by_number_fn;
@@ -102,6 +108,9 @@
NewObjectFromItemMethod new_object_from_item_fn;
// Retrieve the name of an item. Used by iterators on "by_name" mappings.
GetItemNameMethod get_item_name_fn;
+ // Retrieve the camelcase name of an item. Used by iterators on
+ // "by_camelcase_name" mappings.
+ GetItemCamelcaseNameMethod get_item_camelcase_name_fn;
// Retrieve the number of an item. Used by iterators on "by_number" mappings.
GetItemNumberMethod get_item_number_fn;
// Retrieve the index of an item for the container type.
@@ -125,6 +134,7 @@
enum ContainerKind {
KIND_SEQUENCE,
KIND_BYNAME,
+ KIND_BYCAMELCASENAME,
KIND_BYNUMBER,
} kind;
};
@@ -172,6 +182,23 @@
self, string(name, name_size));
return true;
}
+ case PyContainer::KIND_BYCAMELCASENAME:
+ {
+ char* camelcase_name;
+ Py_ssize_t name_size;
+ if (PyString_AsStringAndSize(key, &camelcase_name, &name_size) < 0) {
+ if (PyErr_ExceptionMatches(PyExc_TypeError)) {
+ // Not a string, cannot be in the container.
+ PyErr_Clear();
+ *item = NULL;
+ return true;
+ }
+ return false;
+ }
+ *item = self->container_def->get_by_camelcase_name_fn(
+ self, string(camelcase_name, name_size));
+ return true;
+ }
case PyContainer::KIND_BYNUMBER:
{
Py_ssize_t number = PyNumber_AsSsize_t(key, NULL);
@@ -203,6 +230,12 @@
const string& name(self->container_def->get_item_name_fn(item));
return PyString_FromStringAndSize(name.c_str(), name.size());
}
+ case PyContainer::KIND_BYCAMELCASENAME:
+ {
+ const string& name(
+ self->container_def->get_item_camelcase_name_fn(item));
+ return PyString_FromStringAndSize(name.c_str(), name.size());
+ }
case PyContainer::KIND_BYNUMBER:
{
int value = self->container_def->get_item_number_fn(item);
@@ -276,6 +309,9 @@
case PyContainer::KIND_BYNAME:
kind = "mapping by name";
break;
+ case PyContainer::KIND_BYCAMELCASENAME:
+ kind = "mapping by camelCase name";
+ break;
case PyContainer::KIND_BYNUMBER:
kind = "mapping by number";
break;
@@ -731,6 +767,18 @@
return reinterpret_cast<PyObject*>(self);
}
+static PyObject* NewMappingByCamelcaseName(
+ DescriptorContainerDef* container_def, const void* descriptor) {
+ PyContainer* self = PyObject_New(PyContainer, &DescriptorMapping_Type);
+ if (self == NULL) {
+ return NULL;
+ }
+ self->descriptor = descriptor;
+ self->container_def = container_def;
+ self->kind = PyContainer::KIND_BYCAMELCASENAME;
+ return reinterpret_cast<PyObject*>(self);
+}
+
static PyObject* NewMappingByNumber(
DescriptorContainerDef* container_def, const void* descriptor) {
if (container_def->get_by_number_fn == NULL ||
@@ -889,6 +937,11 @@
return GetDescriptor(self)->FindFieldByName(name);
}
+static ItemDescriptor GetByCamelcaseName(PyContainer* self,
+ const string& name) {
+ return GetDescriptor(self)->FindFieldByCamelcaseName(name);
+}
+
static ItemDescriptor GetByNumber(PyContainer* self, int number) {
return GetDescriptor(self)->FindFieldByNumber(number);
}
@@ -905,6 +958,10 @@
return item->name();
}
+static const string& GetItemCamelcaseName(ItemDescriptor item) {
+ return item->camelcase_name();
+}
+
static int GetItemNumber(ItemDescriptor item) {
return item->number();
}
@@ -918,9 +975,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)GetByCamelcaseName,
(GetByNumberMethod)GetByNumber,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)GetItemCamelcaseName,
(GetItemNumberMethod)GetItemNumber,
(GetItemIndexMethod)GetItemIndex,
};
@@ -931,6 +990,11 @@
return descriptor::NewMappingByName(&fields::ContainerDef, descriptor);
}
+PyObject* NewMessageFieldsByCamelcaseName(ParentDescriptor descriptor) {
+ return descriptor::NewMappingByCamelcaseName(&fields::ContainerDef,
+ descriptor);
+}
+
PyObject* NewMessageFieldsByNumber(ParentDescriptor descriptor) {
return descriptor::NewMappingByNumber(&fields::ContainerDef, descriptor);
}
@@ -972,9 +1036,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1022,9 +1088,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1094,9 +1162,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)NULL,
};
@@ -1140,9 +1210,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1190,9 +1262,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1258,9 +1332,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)GetByNumber,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)GetItemNumber,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1314,9 +1390,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)NULL,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)NULL,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1370,9 +1448,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1416,9 +1496,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1462,9 +1544,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)GetByName,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)GetItemName,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)GetItemIndex,
};
@@ -1496,9 +1580,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)NULL,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)NULL,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)NULL,
};
@@ -1530,9 +1616,11 @@
(CountMethod)Count,
(GetByIndexMethod)GetByIndex,
(GetByNameMethod)NULL,
+ (GetByCamelcaseNameMethod)NULL,
(GetByNumberMethod)NULL,
(NewObjectFromItemMethod)NewObjectFromItem,
(GetItemNameMethod)NULL,
+ (GetItemCamelcaseNameMethod)NULL,
(GetItemNumberMethod)NULL,
(GetItemIndexMethod)NULL,
};
diff --git a/python/google/protobuf/pyext/descriptor_containers.h b/python/google/protobuf/pyext/descriptor_containers.h
index 8fbdaff..ce40747 100644
--- a/python/google/protobuf/pyext/descriptor_containers.h
+++ b/python/google/protobuf/pyext/descriptor_containers.h
@@ -54,6 +54,7 @@
namespace message_descriptor {
PyObject* NewMessageFieldsByName(const Descriptor* descriptor);
+PyObject* NewMessageFieldsByCamelcaseName(const Descriptor* descriptor);
PyObject* NewMessageFieldsByNumber(const Descriptor* descriptor);
PyObject* NewMessageFieldsSeq(const Descriptor* descriptor);
diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc
index 7aed651..6443a7d 100644
--- a/python/google/protobuf/pyext/descriptor_pool.cc
+++ b/python/google/protobuf/pyext/descriptor_pool.cc
@@ -108,6 +108,7 @@
Py_DECREF(it->second);
}
delete self->descriptor_options;
+ delete self->pool;
delete self->message_factory;
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
@@ -131,22 +132,9 @@
}
// Add a message class to our database.
-const Descriptor* RegisterMessageClass(
- PyDescriptorPool* self, PyObject *message_class, PyObject* descriptor) {
- ScopedPyObjectPtr full_message_name(
- PyObject_GetAttrString(descriptor, "full_name"));
- Py_ssize_t name_size;
- char* name;
- if (PyString_AsStringAndSize(full_message_name, &name, &name_size) < 0) {
- return NULL;
- }
- const Descriptor *message_descriptor =
- self->pool->FindMessageTypeByName(string(name, name_size));
- if (!message_descriptor) {
- PyErr_Format(PyExc_TypeError, "Could not find C++ descriptor for '%s'",
- name);
- return NULL;
- }
+int RegisterMessageClass(PyDescriptorPool* self,
+ const Descriptor *message_descriptor,
+ PyObject *message_class) {
Py_INCREF(message_class);
typedef PyDescriptorPool::ClassesByMessageMap::iterator iterator;
std::pair<iterator, bool> ret = self->classes_by_descriptor->insert(
@@ -156,7 +144,7 @@
Py_DECREF(ret.first->second);
ret.first->second = message_class;
}
- return message_descriptor;
+ return 0;
}
// Retrieve the message class added to our database.
@@ -260,6 +248,80 @@
return PyOneofDescriptor_FromDescriptor(oneof_descriptor);
}
+PyObject* FindFileContainingSymbol(PyDescriptorPool* self, PyObject* arg) {
+ Py_ssize_t name_size;
+ char* name;
+ if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
+ return NULL;
+ }
+
+ const FileDescriptor* file_descriptor =
+ self->pool->FindFileContainingSymbol(string(name, name_size));
+ if (file_descriptor == NULL) {
+ PyErr_Format(PyExc_KeyError, "Couldn't find symbol %.200s", name);
+ return NULL;
+ }
+
+ return PyFileDescriptor_FromDescriptor(file_descriptor);
+}
+
+// These functions should not exist -- the only valid way to create
+// descriptors is to call Add() or AddSerializedFile().
+// But these AddDescriptor() functions were created in Python and some people
+// call them, so we support them for now for compatibility.
+// However we do check that the existing descriptor already exists in the pool,
+// which appears to always be true for existing calls -- but then why do people
+// call a function that will just be a no-op?
+// TODO(amauryfa): Need to investigate further.
+
+PyObject* AddFileDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
+ const FileDescriptor* file_descriptor =
+ PyFileDescriptor_AsDescriptor(descriptor);
+ if (!file_descriptor) {
+ return NULL;
+ }
+ if (file_descriptor !=
+ self->pool->FindFileByName(file_descriptor->name())) {
+ PyErr_Format(PyExc_ValueError,
+ "The file descriptor %s does not belong to this pool",
+ file_descriptor->name().c_str());
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+PyObject* AddDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
+ const Descriptor* message_descriptor =
+ PyMessageDescriptor_AsDescriptor(descriptor);
+ if (!message_descriptor) {
+ return NULL;
+ }
+ if (message_descriptor !=
+ self->pool->FindMessageTypeByName(message_descriptor->full_name())) {
+ PyErr_Format(PyExc_ValueError,
+ "The message descriptor %s does not belong to this pool",
+ message_descriptor->full_name().c_str());
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+PyObject* AddEnumDescriptor(PyDescriptorPool* self, PyObject* descriptor) {
+ const EnumDescriptor* enum_descriptor =
+ PyEnumDescriptor_AsDescriptor(descriptor);
+ if (!enum_descriptor) {
+ return NULL;
+ }
+ if (enum_descriptor !=
+ self->pool->FindEnumTypeByName(enum_descriptor->full_name())) {
+ PyErr_Format(PyExc_ValueError,
+ "The enum descriptor %s does not belong to this pool",
+ enum_descriptor->full_name().c_str());
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
// The code below loads new Descriptors from a serialized FileDescriptorProto.
@@ -341,6 +403,15 @@
{ "AddSerializedFile", (PyCFunction)AddSerializedFile, METH_O,
"Adds a serialized FileDescriptorProto to this pool." },
+ // TODO(amauryfa): Understand why the Python implementation differs from
+ // this one, ask users to use another API and deprecate these functions.
+ { "AddFileDescriptor", (PyCFunction)AddFileDescriptor, METH_O,
+ "No-op. Add() must have been called before." },
+ { "AddDescriptor", (PyCFunction)AddDescriptor, METH_O,
+ "No-op. Add() must have been called before." },
+ { "AddEnumDescriptor", (PyCFunction)AddEnumDescriptor, METH_O,
+ "No-op. Add() must have been called before." },
+
{ "FindFileByName", (PyCFunction)FindFileByName, METH_O,
"Searches for a file descriptor by its .proto name." },
{ "FindMessageTypeByName", (PyCFunction)FindMessageByName, METH_O,
@@ -353,6 +424,9 @@
"Searches for enum type descriptor by full name." },
{ "FindOneofByName", (PyCFunction)FindOneofByName, METH_O,
"Searches for oneof descriptor by full name." },
+
+ { "FindFileContainingSymbol", (PyCFunction)FindFileContainingSymbol, METH_O,
+ "Gets the FileDescriptor containing the specified symbol." },
{NULL}
};
@@ -420,7 +494,7 @@
return true;
}
-PyDescriptorPool* GetDescriptorPool() {
+PyDescriptorPool* GetDefaultDescriptorPool() {
return python_generated_pool;
}
@@ -432,7 +506,7 @@
}
hash_map<const DescriptorPool*, PyDescriptorPool*>::iterator it =
descriptor_pool_map.find(pool);
- if (it != descriptor_pool_map.end()) {
+ if (it == descriptor_pool_map.end()) {
PyErr_SetString(PyExc_KeyError, "Unknown descriptor pool");
return NULL;
}
diff --git a/python/google/protobuf/pyext/descriptor_pool.h b/python/google/protobuf/pyext/descriptor_pool.h
index 541d920..eda73d3 100644
--- a/python/google/protobuf/pyext/descriptor_pool.h
+++ b/python/google/protobuf/pyext/descriptor_pool.h
@@ -89,12 +89,10 @@
const string& name);
// Registers a new Python class for the given message descriptor.
-// Returns the message Descriptor.
-// On error, returns NULL with a Python exception set.
-const Descriptor* RegisterMessageClass(
- PyDescriptorPool* self, PyObject* message_class, PyObject* descriptor);
-
-// The function below are also exposed as methods of the DescriptorPool type.
+// On error, returns -1 with a Python exception set.
+int RegisterMessageClass(PyDescriptorPool* self,
+ const Descriptor* message_descriptor,
+ PyObject* message_class);
// Retrieves the Python class registered with the given message descriptor.
//
@@ -103,6 +101,8 @@
PyObject* GetMessageClass(PyDescriptorPool* self,
const Descriptor* message_descriptor);
+// The functions below are also exposed as methods of the DescriptorPool type.
+
// Looks up a message by name. Returns a PyMessageDescriptor corresponding to
// the field on success, or NULL on failure.
//
@@ -136,8 +136,9 @@
} // namespace cdescriptor_pool
// Retrieve the global descriptor pool owned by the _message module.
+// This is the one used by pb2.py generated modules.
// Returns a *borrowed* reference.
-PyDescriptorPool* GetDescriptorPool();
+PyDescriptorPool* GetDefaultDescriptorPool();
// Retrieve the python descriptor pool owning a C++ descriptor pool.
// Returns a *borrowed* reference.
diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc
index 8ebbb27..9c9b417 100644
--- a/python/google/protobuf/pyext/extension_dict.cc
+++ b/python/google/protobuf/pyext/extension_dict.cc
@@ -123,7 +123,8 @@
if (descriptor->label() == FieldDescriptor::LABEL_REPEATED) {
if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
PyObject *message_class = cdescriptor_pool::GetMessageClass(
- GetDescriptorPool(), descriptor->message_type());
+ cmessage::GetDescriptorPoolForMessage(self->parent),
+ descriptor->message_type());
if (message_class == NULL) {
return NULL;
}
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index 62c7c47..9318c83 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -55,6 +55,7 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/text_format.h>
+#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/pyext/descriptor.h>
#include <google/protobuf/pyext/descriptor_pool.h>
#include <google/protobuf/pyext/extension_dict.h>
@@ -107,8 +108,18 @@
// C++ descriptor of this message.
const Descriptor* message_descriptor;
+
// Owned reference, used to keep the pointer above alive.
PyObject* py_message_descriptor;
+
+ // The Python DescriptorPool used to create the class. It is needed to resolve
+ // fields descriptors, including extensions fields; its C++ MessageFactory is
+ // used to instantiate submessages.
+ // This can be different from DESCRIPTOR.file.pool, in the case of a custom
+ // DescriptorPool which defines new extensions.
+ // We own the reference, because it's important to keep the descriptors and
+ // factory alive.
+ PyDescriptorPool* py_descriptor_pool;
};
namespace message_meta {
@@ -139,18 +150,10 @@
// Finalize the creation of the Message class.
-// Called from its metaclass: GeneratedProtocolMessageType.__init__().
-static int AddDescriptors(PyObject* cls, PyObject* descriptor) {
- const Descriptor* message_descriptor =
- cdescriptor_pool::RegisterMessageClass(
- GetDescriptorPool(), cls, descriptor);
- if (message_descriptor == NULL) {
- return -1;
- }
-
+static int AddDescriptors(PyObject* cls, const Descriptor* descriptor) {
// If there are extension_ranges, the message is "extendable", and extension
// classes will register themselves in this class.
- if (message_descriptor->extension_range_count() > 0) {
+ if (descriptor->extension_range_count() > 0) {
ScopedPyObjectPtr by_name(PyDict_New());
if (PyObject_SetAttr(cls, k_extensions_by_name, by_name) < 0) {
return -1;
@@ -162,8 +165,8 @@
}
// For each field set: cls.<field>_FIELD_NUMBER = <number>
- for (int i = 0; i < message_descriptor->field_count(); ++i) {
- if (!AddFieldNumberToClass(cls, message_descriptor->field(i))) {
+ for (int i = 0; i < descriptor->field_count(); ++i) {
+ if (!AddFieldNumberToClass(cls, descriptor->field(i))) {
return -1;
}
}
@@ -173,8 +176,8 @@
// The enum descriptor we get from
// <messagedescriptor>.enum_types_by_name[name]
// which was built previously.
- for (int i = 0; i < message_descriptor->enum_type_count(); ++i) {
- const EnumDescriptor* enum_descriptor = message_descriptor->enum_type(i);
+ for (int i = 0; i < descriptor->enum_type_count(); ++i) {
+ const EnumDescriptor* enum_descriptor = descriptor->enum_type(i);
ScopedPyObjectPtr enum_type(
PyEnumDescriptor_FromDescriptor(enum_descriptor));
if (enum_type == NULL) {
@@ -212,8 +215,8 @@
// Extension descriptors come from
// <message descriptor>.extensions_by_name[name]
// which was defined previously.
- for (int i = 0; i < message_descriptor->extension_count(); ++i) {
- const google::protobuf::FieldDescriptor* field = message_descriptor->extension(i);
+ for (int i = 0; i < descriptor->extension_count(); ++i) {
+ const google::protobuf::FieldDescriptor* field = descriptor->extension(i);
ScopedPyObjectPtr extension_field(PyFieldDescriptor_FromDescriptor(field));
if (extension_field == NULL) {
return -1;
@@ -258,14 +261,14 @@
}
// Check dict['DESCRIPTOR']
- PyObject* descriptor = PyDict_GetItem(dict, kDESCRIPTOR);
- if (descriptor == NULL) {
+ PyObject* py_descriptor = PyDict_GetItem(dict, kDESCRIPTOR);
+ if (py_descriptor == NULL) {
PyErr_SetString(PyExc_TypeError, "Message class has no DESCRIPTOR");
return NULL;
}
- if (!PyObject_TypeCheck(descriptor, &PyMessageDescriptor_Type)) {
+ if (!PyObject_TypeCheck(py_descriptor, &PyMessageDescriptor_Type)) {
PyErr_Format(PyExc_TypeError, "Expected a message Descriptor, got %s",
- descriptor->ob_type->tp_name);
+ py_descriptor->ob_type->tp_name);
return NULL;
}
@@ -291,14 +294,28 @@
}
// Cache the descriptor, both as Python object and as C++ pointer.
- const Descriptor* message_descriptor =
- PyMessageDescriptor_AsDescriptor(descriptor);
- if (message_descriptor == NULL) {
+ const Descriptor* descriptor =
+ PyMessageDescriptor_AsDescriptor(py_descriptor);
+ if (descriptor == NULL) {
return NULL;
}
- Py_INCREF(descriptor);
- newtype->py_message_descriptor = descriptor;
- newtype->message_descriptor = message_descriptor;
+ Py_INCREF(py_descriptor);
+ newtype->py_message_descriptor = py_descriptor;
+ newtype->message_descriptor = descriptor;
+ // TODO(amauryfa): Don't always use the canonical pool of the descriptor,
+ // use the MessageFactory optionally passed in the class dict.
+ newtype->py_descriptor_pool = GetDescriptorPool_FromPool(
+ descriptor->file()->pool());
+ if (newtype->py_descriptor_pool == NULL) {
+ return NULL;
+ }
+ Py_INCREF(newtype->py_descriptor_pool);
+
+ // Add the message to the DescriptorPool.
+ if (cdescriptor_pool::RegisterMessageClass(newtype->py_descriptor_pool,
+ descriptor, result) < 0) {
+ return NULL;
+ }
// Continue with type initialization: add other descriptors, enum values...
if (AddDescriptors(result, descriptor) < 0) {
@@ -309,6 +326,7 @@
static void Dealloc(PyMessageMeta *self) {
Py_DECREF(self->py_message_descriptor);
+ Py_DECREF(self->py_descriptor_pool);
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
}
@@ -381,12 +399,20 @@
message_meta::New, // tp_new
};
-static const Descriptor* GetMessageDescriptor(PyTypeObject* cls) {
+static PyMessageMeta* CheckMessageClass(PyTypeObject* cls) {
if (!PyObject_TypeCheck(cls, &PyMessageMeta_Type)) {
PyErr_Format(PyExc_TypeError, "Class %s is not a Message", cls->tp_name);
return NULL;
}
- return reinterpret_cast<PyMessageMeta*>(cls)->message_descriptor;
+ return reinterpret_cast<PyMessageMeta*>(cls);
+}
+
+static const Descriptor* GetMessageDescriptor(PyTypeObject* cls) {
+ PyMessageMeta* type = CheckMessageClass(cls);
+ if (type == NULL) {
+ return NULL;
+ }
+ return type->message_descriptor;
}
// Forward declarations
@@ -723,6 +749,17 @@
namespace cmessage {
+PyDescriptorPool* GetDescriptorPoolForMessage(CMessage* message) {
+ // No need to check the type: the type of instances of CMessage is always
+ // an instance of PyMessageMeta. Let's prove it with a debug-only check.
+ GOOGLE_DCHECK(PyObject_TypeCheck(message, &CMessage_Type));
+ return reinterpret_cast<PyMessageMeta*>(Py_TYPE(message))->py_descriptor_pool;
+}
+
+MessageFactory* GetFactoryForMessage(CMessage* message) {
+ return GetDescriptorPoolForMessage(message)->message_factory;
+}
+
static int MaybeReleaseOverlappingOneofField(
CMessage* cmessage,
const FieldDescriptor* field) {
@@ -773,7 +810,7 @@
return NULL;
}
return reflection->MutableMessage(
- parent_message, parent_field, GetDescriptorPool()->message_factory);
+ parent_message, parent_field, GetFactoryForMessage(parent));
}
struct FixupMessageReference : public ChildVisitor {
@@ -814,10 +851,7 @@
// If parent is NULL but we are trying to modify a read-only message, this
// is a reference to a constant default instance that needs to be replaced
// with a mutable top-level message.
- const Message* prototype =
- GetDescriptorPool()->message_factory->GetPrototype(
- self->message->GetDescriptor());
- self->message = prototype->New();
+ self->message = self->message->New();
self->owner.reset(self->message);
// Cascade the new owner to eventual children: even if this message is
// empty, some submessages or repeated containers might exist already.
@@ -1190,15 +1224,19 @@
// The __new__ method of Message classes.
// Creates a new C++ message and takes ownership.
-static PyObject* New(PyTypeObject* type,
+static PyObject* New(PyTypeObject* cls,
PyObject* unused_args, PyObject* unused_kwargs) {
+ PyMessageMeta* type = CheckMessageClass(cls);
+ if (type == NULL) {
+ return NULL;
+ }
// Retrieve the message descriptor and the default instance (=prototype).
- const Descriptor* message_descriptor = GetMessageDescriptor(type);
+ const Descriptor* message_descriptor = type->message_descriptor;
if (message_descriptor == NULL) {
return NULL;
}
- const Message* default_message =
- GetDescriptorPool()->message_factory->GetPrototype(message_descriptor);
+ const Message* default_message = type->py_descriptor_pool->message_factory
+ ->GetPrototype(message_descriptor);
if (default_message == NULL) {
PyErr_SetString(PyExc_TypeError, message_descriptor->full_name().c_str());
return NULL;
@@ -1528,7 +1566,7 @@
Message* ReleaseMessage(CMessage* self,
const Descriptor* descriptor,
const FieldDescriptor* field_descriptor) {
- MessageFactory* message_factory = GetDescriptorPool()->message_factory;
+ MessageFactory* message_factory = GetFactoryForMessage(self);
Message* released_message = self->message->GetReflection()->ReleaseMessage(
self->message, field_descriptor, message_factory);
// ReleaseMessage will return NULL which differs from
@@ -1883,8 +1921,8 @@
AssureWritable(self);
io::CodedInputStream input(
reinterpret_cast<const uint8*>(data), data_length);
- input.SetExtensionRegistry(GetDescriptorPool()->pool,
- GetDescriptorPool()->message_factory);
+ PyDescriptorPool* pool = GetDescriptorPoolForMessage(self);
+ input.SetExtensionRegistry(pool->pool, pool->message_factory);
bool success = self->message->MergePartialFromCodedStream(&input);
if (success) {
return PyInt_FromLong(input.CurrentPosition());
@@ -1907,11 +1945,6 @@
static PyObject* RegisterExtension(PyObject* cls,
PyObject* extension_handle) {
- ScopedPyObjectPtr message_descriptor(PyObject_GetAttr(cls, kDESCRIPTOR));
- if (message_descriptor == NULL) {
- return NULL;
- }
-
const FieldDescriptor* descriptor =
GetExtensionDescriptor(extension_handle);
if (descriptor == NULL) {
@@ -1920,13 +1953,6 @@
const Descriptor* cmessage_descriptor = GetMessageDescriptor(
reinterpret_cast<PyTypeObject*>(cls));
- if (cmessage_descriptor != descriptor->containing_type()) {
- if (PyObject_SetAttrString(extension_handle, "containing_type",
- message_descriptor) < 0) {
- return NULL;
- }
- }
-
ScopedPyObjectPtr extensions_by_name(
PyObject_GetAttr(cls, k_extensions_by_name));
if (extensions_by_name == NULL) {
@@ -2050,7 +2076,8 @@
// TODO(amauryfa): consider building the class on the fly!
if (fields[i]->message_type() != NULL &&
cdescriptor_pool::GetMessageClass(
- GetDescriptorPool(), fields[i]->message_type()) == NULL) {
+ GetDescriptorPoolForMessage(self),
+ fields[i]->message_type()) == NULL) {
PyErr_Clear();
continue;
}
@@ -2207,7 +2234,9 @@
message->GetReflection()->GetUnknownFields(*message);
for (int i = 0; i < unknown_field_set.field_count(); ++i) {
if (unknown_field_set.field(i).number() ==
- field_descriptor->number()) {
+ field_descriptor->number() &&
+ unknown_field_set.field(i).type() ==
+ google::protobuf::UnknownField::TYPE_VARINT) {
result = PyInt_FromLong(unknown_field_set.field(i).varint());
break;
}
@@ -2233,11 +2262,12 @@
PyObject* InternalGetSubMessage(
CMessage* self, const FieldDescriptor* field_descriptor) {
const Reflection* reflection = self->message->GetReflection();
+ PyDescriptorPool* pool = GetDescriptorPoolForMessage(self);
const Message& sub_message = reflection->GetMessage(
- *self->message, field_descriptor, GetDescriptorPool()->message_factory);
+ *self->message, field_descriptor, pool->message_factory);
PyObject *message_class = cdescriptor_pool::GetMessageClass(
- GetDescriptorPool(), field_descriptor->message_type());
+ pool, field_descriptor->message_type());
if (message_class == NULL) {
return NULL;
}
@@ -2560,7 +2590,7 @@
const FieldDescriptor* value_type = entry_type->FindFieldByName("value");
if (value_type->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
PyObject* value_class = cdescriptor_pool::GetMessageClass(
- GetDescriptorPool(), value_type->message_type());
+ GetDescriptorPoolForMessage(self), value_type->message_type());
if (value_class == NULL) {
return NULL;
}
@@ -2583,7 +2613,7 @@
PyObject* py_container = NULL;
if (field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
PyObject *message_class = cdescriptor_pool::GetMessageClass(
- GetDescriptorPool(), field_descriptor->message_type());
+ GetDescriptorPoolForMessage(self), field_descriptor->message_type());
if (message_class == NULL) {
return NULL;
}
@@ -2863,6 +2893,14 @@
}
Py_INCREF(mutable_mapping);
+#if PY_MAJOR_VERSION >= 3
+ PyObject* bases = PyTuple_New(1);
+ PyTuple_SET_ITEM(bases, 0, mutable_mapping.get());
+
+ ScalarMapContainer_Type =
+ PyType_FromSpecWithBases(&ScalarMapContainer_Type_spec, bases);
+ PyModule_AddObject(m, "ScalarMapContainer", ScalarMapContainer_Type);
+#else
ScalarMapContainer_Type.tp_base =
reinterpret_cast<PyTypeObject*>(mutable_mapping.get());
@@ -2872,6 +2910,7 @@
PyModule_AddObject(m, "ScalarMapContainer",
reinterpret_cast<PyObject*>(&ScalarMapContainer_Type));
+#endif
if (PyType_Ready(&ScalarMapIterator_Type) < 0) {
return false;
@@ -2880,6 +2919,12 @@
PyModule_AddObject(m, "ScalarMapIterator",
reinterpret_cast<PyObject*>(&ScalarMapIterator_Type));
+
+#if PY_MAJOR_VERSION >= 3
+ MessageMapContainer_Type =
+ PyType_FromSpecWithBases(&MessageMapContainer_Type_spec, bases);
+ PyModule_AddObject(m, "MessageMapContainer", MessageMapContainer_Type);
+#else
Py_INCREF(mutable_mapping);
MessageMapContainer_Type.tp_base =
reinterpret_cast<PyTypeObject*>(mutable_mapping.get());
@@ -2890,6 +2935,7 @@
PyModule_AddObject(m, "MessageMapContainer",
reinterpret_cast<PyObject*>(&MessageMapContainer_Type));
+#endif
if (PyType_Ready(&MessageMapIterator_Type) < 0) {
return false;
@@ -2908,9 +2954,10 @@
// Expose the DescriptorPool used to hold all descriptors added from generated
// pb2.py files.
- Py_INCREF(GetDescriptorPool()); // PyModule_AddObject steals a reference.
- PyModule_AddObject(
- m, "default_pool", reinterpret_cast<PyObject*>(GetDescriptorPool()));
+ // PyModule_AddObject steals a reference.
+ Py_INCREF(GetDefaultDescriptorPool());
+ PyModule_AddObject(m, "default_pool",
+ reinterpret_cast<PyObject*>(GetDefaultDescriptorPool()));
// This implementation provides full Descriptor types, we advertise it so that
// descriptor.py can use them in replacement of the Python classes.
diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h
index f147d43..1ff82e2 100644
--- a/python/google/protobuf/pyext/message.h
+++ b/python/google/protobuf/pyext/message.h
@@ -49,12 +49,15 @@
class Reflection;
class FieldDescriptor;
class Descriptor;
+class DescriptorPool;
+class MessageFactory;
using internal::shared_ptr;
namespace python {
struct ExtensionDict;
+struct PyDescriptorPool;
typedef struct CMessage {
PyObject_HEAD;
@@ -220,6 +223,16 @@
int SetOwner(CMessage* self, const shared_ptr<Message>& new_owner);
int AssureWritable(CMessage* self);
+
+// Returns the "best" DescriptorPool for the given message.
+// This is often equivalent to message.DESCRIPTOR.pool, but not always, when
+// the message class was created from a MessageFactory using a custom pool which
+// uses the generated pool as an underlay.
+//
+// The returned pool is suitable for finding fields and building submessages,
+// even in the case of extensions.
+PyDescriptorPool* GetDescriptorPoolForMessage(CMessage* message);
+
} // namespace cmessage
diff --git a/python/google/protobuf/pyext/message_map_container.cc b/python/google/protobuf/pyext/message_map_container.cc
index a4a7fbf..f54d201 100644
--- a/python/google/protobuf/pyext/message_map_container.cc
+++ b/python/google/protobuf/pyext/message_map_container.cc
@@ -84,7 +84,12 @@
return NULL;
}
+#if PY_MAJOR_VERSION >= 3
+ PyObject* obj = PyType_GenericAlloc(
+ reinterpret_cast<PyTypeObject *>(MessageMapContainer_Type), 0);
+#else
PyObject* obj = PyType_GenericAlloc(&MessageMapContainer_Type, 0);
+#endif
if (obj == NULL) {
return PyErr_Format(PyExc_RuntimeError,
"Could not allocate new container.");
@@ -458,44 +463,67 @@
} // namespace message_map_iterator
-PyTypeObject MessageMapContainer_Type = {
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
- FULL_MODULE_NAME ".MessageMapContainer", // tp_name
- sizeof(MessageMapContainer), // tp_basicsize
- 0, // tp_itemsize
- message_map_container::Dealloc, // tp_dealloc
- 0, // tp_print
- 0, // tp_getattr
- 0, // tp_setattr
- 0, // tp_compare
- 0, // tp_repr
- 0, // tp_as_number
- 0, // tp_as_sequence
- &message_map_container::MpMethods, // tp_as_mapping
- 0, // tp_hash
- 0, // tp_call
- 0, // tp_str
- 0, // tp_getattro
- 0, // tp_setattro
- 0, // tp_as_buffer
- Py_TPFLAGS_DEFAULT, // tp_flags
- "A map container for message", // tp_doc
- 0, // tp_traverse
- 0, // tp_clear
- 0, // tp_richcompare
- 0, // tp_weaklistoffset
- message_map_container::GetIterator, // tp_iter
- 0, // tp_iternext
- message_map_container::Methods, // tp_methods
- 0, // tp_members
- 0, // tp_getset
- 0, // tp_base
- 0, // tp_dict
- 0, // tp_descr_get
- 0, // tp_descr_set
- 0, // tp_dictoffset
- 0, // tp_init
-};
+#if PY_MAJOR_VERSION >= 3
+ static PyType_Slot MessageMapContainer_Type_slots[] = {
+ {Py_tp_dealloc, (void *)message_map_container::Dealloc},
+ {Py_mp_length, (void *)message_map_container::Length},
+ {Py_mp_subscript, (void *)message_map_container::GetItem},
+ {Py_mp_ass_subscript, (void *)message_map_container::SetItem},
+ {Py_tp_methods, (void *)message_map_container::Methods},
+ {Py_tp_iter, (void *)message_map_container::GetIterator},
+ {0, 0}
+ };
+
+ PyType_Spec MessageMapContainer_Type_spec = {
+ FULL_MODULE_NAME ".MessageMapContainer",
+ sizeof(MessageMapContainer),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ MessageMapContainer_Type_slots
+ };
+
+ PyObject *MessageMapContainer_Type;
+
+#else
+ PyTypeObject MessageMapContainer_Type = {
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ FULL_MODULE_NAME ".MessageMapContainer", // tp_name
+ sizeof(MessageMapContainer), // tp_basicsize
+ 0, // tp_itemsize
+ message_map_container::Dealloc, // tp_dealloc
+ 0, // tp_print
+ 0, // tp_getattr
+ 0, // tp_setattr
+ 0, // tp_compare
+ 0, // tp_repr
+ 0, // tp_as_number
+ 0, // tp_as_sequence
+ &message_map_container::MpMethods, // tp_as_mapping
+ 0, // tp_hash
+ 0, // tp_call
+ 0, // tp_str
+ 0, // tp_getattro
+ 0, // tp_setattro
+ 0, // tp_as_buffer
+ Py_TPFLAGS_DEFAULT, // tp_flags
+ "A map container for message", // tp_doc
+ 0, // tp_traverse
+ 0, // tp_clear
+ 0, // tp_richcompare
+ 0, // tp_weaklistoffset
+ message_map_container::GetIterator, // tp_iter
+ 0, // tp_iternext
+ message_map_container::Methods, // tp_methods
+ 0, // tp_members
+ 0, // tp_getset
+ 0, // tp_base
+ 0, // tp_dict
+ 0, // tp_descr_get
+ 0, // tp_descr_set
+ 0, // tp_dictoffset
+ 0, // tp_init
+ };
+#endif
PyTypeObject MessageMapIterator_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
diff --git a/python/google/protobuf/pyext/message_map_container.h b/python/google/protobuf/pyext/message_map_container.h
index 4ca0aec..8286ba8 100644
--- a/python/google/protobuf/pyext/message_map_container.h
+++ b/python/google/protobuf/pyext/message_map_container.h
@@ -89,7 +89,12 @@
uint64 version;
};
-extern PyTypeObject MessageMapContainer_Type;
+#if PY_MAJOR_VERSION >= 3
+ extern PyObject *MessageMapContainer_Type;
+ extern PyType_Spec MessageMapContainer_Type_spec;
+#else
+ extern PyTypeObject MessageMapContainer_Type;
+#endif
extern PyTypeObject MessageMapIterator_Type;
namespace message_map_container {
diff --git a/python/google/protobuf/pyext/scalar_map_container.cc b/python/google/protobuf/pyext/scalar_map_container.cc
index 80d2942..a355edb 100644
--- a/python/google/protobuf/pyext/scalar_map_container.cc
+++ b/python/google/protobuf/pyext/scalar_map_container.cc
@@ -83,7 +83,12 @@
return NULL;
}
+#if PY_MAJOR_VERSION >= 3
+ ScopedPyObjectPtr obj(PyType_GenericAlloc(
+ reinterpret_cast<PyTypeObject *>(ScalarMapContainer_Type), 0));
+#else
ScopedPyObjectPtr obj(PyType_GenericAlloc(&ScalarMapContainer_Type, 0));
+#endif
if (obj.get() == NULL) {
return PyErr_Format(PyExc_RuntimeError,
"Could not allocate new container.");
@@ -432,44 +437,66 @@
} // namespace scalar_map_iterator
-PyTypeObject ScalarMapContainer_Type = {
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
- FULL_MODULE_NAME ".ScalarMapContainer", // tp_name
- sizeof(ScalarMapContainer), // tp_basicsize
- 0, // tp_itemsize
- scalar_map_container::Dealloc, // tp_dealloc
- 0, // tp_print
- 0, // tp_getattr
- 0, // tp_setattr
- 0, // tp_compare
- 0, // tp_repr
- 0, // tp_as_number
- 0, // tp_as_sequence
- &scalar_map_container::MpMethods, // tp_as_mapping
- 0, // tp_hash
- 0, // tp_call
- 0, // tp_str
- 0, // tp_getattro
- 0, // tp_setattro
- 0, // tp_as_buffer
- Py_TPFLAGS_DEFAULT, // tp_flags
- "A scalar map container", // tp_doc
- 0, // tp_traverse
- 0, // tp_clear
- 0, // tp_richcompare
- 0, // tp_weaklistoffset
- scalar_map_container::GetIterator, // tp_iter
- 0, // tp_iternext
- scalar_map_container::Methods, // tp_methods
- 0, // tp_members
- 0, // tp_getset
- 0, // tp_base
- 0, // tp_dict
- 0, // tp_descr_get
- 0, // tp_descr_set
- 0, // tp_dictoffset
- 0, // tp_init
-};
+
+#if PY_MAJOR_VERSION >= 3
+ static PyType_Slot ScalarMapContainer_Type_slots[] = {
+ {Py_tp_dealloc, (void *)scalar_map_container::Dealloc},
+ {Py_mp_length, (void *)scalar_map_container::Length},
+ {Py_mp_subscript, (void *)scalar_map_container::GetItem},
+ {Py_mp_ass_subscript, (void *)scalar_map_container::SetItem},
+ {Py_tp_methods, (void *)scalar_map_container::Methods},
+ {Py_tp_iter, (void *)scalar_map_container::GetIterator},
+ {0, 0},
+ };
+
+ PyType_Spec ScalarMapContainer_Type_spec = {
+ FULL_MODULE_NAME ".ScalarMapContainer",
+ sizeof(ScalarMapContainer),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ ScalarMapContainer_Type_slots
+ };
+ PyObject *ScalarMapContainer_Type;
+#else
+ PyTypeObject ScalarMapContainer_Type = {
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ FULL_MODULE_NAME ".ScalarMapContainer", // tp_name
+ sizeof(ScalarMapContainer), // tp_basicsize
+ 0, // tp_itemsize
+ scalar_map_container::Dealloc, // tp_dealloc
+ 0, // tp_print
+ 0, // tp_getattr
+ 0, // tp_setattr
+ 0, // tp_compare
+ 0, // tp_repr
+ 0, // tp_as_number
+ 0, // tp_as_sequence
+ &scalar_map_container::MpMethods, // tp_as_mapping
+ 0, // tp_hash
+ 0, // tp_call
+ 0, // tp_str
+ 0, // tp_getattro
+ 0, // tp_setattro
+ 0, // tp_as_buffer
+ Py_TPFLAGS_DEFAULT, // tp_flags
+ "A scalar map container", // tp_doc
+ 0, // tp_traverse
+ 0, // tp_clear
+ 0, // tp_richcompare
+ 0, // tp_weaklistoffset
+ scalar_map_container::GetIterator, // tp_iter
+ 0, // tp_iternext
+ scalar_map_container::Methods, // tp_methods
+ 0, // tp_members
+ 0, // tp_getset
+ 0, // tp_base
+ 0, // tp_dict
+ 0, // tp_descr_get
+ 0, // tp_descr_set
+ 0, // tp_dictoffset
+ 0, // tp_init
+ };
+#endif
PyTypeObject ScalarMapIterator_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
diff --git a/python/google/protobuf/pyext/scalar_map_container.h b/python/google/protobuf/pyext/scalar_map_container.h
index 254e6e9..aded8d4 100644
--- a/python/google/protobuf/pyext/scalar_map_container.h
+++ b/python/google/protobuf/pyext/scalar_map_container.h
@@ -83,7 +83,12 @@
uint64 version;
};
-extern PyTypeObject ScalarMapContainer_Type;
+#if PY_MAJOR_VERSION >= 3
+ extern PyObject *ScalarMapContainer_Type;
+ extern PyType_Spec ScalarMapContainer_Type_spec;
+#else
+ extern PyTypeObject ScalarMapContainer_Type;
+#endif
extern PyTypeObject ScalarMapIterator_Type;
namespace scalar_map_container {
diff --git a/python/google/protobuf/symbol_database.py b/python/google/protobuf/symbol_database.py
index 4c70b39..b81ef4d 100644
--- a/python/google/protobuf/symbol_database.py
+++ b/python/google/protobuf/symbol_database.py
@@ -60,6 +60,7 @@
"""
+from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool
@@ -72,6 +73,31 @@
buffer types used within a program.
"""
+ # pylint: disable=protected-access
+ if _descriptor._USE_C_DESCRIPTORS:
+
+ def __new__(cls):
+ raise TypeError("Instances of SymbolDatabase cannot be created")
+
+ @classmethod
+ def _CreateDefaultDatabase(cls):
+ self = object.__new__(cls) # Bypass the __new__ above.
+ # Don't call __init__() and initialize here.
+ self._symbols = {}
+ self._symbols_by_file = {}
+ # As of today all descriptors are registered and retrieved from
+ # _message.default_pool (see FileDescriptor.__new__), so it's not
+ # necessary to use another pool.
+ self.pool = _descriptor._message.default_pool
+ return self
+ # pylint: enable=protected-access
+
+ else:
+
+ @classmethod
+ def _CreateDefaultDatabase(cls):
+ return cls()
+
def __init__(self):
"""Constructor."""
@@ -177,7 +203,7 @@
result.update(self._symbols_by_file[f])
return result
-_DEFAULT = SymbolDatabase()
+_DEFAULT = SymbolDatabase._CreateDefaultDatabase()
def Default():
diff --git a/python/google/protobuf/text_encoding.py b/python/google/protobuf/text_encoding.py
index a0728e3..9899563 100644
--- a/python/google/protobuf/text_encoding.py
+++ b/python/google/protobuf/text_encoding.py
@@ -27,6 +27,7 @@
# 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.
+
"""Encoding related utilities."""
import re
diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py
index 1399223..e4fadf0 100755
--- a/python/google/protobuf/text_format.py
+++ b/python/google/protobuf/text_format.py
@@ -28,9 +28,17 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Copyright 2007 Google Inc. All Rights Reserved.
+"""Contains routines for printing protocol messages in text format.
-"""Contains routines for printing protocol messages in text format."""
+Simple usage example:
+
+ # Create a proto object and serialize it to a text proto string.
+ message = my_proto_pb2.MyMessage(foo='bar')
+ text_proto = text_format.MessageToString(message)
+
+ # Parse a text proto string.
+ message = text_format.Parse(text_proto, my_proto_pb2.MyMessage())
+"""
__author__ = 'kenton@google.com (Kenton Varda)'
diff --git a/python/google/protobuf/util/__init__.py b/python/google/protobuf/util/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/python/google/protobuf/util/__init__.py
diff --git a/python/setup.py b/python/setup.py
index 8269c4a..cda5686 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -88,6 +88,7 @@
generate_proto("../src/google/protobuf/unittest_mset_wire_format.proto", False)
generate_proto("../src/google/protobuf/unittest_no_generic_services.proto", False)
generate_proto("../src/google/protobuf/unittest_proto3_arena.proto", False)
+ generate_proto("../src/google/protobuf/util/json_format_proto3.proto", False)
generate_proto("google/protobuf/internal/descriptor_pool_test1.proto", False)
generate_proto("google/protobuf/internal/descriptor_pool_test2.proto", False)
generate_proto("google/protobuf/internal/factory_test1.proto", False)
@@ -122,6 +123,16 @@
# Generate necessary .proto file if it doesn't exist.
generate_proto("../src/google/protobuf/descriptor.proto")
generate_proto("../src/google/protobuf/compiler/plugin.proto")
+ generate_proto("../src/google/protobuf/any.proto")
+ generate_proto("../src/google/protobuf/api.proto")
+ generate_proto("../src/google/protobuf/duration.proto")
+ generate_proto("../src/google/protobuf/empty.proto")
+ generate_proto("../src/google/protobuf/field_mask.proto")
+ generate_proto("../src/google/protobuf/source_context.proto")
+ generate_proto("../src/google/protobuf/struct.proto")
+ generate_proto("../src/google/protobuf/timestamp.proto")
+ generate_proto("../src/google/protobuf/type.proto")
+ generate_proto("../src/google/protobuf/wrappers.proto")
GenerateUnittestProtos()
# Make sure google.protobuf/** are valid packages.
diff --git a/python/tox.ini b/python/tox.ini
index d010075..1c433fa 100644
--- a/python/tox.ini
+++ b/python/tox.ini
@@ -2,8 +2,8 @@
envlist =
# cpp implementation on py34 is currently broken due to
# changes introduced by http://bugs.python.org/issue22079.
- #py{26,27,33,34}-{cpp,python}
- py{26,27,33}-{cpp,python}, py34-{python}
+ # py26 is currently broken due to the json_format
+ py{27,33,34}-{cpp,python}
[testenv]
usedevelop=true
diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock
index 91e1666..8599da7 100644
--- a/ruby/Gemfile.lock
+++ b/ruby/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- google-protobuf (3.0.0.alpha.4)
+ google-protobuf (3.0.0.alpha.4.0)
GEM
remote: https://rubygems.org/
@@ -23,3 +23,6 @@
rake-compiler
rubygems-tasks
test-unit
+
+BUNDLED WITH
+ 1.10.6
diff --git a/ruby/ext/google/protobuf_c/encode_decode.c b/ruby/ext/google/protobuf_c/encode_decode.c
index df4feac..1c48281 100644
--- a/ruby/ext/google/protobuf_c/encode_decode.c
+++ b/ruby/ext/google/protobuf_c/encode_decode.c
@@ -35,11 +35,13 @@
// For more information, see:
// https://bugs.ruby-lang.org/issues/11328
VALUE noleak_rb_str_cat(VALUE rb_str, const char *str, long len) {
+ char *p;
size_t oldlen = RSTRING_LEN(rb_str);
rb_str_modify_expand(rb_str, len);
- char *p = RSTRING_PTR(rb_str);
+ p = RSTRING_PTR(rb_str);
memcpy(p + oldlen, str, len);
rb_str_set_len(rb_str, oldlen + len);
+ return rb_str;
}
// -----------------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index caae293..2985b5d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -434,6 +434,8 @@
google/protobuf/compiler/objectivec/objectivec_primitive_field.h \
google/protobuf/compiler/python/python_generator.cc \
google/protobuf/compiler/ruby/ruby_generator.cc \
+ google/protobuf/compiler/csharp/csharp_doc_comment.cc \
+ google/protobuf/compiler/csharp/csharp_doc_comment.h \
google/protobuf/compiler/csharp/csharp_enum.cc \
google/protobuf/compiler/csharp/csharp_enum.h \
google/protobuf/compiler/csharp/csharp_enum_field.cc \
diff --git a/src/google/protobuf/any.cc b/src/google/protobuf/any.cc
index c6ed37a..7351d37 100644
--- a/src/google/protobuf/any.cc
+++ b/src/google/protobuf/any.cc
@@ -43,6 +43,7 @@
const char kAnyFullTypeName[] = "google.protobuf.Any";
const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/";
+const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/";
AnyMetadata::AnyMetadata(UrlType* type_url, ValueType* value)
: type_url_(type_url), value_(value) {
@@ -70,11 +71,17 @@
}
bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) {
- const int prefix_len = strlen(kTypeGoogleApisComPrefix);
- if (strncmp(type_url.c_str(), kTypeGoogleApisComPrefix, prefix_len) == 0) {
- full_type_name->assign(type_url.data() + prefix_len,
- type_url.size() - prefix_len);
- return true;
+ static const char* prefix[] = {
+ kTypeGoogleApisComPrefix,
+ kTypeGoogleProdComPrefix
+ };
+ for (int i = 0; i < 2; i++) {
+ const int prefix_len = strlen(prefix[i]);
+ if (strncmp(type_url.c_str(), prefix[i], prefix_len) == 0) {
+ full_type_name->assign(type_url.data() + prefix_len,
+ type_url.size() - prefix_len);
+ return true;
+ }
}
return false;
}
diff --git a/src/google/protobuf/any.h b/src/google/protobuf/any.h
index 7eeb6b7..f760ad5 100644
--- a/src/google/protobuf/any.h
+++ b/src/google/protobuf/any.h
@@ -70,6 +70,7 @@
extern const char kAnyFullTypeName[]; // "google.protobuf.Any".
extern const char kTypeGoogleApisComPrefix[]; // "type.googleapis.com/".
+extern const char kTypeGoogleProdComPrefix[]; // "type.googleprod.com/".
// Get the proto type name from Any::type_url value. For example, passing
// "type.googleapis.com/rpc.QueryOrigin" will return "rpc.QueryOrigin" in
diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc
index 907a6a2..cd0b21a 100755
--- a/src/google/protobuf/arena.cc
+++ b/src/google/protobuf/arena.cc
@@ -38,17 +38,17 @@
namespace protobuf {
google::protobuf::internal::SequenceNumber Arena::lifecycle_id_generator_;
-#ifdef PROTOBUF_USE_DLLS
-Arena::ThreadCache& Arena::thread_cache() {
- static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = { -1, NULL };
- return thread_cache_;
-}
-#elif defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
+#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
Arena::ThreadCache& Arena::thread_cache() {
static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ =
new internal::ThreadLocalStorage<ThreadCache>();
return *thread_cache_->Get();
}
+#elif defined(PROTOBUF_USE_DLLS)
+Arena::ThreadCache& Arena::thread_cache() {
+ static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = { -1, NULL };
+ return thread_cache_;
+}
#else
GOOGLE_THREAD_LOCAL Arena::ThreadCache Arena::thread_cache_ = { -1, NULL };
#endif
@@ -61,6 +61,9 @@
cleanup_list_ = 0;
if (options_.initial_block != NULL && options_.initial_block_size > 0) {
+ GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block))
+ << ": Initial block size too small for header.";
+
// Add first unowned block to list.
Block* first_block = reinterpret_cast<Block*>(options_.initial_block);
first_block->size = options_.initial_block_size;
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index 074a9e5..16e0d50 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -38,7 +38,16 @@
#if __cplusplus >= 201103L
#include <google/protobuf/stubs/type_traits.h>
#endif
+#if defined(_MSC_VER) && !_HAS_EXCEPTIONS
+// Work around bugs in MSVC <typeinfo> header when _HAS_EXCEPTIONS=0.
+#include <exception>
#include <typeinfo>
+namespace std {
+using type_info = ::type_info;
+}
+#else
+#include <typeinfo>
+#endif
#include <google/protobuf/stubs/atomic_sequence_num.h>
#include <google/protobuf/stubs/atomicops.h>
@@ -533,15 +542,15 @@
static const size_t kHeaderSize = sizeof(Block);
static google::protobuf::internal::SequenceNumber lifecycle_id_generator_;
-#ifdef PROTOBUF_USE_DLLS
- // Thread local variables cannot be exposed through DLL interface but we can
- // wrap them in static functions.
- static ThreadCache& thread_cache();
-#elif defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
+#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
// Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread
// local storage class we implemented.
// iOS also does not support the GOOGLE_THREAD_LOCAL keyword.
static ThreadCache& thread_cache();
+#elif defined(PROTOBUF_USE_DLLS)
+ // Thread local variables cannot be exposed through DLL interface but we can
+ // wrap them in static functions.
+ static ThreadCache& thread_cache();
#else
static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_;
static ThreadCache& thread_cache() { return thread_cache_; }
@@ -581,11 +590,13 @@
template<typename U>
static double DestructorSkippable(...);
+ // The raw_skippable_value const bool variable is separated from the typedef
+ // line below as a work-around of an NVCC 7.0 (and earlier) compiler bug.
+ static const bool raw_skippable_value =
+ sizeof(DestructorSkippable<const T>(static_cast<const T*>(0))) ==
+ sizeof(char) || google::protobuf::internal::has_trivial_destructor<T>::value == true;
// This will resolve to either google::protobuf::internal::true_type or google::protobuf::internal::false_type.
- typedef google::protobuf::internal::integral_constant<bool,
- sizeof(DestructorSkippable<const T>(static_cast<const T*>(0))) ==
- sizeof(char) || google::protobuf::internal::has_trivial_destructor<T>::value == true>
- type;
+ typedef google::protobuf::internal::integral_constant<bool, raw_skippable_value> type;
static const type value;
};
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index c9ca1fd..6b67f44 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -362,7 +362,7 @@
Arena arena;
TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
arena_message->mutable_optional_nested_message()->set_bb(118);
- scoped_ptr<TestAllTypes::NestedMessage> nested(
+ google::protobuf::scoped_ptr<TestAllTypes::NestedMessage> nested(
arena_message->release_optional_nested_message());
EXPECT_EQ(118, nested->bb());
@@ -383,7 +383,7 @@
Arena arena;
TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
arena_message->set_optional_string("hello");
- scoped_ptr<string> released_str(
+ google::protobuf::scoped_ptr<string> released_str(
arena_message->release_optional_string());
EXPECT_EQ("hello", *released_str);
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc
index 18102f4..fa792da 100644
--- a/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -63,13 +63,13 @@
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-namespace google {
-namespace protobuf {
-namespace compiler {
// Disable the whole test when we use tcmalloc for "draconian" heap checks, in
// which case tcmalloc will print warnings that fail the plugin tests.
#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN
+namespace google {
+namespace protobuf {
+namespace compiler {
#if defined(_WIN32)
#ifndef STDIN_FILENO
@@ -1802,8 +1802,8 @@
} // anonymous namespace
-#endif // !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN
-
} // namespace compiler
} // namespace protobuf
+
+#endif // !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN
} // namespace google
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 5dae4cd..8e8bd8b 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -598,8 +598,13 @@
// bytes in length". Declare a static array of characters rather than use a
// string literal.
if (breakdown_large_file && file_data.size() > 65535) {
+ // This has to be explicitly marked as a signed char because the generated
+ // code puts negative values in the array, and sometimes plain char is
+ // unsigned. That implicit narrowing conversion is not allowed in C++11.
+ // <http://stackoverflow.com/questions/4434140/narrowing-conversions-in-c0x-is-it-just-me-or-does-this-sound-like-a-breakin>
+ // has details on why.
printer->Print(
- "static const char descriptor[] = {\n");
+ "static const signed char descriptor[] = {\n");
printer->Indent();
// Only write 25 bytes per line.
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index 25acc61..e5e2f07 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -66,7 +66,7 @@
(*variables)["wrapper"] = "EntryWrapper";
break;
case FieldDescriptor::CPPTYPE_ENUM:
- (*variables)["val_cpp"] = ClassName(val->enum_type(), false);
+ (*variables)["val_cpp"] = ClassName(val->enum_type(), true);
(*variables)["wrapper"] = "EnumEntryWrapper";
break;
default:
@@ -200,7 +200,7 @@
case FieldDescriptor::CPPTYPE_ENUM:
printer->Print(variables_,
"(*mutable_$name$())[entry->key()] =\n"
- " static_cast<$val_cpp$>(*entry->mutable_value());\n");
+ " static_cast< $val_cpp$ >(*entry->mutable_value());\n");
break;
default:
printer->Print(variables_,
@@ -215,7 +215,7 @@
" DO_(entry->ParseFromString(data));\n"
" if ($val_cpp$_IsValid(*entry->mutable_value())) {\n"
" (*mutable_$name$())[entry->key()] =\n"
- " static_cast<$val_cpp$>(*entry->mutable_value());\n"
+ " static_cast< $val_cpp$ >(*entry->mutable_value());\n"
" } else {\n");
if (HasDescriptorMethods(descriptor_->file())) {
printer->Print(variables_,
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index fc1ce96..8cc8c7b 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -350,7 +350,7 @@
(*variables)["val"] = FieldMessageTypeName(val);
break;
case FieldDescriptor::CPPTYPE_ENUM:
- (*variables)["val"] = ClassName(val->enum_type(), false);
+ (*variables)["val"] = ClassName(val->enum_type(), true);
break;
default:
(*variables)["val"] = PrimitiveTypeName(val->cpp_type());
diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_unittest.cc
index b7b6039..9942a34 100644
--- a/src/google/protobuf/compiler/cpp/cpp_unittest.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_unittest.cc
@@ -82,6 +82,7 @@
namespace google {
namespace protobuf {
+using internal::NewPermanentCallback;
namespace compiler {
namespace cpp {
diff --git a/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc b/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
new file mode 100644
index 0000000..9ad2cbb
--- /dev/null
+++ b/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
@@ -0,0 +1,98 @@
+// 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.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace csharp {
+
+// Functions to create C# XML documentation comments.
+// Currently this only includes documentation comments containing text specified as comments
+// in the .proto file; documentation comments generated just from field/message/enum/proto names
+// is inlined in the relevant code. If more control is required, that code can be moved here.
+
+void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) {
+ string comments = location.leading_comments.empty() ?
+ location.trailing_comments : location.leading_comments;
+ if (comments.empty()) {
+ return;
+ }
+ // XML escaping... no need for apostrophes etc as the whole text is going to be a child
+ // node of a summary element, not part of an attribute.
+ comments = StringReplace(comments, "&", "&", true);
+ comments = StringReplace(comments, "<", "<", true);
+ vector<string> lines = Split(comments, "\n");
+ printer->Print("/// <summary>\n");
+ for (std::vector<string>::iterator it = lines.begin(); it != lines.end(); ++it) {
+ printer->Print("/// $line$\n", "line", *it);
+ }
+ printer->Print("/// </summary>\n");
+}
+
+template <typename DescriptorType>
+static void WriteDocCommentBody(
+ io::Printer* printer, const DescriptorType* descriptor) {
+ SourceLocation location;
+ if (descriptor->GetSourceLocation(&location)) {
+ WriteDocCommentBodyImpl(printer, location);
+ }
+}
+
+void WriteMessageDocComment(io::Printer* printer, const Descriptor* message) {
+ WriteDocCommentBody(printer, message);
+}
+
+void WritePropertyDocComment(io::Printer* printer, const FieldDescriptor* field) {
+ WriteDocCommentBody(printer, field);
+}
+
+void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enumDescriptor) {
+ WriteDocCommentBody(printer, enumDescriptor);
+}
+void WriteEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value) {
+ WriteDocCommentBody(printer, value);
+}
+
+void WriteMethodDocComment(io::Printer* printer, const MethodDescriptor* method) {
+ WriteDocCommentBody(printer, method);
+}
+
+} // namespace csharp
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/src/google/protobuf/proto_cast_test.cc b/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
similarity index 66%
rename from src/google/protobuf/proto_cast_test.cc
rename to src/google/protobuf/compiler/csharp/csharp_doc_comment.h
index a8f43ae..75eb0ea 100644
--- a/src/google/protobuf/proto_cast_test.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
@@ -28,33 +28,24 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <google/protobuf/util/proto_cast.h>
-#include <google/protobuf/util/unknown_enum_test.pb.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
+#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_DOC_COMMENT_H__
+#define GOOGLE_PROTOBUF_COMPILER_CSHARP_DOC_COMMENT_H__
+
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.h>
namespace google {
-using google::protobuf::util::UpRevision;
-using google::protobuf::util::DownRevision;
-
-namespace {
-
-TEST(ProtoCastTest, V2KnownValue) {
- UpRevision sender;
- sender.set_value(UpRevision::NONDEFAULT_VALUE);
-
- DownRevision receiver = proto_cast<DownRevision>(sender);
- ASSERT_EQ(DownRevision::NONDEFAULT_VALUE, receiver.value());
-}
-
-TEST(ProtoCastTest, V2UnknownValue) {
- UpRevision sender;
- sender.set_value(UpRevision::NEW_VALUE);
-
- DownRevision receiver = proto_cast<DownRevision>(sender);
- ASSERT_EQ(DownRevision::DEFAULT_VALUE, receiver.value());
-}
-
-} // namespace
+namespace protobuf {
+namespace compiler {
+namespace csharp {
+ void WriteMessageDocComment(io::Printer* printer, const Descriptor* message);
+ void WritePropertyDocComment(io::Printer* printer, const FieldDescriptor* field);
+ void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enumDescriptor);
+ void WriteEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value);
+ void WriteMethodDocComment(io::Printer* printer, const MethodDescriptor* method);
+} // namespace csharp
+} // namespace compiler
+} // namespace protobuf
} // namespace google
+#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_DOC_COMMENT_H__
diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc
index 0e8f983..5668198 100644
--- a/src/google/protobuf/compiler/csharp/csharp_enum.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc
@@ -38,6 +38,7 @@
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_enum.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
@@ -57,13 +58,15 @@
}
void EnumGenerator::Generate(io::Printer* printer) {
+ WriteEnumDocComment(printer, descriptor_);
WriteGeneratedCodeAttributes(printer);
printer->Print("$access_level$ enum $name$ {\n",
"access_level", class_access_level(),
"name", descriptor_->name());
printer->Indent();
for (int i = 0; i < descriptor_->value_count(); i++) {
- printer->Print("$name$ = $number$,\n",
+ WriteEnumValueDocComment(printer, descriptor_->value(i));
+ printer->Print("$name$ = $number$,\n",
"name", descriptor_->value(i)->name(),
"number", SimpleItoa(descriptor_->value(i)->number()));
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc
index e0a6c83..f5ff880 100644
--- a/src/google/protobuf/compiler/csharp/csharp_generator.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc
@@ -36,10 +36,12 @@
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/compiler/csharp/csharp_generator.h>
-#include <google/protobuf/compiler/csharp/csharp_umbrella_class.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
+#include <google/protobuf/compiler/csharp/csharp_names.h>
+#include <google/protobuf/compiler/csharp/csharp_umbrella_class.h>
using google::protobuf::internal::scoped_ptr;
@@ -48,11 +50,6 @@
namespace compiler {
namespace csharp {
-std::string GetOutputFile(const google::protobuf::FileDescriptor* file, const std::string file_extension)
-{
- return GetUmbrellaClassUnqualifiedName(file) + file_extension;
-}
-
void GenerateFile(const google::protobuf::FileDescriptor* file,
io::Printer* printer) {
UmbrellaClassGenerator umbrellaGenerator(file);
@@ -75,16 +72,26 @@
}
std::string file_extension = ".cs";
+ std::string base_namespace = "";
+ bool generate_directories = false;
for (int i = 0; i < options.size(); i++) {
if (options[i].first == "file_extension") {
file_extension = options[i].second;
+ } else if (options[i].first == "base_namespace") {
+ base_namespace = options[i].second;
+ generate_directories = true;
} else {
*error = "Unknown generator option: " + options[i].first;
return false;
}
}
- std::string filename = GetOutputFile(file, file_extension);
+ string filename_error = "";
+ std::string filename = GetOutputFile(file, file_extension, generate_directories, base_namespace, &filename_error);
+ if (filename.empty()) {
+ *error = filename_error;
+ return false;
+ }
scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '$');
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
index 333b491..2264b88 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
@@ -269,6 +269,41 @@
return property_name;
}
+std::string GetOutputFile(
+ const google::protobuf::FileDescriptor* descriptor,
+ const std::string file_extension,
+ const bool generate_directories,
+ const std::string base_namespace,
+ string* error) {
+ string relative_filename = GetUmbrellaClassUnqualifiedName(descriptor) + file_extension;
+ if (!generate_directories) {
+ return relative_filename;
+ }
+ string ns = GetFileNamespace(descriptor);
+ string namespace_suffix = ns;
+ if (!base_namespace.empty()) {
+ // Check that the base_namespace is either equal to or a leading part of
+ // the file namespace. This isn't just a simple prefix; "Foo.B" shouldn't
+ // be regarded as a prefix of "Foo.Bar". The simplest option is to add "."
+ // to both.
+ string extended_ns = ns + ".";
+ if (extended_ns.find(base_namespace + ".") != 0) {
+ *error = "Namespace " + ns + " is not a prefix namespace of base namespace " + base_namespace;
+ return ""; // This will be ignored, because we've set an error.
+ }
+ namespace_suffix = ns.substr(base_namespace.length());
+ if (namespace_suffix.find(".") == 0) {
+ namespace_suffix = namespace_suffix.substr(1);
+ }
+ }
+
+ string namespace_dir = StringReplace(namespace_suffix, ".", "/", true);
+ if (!namespace_dir.empty()) {
+ namespace_dir += "/";
+ }
+ return namespace_dir + relative_filename;
+}
+
// TODO: c&p from Java protoc plugin
// For encodings with fixed sizes, returns that size in bytes. Otherwise
// returns -1.
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.h b/src/google/protobuf/compiler/csharp/csharp_helpers.h
index 4ed17a8..4f393e1 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.h
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.h
@@ -76,8 +76,6 @@
// not including the GetFileNamespace part).
std::string GetUmbrellaClassNestedNamespace(const FileDescriptor* descriptor);
-std::string GetClassName(const Descriptor* descriptor);
-
std::string GetClassName(const EnumDescriptor* descriptor);
std::string GetFieldName(const FieldDescriptor* descriptor);
@@ -101,8 +99,6 @@
std::string FileDescriptorToBase64(const FileDescriptor* descriptor);
-uint FixedMakeTag(const FieldDescriptor* descriptor);
-
FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal);
// Determines whether the given message is a map entry message, i.e. one implicitly created
diff --git a/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/src/google/protobuf/compiler/csharp/csharp_map_field.cc
index f84ad6f..b493495 100644
--- a/src/google/protobuf/compiler/csharp/csharp_map_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_map_field.cc
@@ -38,6 +38,7 @@
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_map_field.h>
@@ -76,6 +77,7 @@
variables_,
", $tag$);\n"
"private readonly pbc::MapField<$key_type_name$, $value_type_name$> $name$_ = new pbc::MapField<$key_type_name$, $value_type_name$>($true_for_wrappers$);\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc
index a71a790..21fbf7e 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_message.cc
@@ -42,6 +42,7 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_enum.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
@@ -101,6 +102,7 @@
vars["class_name"] = class_name();
vars["access_level"] = class_access_level();
+ WriteMessageDocComment(printer, descriptor_);
printer->Print(
"[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n");
WriteGeneratedCodeAttributes(printer);
@@ -152,7 +154,9 @@
// Rats: we lose the debug comment here :(
printer->Print(
+ "/// <summary>Field number for the \"$field_name$\" field.</summary>\n"
"public const int $field_constant_name$ = $index$;\n",
+ "field_name", fieldDescriptor->name(),
"field_constant_name", GetFieldConstantName(fieldDescriptor),
"index", SimpleItoa(fieldDescriptor->number()));
scoped_ptr<FieldGeneratorBase> generator(
@@ -169,6 +173,7 @@
printer->Print(
vars,
"private object $name$_;\n"
+ "/// <summary>Enum of possible cases for the \"$original_name$\" oneof.</summary>\n"
"public enum $property_name$OneofCase {\n");
printer->Indent();
printer->Print("None = 0,\n");
@@ -180,6 +185,7 @@
}
printer->Outdent();
printer->Print("}\n");
+ // TODO: Should we put the oneof .proto comments here? It's unclear exactly where they should go.
printer->Print(
vars,
"private $property_name$OneofCase $name$Case_ = $property_name$OneofCase.None;\n"
@@ -199,8 +205,11 @@
// Nested messages and enums
if (HasNestedGeneratedTypes()) {
- printer->Print("#region Nested types\n"
- "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n");
+ printer->Print(
+ vars,
+ "#region Nested types\n"
+ "/// <summary>Container for nested types declared in the $class_name$ message type.</summary>\n"
+ "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n");
WriteGeneratedCodeAttributes(printer);
printer->Print("public static partial class Types {\n");
printer->Indent();
diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_message_field.cc
index 4f576cd..f81f769 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_message_field.cc
@@ -38,6 +38,7 @@
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_message_field.h>
@@ -61,6 +62,7 @@
printer->Print(
variables_,
"private $type_name$ $name$_;\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
@@ -152,6 +154,7 @@
}
void MessageOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/csharp/csharp_names.h b/src/google/protobuf/compiler/csharp/csharp_names.h
index ccd2e72..23dac1c 100644
--- a/src/google/protobuf/compiler/csharp/csharp_names.h
+++ b/src/google/protobuf/compiler/csharp/csharp_names.h
@@ -72,7 +72,28 @@
// The fully-qualified name of the C# class that provides
// access to the file descriptor. Proto compiler generates
// such class for each .proto file processed.
-std::string GetUmbrellaClassName(const FileDescriptor* descriptor);
+string GetUmbrellaClassName(const FileDescriptor* descriptor);
+
+// Generates output file name for given file descriptor. If generate_directories
+// is true, the output file will be put under directory corresponding to file's
+// namespace. base_namespace can be used to strip some of the top level
+// directories. E.g. for file with namespace "Bar.Foo" and base_namespace="Bar",
+// the resulting file will be put under directory "Foo" (and not "Bar/Foo").
+//
+// Requires:
+// descriptor != NULL
+// error != NULL
+//
+// Returns:
+// The file name to use as output file for given file descriptor. In case
+// of failure, this function will return empty string and error parameter
+// will contain the error message.
+string GetOutputFile(
+ const google::protobuf::FileDescriptor* descriptor,
+ const string file_extension,
+ const bool generate_directories,
+ const string base_namespace,
+ string* error);
} // namespace csharp
} // namespace compiler
diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
index fc043ec..76d5b24 100644
--- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
@@ -38,6 +38,7 @@
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_primitive_field.h>
@@ -68,6 +69,7 @@
printer->Print(
variables_,
"private $type_name$ $name_def_message$;\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
@@ -170,6 +172,7 @@
}
void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
index 625631d..3a11b75 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
@@ -38,6 +38,7 @@
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/wire_format.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_repeated_enum_field.h>
@@ -62,6 +63,7 @@
" = pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x);\n");
printer->Print(variables_,
"private readonly pbc::RepeatedField<$type_name$> $name$_ = new pbc::RepeatedField<$type_name$>();\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
index 7fbab68..fc12fae 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
@@ -37,6 +37,7 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_repeated_message_field.h>
#include <google/protobuf/compiler/csharp/csharp_message_field.h>
@@ -75,6 +76,7 @@
printer->Print(
variables_,
"private readonly pbc::RepeatedField<$type_name$> $name$_ = new pbc::RepeatedField<$type_name$>();\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
index 1163ce7..5fe0b20 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
@@ -38,6 +38,7 @@
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/wire_format.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h>
@@ -62,6 +63,7 @@
" = pb::FieldCodec.For$capitalized_type_name$($tag$);\n");
printer->Print(variables_,
"private readonly pbc::RepeatedField<$type_name$> $name$_ = new pbc::RepeatedField<$type_name$>();\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
index 399c64e..7cf101b 100644
--- a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
@@ -135,7 +135,9 @@
}
printer->Print(
- "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n");
+ "/// <summary>Holder for reflection information generated from $file_name$</summary>\n"
+ "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n",
+ "file_name", file_->name());
WriteGeneratedCodeAttributes(printer);
printer->Print(
"$access_level$ static partial class $umbrella_class_name$ {\n"
@@ -148,12 +150,14 @@
void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) {
printer->Print(
"#region Descriptor\n"
+ "/// <summary>File descriptor for $file_name$</summary>\n"
"public static pbr::FileDescriptor Descriptor {\n"
" get { return descriptor; }\n"
"}\n"
"private static pbr::FileDescriptor descriptor;\n"
"\n"
"static $umbrella_class_name$() {\n",
+ "file_name", file_->name(),
"umbrella_class_name", umbrellaClassname_);
printer->Indent();
printer->Print(
@@ -166,7 +170,7 @@
// TODO(jonskeet): Consider a C#-escaping format here instead of just Base64.
std::string base64 = FileDescriptorToBase64(file_);
while (base64.size() > 60) {
- printer->Print("\"$base64$\", \n", "base64", base64.substr(0, 60));
+ printer->Print("\"$base64$\",\n", "base64", base64.substr(0, 60));
base64 = base64.substr(60);
}
printer->Print("\"$base64$\"));\n", "base64", base64);
diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
index 44f832b..6a3750e 100644
--- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
@@ -37,6 +37,7 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/compiler/csharp/csharp_doc_comment.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_wrapper_field.h>
@@ -70,6 +71,7 @@
variables_,
";\n"
"private $type_name$ $name$_;\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
@@ -165,6 +167,7 @@
"private static readonly pb::FieldCodec<$type_name$> _oneof_$name$_codec = ");
GenerateCodecCode(printer);
printer->Print(";\n");
+ WritePropertyDocComment(printer, descriptor_);
AddDeprecatedFlag(printer);
printer->Print(
variables_,
diff --git a/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
index 2c3608c..e8bf15d 100644
--- a/src/google/protobuf/compiler/java/java_enum_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
@@ -299,7 +299,7 @@
"if (value == null) {\n");
if (PreserveUnknownFields(descriptor_->containing_type())) {
printer->Print(variables_,
- " unknownFields.mergeVarintField($number$, rawValue);\n");
+ " super.mergeVarintField($number$, rawValue);\n");
}
printer->Print(variables_,
"} else {\n"
@@ -492,7 +492,7 @@
"if (value == null) {\n");
if (PreserveUnknownFields(descriptor_->containing_type())) {
printer->Print(variables_,
- " unknownFields.mergeVarintField($number$, rawValue);\n");
+ " super.mergeVarintField($number$, rawValue);\n");
}
printer->Print(variables_,
"} else {\n"
@@ -850,7 +850,7 @@
"if (value == null) {\n");
if (PreserveUnknownFields(descriptor_->containing_type())) {
printer->Print(variables_,
- " unknownFields.mergeVarintField($number$, rawValue);\n");
+ " super.mergeVarintField($number$, rawValue);\n");
}
printer->Print(variables_,
"} else {\n"
diff --git a/src/google/protobuf/compiler/java/java_map_field_lite.cc b/src/google/protobuf/compiler/java/java_map_field_lite.cc
index 4fe656d..d203940 100644
--- a/src/google/protobuf/compiler/java/java_map_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_map_field_lite.cc
@@ -405,7 +405,7 @@
printer->Print(
variables_,
"if ($value_enum_type$.valueOf($name$.getValue()) == null) {\n"
- " unknownFields.mergeLengthDelimitedField($number$, bytes);\n"
+ " super.mergeLengthDelimitedField($number$, bytes);\n"
"} else {\n"
" $name$_.getMutableMap().put($name$.getKey(), $name$.getValue());\n"
"}\n");
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index 8b6c75b..94ed2c3 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -1029,12 +1029,6 @@
"bit_field_name", GetBitFieldName(i));
}
- if (PreserveUnknownFields(descriptor_)) {
- printer->Print(
- "com.google.protobuf.UnknownFieldSetLite.Builder unknownFields =\n"
- " com.google.protobuf.UnknownFieldSetLite.newBuilder();\n");
- }
-
printer->Print(
"try {\n");
printer->Indent();
@@ -1056,13 +1050,10 @@
if (PreserveUnknownFields(descriptor_)) {
if (descriptor_->extension_range_count() > 0) {
- // Lite runtime directly invokes parseUnknownField to reduce method
- // counts.
printer->Print(
"default: {\n"
- " if (!parseUnknownField(extensions, getDefaultInstanceForType(),\n"
- " input, unknownFields,\n"
- " extensionRegistry, tag)) {\n"
+ " if (!parseUnknownField(getDefaultInstanceForType(),\n"
+ " input, extensionRegistry, tag)) {\n"
" done = true;\n" // it's an endgroup tag
" }\n"
" break;\n"
@@ -1070,8 +1061,7 @@
} else {
printer->Print(
"default: {\n"
- " if (!parseUnknownField(input, unknownFields,\n"
- " extensionRegistry, tag)) {\n"
+ " if (!parseUnknownField(tag, input)) {\n"
" done = true;\n" // it's an endgroup tag
" }\n"
" break;\n"
@@ -1146,16 +1136,8 @@
field_generators_.get(field).GenerateParsingDoneCode(printer);
}
- if (PreserveUnknownFields(descriptor_)) {
- // Make unknown fields immutable.
- printer->Print("this.unknownFields = unknownFields.build();\n");
- }
-
- if (descriptor_->extension_range_count() > 0) {
- // Make extensions immutable.
- printer->Print(
- "makeExtensionsImmutable(extensions);\n");
- }
+ printer->Print(
+ "doneParsing();\n");
printer->Outdent();
printer->Outdent();
diff --git a/src/google/protobuf/compiler/main.cc b/src/google/protobuf/compiler/main.cc
index 4815a72..584e5a4 100644
--- a/src/google/protobuf/compiler/main.cc
+++ b/src/google/protobuf/compiler/main.cc
@@ -72,7 +72,7 @@
// CSharp
google::protobuf::compiler::csharp::Generator csharp_generator;
- cli.RegisterGenerator("--csharp_out", &csharp_generator,
+ cli.RegisterGenerator("--csharp_out", "--csharp_opt", &csharp_generator,
"Generate C# source file.");
// Objective C
diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc
index 4d01842..a389a4f 100644
--- a/src/google/protobuf/compiler/parser.cc
+++ b/src/google/protobuf/compiler/parser.cc
@@ -993,6 +993,9 @@
// We intentionally pass field_location rather than location here, since
// the default value is not actually an option.
DO(ParseDefaultAssignment(field, field_location, containing_file));
+ } else if (LookingAt("json_name")) {
+ // Like default value, this "json_name" is not an actual option.
+ DO(ParseJsonName(field, field_location, containing_file));
} else {
DO(ParseOption(field->mutable_options(), location,
containing_file, OPTION_ASSIGNMENT));
@@ -1140,6 +1143,28 @@
return true;
}
+bool Parser::ParseJsonName(
+ FieldDescriptorProto* field,
+ const LocationRecorder& field_location,
+ const FileDescriptorProto* containing_file) {
+ if (field->has_json_name()) {
+ AddError("Already set option \"json_name\".");
+ field->clear_json_name();
+ }
+
+ DO(Consume("json_name"));
+ DO(Consume("="));
+
+ LocationRecorder location(field_location,
+ FieldDescriptorProto::kJsonNameFieldNumber);
+ location.RecordLegacyLocation(
+ field, DescriptorPool::ErrorCollector::OPTION_VALUE);
+ DO(ConsumeString(field->mutable_json_name(),
+ "Expected string for JSON name."));
+ return true;
+}
+
+
bool Parser::ParseOptionNamePart(UninterpretedOption* uninterpreted_option,
const LocationRecorder& part_location,
const FileDescriptorProto* containing_file) {
diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h
index 007b001..3ba1e17 100644
--- a/src/google/protobuf/compiler/parser.h
+++ b/src/google/protobuf/compiler/parser.h
@@ -439,6 +439,10 @@
const LocationRecorder& field_location,
const FileDescriptorProto* containing_file);
+ bool ParseJsonName(FieldDescriptorProto* field,
+ const LocationRecorder& field_location,
+ const FileDescriptorProto* containing_file);
+
enum OptionStyle {
OPTION_ASSIGNMENT, // just "name = value"
OPTION_STATEMENT // "option name = value;"
diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc
index cc6f1ef..0d729e0 100644
--- a/src/google/protobuf/compiler/parser_unittest.cc
+++ b/src/google/protobuf/compiler/parser_unittest.cc
@@ -452,6 +452,20 @@
#undef ETC
}
+TEST_F(ParseMessageTest, FieldJsonName) {
+ ExpectParsesTo(
+ "message TestMessage {\n"
+ " optional string foo = 1 [json_name = \"@type\"];\n"
+ "}\n",
+ "message_type {"
+ " name: \"TestMessage\""
+ " field {\n"
+ " name: \"foo\" label: LABEL_OPTIONAL type: TYPE_STRING number: 1"
+ " json_name: \"@type\"\n"
+ " }\n"
+ "}\n");
+}
+
TEST_F(ParseMessageTest, FieldOptions) {
ExpectParsesTo(
"message TestMessage {\n"
@@ -1126,6 +1140,22 @@
"6:36: Integer out of range.\n");
}
+TEST_F(ParseErrorTest, JsonNameNotString) {
+ ExpectHasErrors(
+ "message TestMessage {\n"
+ " optional string foo = 1 [json_name=1];\n"
+ "}\n",
+ "1:37: Expected string for JSON name.\n");
+}
+
+TEST_F(ParseErrorTest, DuplicateJsonName) {
+ ExpectHasErrors(
+ "message TestMessage {\n"
+ " optional uint32 foo = 1 [json_name=\"a\",json_name=\"b\"];\n"
+ "}\n",
+ "1:41: Already set option \"json_name\".\n");
+}
+
TEST_F(ParseErrorTest, EnumValueOutOfRange) {
ExpectHasErrors(
"enum TestEnum {\n"
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index e81af70..4d500f9 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -28,6 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//#PY25 compatible generated code for GAE.
// Copyright 2007 Google Inc. All Rights Reserved.
// Author: robinson@google.com (Will Robinson)
//
@@ -166,6 +167,7 @@
printer->Print(
"# Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"# source: $filename$\n"
+ "\nimport sys\n_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))" //##PY25
"\n",
"filename", file->name());
if (HasTopLevelEnums(file)) {
@@ -257,9 +259,12 @@
case FieldDescriptor::CPPTYPE_ENUM:
return SimpleItoa(field.default_value_enum()->number());
case FieldDescriptor::CPPTYPE_STRING:
- return "b\"" + CEscape(field.default_value_string()) +
- (field.type() != FieldDescriptor::TYPE_STRING ? "\"" :
- "\".decode('utf-8')");
+//##!PY25 return "b\"" + CEscape(field.default_value_string()) +
+//##!PY25 (field.type() != FieldDescriptor::TYPE_STRING ? "\"" :
+//##!PY25 "\".decode('utf-8')");
+ return "_b(\"" + CEscape(field.default_value_string()) + //##PY25
+ (field.type() != FieldDescriptor::TYPE_STRING ? "\")" : //##PY25
+ "\").decode('utf-8')"); //##PY25
case FieldDescriptor::CPPTYPE_MESSAGE:
return "None";
}
@@ -385,7 +390,8 @@
printer_->Print(m, file_descriptor_template);
printer_->Indent();
printer_->Print(
- "serialized_pb=b'$value$'\n",
+//##!PY25 "serialized_pb=b'$value$'\n",
+ "serialized_pb=_b('$value$')\n", //##PY25
"value", strings::CHexEscape(file_descriptor_serialized_));
if (file_->dependency_count() != 0) {
printer_->Print(",\ndependencies=[");
@@ -1029,8 +1035,10 @@
return "None";
} else {
string full_class_name = "descriptor_pb2." + class_name;
- return "_descriptor._ParseOptions(" + full_class_name + "(), b'"
- + CEscape(serialized_options)+ "')";
+//##!PY25 return "_descriptor._ParseOptions(" + full_class_name + "(), b'"
+//##!PY25 + CEscape(serialized_options)+ "')";
+ return "_descriptor._ParseOptions(" + full_class_name + "(), _b('" //##PY25
+ + CEscape(serialized_options)+ "'))"; //##PY25
}
}
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 5256b83..b40fe95 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -34,6 +34,10 @@
#include <google/protobuf/stubs/hash.h>
#include <map>
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <string>
#include <vector>
@@ -1726,6 +1730,20 @@
}
}
+void FileDescriptor::CopyJsonNameTo(FileDescriptorProto* proto) const {
+ if (message_type_count() != proto->message_type_size() ||
+ extension_count() != proto->extension_size()) {
+ GOOGLE_LOG(ERROR) << "Cannot copy json_name to a proto of a different size.";
+ return;
+ }
+ for (int i = 0; i < message_type_count(); i++) {
+ message_type(i)->CopyJsonNameTo(proto->mutable_message_type(i));
+ }
+ for (int i = 0; i < extension_count(); i++) {
+ extension(i)->CopyJsonNameTo(proto->mutable_extension(i));
+ }
+}
+
void FileDescriptor::CopySourceCodeInfoTo(FileDescriptorProto* proto) const {
if (source_code_info_ &&
source_code_info_ != &SourceCodeInfo::default_instance()) {
@@ -1770,9 +1788,30 @@
}
}
+void Descriptor::CopyJsonNameTo(DescriptorProto* proto) const {
+ if (field_count() != proto->field_size() ||
+ nested_type_count() != proto->nested_type_size() ||
+ extension_count() != proto->extension_size()) {
+ GOOGLE_LOG(ERROR) << "Cannot copy json_name to a proto of a different size.";
+ return;
+ }
+ for (int i = 0; i < field_count(); i++) {
+ field(i)->CopyJsonNameTo(proto->mutable_field(i));
+ }
+ for (int i = 0; i < nested_type_count(); i++) {
+ nested_type(i)->CopyJsonNameTo(proto->mutable_nested_type(i));
+ }
+ for (int i = 0; i < extension_count(); i++) {
+ extension(i)->CopyJsonNameTo(proto->mutable_extension(i));
+ }
+}
+
void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const {
proto->set_name(name());
proto->set_number(number());
+ if (has_json_name_) {
+ proto->set_json_name(json_name());
+ }
// Some compilers do not allow static_cast directly between two enum types,
// so we must cast to int first.
@@ -1819,6 +1858,10 @@
}
}
+void FieldDescriptor::CopyJsonNameTo(FieldDescriptorProto* proto) const {
+ proto->set_json_name(json_name());
+}
+
void OneofDescriptor::CopyTo(OneofDescriptorProto* proto) const {
proto->set_name(name());
}
@@ -4136,6 +4179,14 @@
tables_->AllocateString(ToCamelCase(proto.name(),
/* lower_first = */ true));
+ if (proto.has_json_name()) {
+ result->has_json_name_ = true;
+ result->json_name_ = tables_->AllocateString(proto.json_name());
+ } else {
+ result->has_json_name_ = false;
+ result->json_name_ = result->camelcase_name_;
+ }
+
// Some compilers do not allow static_cast directly between two enum types,
// so we must cast to int first.
result->type_ = static_cast<FieldDescriptor::Type>(
@@ -5040,6 +5091,20 @@
}
}
+static string ToLowercaseWithoutUnderscores(const string& name) {
+ string result;
+ for (int i = 0; i < name.size(); ++i) {
+ if (name[i] != '_') {
+ if (name[i] >= 'A' && name[i] <= 'Z') {
+ result.push_back(name[i] - 'A' + 'a');
+ } else {
+ result.push_back(name[i]);
+ }
+ }
+ }
+ return result;
+}
+
void DescriptorBuilder::ValidateProto3Message(
Descriptor* message, const DescriptorProto& proto) {
for (int i = 0; i < message->nested_type_count(); ++i) {
@@ -5067,6 +5132,25 @@
DescriptorPool::ErrorCollector::OTHER,
"MessageSet is not supported in proto3.");
}
+
+ // In proto3, we reject field names if they conflict in camelCase.
+ // Note that we currently enforce a stricter rule: Field names must be
+ // unique after being converted to lowercase with underscores removed.
+ map<string, const FieldDescriptor*> name_to_field;
+ for (int i = 0; i < message->field_count(); ++i) {
+ string lowercase_name = ToLowercaseWithoutUnderscores(
+ message->field(i)->name());
+ if (name_to_field.find(lowercase_name) != name_to_field.end()) {
+ AddError(message->full_name(), proto,
+ DescriptorPool::ErrorCollector::OTHER,
+ "The JSON camcel-case name of field \"" +
+ message->field(i)->name() + "\" conflicts with field \"" +
+ name_to_field[lowercase_name]->name() + "\". This is not " +
+ "allowed in proto3.");
+ } else {
+ name_to_field[lowercase_name] = message->field(i);
+ }
+ }
}
void DescriptorBuilder::ValidateProto3Field(
@@ -5602,7 +5686,7 @@
// First set the value on the UnknownFieldSet corresponding to the
// innermost message.
- scoped_ptr<UnknownFieldSet> unknown_fields(new UnknownFieldSet());
+ google::protobuf::scoped_ptr<UnknownFieldSet> unknown_fields(new UnknownFieldSet());
if (!SetOptionValue(field, unknown_fields.get())) {
return false; // SetOptionValue() already added the error.
}
@@ -5612,7 +5696,8 @@
for (vector<const FieldDescriptor*>::reverse_iterator iter =
intermediate_fields.rbegin();
iter != intermediate_fields.rend(); ++iter) {
- scoped_ptr<UnknownFieldSet> parent_unknown_fields(new UnknownFieldSet());
+ google::protobuf::scoped_ptr<UnknownFieldSet> parent_unknown_fields(
+ new UnknownFieldSet());
switch ((*iter)->type()) {
case FieldDescriptor::TYPE_MESSAGE: {
io::StringOutputStream outstr(
@@ -5998,7 +6083,7 @@
}
const Descriptor* type = option_field->message_type();
- scoped_ptr<Message> dynamic(dynamic_factory_.GetPrototype(type)->New());
+ google::protobuf::scoped_ptr<Message> dynamic(dynamic_factory_.GetPrototype(type)->New());
GOOGLE_CHECK(dynamic.get() != NULL)
<< "Could not create an instance of " << option_field->DebugString();
diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h
index 2ab316a..e7e8c6a 100644
--- a/src/google/protobuf/descriptor.h
+++ b/src/google/protobuf/descriptor.h
@@ -54,6 +54,10 @@
#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__
#define GOOGLE_PROTOBUF_DESCRIPTOR_H__
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <set>
#include <string>
#include <vector>
@@ -111,8 +115,17 @@
// Defined in generated_message_reflection.h.
namespace internal {
- class GeneratedMessageReflection;
-}
+class GeneratedMessageReflection;
+} // namespace internal
+
+// Defined in command_line_interface.cc
+namespace compiler {
+class CommandLineInterface;
+} // namespace compiler
+
+namespace descriptor_unittest {
+class DescriptorTest;
+} // namespace descriptor_unittest
// NB, all indices are zero-based.
struct SourceLocation {
@@ -343,6 +356,12 @@
private:
typedef MessageOptions OptionsType;
+ // Allows tests to test CopyTo(proto, true).
+ friend class ::google::protobuf::descriptor_unittest::DescriptorTest;
+
+ // Fill the json_name field of FieldDescriptorProto.
+ void CopyJsonNameTo(DescriptorProto* proto) const;
+
// Internal version of DebugString; controls the level of indenting for
// correct depth. Takes |options| to control debug-string options, and
// |include_opening_clause| to indicate whether the "message ... " part of the
@@ -484,6 +503,7 @@
const string& name() const; // Name of this field within the message.
const string& full_name() const; // Fully-qualified name of the field.
+ const string& json_name() const; // JSON name of this field.
const FileDescriptor* file() const;// File in which this field was defined.
bool is_extension() const; // Is this an extension field?
int number() const; // Declared tag number.
@@ -624,6 +644,9 @@
private:
typedef FieldOptions OptionsType;
+ // Fill the json_name field of FieldDescriptorProto.
+ void CopyJsonNameTo(FieldDescriptorProto* proto) const;
+
// See Descriptor::DebugString().
enum PrintLabelFlag { PRINT_LABEL, OMIT_LABEL };
void DebugString(int depth, PrintLabelFlag print_label_flag,
@@ -645,6 +668,12 @@
const string* full_name_;
const string* lowercase_name_;
const string* camelcase_name_;
+ // Whether the user has specified the json_name field option in the .proto
+ // file.
+ bool has_json_name_;
+ // If has_json_name_ is true, it's the value specified by the user.
+ // Otherwise, it has the same value as lowercase_name_.
+ const string* json_name_;
const FileDescriptor* file_;
int number_;
Type type_;
@@ -1202,6 +1231,9 @@
// Write the source code information of this FileDescriptor into the given
// FileDescriptorProto. See CopyTo() above.
void CopySourceCodeInfoTo(FileDescriptorProto* proto) const;
+ // Fill the json_name field of FieldDescriptorProto for all fields. Can only
+ // be called after CopyTo().
+ void CopyJsonNameTo(FileDescriptorProto* proto) const;
// See Descriptor::DebugString().
string DebugString() const;
@@ -1559,7 +1591,7 @@
// This class contains a lot of hash maps with complicated types that
// we'd like to keep out of the header.
class Tables;
- scoped_ptr<Tables> tables_;
+ google::protobuf::scoped_ptr<Tables> tables_;
bool enforce_dependencies_;
bool allow_unknown_;
@@ -1618,6 +1650,7 @@
PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name)
PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name)
+PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, json_name)
PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name)
PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*)
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index fe23c0a..9c81712 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -200,7 +200,7 @@
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _internal_metadata_),
-1);
FieldDescriptorProto_descriptor_ = file->message_type(3);
- static const int FieldDescriptorProto_offsets_[9] = {
+ static const int FieldDescriptorProto_offsets_[10] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, number_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, label_),
@@ -209,6 +209,7 @@
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, extendee_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, default_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, oneof_index_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, json_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, options_),
};
FieldDescriptorProto_reflection_ =
@@ -663,101 +664,102 @@
"tobuf.DescriptorProto.ReservedRange\022\025\n\rr"
"eserved_name\030\n \003(\t\032,\n\016ExtensionRange\022\r\n\005"
"start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\032+\n\rReservedRang"
- "e\022\r\n\005start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\"\251\005\n\024FieldD"
+ "e\022\r\n\005start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\"\274\005\n\024FieldD"
"escriptorProto\022\014\n\004name\030\001 \001(\t\022\016\n\006number\030\003"
" \001(\005\022:\n\005label\030\004 \001(\0162+.google.protobuf.Fi"
"eldDescriptorProto.Label\0228\n\004type\030\005 \001(\0162*"
".google.protobuf.FieldDescriptorProto.Ty"
"pe\022\021\n\ttype_name\030\006 \001(\t\022\020\n\010extendee\030\002 \001(\t\022"
"\025\n\rdefault_value\030\007 \001(\t\022\023\n\013oneof_index\030\t "
- "\001(\005\022.\n\007options\030\010 \001(\0132\035.google.protobuf.F"
- "ieldOptions\"\266\002\n\004Type\022\017\n\013TYPE_DOUBLE\020\001\022\016\n"
- "\nTYPE_FLOAT\020\002\022\016\n\nTYPE_INT64\020\003\022\017\n\013TYPE_UI"
- "NT64\020\004\022\016\n\nTYPE_INT32\020\005\022\020\n\014TYPE_FIXED64\020\006"
- "\022\020\n\014TYPE_FIXED32\020\007\022\r\n\tTYPE_BOOL\020\010\022\017\n\013TYP"
- "E_STRING\020\t\022\016\n\nTYPE_GROUP\020\n\022\020\n\014TYPE_MESSA"
- "GE\020\013\022\016\n\nTYPE_BYTES\020\014\022\017\n\013TYPE_UINT32\020\r\022\r\n"
- "\tTYPE_ENUM\020\016\022\021\n\rTYPE_SFIXED32\020\017\022\021\n\rTYPE_"
- "SFIXED64\020\020\022\017\n\013TYPE_SINT32\020\021\022\017\n\013TYPE_SINT"
- "64\020\022\"C\n\005Label\022\022\n\016LABEL_OPTIONAL\020\001\022\022\n\016LAB"
- "EL_REQUIRED\020\002\022\022\n\016LABEL_REPEATED\020\003\"$\n\024One"
- "ofDescriptorProto\022\014\n\004name\030\001 \001(\t\"\214\001\n\023Enum"
- "DescriptorProto\022\014\n\004name\030\001 \001(\t\0228\n\005value\030\002"
- " \003(\0132).google.protobuf.EnumValueDescript"
- "orProto\022-\n\007options\030\003 \001(\0132\034.google.protob"
- "uf.EnumOptions\"l\n\030EnumValueDescriptorPro"
- "to\022\014\n\004name\030\001 \001(\t\022\016\n\006number\030\002 \001(\005\0222\n\007opti"
- "ons\030\003 \001(\0132!.google.protobuf.EnumValueOpt"
- "ions\"\220\001\n\026ServiceDescriptorProto\022\014\n\004name\030"
- "\001 \001(\t\0226\n\006method\030\002 \003(\0132&.google.protobuf."
- "MethodDescriptorProto\0220\n\007options\030\003 \001(\0132\037"
- ".google.protobuf.ServiceOptions\"\301\001\n\025Meth"
- "odDescriptorProto\022\014\n\004name\030\001 \001(\t\022\022\n\ninput"
- "_type\030\002 \001(\t\022\023\n\013output_type\030\003 \001(\t\022/\n\007opti"
- "ons\030\004 \001(\0132\036.google.protobuf.MethodOption"
- "s\022\037\n\020client_streaming\030\005 \001(\010:\005false\022\037\n\020se"
- "rver_streaming\030\006 \001(\010:\005false\"\252\005\n\013FileOpti"
- "ons\022\024\n\014java_package\030\001 \001(\t\022\034\n\024java_outer_"
- "classname\030\010 \001(\t\022\"\n\023java_multiple_files\030\n"
- " \001(\010:\005false\022,\n\035java_generate_equals_and_"
- "hash\030\024 \001(\010:\005false\022%\n\026java_string_check_u"
- "tf8\030\033 \001(\010:\005false\022F\n\014optimize_for\030\t \001(\0162)"
- ".google.protobuf.FileOptions.OptimizeMod"
- "e:\005SPEED\022\022\n\ngo_package\030\013 \001(\t\022\"\n\023cc_gener"
- "ic_services\030\020 \001(\010:\005false\022$\n\025java_generic"
- "_services\030\021 \001(\010:\005false\022\"\n\023py_generic_ser"
- "vices\030\022 \001(\010:\005false\022\031\n\ndeprecated\030\027 \001(\010:\005"
- "false\022\037\n\020cc_enable_arenas\030\037 \001(\010:\005false\022\031"
- "\n\021objc_class_prefix\030$ \001(\t\022\030\n\020csharp_name"
- "space\030% \001(\t\022\'\n\037javanano_use_deprecated_p"
- "ackage\030& \001(\010\022C\n\024uninterpreted_option\030\347\007 "
- "\003(\0132$.google.protobuf.UninterpretedOptio"
- "n\":\n\014OptimizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZ"
- "E\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016Mes"
- "sageOptions\022&\n\027message_set_wire_format\030\001"
- " \001(\010:\005false\022.\n\037no_standard_descriptor_ac"
- "cessor\030\002 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:"
- "\005false\022\021\n\tmap_entry\030\007 \001(\010\022C\n\024uninterpret"
- "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint"
- "erpretedOption*\t\010\350\007\020\200\200\200\200\002\"\230\003\n\014FieldOptio"
- "ns\022:\n\005ctype\030\001 \001(\0162#.google.protobuf.Fiel"
- "dOptions.CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?"
- "\n\006jstype\030\006 \001(\0162$.google.protobuf.FieldOp"
- "tions.JSType:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005f"
- "alse\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\023\n\004weak\030"
- "\n \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 "
- "\003(\0132$.google.protobuf.UninterpretedOptio"
- "n\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRI"
- "NG_PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJ"
- "S_STRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n"
- "\013EnumOptions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndep"
- "recated\030\003 \001(\010:\005false\022C\n\024uninterpreted_op"
- "tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre"
- "tedOption*\t\010\350\007\020\200\200\200\200\002\"}\n\020EnumValueOptions"
- "\022\031\n\ndeprecated\030\001 \001(\010:\005false\022C\n\024uninterpr"
- "eted_option\030\347\007 \003(\0132$.google.protobuf.Uni"
- "nterpretedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOp"
- "tions\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024unin"
- "terpreted_option\030\347\007 \003(\0132$.google.protobu"
- "f.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"z\n\rMeth"
- "odOptions\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024"
- "uninterpreted_option\030\347\007 \003(\0132$.google.pro"
- "tobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\236\002\n"
- "\023UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goo"
- "gle.protobuf.UninterpretedOption.NamePar"
- "t\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_"
- "int_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 "
- "\001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_valu"
- "e\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010Name"
- "Part\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030"
- "\002 \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003"
- "(\0132(.google.protobuf.SourceCodeInfo.Loca"
- "tion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004s"
- "pan\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022"
- "\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_de"
- "tached_comments\030\006 \003(\tB;\n\023com.google.prot"
- "obufB\020DescriptorProtosH\001Z\ndescriptor\242\002\003G"
- "PB", 4962);
+ "\001(\005\022\021\n\tjson_name\030\n \001(\t\022.\n\007options\030\010 \001(\0132"
+ "\035.google.protobuf.FieldOptions\"\266\002\n\004Type\022"
+ "\017\n\013TYPE_DOUBLE\020\001\022\016\n\nTYPE_FLOAT\020\002\022\016\n\nTYPE"
+ "_INT64\020\003\022\017\n\013TYPE_UINT64\020\004\022\016\n\nTYPE_INT32\020"
+ "\005\022\020\n\014TYPE_FIXED64\020\006\022\020\n\014TYPE_FIXED32\020\007\022\r\n"
+ "\tTYPE_BOOL\020\010\022\017\n\013TYPE_STRING\020\t\022\016\n\nTYPE_GR"
+ "OUP\020\n\022\020\n\014TYPE_MESSAGE\020\013\022\016\n\nTYPE_BYTES\020\014\022"
+ "\017\n\013TYPE_UINT32\020\r\022\r\n\tTYPE_ENUM\020\016\022\021\n\rTYPE_"
+ "SFIXED32\020\017\022\021\n\rTYPE_SFIXED64\020\020\022\017\n\013TYPE_SI"
+ "NT32\020\021\022\017\n\013TYPE_SINT64\020\022\"C\n\005Label\022\022\n\016LABE"
+ "L_OPTIONAL\020\001\022\022\n\016LABEL_REQUIRED\020\002\022\022\n\016LABE"
+ "L_REPEATED\020\003\"$\n\024OneofDescriptorProto\022\014\n\004"
+ "name\030\001 \001(\t\"\214\001\n\023EnumDescriptorProto\022\014\n\004na"
+ "me\030\001 \001(\t\0228\n\005value\030\002 \003(\0132).google.protobu"
+ "f.EnumValueDescriptorProto\022-\n\007options\030\003 "
+ "\001(\0132\034.google.protobuf.EnumOptions\"l\n\030Enu"
+ "mValueDescriptorProto\022\014\n\004name\030\001 \001(\t\022\016\n\006n"
+ "umber\030\002 \001(\005\0222\n\007options\030\003 \001(\0132!.google.pr"
+ "otobuf.EnumValueOptions\"\220\001\n\026ServiceDescr"
+ "iptorProto\022\014\n\004name\030\001 \001(\t\0226\n\006method\030\002 \003(\013"
+ "2&.google.protobuf.MethodDescriptorProto"
+ "\0220\n\007options\030\003 \001(\0132\037.google.protobuf.Serv"
+ "iceOptions\"\301\001\n\025MethodDescriptorProto\022\014\n\004"
+ "name\030\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t\022\023\n\013output"
+ "_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google.pr"
+ "otobuf.MethodOptions\022\037\n\020client_streaming"
+ "\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001(\010:"
+ "\005false\"\252\005\n\013FileOptions\022\024\n\014java_package\030\001"
+ " \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023ja"
+ "va_multiple_files\030\n \001(\010:\005false\022,\n\035java_g"
+ "enerate_equals_and_hash\030\024 \001(\010:\005false\022%\n\026"
+ "java_string_check_utf8\030\033 \001(\010:\005false\022F\n\014o"
+ "ptimize_for\030\t \001(\0162).google.protobuf.File"
+ "Options.OptimizeMode:\005SPEED\022\022\n\ngo_packag"
+ "e\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 \001(\010:\005fa"
+ "lse\022$\n\025java_generic_services\030\021 \001(\010:\005fals"
+ "e\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022\031\n"
+ "\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enable_ar"
+ "enas\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030$"
+ " \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\'\n\037javana"
+ "no_use_deprecated_package\030& \001(\010\022C\n\024unint"
+ "erpreted_option\030\347\007 \003(\0132$.google.protobuf"
+ ".UninterpretedOption\":\n\014OptimizeMode\022\t\n\005"
+ "SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003"
+ "*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOptions\022&\n\027messag"
+ "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta"
+ "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031"
+ "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007"
+ " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go"
+ "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200"
+ "\200\200\200\002\"\230\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.g"
+ "oogle.protobuf.FieldOptions.CType:\006STRIN"
+ "G\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.goog"
+ "le.protobuf.FieldOptions.JSType:\tJS_NORM"
+ "AL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 "
+ "\001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024unint"
+ "erpreted_option\030\347\007 \003(\0132$.google.protobuf"
+ ".UninterpretedOption\"/\n\005CType\022\n\n\006STRING\020"
+ "\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022"
+ "\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMB"
+ "ER\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOptions\022\023\n\013allow"
+ "_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022"
+ "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google."
+ "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\""
+ "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:"
+ "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$."
+ "google.protobuf.UninterpretedOption*\t\010\350\007"
+ "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!"
+ " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003"
+ "(\0132$.google.protobuf.UninterpretedOption"
+ "*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndeprecat"
+ "ed\030! \001(\010:\005false\022C\n\024uninterpreted_option\030"
+ "\347\007 \003(\0132$.google.protobuf.UninterpretedOp"
+ "tion*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022"
+ ";\n\004name\030\002 \003(\0132-.google.protobuf.Uninterp"
+ "retedOption.NamePart\022\030\n\020identifier_value"
+ "\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022ne"
+ "gative_int_value\030\005 \001(\003\022\024\n\014double_value\030\006"
+ " \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_"
+ "value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002"
+ "(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeI"
+ "nfo\022:\n\010location\030\001 \003(\0132(.google.protobuf."
+ "SourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004"
+ "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead"
+ "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030"
+ "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t"
+ "BX\n\023com.google.protobufB\020DescriptorProto"
+ "sH\001Z\ndescriptor\242\002\003GPB\252\002\032Google.Protobuf."
+ "Reflection", 5010);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
FileDescriptorSet::default_instance_ = new FileDescriptorSet();
@@ -4109,6 +4111,7 @@
const int FieldDescriptorProto::kExtendeeFieldNumber;
const int FieldDescriptorProto::kDefaultValueFieldNumber;
const int FieldDescriptorProto::kOneofIndexFieldNumber;
+const int FieldDescriptorProto::kJsonNameFieldNumber;
const int FieldDescriptorProto::kOptionsFieldNumber;
#endif // !_MSC_VER
@@ -4141,6 +4144,7 @@
extendee_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
oneof_index_ = 0;
+ json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -4155,6 +4159,7 @@
type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
extendee_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
default_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ json_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != default_instance_) {
delete options_;
}
@@ -4204,8 +4209,13 @@
}
oneof_index_ = 0;
}
- if (has_options()) {
- if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
+ if (_has_bits_[8 / 32] & 768u) {
+ if (has_json_name()) {
+ json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ if (has_options()) {
+ if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
+ }
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
if (_internal_metadata_.have_unknown_fields()) {
@@ -4369,6 +4379,23 @@
} else {
goto handle_unusual;
}
+ if (input->ExpectTag(82)) goto parse_json_name;
+ break;
+ }
+
+ // optional string json_name = 10;
+ case 10: {
+ if (tag == 82) {
+ parse_json_name:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->mutable_json_name()));
+ ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+ this->json_name().data(), this->json_name().length(),
+ ::google::protobuf::internal::WireFormat::PARSE,
+ "google.protobuf.FieldDescriptorProto.json_name");
+ } else {
+ goto handle_unusual;
+ }
if (input->ExpectAtEnd()) goto success;
break;
}
@@ -4466,6 +4493,16 @@
::google::protobuf::internal::WireFormatLite::WriteInt32(9, this->oneof_index(), output);
}
+ // optional string json_name = 10;
+ if (has_json_name()) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+ this->json_name().data(), this->json_name().length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE,
+ "google.protobuf.FieldDescriptorProto.json_name");
+ ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+ 10, this->json_name(), output);
+ }
+
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
@@ -4549,6 +4586,17 @@
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(9, this->oneof_index(), target);
}
+ // optional string json_name = 10;
+ if (has_json_name()) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+ this->json_name().data(), this->json_name().length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE,
+ "google.protobuf.FieldDescriptorProto.json_name");
+ target =
+ ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+ 10, this->json_name(), target);
+ }
+
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
@@ -4616,13 +4664,22 @@
}
}
- // optional .google.protobuf.FieldOptions options = 8;
- if (has_options()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- *this->options_);
- }
+ if (_has_bits_[8 / 32] & 768u) {
+ // optional string json_name = 10;
+ if (has_json_name()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->json_name());
+ }
+ // optional .google.protobuf.FieldOptions options = 8;
+ if (has_options()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ *this->options_);
+ }
+
+ }
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
@@ -4679,6 +4736,10 @@
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+ if (from.has_json_name()) {
+ set_has_json_name();
+ json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_);
+ }
if (from.has_options()) {
mutable_options()->::google::protobuf::FieldOptions::MergeFrom(from.options());
}
@@ -4721,6 +4782,7 @@
extendee_.Swap(&other->extendee_);
default_value_.Swap(&other->default_value_);
std::swap(oneof_index_, other->oneof_index_);
+ json_name_.Swap(&other->json_name_);
std::swap(options_, other->options_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
@@ -5048,16 +5110,69 @@
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index)
}
-// optional .google.protobuf.FieldOptions options = 8;
-bool FieldDescriptorProto::has_options() const {
+// optional string json_name = 10;
+bool FieldDescriptorProto::has_json_name() const {
return (_has_bits_[0] & 0x00000100u) != 0;
}
-void FieldDescriptorProto::set_has_options() {
+void FieldDescriptorProto::set_has_json_name() {
_has_bits_[0] |= 0x00000100u;
}
-void FieldDescriptorProto::clear_has_options() {
+void FieldDescriptorProto::clear_has_json_name() {
_has_bits_[0] &= ~0x00000100u;
}
+void FieldDescriptorProto::clear_json_name() {
+ json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_json_name();
+}
+ const ::std::string& FieldDescriptorProto::json_name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name)
+ return json_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+ void FieldDescriptorProto::set_json_name(const ::std::string& value) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
+}
+ void FieldDescriptorProto::set_json_name(const char* value) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name)
+}
+ void FieldDescriptorProto::set_json_name(const char* value, size_t size) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name)
+}
+ ::std::string* FieldDescriptorProto::mutable_json_name() {
+ set_has_json_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
+ return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+ ::std::string* FieldDescriptorProto::release_json_name() {
+ clear_has_json_name();
+ return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+ void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) {
+ if (json_name != NULL) {
+ set_has_json_name();
+ } else {
+ clear_has_json_name();
+ }
+ json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
+}
+
+// optional .google.protobuf.FieldOptions options = 8;
+bool FieldDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000200u) != 0;
+}
+void FieldDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000200u;
+}
+void FieldDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000200u;
+}
void FieldDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
clear_has_options();
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 931ff02..6025516 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -1133,6 +1133,18 @@
::google::protobuf::int32 oneof_index() const;
void set_oneof_index(::google::protobuf::int32 value);
+ // optional string json_name = 10;
+ bool has_json_name() const;
+ void clear_json_name();
+ static const int kJsonNameFieldNumber = 10;
+ const ::std::string& json_name() const;
+ void set_json_name(const ::std::string& value);
+ void set_json_name(const char* value);
+ void set_json_name(const char* value, size_t size);
+ ::std::string* mutable_json_name();
+ ::std::string* release_json_name();
+ void set_allocated_json_name(::std::string* json_name);
+
// optional .google.protobuf.FieldOptions options = 8;
bool has_options() const;
void clear_options();
@@ -1160,6 +1172,8 @@
inline void clear_has_default_value();
inline void set_has_oneof_index();
inline void clear_has_oneof_index();
+ inline void set_has_json_name();
+ inline void clear_has_json_name();
inline void set_has_options();
inline void clear_has_options();
@@ -1174,6 +1188,7 @@
int type_;
::google::protobuf::int32 oneof_index_;
::google::protobuf::internal::ArenaStringPtr default_value_;
+ ::google::protobuf::internal::ArenaStringPtr json_name_;
::google::protobuf::FieldOptions* options_;
friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
@@ -4678,16 +4693,69 @@
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index)
}
-// optional .google.protobuf.FieldOptions options = 8;
-inline bool FieldDescriptorProto::has_options() const {
+// optional string json_name = 10;
+inline bool FieldDescriptorProto::has_json_name() const {
return (_has_bits_[0] & 0x00000100u) != 0;
}
-inline void FieldDescriptorProto::set_has_options() {
+inline void FieldDescriptorProto::set_has_json_name() {
_has_bits_[0] |= 0x00000100u;
}
-inline void FieldDescriptorProto::clear_has_options() {
+inline void FieldDescriptorProto::clear_has_json_name() {
_has_bits_[0] &= ~0x00000100u;
}
+inline void FieldDescriptorProto::clear_json_name() {
+ json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ clear_has_json_name();
+}
+inline const ::std::string& FieldDescriptorProto::json_name() const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name)
+ return json_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void FieldDescriptorProto::set_json_name(const ::std::string& value) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
+}
+inline void FieldDescriptorProto::set_json_name(const char* value) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+ // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name)
+}
+inline void FieldDescriptorProto::set_json_name(const char* value, size_t size) {
+ set_has_json_name();
+ json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+ ::std::string(reinterpret_cast<const char*>(value), size));
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name)
+}
+inline ::std::string* FieldDescriptorProto::mutable_json_name() {
+ set_has_json_name();
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
+ return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* FieldDescriptorProto::release_json_name() {
+ clear_has_json_name();
+ return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) {
+ if (json_name != NULL) {
+ set_has_json_name();
+ } else {
+ clear_has_json_name();
+ }
+ json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name);
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
+}
+
+// optional .google.protobuf.FieldOptions options = 8;
+inline bool FieldDescriptorProto::has_options() const {
+ return (_has_bits_[0] & 0x00000200u) != 0;
+}
+inline void FieldDescriptorProto::set_has_options() {
+ _has_bits_[0] |= 0x00000200u;
+}
+inline void FieldDescriptorProto::clear_has_options() {
+ _has_bits_[0] &= ~0x00000200u;
+}
inline void FieldDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
clear_has_options();
diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto
index 8f90a95..c59a602 100644
--- a/src/google/protobuf/descriptor.proto
+++ b/src/google/protobuf/descriptor.proto
@@ -43,8 +43,7 @@
option go_package = "descriptor";
option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos";
-// Re-enable this once the tools have picked up the csharp_namespace option.
-// option csharp_namespace = "Google.ProtocolBuffers.DescriptorProtos";
+option csharp_namespace = "Google.Protobuf.Reflection";
option objc_class_prefix = "GPB";
// descriptor.proto must be optimized for speed because reflection-based
@@ -191,6 +190,12 @@
// list. This field is a member of that oneof.
optional int32 oneof_index = 9;
+ // JSON name of this field. The value is set by protocol compiler. If the
+ // user has set a "json_name" option on this field, that option's value
+ // will be used. Otherwise, it's deduced from the field's name by converting
+ // it to camelCase.
+ optional string json_name = 10;
+
optional FieldOptions options = 8;
}
diff --git a/src/google/protobuf/descriptor_database_unittest.cc b/src/google/protobuf/descriptor_database_unittest.cc
index a87fa04..1fc3816 100644
--- a/src/google/protobuf/descriptor_database_unittest.cc
+++ b/src/google/protobuf/descriptor_database_unittest.cc
@@ -35,6 +35,10 @@
// This file makes extensive use of RFC 3092. :)
#include <algorithm>
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/descriptor_database.h>
#include <google/protobuf/descriptor.h>
@@ -177,7 +181,7 @@
EXPECT_FALSE(test_case_->AddToDatabase(file_proto));
}
- scoped_ptr<DescriptorDatabaseTestCase> test_case_;
+ google::protobuf::scoped_ptr<DescriptorDatabaseTestCase> test_case_;
DescriptorDatabase* database_;
};
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index e9b027d..ccd0650 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -34,6 +34,10 @@
//
// This file makes extensive use of RFC 3092. :)
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/compiler/importer.h>
@@ -461,6 +465,16 @@
// map<int32, int32> map_int32_int32 = 1;
// }
//
+ // // in "json.proto"
+ // message TestMessage4 {
+ // optional int32 field_name1 = 1;
+ // optional int32 fieldName2 = 2;
+ // optional int32 FieldName3 = 3;
+ // optional int32 _field_name4 = 4;
+ // optional int32 FIELD_NAME5 = 5;
+ // optional int32 field_name6 = 6 [json_name = "@type"];
+ // }
+ //
// We cheat and use TestForeign as the type for qux rather than create
// an actual nested type.
//
@@ -526,6 +540,30 @@
FieldDescriptorProto::TYPE_MESSAGE)
->set_type_name("MapInt32Int32Entry");
+ FileDescriptorProto json_file;
+ json_file.set_name("json.proto");
+ json_file.set_syntax("proto3");
+ DescriptorProto* message4 = AddMessage(&json_file, "TestMessage4");
+ AddField(message4, "field_name1", 1,
+ FieldDescriptorProto::LABEL_OPTIONAL,
+ FieldDescriptorProto::TYPE_INT32);
+ AddField(message4, "fieldName2", 2,
+ FieldDescriptorProto::LABEL_OPTIONAL,
+ FieldDescriptorProto::TYPE_INT32);
+ AddField(message4, "FieldName3", 3,
+ FieldDescriptorProto::LABEL_OPTIONAL,
+ FieldDescriptorProto::TYPE_INT32);
+ AddField(message4, "_field_name4", 4,
+ FieldDescriptorProto::LABEL_OPTIONAL,
+ FieldDescriptorProto::TYPE_INT32);
+ AddField(message4, "FIELD_NAME5", 5,
+ FieldDescriptorProto::LABEL_OPTIONAL,
+ FieldDescriptorProto::TYPE_INT32);
+ AddField(message4, "field_name6", 6,
+ FieldDescriptorProto::LABEL_OPTIONAL,
+ FieldDescriptorProto::TYPE_INT32)
+ ->set_json_name("@type");
+
// Build the descriptors and get the pointers.
foo_file_ = pool_.BuildFile(foo_file);
ASSERT_TRUE(foo_file_ != NULL);
@@ -536,6 +574,9 @@
map_file_ = pool_.BuildFile(map_file);
ASSERT_TRUE(map_file_ != NULL);
+ json_file_ = pool_.BuildFile(json_file);
+ ASSERT_TRUE(json_file_ != NULL);
+
ASSERT_EQ(1, foo_file_->enum_type_count());
enum_ = foo_file_->enum_type(0);
@@ -562,6 +603,14 @@
ASSERT_EQ(1, message3_->field_count());
map_ = message3_->field(0);
+
+ ASSERT_EQ(1, json_file_->message_type_count());
+ message4_ = json_file_->message_type(0);
+ }
+
+ void CopyWithJsonName(const Descriptor* message, DescriptorProto* proto) {
+ message->CopyTo(proto);
+ message->CopyJsonNameTo(proto);
}
DescriptorPool pool_;
@@ -569,10 +618,12 @@
const FileDescriptor* foo_file_;
const FileDescriptor* bar_file_;
const FileDescriptor* map_file_;
+ const FileDescriptor* json_file_;
const Descriptor* message_;
const Descriptor* message2_;
const Descriptor* message3_;
+ const Descriptor* message4_;
const Descriptor* foreign_;
const EnumDescriptor* enum_;
@@ -664,6 +715,35 @@
EXPECT_EQ("corge.grault.TestMessage2.quux", quux2_->full_name());
}
+TEST_F(DescriptorTest, FieldJsonName) {
+ EXPECT_EQ("fieldName1", message4_->field(0)->json_name());
+ EXPECT_EQ("fieldName2", message4_->field(1)->json_name());
+ EXPECT_EQ("fieldName3", message4_->field(2)->json_name());
+ EXPECT_EQ("fieldName4", message4_->field(3)->json_name());
+ EXPECT_EQ("fIELDNAME5", message4_->field(4)->json_name());
+ EXPECT_EQ("@type", message4_->field(5)->json_name());
+
+ DescriptorProto proto;
+ message4_->CopyTo(&proto);
+ ASSERT_EQ(6, proto.field_size());
+ EXPECT_FALSE(proto.field(0).has_json_name());
+ EXPECT_FALSE(proto.field(1).has_json_name());
+ EXPECT_FALSE(proto.field(2).has_json_name());
+ EXPECT_FALSE(proto.field(3).has_json_name());
+ EXPECT_FALSE(proto.field(4).has_json_name());
+ EXPECT_EQ("@type", proto.field(5).json_name());
+
+ proto.Clear();
+ CopyWithJsonName(message4_, &proto);
+ ASSERT_EQ(6, proto.field_size());
+ EXPECT_EQ("fieldName1", proto.field(0).json_name());
+ EXPECT_EQ("fieldName2", proto.field(1).json_name());
+ EXPECT_EQ("fieldName3", proto.field(2).json_name());
+ EXPECT_EQ("fieldName4", proto.field(3).json_name());
+ EXPECT_EQ("fIELDNAME5", proto.field(4).json_name());
+ EXPECT_EQ("@type", proto.field(5).json_name());
+}
+
TEST_F(DescriptorTest, FieldFile) {
EXPECT_EQ(foo_file_, foo_->file());
EXPECT_EQ(foo_file_, bar_->file());
@@ -1900,7 +1980,7 @@
return field != NULL ? field->enum_type() : NULL;
}
- scoped_ptr<DescriptorPool> pool_;
+ google::protobuf::scoped_ptr<DescriptorPool> pool_;
};
TEST_F(MiscTest, TypeNames) {
@@ -2330,7 +2410,7 @@
const FieldDescriptor* qux_field_;
SimpleDescriptorDatabase db_; // used if in FALLBACK_DATABASE mode.
- scoped_ptr<DescriptorPool> pool_;
+ google::protobuf::scoped_ptr<DescriptorPool> pool_;
};
TEST_P(AllowUnknownDependenciesTest, PlaceholderFile) {
@@ -5681,6 +5761,32 @@
"defining options.\n");
}
+// Test that field names that may conflict in JSON is not allowed by protoc.
+TEST_F(ValidationErrorTest, ValidateProto3JsonName) {
+ // The comparison is case-insensitive.
+ BuildFileWithErrors(
+ "name: 'foo.proto' "
+ "syntax: 'proto3' "
+ "message_type {"
+ " name: 'Foo'"
+ " field { name:'name' number:1 label:LABEL_OPTIONAL type:TYPE_INT32 }"
+ " field { name:'Name' number:2 label:LABEL_OPTIONAL type:TYPE_INT32 }"
+ "}",
+ "foo.proto: Foo: OTHER: The JSON camcel-case name of field \"Name\" "
+ "conflicts with field \"name\". This is not allowed in proto3.\n");
+ // Underscores are ignored.
+ BuildFileWithErrors(
+ "name: 'foo.proto' "
+ "syntax: 'proto3' "
+ "message_type {"
+ " name: 'Foo'"
+ " field { name:'ab' number:1 label:LABEL_OPTIONAL type:TYPE_INT32 }"
+ " field { name:'_a__b_' number:2 label:LABEL_OPTIONAL type:TYPE_INT32 }"
+ "}",
+ "foo.proto: Foo: OTHER: The JSON camcel-case name of field \"_a__b_\" "
+ "conflicts with field \"ab\". This is not allowed in proto3.\n");
+}
+
// ===================================================================
// DescriptorDatabase
diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc
index 2324d95..091fc97 100644
--- a/src/google/protobuf/dynamic_message.cc
+++ b/src/google/protobuf/dynamic_message.cc
@@ -64,6 +64,10 @@
#include <algorithm>
#include <google/protobuf/stubs/hash.h>
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/scoped_ptr.h>
#include <google/protobuf/stubs/common.h>
@@ -229,8 +233,8 @@
// Warning: The order in which the following pointers are defined is
// important (the prototype must be deleted *before* the offsets).
- scoped_array<int> offsets;
- scoped_ptr<const GeneratedMessageReflection> reflection;
+ google::protobuf::scoped_array<int> offsets;
+ google::protobuf::scoped_ptr<const GeneratedMessageReflection> reflection;
// Don't use a scoped_ptr to hold the prototype: the destructor for
// DynamicMessage needs to know whether it is the prototype, and does so by
// looking back at this field. This would assume details about the
diff --git a/src/google/protobuf/dynamic_message_unittest.cc b/src/google/protobuf/dynamic_message_unittest.cc
index b9796c7..70e437d 100644
--- a/src/google/protobuf/dynamic_message_unittest.cc
+++ b/src/google/protobuf/dynamic_message_unittest.cc
@@ -40,6 +40,11 @@
// reflection_ops_unittest, cover the rest of the functionality used by
// DynamicMessage.
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
+
#include <google/protobuf/stubs/scoped_ptr.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/dynamic_message.h>
@@ -144,7 +149,7 @@
// Check that all fields have independent offsets by setting each
// one to a unique value then checking that they all still have those
// unique values (i.e. they don't stomp each other).
- scoped_ptr<Message> message(prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(prototype_->New());
TestUtil::ReflectionTester reflection_tester(descriptor_);
reflection_tester.SetAllFieldsViaReflection(message.get());
@@ -153,7 +158,7 @@
TEST_F(DynamicMessageTest, Extensions) {
// Check that extensions work.
- scoped_ptr<Message> message(extensions_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(extensions_prototype_->New());
TestUtil::ReflectionTester reflection_tester(extensions_descriptor_);
reflection_tester.SetAllFieldsViaReflection(message.get());
@@ -162,7 +167,7 @@
TEST_F(DynamicMessageTest, PackedFields) {
// Check that packed fields work properly.
- scoped_ptr<Message> message(packed_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(packed_prototype_->New());
TestUtil::ReflectionTester reflection_tester(packed_descriptor_);
reflection_tester.SetPackedFieldsViaReflection(message.get());
@@ -171,7 +176,7 @@
TEST_F(DynamicMessageTest, Oneof) {
// Check that oneof fields work properly.
- scoped_ptr<Message> message(oneof_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(oneof_prototype_->New());
// Check default values.
const Descriptor* descriptor = message->GetDescriptor();
@@ -232,7 +237,7 @@
// Since we share the implementation with generated messages, we don't need
// to test very much here. Just make sure it appears to be working.
- scoped_ptr<Message> message(prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(prototype_->New());
TestUtil::ReflectionTester reflection_tester(descriptor_);
int initial_space_used = message->SpaceUsed();
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index 919bd83..9afb236 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -34,6 +34,7 @@
#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/io/coded_stream.h>
@@ -594,20 +595,21 @@
ClearExtension(number);
return;
}
+ ::google::protobuf::Arena* message_arena = message->GetArena();
Extension* extension;
if (MaybeNewExtension(number, descriptor, &extension)) {
extension->type = type;
GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE);
extension->is_repeated = false;
extension->is_lazy = false;
- if (message->GetArena() == arena_) {
+ if (message_arena == arena_) {
extension->message_value = message;
+ } else if (message_arena == NULL) {
+ extension->message_value = message;
+ arena_->Own(message); // not NULL because not equal to message_arena
} else {
extension->message_value = message->New(arena_);
extension->message_value->CheckTypeAndMergeFrom(*message);
- if (message->GetArena() == NULL) {
- delete message;
- }
}
} else {
GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
@@ -617,14 +619,14 @@
if (arena_ == NULL) {
delete extension->message_value;
}
- if (message->GetArena() == arena_) {
+ if (message_arena == arena_) {
extension->message_value = message;
+ } else if (message_arena == NULL) {
+ extension->message_value = message;
+ arena_->Own(message); // not NULL because not equal to message_arena
} else {
extension->message_value = message->New(arena_);
extension->message_value->CheckTypeAndMergeFrom(*message);
- if (message->GetArena() == NULL) {
- delete message;
- }
}
}
}
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h
index 0968125..bca179b 100644
--- a/src/google/protobuf/extension_set.h
+++ b/src/google/protobuf/extension_set.h
@@ -724,8 +724,7 @@
static const RepeatedFieldType* GetDefaultRepeatedField();
};
-LIBPROTOBUF_EXPORT extern ProtobufOnceType
-repeated_primitive_generic_type_traits_once_init_;
+LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_primitive_generic_type_traits_once_init_;
class LIBPROTOBUF_EXPORT RepeatedPrimitiveGenericTypeTraits {
private:
@@ -766,7 +765,7 @@
} \
template<> inline const RepeatedField<TYPE>* \
RepeatedPrimitiveTypeTraits<TYPE>::GetDefaultRepeatedField() { \
- GoogleOnceInit( \
+ ::google::protobuf::GoogleOnceInit( \
&repeated_primitive_generic_type_traits_once_init_, \
&RepeatedPrimitiveGenericTypeTraits::InitializeDefaultRepeatedFields); \
return RepeatedPrimitiveGenericTypeTraits:: \
@@ -822,8 +821,7 @@
}
};
-LIBPROTOBUF_EXPORT extern ProtobufOnceType
-repeated_string_type_traits_once_init_;
+LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_string_type_traits_once_init_;
class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits {
public:
@@ -868,7 +866,7 @@
}
static const RepeatedFieldType* GetDefaultRepeatedField() {
- GoogleOnceInit(&repeated_string_type_traits_once_init_,
+ ::google::protobuf::GoogleOnceInit(&repeated_string_type_traits_once_init_,
&InitializeDefaultRepeatedFields);
return default_repeated_field_;
}
@@ -1034,8 +1032,7 @@
static const RepeatedFieldType* GetDefaultRepeatedField();
};
-LIBPROTOBUF_EXPORT extern ProtobufOnceType
-repeated_message_generic_type_traits_once_init_;
+LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_message_generic_type_traits_once_init_;
// This class exists only to hold a generic default empty repeated field for all
// message-type repeated field extensions.
@@ -1052,7 +1049,7 @@
template<typename Type> inline
const typename RepeatedMessageTypeTraits<Type>::RepeatedFieldType*
RepeatedMessageTypeTraits<Type>::GetDefaultRepeatedField() {
- GoogleOnceInit(
+ ::google::protobuf::GoogleOnceInit(
&repeated_message_generic_type_traits_once_init_,
&RepeatedMessageGenericTypeTraits::InitializeDefaultRepeatedFields);
return reinterpret_cast<const RepeatedFieldType*>(
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index 1569120..f40fcbc 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -360,9 +360,8 @@
unittest::ForeignMessage* foreign_message = new unittest::ForeignMessage();
message->SetAllocatedExtension(unittest::optional_foreign_message_extension,
foreign_message);
- // foreign_message is copied underneath, as foreign_message is on heap
- // and extension_set is on an arena.
- EXPECT_NE(foreign_message,
+ // foreign_message is now owned by the arena.
+ EXPECT_EQ(foreign_message,
message->MutableExtension(
unittest::optional_foreign_message_extension));
diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc
index df04384..85ebdef 100644
--- a/src/google/protobuf/generated_message_reflection_unittest.cc
+++ b/src/google/protobuf/generated_message_reflection_unittest.cc
@@ -43,6 +43,11 @@
// rather than generated accessors.
#include <google/protobuf/generated_message_reflection.h>
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
+
#include <google/protobuf/descriptor.h>
#include <google/protobuf/test_util.h>
#include <google/protobuf/unittest.pb.h>
@@ -354,7 +359,7 @@
ASSERT_EQ(2, message.repeated_foreign_message_size());
const protobuf_unittest::ForeignMessage* expected =
message.mutable_repeated_foreign_message(1);
- scoped_ptr<Message> released(message.GetReflection()->ReleaseLast(
+ google::protobuf::scoped_ptr<Message> released(message.GetReflection()->ReleaseLast(
&message, descriptor->FindFieldByName("repeated_foreign_message")));
EXPECT_EQ(expected, released.get());
}
@@ -377,9 +382,9 @@
unittest::repeated_foreign_message_extension));
const protobuf_unittest::ForeignMessage* expected = message.MutableExtension(
unittest::repeated_foreign_message_extension, 1);
- scoped_ptr<Message> released(message.GetReflection()->ReleaseLast(
+ google::protobuf::scoped_ptr<Message> released(message.GetReflection()->ReleaseLast(
&message, descriptor->file()->FindExtensionByName(
- "repeated_foreign_message_extension")));
+ "repeated_foreign_message_extension")));
EXPECT_EQ(expected, released.get());
}
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc
index afaca2e..7b813f8 100644
--- a/src/google/protobuf/generated_message_util.cc
+++ b/src/google/protobuf/generated_message_util.cc
@@ -63,7 +63,6 @@
int StringSpaceUsedExcludingSelf(const string& str) {
const void* start = &str;
const void* end = &str + 1;
-
if (start <= str.data() && str.data() < end) {
// The string's data is stored inside the string object itself.
return 0;
@@ -73,6 +72,7 @@
}
+
} // namespace internal
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/io/coded_stream_unittest.cc b/src/google/protobuf/io/coded_stream_unittest.cc
index 630c908..d1782e3 100644
--- a/src/google/protobuf/io/coded_stream_unittest.cc
+++ b/src/google/protobuf/io/coded_stream_unittest.cc
@@ -34,6 +34,10 @@
//
// This file contains tests and benchmarks.
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <vector>
#include <google/protobuf/io/coded_stream.h>
@@ -679,7 +683,7 @@
}
TEST_F(CodedStreamTest, ReadStringImpossiblyLargeFromStringOnHeap) {
- scoped_array<uint8> buffer(new uint8[8]);
+ google::protobuf::scoped_array<uint8> buffer(new uint8[8]);
CodedInputStream coded_input(buffer.get(), 8);
string str;
EXPECT_FALSE(coded_input.ReadString(&str, 1 << 30));
diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
index 9cdf037..a598ef2 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
@@ -44,6 +44,10 @@
#ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__
#define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <string>
#include <iosfwd>
#include <google/protobuf/io/zero_copy_stream.h>
@@ -235,7 +239,7 @@
// Data is read into this buffer. It may be NULL if no buffer is currently
// in use. Otherwise, it points to an array of size buffer_size_.
- scoped_array<uint8> buffer_;
+ google::protobuf::scoped_array<uint8> buffer_;
const int buffer_size_;
// Number of valid bytes currently in the buffer (i.e. the size last
@@ -324,7 +328,7 @@
// Data is written from this buffer. It may be NULL if no buffer is
// currently in use. Otherwise, it points to an array of size buffer_size_.
- scoped_array<uint8> buffer_;
+ google::protobuf::scoped_array<uint8> buffer_;
const int buffer_size_;
// Number of valid bytes currently in the buffer (i.e. the size last
diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc
index 3850e76..8c7358c 100644
--- a/src/google/protobuf/io/zero_copy_stream_unittest.cc
+++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc
@@ -57,6 +57,10 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <sstream>
#include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -197,7 +201,7 @@
}
void IoTest::ReadString(ZeroCopyInputStream* input, const string& str) {
- scoped_array<char> buffer(new char[str.size() + 1]);
+ google::protobuf::scoped_array<char> buffer(new char[str.size() + 1]);
buffer[str.size()] = '\0';
EXPECT_EQ(ReadFromInput(input, buffer.get(), str.size()), str.size());
EXPECT_STREQ(str.c_str(), buffer.get());
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 8b61573..52fba60 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -155,7 +155,7 @@
"MapKey::GetUInt32Value");
return val_.uint32_value_;
}
- int32 GetBoolValue() const {
+ bool GetBoolValue() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL,
"MapKey::GetBoolValue");
return val_.bool_value_;
@@ -190,6 +190,8 @@
GOOGLE_LOG(FATAL) << "Can't get here.";
return false;
}
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return false;
}
void CopyFrom(const MapKey& other) {
@@ -273,7 +275,7 @@
"MapValueRef::SetInt32Value");
*reinterpret_cast<int32*>(data_) = value;
}
- void SetUInt32Value(uint64 value) {
+ void SetUInt32Value(uint32 value) {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32,
"MapValueRef::SetUInt32Value");
*reinterpret_cast<uint32*>(data_) = value;
@@ -852,6 +854,8 @@
GOOGLE_LOG(FATAL) << "Can't get here.";
return 0;
}
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return 0;
}
bool
operator()(const google::protobuf::MapKey& map_key1,
@@ -875,6 +879,8 @@
GOOGLE_LOG(FATAL) << "Can't get here.";
return true;
}
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return true;
}
};
GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h
index 16c4a08..f116697 100644
--- a/src/google/protobuf/map_field_inl.h
+++ b/src/google/protobuf/map_field_inl.h
@@ -155,7 +155,8 @@
this_iter->key_.SetType(that_iter.key_.type());
// MapValueRef::type() fails when containing data is null. However, if
// this_iter points to MapEnd, data can be null.
- this_iter->value_.SetType((FieldDescriptor::CppType)that_iter.value_.type_);
+ this_iter->value_.SetType(
+ static_cast<FieldDescriptor::CppType>(that_iter.value_.type_));
SetMapIteratorValue(this_iter);
}
diff --git a/src/google/protobuf/map_proto2_unittest.proto b/src/google/protobuf/map_proto2_unittest.proto
index 6f9d616..916cc54 100644
--- a/src/google/protobuf/map_proto2_unittest.proto
+++ b/src/google/protobuf/map_proto2_unittest.proto
@@ -31,6 +31,8 @@
syntax = "proto2";
+import "google/protobuf/unittest_import.proto";
+
// We don't put this in a package within proto2 because we need to make sure
// that the generated code doesn't depend on being in the proto2 namespace.
// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
@@ -58,3 +60,7 @@
map<int32, Proto2MapEnumPlusExtra> known_map_field = 101;
map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102;
}
+
+message TestImportEnumMap {
+ map<int32, protobuf_unittest_import.ImportEnumForMap> import_enum_amp = 1;
+}
diff --git a/src/google/protobuf/map_test.cc b/src/google/protobuf/map_test.cc
index 16a24c2..451b02e 100644
--- a/src/google/protobuf/map_test.cc
+++ b/src/google/protobuf/map_test.cc
@@ -2154,7 +2154,7 @@
// Check that all fields have independent offsets by setting each
// one to a unique value then checking that they all still have those
// unique values (i.e. they don't stomp each other).
- scoped_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
MapReflectionTester reflection_tester(map_descriptor_);
reflection_tester.SetMapFieldsViaReflection(message.get());
@@ -2163,7 +2163,7 @@
TEST_F(MapFieldInDynamicMessageTest, DynamicMapReflection) {
// Check that map fields work properly.
- scoped_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
// Check set functions.
MapReflectionTester reflection_tester(map_descriptor_);
@@ -2177,7 +2177,7 @@
// Since we share the implementation with generated messages, we don't need
// to test very much here. Just make sure it appears to be working.
- scoped_ptr<Message> message(map_prototype_->New());
+ google::protobuf::scoped_ptr<Message> message(map_prototype_->New());
MapReflectionTester reflection_tester(map_descriptor_);
int initial_space_used = message->SpaceUsed();
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index 5040e60..f8ad758 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -272,24 +272,24 @@
return WireFormatLite::MessageSizeNoVirtual(value);
}
-#define BYTE_SIZE(FieldType, DeclaredType) \
+#define GOOGLE_PROTOBUF_BYTE_SIZE(FieldType, DeclaredType) \
template <typename Type> \
inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \
const MapEntryAccessorType& value) { \
return WireFormatLite::DeclaredType##Size(value); \
}
-BYTE_SIZE(STRING, String)
-BYTE_SIZE(BYTES , Bytes)
-BYTE_SIZE(INT64 , Int64)
-BYTE_SIZE(UINT64, UInt64)
-BYTE_SIZE(INT32 , Int32)
-BYTE_SIZE(UINT32, UInt32)
-BYTE_SIZE(SINT64, SInt64)
-BYTE_SIZE(SINT32, SInt32)
-BYTE_SIZE(ENUM , Enum)
+GOOGLE_PROTOBUF_BYTE_SIZE(STRING, String)
+GOOGLE_PROTOBUF_BYTE_SIZE(BYTES , Bytes)
+GOOGLE_PROTOBUF_BYTE_SIZE(INT64 , Int64)
+GOOGLE_PROTOBUF_BYTE_SIZE(UINT64, UInt64)
+GOOGLE_PROTOBUF_BYTE_SIZE(INT32 , Int32)
+GOOGLE_PROTOBUF_BYTE_SIZE(UINT32, UInt32)
+GOOGLE_PROTOBUF_BYTE_SIZE(SINT64, SInt64)
+GOOGLE_PROTOBUF_BYTE_SIZE(SINT32, SInt32)
+GOOGLE_PROTOBUF_BYTE_SIZE(ENUM , Enum)
-#undef BYTE_SIZE
+#undef GOOGLE_PROTOBUF_BYTE_SIZE
#define FIXED_BYTE_SIZE(FieldType, DeclaredType) \
template <typename Type> \
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index 2f6416d..032748b 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -55,7 +55,6 @@
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/singleton.h>
#include <google/protobuf/stubs/stl_util.h>
-#include <google/protobuf/stubs/port.h>
namespace google {
namespace protobuf {
@@ -495,11 +494,19 @@
return prototype->New(arena);
}
template<>
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240
+GOOGLE_ATTRIBUTE_NOINLINE
+#endif
google::protobuf::Arena* GenericTypeHandler<Message>::GetArena(
Message* value) {
return value->GetArena();
}
template<>
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240
+GOOGLE_ATTRIBUTE_NOINLINE
+#endif
void* GenericTypeHandler<Message>::GetMaybeArenaPointer(
Message* value) {
return value->GetMaybeArenaPointer();
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index 348e7c7..7c27afd 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -971,7 +971,7 @@
return false;
}
- // Returns a MaIterator referring to the first element in the map field.
+ // Returns a MapIterator referring to the first element in the map field.
// If the map field is empty, this function returns the same as
// reflection::MapEnd. Mutation to the field may invalidate the iterator.
virtual MapIterator MapBegin(
diff --git a/src/google/protobuf/metadata.h b/src/google/protobuf/metadata.h
index fdee150..219645d 100644
--- a/src/google/protobuf/metadata.h
+++ b/src/google/protobuf/metadata.h
@@ -56,7 +56,7 @@
// The tagged pointer uses the LSB to disambiguate cases, and uses bit 0 == 0 to
// indicate an arena pointer and bit 0 == 1 to indicate a UFS+Arena-container
// pointer.
-class LIBPROTOBUF_EXPORT InternalMetadataWithArena {
+class InternalMetadataWithArena {
public:
InternalMetadataWithArena() : ptr_(NULL) {}
explicit InternalMetadataWithArena(Arena* arena)
diff --git a/src/google/protobuf/proto_cast.h b/src/google/protobuf/proto_cast.h
deleted file mode 100644
index dc0e9ac..0000000
--- a/src/google/protobuf/proto_cast.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.
-
-#ifndef GOOGLE_PROTOBUF_UTIL_PROTO_CAST_H__
-#define GOOGLE_PROTOBUF_UTIL_PROTO_CAST_H__
-
-#include <string>
-
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-
-// proto_cast<> is used to simulate over-the-wire conversion of one
-// proto message into another. This is primarily useful for unit tests
-// which validate the version-compatibility semantics of protobufs.
-// Usage is similar to C++-style typecasts:
-//
-// OldMessage old_message = /*...*/;
-// NewMessage new_message = proto_cast<NewMessage>(old_message);
-namespace google {
-template<typename NewProto,
- typename OldProto>
-NewProto proto_cast(const OldProto& old_proto) {
- string wire_format;
- GOOGLE_CHECK(old_proto.SerializeToString(&wire_format));
-
- NewProto new_proto;
- GOOGLE_CHECK(new_proto.ParseFromString(wire_format));
- return new_proto;
-}
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_UTIL_PROTO_CAST_H__
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index b10e7a9..5530fef 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -649,7 +649,7 @@
// StringTypeHandler is exported. So, we factor out StringTypeHandlerBase,
// export that, then make StringTypeHandler be a subclass which is NOT
// exported.
-// TODO(kenton): Now that StringSpaceUsedExcludingSelf() is in the lite
+// TODO(kenton): Now that StringSpaceUsedExcludingSelf() is in the lite
// library, this can be cleaned up.
class LIBPROTOBUF_EXPORT StringTypeHandlerBase {
public:
diff --git a/src/google/protobuf/stubs/callback.h b/src/google/protobuf/stubs/callback.h
index c4f9ede..6da530d 100644
--- a/src/google/protobuf/stubs/callback.h
+++ b/src/google/protobuf/stubs/callback.h
@@ -325,8 +325,6 @@
typename remove_reference<P5>::type p5_;
};
-} // namespace internal
-
// See Closure.
inline Closure* NewCallback(void (*function)()) {
return new internal::FunctionClosure0(function, true);
@@ -452,6 +450,8 @@
p2, p3, p4, p5);
}
+} // namespace internal
+
// A function which does nothing. Useful for creating no-op callbacks, e.g.:
// Closure* nothing = NewCallback(&DoNothing);
void LIBPROTOBUF_EXPORT DoNothing();
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index 88e7084..9c05cac 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -146,7 +146,7 @@
LIBPROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len);
inline bool IsStructurallyValidUTF8(const std::string& str) {
- return IsStructurallyValidUTF8(str.data(), str.length());
+ return IsStructurallyValidUTF8(str.data(), static_cast<int>(str.length()));
}
// Returns initial number of bytes of structually valid UTF-8.
diff --git a/src/google/protobuf/stubs/common_unittest.cc b/src/google/protobuf/stubs/common_unittest.cc
index f9e2cfd..25bae9b 100644
--- a/src/google/protobuf/stubs/common_unittest.cc
+++ b/src/google/protobuf/stubs/common_unittest.cc
@@ -41,6 +41,8 @@
namespace google {
namespace protobuf {
+using internal::NewCallback;
+using internal::NewPermanentCallback;
namespace {
// TODO(kenton): More tests.
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h
index c6f210f..5833432 100755
--- a/src/google/protobuf/stubs/hash.h
+++ b/src/google/protobuf/stubs/hash.h
@@ -41,10 +41,15 @@
#define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1
#define GOOGLE_PROTOBUF_HAVE_HASH_SET 1
-// Use C++11 unordered_{map|set} if available. Otherwise, libc++ always support
-// unordered_{map|set}
-#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X) || \
- defined(_LIBCPP_VERSION)
+// Android
+#if defined(__ANDROID__)
+# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP
+# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP
+
+// Use C++11 unordered_{map|set} if available.
+#elif ((_LIBCPP_STD_VER >= 11) || \
+ (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \
+ (__GLIBCXX__ > 20090421)))
# define GOOGLE_PROTOBUF_HAS_CXX11_HASH
// For XCode >= 4.6: the compiler is clang with libc++.
diff --git a/src/google/protobuf/stubs/int128.cc b/src/google/protobuf/stubs/int128.cc
index 9f4fb82..d80c64f 100644
--- a/src/google/protobuf/stubs/int128.cc
+++ b/src/google/protobuf/stubs/int128.cc
@@ -188,7 +188,8 @@
if ((flags & std::ios::adjustfield) == std::ios::left) {
rep.append(width - rep.size(), o.fill());
} else {
- rep.insert(0, width - rep.size(), o.fill());
+ rep.insert(static_cast<std::string::size_type>(0),
+ width - rep.size(), o.fill());
}
}
diff --git a/src/google/protobuf/stubs/once_unittest.cc b/src/google/protobuf/stubs/once_unittest.cc
index cb5a20d..37def58 100644
--- a/src/google/protobuf/stubs/once_unittest.cc
+++ b/src/google/protobuf/stubs/once_unittest.cc
@@ -43,6 +43,7 @@
namespace google {
namespace protobuf {
+using internal::NewCallback;
namespace {
class OnceInitTest : public testing::Test {
@@ -127,10 +128,11 @@
};
TestThread* RunInitOnceInNewThread() {
- return new TestThread(NewCallback(this, &OnceInitTest::InitOnce));
+ return new TestThread(internal::NewCallback(this, &OnceInitTest::InitOnce));
}
TestThread* RunInitRecursiveOnceInNewThread() {
- return new TestThread(NewCallback(this, &OnceInitTest::InitRecursiveOnce));
+ return new TestThread(
+ internal::NewCallback(this, &OnceInitTest::InitRecursiveOnce));
}
enum State {
diff --git a/src/google/protobuf/stubs/stringpiece.h b/src/google/protobuf/stubs/stringpiece.h
index 353a60d..ec3ffd5 100644
--- a/src/google/protobuf/stubs/stringpiece.h
+++ b/src/google/protobuf/stubs/stringpiece.h
@@ -149,6 +149,7 @@
#include <string>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/hash.h>
namespace google {
namespace protobuf {
@@ -437,4 +438,16 @@
} // namespace protobuf
} // namespace google
+GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START
+template<> struct hash<StringPiece> {
+ size_t operator()(const StringPiece& s) const {
+ size_t result = 0;
+ for (const char *str = s.data(), *end = str + s.size(); str < end; str++) {
+ result = 5 * result + *str;
+ }
+ return result;
+ }
+};
+GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
+
#endif // STRINGS_STRINGPIECE_H_
diff --git a/src/google/protobuf/stubs/stringpiece_unittest.cc b/src/google/protobuf/stubs/stringpiece_unittest.cc
index 9b5dae1..43737a5 100644
--- a/src/google/protobuf/stubs/stringpiece_unittest.cc
+++ b/src/google/protobuf/stubs/stringpiece_unittest.cc
@@ -36,6 +36,7 @@
#include <vector>
#include <google/protobuf/testing/googletest.h>
+#include <google/protobuf/stubs/hash.h>
#include <gtest/gtest.h>
namespace google {
@@ -745,6 +746,23 @@
EXPECT_TRUE(abc.ends_with("nopqrstuvwxyz"));
}
+TEST(StringPiece, HashFunction) {
+ hash_set<StringPiece> set;
+
+ set.insert(StringPiece("hello"));
+ EXPECT_EQ(1, set.size());
+
+ // Insert a StringPiece of the same value again and should NOT increment
+ // size of the set.
+ set.insert(StringPiece("hello"));
+ EXPECT_EQ(1, set.size());
+
+ // Insert a StringPiece with different value and check that size of the set
+ // has been increment by one.
+ set.insert(StringPiece("world"));
+ EXPECT_EQ(2, set.size());
+}
+
TEST(ComparisonOpsTest, StringCompareNotAmbiguous) {
EXPECT_EQ("hello", string("hello"));
EXPECT_LT("hello", string("world"));
diff --git a/src/google/protobuf/testing/googletest.cc b/src/google/protobuf/testing/googletest.cc
index b8bd790..2b9cdde 100644
--- a/src/google/protobuf/testing/googletest.cc
+++ b/src/google/protobuf/testing/googletest.cc
@@ -94,6 +94,13 @@
namespace {
string GetTemporaryDirectoryName() {
+ // Tests run under Bazel "should not" use /tmp. Bazel sets this environment
+ // variable for tests to use instead.
+ char *from_environment = getenv("TEST_TMPDIR");
+ if (from_environment != NULL && from_environment[0] != '\0') {
+ return string(from_environment) + "/protobuf_tmpdir";
+ }
+
// tmpnam() is generally not considered safe but we're only using it for
// testing. We cannot use tmpfile() or mkstemp() since we're creating a
// directory.
diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index 4d8c1f9..38b9069 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -377,8 +377,8 @@
if (internal::GetAnyFieldDescriptors(*message, &any_type_url_field,
&any_value_field) &&
TryConsume("[")) {
- string full_type_name;
- DO(ConsumeAnyTypeUrl(&full_type_name));
+ string full_type_name, prefix;
+ DO(ConsumeAnyTypeUrl(&full_type_name, &prefix));
DO(Consume("]"));
string serialized_value;
DO(ConsumeAnyValue(full_type_name,
@@ -386,7 +386,7 @@
&serialized_value));
reflection->SetString(
message, any_type_url_field,
- string(internal::kTypeGoogleApisComPrefix) + full_type_name);
+ string(prefix + full_type_name));
reflection->SetString(message, any_value_field, serialized_value);
return true;
// Fall through.
@@ -981,7 +981,8 @@
}
// Consumes Any::type_url value, of form "type.googleapis.com/full.type.Name"
- bool ConsumeAnyTypeUrl(string* full_type_name) {
+ // or "type.googleprod.com/full.type.Name"
+ bool ConsumeAnyTypeUrl(string* full_type_name, string* prefix) {
// TODO(saito) Extend Consume() to consume multiple tokens at once, so that
// this code can be written as just DO(Consume(kGoogleApisTypePrefix)).
string url1, url2, url3;
@@ -993,10 +994,12 @@
DO(Consume("/"));
DO(ConsumeFullTypeName(full_type_name));
- const string prefix = url1 + "." + url2 + "." + url3 + "/";
- if (prefix != internal::kTypeGoogleApisComPrefix) {
+ *prefix = url1 + "." + url2 + "." + url3 + "/";
+ if (*prefix != internal::kTypeGoogleApisComPrefix &&
+ *prefix != internal::kTypeGoogleProdComPrefix) {
ReportError("TextFormat::Parser for Any supports only "
- "type.googleapi.com, but found \"" + prefix + "\"");
+ "type.googleapis.com and type.googleprod.com, "
+ "but found \"" + *prefix + "\"");
return false;
}
return true;
diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc
index 1aafd8e..8d61be1 100644
--- a/src/google/protobuf/text_format_unittest.cc
+++ b/src/google/protobuf/text_format_unittest.cc
@@ -37,6 +37,10 @@
#include <math.h>
#include <stdlib.h>
#include <limits>
+#include <memory>
+#ifndef _SHARED_PTR_H
+#include <google/protobuf/stubs/shared_ptr.h>
+#endif
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
@@ -931,7 +935,7 @@
protected:
void ExpectFailure(const string& input, const string& message, int line,
int col) {
- scoped_ptr<unittest::TestAllTypes> proto(new unittest::TestAllTypes);
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> proto(new unittest::TestAllTypes);
ExpectFailure(input, message, line, col, proto.get());
}
@@ -992,7 +996,7 @@
};
TEST_F(TextFormatParserTest, ParseInfoTreeBuilding) {
- scoped_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
const Descriptor* d = message->GetDescriptor();
string stringData =
@@ -1057,7 +1061,7 @@
}
TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
- scoped_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
+ google::protobuf::scoped_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
const Descriptor* d = message->GetDescriptor();
#define EXPECT_FIELD(name, value, valuestring) \
diff --git a/src/google/protobuf/unittest_import.proto b/src/google/protobuf/unittest_import.proto
index 7e16522..8d03e38 100644
--- a/src/google/protobuf/unittest_import.proto
+++ b/src/google/protobuf/unittest_import.proto
@@ -64,3 +64,10 @@
IMPORT_BAZ = 9;
}
+
+// To use an enum in a map, it must has the first value as 0.
+enum ImportEnumForMap {
+ UNKNOWN = 0;
+ FOO = 1;
+ BAR = 2;
+}
diff --git a/src/google/protobuf/unknown_enum_impl.h b/src/google/protobuf/unknown_enum_impl.h
deleted file mode 100644
index 7c68ad6..0000000
--- a/src/google/protobuf/unknown_enum_impl.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// 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.
-
-#ifndef GOOGLE_PROTOBUF_UTIL_UNKNOWN_ENUM_IMPL_H__
-#define GOOGLE_PROTOBUF_UTIL_UNKNOWN_ENUM_IMPL_H__
-
-#include <stdlib.h>
-
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/bridge/compatibility_mode_support.h>
-
-namespace google {
-namespace protobuf {
-
-// google/protobuf/message.h
-class Message;
-
-namespace util {
-
-// NOTE: You should not call these functions directly. Instead use either
-// HAS_UNKNOWN_ENUM() or GET_UNKNOWN_ENUM(), defined in the public header.
-// The macro-versions operate in a type-safe manner and behave appropriately
-// for the proto version of the message, whereas these versions assume a
-// specific proto version and allow the caller to pass in any arbitrary integer
-// value as a field number.
-//
-// Returns whether the message has unrecognized the enum value for a given
-// field. It also stores the value into the unknown_value parameter if the
-// function returns true and the pointer is not NULL.
-//
-// In proto2, invalid enum values will be treated as unknown fields. This
-// function checks that case.
-bool HasUnknownEnum(const Message& message, int32 field_number,
- int32* unknown_value = NULL);
-// Same as above, but returns all unknown enums.
-bool GetRepeatedEnumUnknowns(const Message& message, int32 field_number,
- vector<int32>* unknown_values = NULL);
-// In proto1, invalue enum values are stored in the same way as valid enum
-// values.
-// TODO(karner): Delete this once the migration to proto2 is complete.
-bool HasUnknownEnumProto1(const Message& message, int32 field_number,
- int32* unknown_value);
-// Same as above, but returns all unknown enums.
-bool GetRepeatedEnumUnknownsProto1(const Message& message, int32 field_number,
- vector<int32>* unknown_values);
-// Invokes the appropriate version based on whether the message is proto1
-// or proto2.
-template <typename T>
-bool HasUnknownEnum_Template(const T& message, int32 field_number,
- int32* unknown_value = NULL) {
- if (internal::is_base_of<bridge::internal::Proto1CompatibleMessage, T>::value ||
- !internal::is_base_of<ProtocolMessage, T>::value) {
- return HasUnknownEnum(message, field_number, unknown_value);
- } else {
- return HasUnknownEnumProto1(message, field_number, unknown_value);
- }
-}
-// Invokes the appropriate version based on whether the message is proto1
-// or proto2.
-template <typename T>
-bool GetRepeatedEnumUnknowns_Template(
- const T& message, int32 field_number,
- vector<int32>* unknown_values = NULL) {
- if (internal::is_base_of<bridge::internal::Proto1CompatibleMessage, T>::value ||
- !internal::is_base_of<ProtocolMessage, T>::value) {
- return GetRepeatedEnumUnknowns(message, field_number, unknown_values);
- } else {
- return GetRepeatedEnumUnknownsProto1(message, field_number,
- unknown_values);
- }
-}
-
-// NOTE: You should not call these functions directly. Instead use
-// CLEAR_UNKNOWN_ENUM(), defined in the public header. The macro-versions
-// operate in a type-safe manner and behave appropriately for the proto
-// version of the message, whereas these versions assume a specific proto
-// version and allow the caller to pass in any arbitrary integer value as a
-// field number.
-//
-// Clears the unknown entries of the given field of the message.
-void ClearUnknownEnum(Message* message, int32 field_number);
-// In proto1, clears the field if the value is out of range.
-// TODO(karner): Delete this or make it proto2-only once the migration
-// to proto2 is complete.
-void ClearUnknownEnumProto1(Message* message, int32 field_number);
-template <typename T>
-void ClearUnknownEnum_Template(T* message, int32 field_number) {
- if (internal::is_base_of<bridge::internal::Proto1CompatibleMessage, T>::value ||
- !internal::is_base_of<ProtocolMessage, T>::value) {
- ClearUnknownEnum(message, field_number);
- } else {
- ClearUnknownEnumProto1(message, field_number);
- }
-}
-
-// NOTE: You should not call these functions directly. Instead use
-// SET_UNKNOWN_ENUM(), defined in the public header. The macro-versions
-// operate in a type-safe manner and behave appropriately for the proto
-// version of the message, whereas these versions assume a specific proto
-// version and allow the caller to pass in any arbitrary integer value as a
-// field number.
-//
-// Sets the given value in the unknown fields of the message.
-void SetUnknownEnum(Message* message, int32 field_number, int32 unknown_value);
-// In proto1, invalue enum values are stored in the same way as valid enum
-// values.
-// TODO(karner): Delete this once the migration to proto2 is complete.
-void SetUnknownEnumProto1(Message* message, int32 field_number,
- int32 unknown_value);
-// Invokes the appropriate version based on whether the message is proto1
-// or proto2.
-template <typename T>
-void SetUnknownEnum_Template(T* message, int32 field_number,
- int32 unknown_value) {
- if (internal::is_base_of<bridge::internal::Proto1CompatibleMessage, T>::value ||
- !internal::is_base_of<ProtocolMessage, T>::value) {
- SetUnknownEnum(message, field_number, unknown_value);
- } else {
- SetUnknownEnumProto1(message, field_number, unknown_value);
- }
-}
-
-} // namespace util
-} // namespace protobuf
-
-} // namespace google
-#endif // GOOGLE_PROTOBUF_UTIL_UNKNOWN_ENUM_IMPL_H__
diff --git a/src/google/protobuf/unknown_enum_test.proto b/src/google/protobuf/unknown_enum_test.proto
deleted file mode 100644
index 3c549cc..0000000
--- a/src/google/protobuf/unknown_enum_test.proto
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.
-
-// Definitions of protos for testing cross-version compatibility. The
-// UpRevision message acts as if it were a newer version of the DownRevision
-// message. That is, UpRevision shares all the same fields as DownRevision,
-// but UpRevision can add fields and add enum values.
-syntax = "proto2";
-
-package google.protobuf.util;
-
-option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
-
-message DownRevision {
- enum Enum {
- DEFAULT_VALUE = 2;
- NONDEFAULT_VALUE = 3;
- }
-
- optional Enum value = 1 [default = DEFAULT_VALUE];
- repeated Enum values = 2;
-}
-
-message UpRevision {
- enum Enum {
- DEFAULT_VALUE = 2;
- NONDEFAULT_VALUE = 3;
- NEW_VALUE = 4;
- NEW_VALUE_2 = 5;
- NEW_VALUE_3 = 6;
- }
-
- optional Enum value = 1 [default = DEFAULT_VALUE];
- repeated Enum values = 2;
-}
diff --git a/src/google/protobuf/util/field_comparator_test.cc b/src/google/protobuf/util/field_comparator_test.cc
index 845839a..748c7d1 100644
--- a/src/google/protobuf/util/field_comparator_test.cc
+++ b/src/google/protobuf/util/field_comparator_test.cc
@@ -34,8 +34,8 @@
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/descriptor.h>
-#include <google/protobuf/stubs/mathutil.h>
#include <gtest/gtest.h>
+#include <google/protobuf/stubs/mathutil.h>
namespace google {
namespace protobuf {
diff --git a/src/google/protobuf/util/field_mask_util.cc b/src/google/protobuf/util/field_mask_util.cc
index 82034bd..29ca9c1 100644
--- a/src/google/protobuf/util/field_mask_util.cc
+++ b/src/google/protobuf/util/field_mask_util.cc
@@ -43,7 +43,7 @@
return Join(mask.paths(), ",");
}
-void FieldMaskUtil::FromString(const string& str, FieldMask* out) {
+void FieldMaskUtil::FromString(StringPiece str, FieldMask* out) {
out->Clear();
vector<string> paths = Split(str, ",");
for (int i = 0; i < paths.size(); ++i) {
@@ -53,7 +53,7 @@
}
bool FieldMaskUtil::InternalIsValidPath(const Descriptor* descriptor,
- const string& path) {
+ StringPiece path) {
vector<string> parts = Split(path, ".");
for (int i = 0; i < parts.size(); ++i) {
const string& field_name = parts[i];
@@ -386,15 +386,15 @@
intersection.MergeToFieldMask(out);
}
-bool FieldMaskUtil::IsPathInFieldMask(const string& path,
- const FieldMask& mask) {
+bool FieldMaskUtil::IsPathInFieldMask(StringPiece path, const FieldMask& mask) {
for (int i = 0; i < mask.paths_size(); ++i) {
const string& mask_path = mask.paths(i);
if (path == mask_path) {
return true;
} else if (mask_path.length() < path.length()) {
// Also check whether mask.paths(i) is a prefix of path.
- if (path.compare(0, mask_path.length() + 1, mask_path + ".") == 0) {
+ if (path.substr(0, mask_path.length() + 1).compare(mask_path + ".") ==
+ 0) {
return true;
}
}
diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h
index c99c34f..92f6989 100644
--- a/src/google/protobuf/util/field_mask_util.h
+++ b/src/google/protobuf/util/field_mask_util.h
@@ -35,6 +35,7 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/field_mask.pb.h>
+#include <google/protobuf/stubs/stringpiece.h>
namespace google {
namespace protobuf {
@@ -47,11 +48,11 @@
// Converts FieldMask to/from string, formatted according to proto3 JSON
// spec for FieldMask (e.g., "foo,bar,baz.quz").
static string ToString(const FieldMask& mask);
- static void FromString(const string& str, FieldMask* out);
+ static void FromString(StringPiece str, FieldMask* out);
// Checks whether the given path is valid for type T.
template <typename T>
- static bool IsValidPath(const string& path) {
+ static bool IsValidPath(StringPiece path) {
return InternalIsValidPath(T::descriptor(), path);
}
@@ -67,7 +68,7 @@
// Adds a path to FieldMask after checking whether the given path is valid.
// This method check-fails if the path is not a valid path for type T.
template <typename T>
- static void AddPathToFieldMask(const string& path, FieldMask* mask) {
+ static void AddPathToFieldMask(StringPiece path, FieldMask* mask) {
GOOGLE_CHECK(IsValidPath<T>(path));
mask->add_paths(path);
}
@@ -96,7 +97,7 @@
// Returns true if path is covered by the given FieldMask. Note that path
// "foo.bar" covers all paths like "foo.bar.baz", "foo.bar.quz.x", etc.
- static bool IsPathInFieldMask(const string& path, const FieldMask& mask);
+ static bool IsPathInFieldMask(StringPiece path, const FieldMask& mask);
class MergeOptions;
// Merges fields specified in a FieldMask into another message.
@@ -105,7 +106,7 @@
private:
static bool InternalIsValidPath(const Descriptor* descriptor,
- const string& path);
+ StringPiece path);
static void InternalGetFieldMaskForAllFields(const Descriptor* descriptor,
FieldMask* out);
diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.h b/src/google/protobuf/util/internal/default_value_objectwriter.h
index d454760..bcb526e 100644
--- a/src/google/protobuf/util/internal/default_value_objectwriter.h
+++ b/src/google/protobuf/util/internal/default_value_objectwriter.h
@@ -110,7 +110,7 @@
// "Node" represents a node in the tree that holds the input of
// DefaultValueObjectWriter.
- class Node {
+ class LIBPROTOBUF_EXPORT Node {
public:
Node(const string& name, const google::protobuf::Type* type, NodeKind kind,
const DataPiece& data, bool is_placeholder);
diff --git a/src/google/protobuf/util/internal/json_objectwriter.cc b/src/google/protobuf/util/internal/json_objectwriter.cc
index f81e330..94d2ab7 100644
--- a/src/google/protobuf/util/internal/json_objectwriter.cc
+++ b/src/google/protobuf/util/internal/json_objectwriter.cc
@@ -37,8 +37,8 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/util/internal/json_escaping.h>
-#include <google/protobuf/stubs/mathlimits.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/stubs/mathlimits.h>
namespace google {
namespace protobuf {
@@ -116,7 +116,7 @@
JsonObjectWriter* JsonObjectWriter::RenderDouble(StringPiece name,
double value) {
- if (google::protobuf::MathLimits<double>::IsFinite(value)) {
+ if (MathLimits<double>::IsFinite(value)) {
return RenderSimple(name, SimpleDtoa(value));
}
@@ -126,7 +126,7 @@
JsonObjectWriter* JsonObjectWriter::RenderFloat(StringPiece name,
float value) {
- if (google::protobuf::MathLimits<float>::IsFinite(value)) {
+ if (MathLimits<float>::IsFinite(value)) {
return RenderSimple(name, SimpleFtoa(value));
}
diff --git a/src/google/protobuf/util/internal/protostream_objectsource.cc b/src/google/protobuf/util/internal/protostream_objectsource.cc
index 996e1f8..aebf19a 100644
--- a/src/google/protobuf/util/internal/protostream_objectsource.cc
+++ b/src/google/protobuf/util/internal/protostream_objectsource.cc
@@ -47,7 +47,6 @@
#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/map_util.h>
-#include <google/protobuf/stubs/once.h>
#include <google/protobuf/stubs/status_macros.h>
@@ -140,6 +139,7 @@
const uint32 end_tag,
bool include_start_and_end,
ObjectWriter* ow) const {
+
const TypeRenderer* type_renderer = FindTypeRenderer(type.name());
if (type_renderer != NULL) {
return (*type_renderer)(this, type, name, ow);
@@ -332,10 +332,9 @@
if (seconds < 0) {
if (nanos > 0) {
return Status(util::error::INTERNAL,
- StrCat(
- "Duration nanos is non-negative, but seconds is "
- "negative for field: ",
- field_name));
+ StrCat("Duration nanos is non-negative, but seconds is "
+ "negative for field: ",
+ field_name));
}
sign = "-";
seconds = -seconds;
@@ -648,6 +647,7 @@
return Status::OK;
}
+
hash_map<string, ProtoStreamObjectSource::TypeRenderer>*
ProtoStreamObjectSource::renderers_ = NULL;
GOOGLE_PROTOBUF_DECLARE_ONCE(source_renderers_init_);
@@ -670,13 +670,16 @@
&ProtoStreamObjectSource::RenderInt32;
(*renderers_)["google.protobuf.UInt32Value"] =
&ProtoStreamObjectSource::RenderUInt32;
- (*renderers_)["google.protobuf.BoolValue"] = &ProtoStreamObjectSource::RenderBool;
+ (*renderers_)["google.protobuf.BoolValue"] =
+ &ProtoStreamObjectSource::RenderBool;
(*renderers_)["google.protobuf.StringValue"] =
&ProtoStreamObjectSource::RenderString;
(*renderers_)["google.protobuf.BytesValue"] =
&ProtoStreamObjectSource::RenderBytes;
- (*renderers_)["google.protobuf.Any"] = &ProtoStreamObjectSource::RenderAny;
- (*renderers_)["google.protobuf.Struct"] = &ProtoStreamObjectSource::RenderStruct;
+ (*renderers_)["google.protobuf.Any"] =
+ &ProtoStreamObjectSource::RenderAny;
+ (*renderers_)["google.protobuf.Struct"] =
+ &ProtoStreamObjectSource::RenderStruct;
(*renderers_)["google.protobuf.Value"] =
&ProtoStreamObjectSource::RenderStructValue;
(*renderers_)["google.protobuf.ListValue"] =
@@ -835,6 +838,7 @@
StrCat("Invalid configuration. Could not find the type: ",
field->type_url()));
}
+
RETURN_IF_ERROR(WriteMessage(*type, field_name, 0, true, ow));
if (!stream_->ConsumedEntireMessage()) {
return Status(util::error::INVALID_ARGUMENT,
@@ -988,7 +992,7 @@
uint32 nanos = 0;
uint32 tag = 0;
int64 signed_seconds = 0;
- int64 signed_nanos = 0;
+ int32 signed_nanos = 0;
for (tag = stream_->ReadTag(); tag != 0; tag = stream_->ReadTag()) {
const google::protobuf::Field* field = FindAndVerifyField(type, tag);
diff --git a/src/google/protobuf/util/internal/protostream_objectsource.h b/src/google/protobuf/util/internal/protostream_objectsource.h
index f52383a..3cd37aa 100644
--- a/src/google/protobuf/util/internal/protostream_objectsource.h
+++ b/src/google/protobuf/util/internal/protostream_objectsource.h
@@ -188,8 +188,7 @@
// Helper to render google.protobuf.Struct's ListValue fields to ObjectWriter.
static util::Status RenderStructListValue(
- const ProtoStreamObjectSource* os,
- const google::protobuf::Type& type,
+ const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
StringPiece name, ObjectWriter* ow);
// Render the "Any" type.
@@ -211,6 +210,7 @@
util::Status RenderField(const google::protobuf::Field* field,
StringPiece field_name, ObjectWriter* ow) const;
+
// Reads field value according to Field spec in 'field' and returns the read
// value as string. This only works for primitive datatypes (no message
// types).
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.cc b/src/google/protobuf/util/internal/protostream_objectwriter.cc
index a935ac3..08a2fb9 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter.cc
+++ b/src/google/protobuf/util/internal/protostream_objectwriter.cc
@@ -33,13 +33,13 @@
#include <functional>
#include <stack>
+#include <google/protobuf/stubs/once.h>
#include <google/protobuf/stubs/time.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/util/internal/field_mask_utility.h>
#include <google/protobuf/util/internal/object_location_tracker.h>
#include <google/protobuf/util/internal/constants.h>
#include <google/protobuf/util/internal/utility.h>
-#include <google/protobuf/stubs/once.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/statusor.h>
@@ -397,8 +397,8 @@
const TypeRenderer* type_renderer =
FindTypeRenderer(GetFullTypeWithUrl(ow_->master_type_.name()));
if (type_renderer) {
- // TODO(rikka): Don't just ignore the util::Status object!
- (*type_renderer)(ow_.get(), value);
+ Status status = (*type_renderer)(ow_.get(), value);
+ if (!status.ok()) ow_->InvalidValue("Any", status.error_message());
} else {
ow_->RenderDataPiece(name, value);
}
@@ -600,6 +600,11 @@
InsertIfNotPresent(&oneof_indices_, index);
}
+bool ProtoStreamObjectWriter::ProtoElement::InsertMapKeyIfNotPresent(
+ StringPiece map_key) {
+ return InsertIfNotPresent(&map_keys_, map_key);
+}
+
inline void ProtoStreamObjectWriter::InvalidName(StringPiece unknown_name,
StringPiece message) {
listener_->InvalidName(location(), ToSnakeCase(unknown_name), message);
@@ -643,6 +648,11 @@
return this;
} else if (element_ != NULL &&
(element_->IsMap() || element_->IsStructMap())) {
+ if (!ValidMapKey(name)) {
+ ++invalid_depth_;
+ return this;
+ }
+
field = StartMapEntry(name);
if (element_->IsStructMapEntry()) {
// If the top element is a map entry, this means we are starting another
@@ -698,7 +708,7 @@
element_.reset(
new ProtoElement(element_.release(), field, *type, ProtoElement::MAP));
} else {
- WriteTag(*field);
+ WriteTag(*field);
element_.reset(new ProtoElement(element_.release(), field, *type,
ProtoElement::MESSAGE));
}
@@ -863,6 +873,7 @@
// struct.
SkipElements();
+
// If ending the root element,
// then serialize the full message with calculated sizes.
if (element_ == NULL) {
@@ -914,6 +925,11 @@
// Check if we need to start a map. This can heppen when there is either a map
// or a struct type within a list.
if (element_->IsMap() || element_->IsStructMap()) {
+ if (!ValidMapKey(name)) {
+ ++invalid_depth_;
+ return this;
+ }
+
field = StartMapEntry(name);
if (field == NULL) return this;
@@ -969,7 +985,7 @@
ProtoElement::MESSAGE));
InvalidValue("Map", "Cannot bind a list to map.");
++invalid_depth_;
- element_->pop();
+ element_.reset(element_->pop());
return this;
}
@@ -1113,7 +1129,7 @@
// conversions as much as possible. Because ToSnakeCase sometimes returns the
// wrong value.
google::protobuf::scoped_ptr<ResultCallback1<util::Status, StringPiece> > callback(
- NewPermanentCallback(&RenderOneFieldPath, ow));
+ google::protobuf::internal::NewPermanentCallback(&RenderOneFieldPath, ow));
return DecodeCompactFieldMaskPaths(data.str(), callback.get());
}
@@ -1188,6 +1204,7 @@
type_url = GetFullTypeWithUrl(master_type_.name());
} else {
if (element_->IsMap() || element_->IsStructMap()) {
+ if (!ValidMapKey(name)) return this;
is_map_entry = true;
field = StartMapEntry(name);
} else {
@@ -1462,6 +1479,19 @@
return true;
}
+bool ProtoStreamObjectWriter::ValidMapKey(StringPiece unnormalized_name) {
+ if (element_ == NULL) return true;
+
+ if (!element_->InsertMapKeyIfNotPresent(unnormalized_name)) {
+ InvalidName(
+ unnormalized_name,
+ StrCat("Repeated map key: '", unnormalized_name, "' is already set."));
+ return false;
+ }
+
+ return true;
+}
+
const google::protobuf::Field* ProtoStreamObjectWriter::BeginNamed(
StringPiece name, bool is_list) {
if (invalid_depth_ > 0) {
@@ -1614,6 +1644,7 @@
stream_->WriteTag(WireFormatLite::MakeTag(field.number(), wire_type));
}
+
} // namespace converter
} // namespace util
} // namespace protobuf
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.h b/src/google/protobuf/util/internal/protostream_objectwriter.h
index 8f49120..19f747f 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter.h
+++ b/src/google/protobuf/util/internal/protostream_objectwriter.h
@@ -259,6 +259,13 @@
// generate an error.
void TakeOneofIndex(int32 index);
+ // Inserts map key into hash set if and only if the key did NOT already
+ // exist in hash set.
+ // The hash set (map_keys_) is ONLY used to keep track of map keys.
+ // Return true if insert successfully; returns false if the map key was
+ // already present.
+ bool InsertMapKeyIfNotPresent(StringPiece map_key);
+
private:
// Used for access to variables of the enclosing instance of
// ProtoStreamObjectWriter.
@@ -296,6 +303,10 @@
// incoming messages so no more than one oneof is set.
hash_set<int32> oneof_indices_;
+ // Set of map keys already seen for the type_. Used to validate incoming
+ // messages so no map key appears more than once.
+ hash_set<StringPiece> map_keys_;
+
GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(ProtoElement);
};
@@ -378,6 +389,7 @@
// Helper method to write proto tags based on the given field.
void WriteTag(const google::protobuf::Field& field);
+
// Helper function to render primitive data types in DataPiece.
void RenderSimpleDataPiece(const google::protobuf::Field& field,
const google::protobuf::Type& type,
@@ -424,6 +436,14 @@
bool ValidOneof(const google::protobuf::Field& field,
StringPiece unnormalized_name);
+ // Returns true if the map key for type_ is not duplicated key.
+ // If map key is duplicated key, this function returns false.
+ // Note that caller should make sure that the current proto element (element_)
+ // is of element type MAP or STRUCT_MAP.
+ // It also calls the appropriate error callback and unnormalzied_name is used
+ // for error string.
+ bool ValidMapKey(StringPiece unnormalized_name);
+
// Variables for describing the structure of the input tree:
// master_type_: descriptor for the whole protobuf message.
// typeinfo_ : the TypeInfo object to lookup types.
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter_test.cc b/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
index 96e5ccf..cb9f97f 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
+++ b/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
@@ -45,6 +45,7 @@
#include <google/protobuf/util/internal/testdata/field_mask.pb.h>
#include <google/protobuf/util/internal/type_info_test_helper.h>
#include <google/protobuf/util/internal/constants.h>
+#include <google/protobuf/util/message_differencer.h>
#include <google/protobuf/stubs/bytestream.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/util/internal/testdata/anys.pb.h>
@@ -139,7 +140,9 @@
google::protobuf::scoped_ptr<Message> message(expected.New());
message->ParsePartialFromIstream(&istream);
- EXPECT_EQ(expected.DebugString(), message->DebugString());
+ if (!MessageDifferencer::Equivalent(expected, *message)) {
+ EXPECT_EQ(expected.DebugString(), message->DebugString());
+ }
}
void CheckOutput(const Message& expected) { CheckOutput(expected, -1); }
@@ -156,7 +159,12 @@
MATCHER_P(HasObjectLocation, expected,
"Verifies the expected object location") {
- string actual = std::tr1::get<0>(arg).ToString();
+ string actual;
+#if __cplusplus >= 201103L
+ actual = std::get<0>(arg).ToString();
+#else
+ actual = std::tr1::get<0>(arg).ToString();
+#endif
if (actual.compare(expected) == 0) return true;
*result_listener << "actual location is: " << actual;
return false;
@@ -851,15 +859,19 @@
}
};
+INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest,
+ ProtoStreamObjectWriterTimestampDurationTest,
+ ::testing::Values(
+ testing::USE_TYPE_RESOLVER));
+
TEST_P(ProtoStreamObjectWriterTimestampDurationTest, InvalidTimestampError1) {
TimestampDuration timestamp;
EXPECT_CALL(
listener_,
- InvalidValue(
- _, StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
- StringPiece("Field 'ts', Illegal timestamp format; timestamps "
- "must end with 'Z'")));
+ InvalidValue(_,
+ StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
+ StringPiece("Field 'ts', Invalid time format: ")));
ow_->StartObject("")->RenderString("ts", "")->EndObject();
CheckOutput(timestamp);
@@ -870,10 +882,9 @@
EXPECT_CALL(
listener_,
- InvalidValue(
- _, StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
- StringPiece(
- "Field 'ts', Invalid time format: Failed to parse input")));
+ InvalidValue(_,
+ StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
+ StringPiece("Field 'ts', Invalid time format: Z")));
ow_->StartObject("")->RenderString("ts", "Z")->EndObject();
CheckOutput(timestamp);
@@ -884,10 +895,10 @@
EXPECT_CALL(
listener_,
- InvalidValue(
- _, StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
- StringPiece("Field 'ts', Invalid time format, failed to parse nano "
- "seconds")));
+ InvalidValue(_,
+ StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
+ StringPiece("Field 'ts', Invalid time format: "
+ "1970-01-01T00:00:00.ABZ")));
ow_->StartObject("")
->RenderString("ts", "1970-01-01T00:00:00.ABZ")
@@ -902,7 +913,8 @@
listener_,
InvalidValue(_,
StringPiece("type.googleapis.com/google.protobuf.Timestamp"),
- StringPiece("Field 'ts', Timestamp value exceeds limits")));
+ StringPiece("Field 'ts', Invalid time format: "
+ "-8032-10-18T00:00:00.000Z")));
ow_->StartObject("")
->RenderString("ts", "-8032-10-18T00:00:00.000Z")
@@ -1008,6 +1020,11 @@
}
};
+INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest,
+ ProtoStreamObjectWriterStructTest,
+ ::testing::Values(
+ testing::USE_TYPE_RESOLVER));
+
// TODO(skarvaje): Write tests for failure cases.
TEST_P(ProtoStreamObjectWriterStructTest, StructRenderSuccess) {
StructType struct_type;
@@ -1046,12 +1063,62 @@
CheckOutput(struct_type);
}
+TEST_P(ProtoStreamObjectWriterStructTest, SimpleRepeatedStructMapKeyTest) {
+ EXPECT_CALL(
+ listener_,
+ InvalidName(_, StringPiece("k1"),
+ StringPiece("Repeated map key: 'k1' is already set.")));
+ ow_->StartObject("")
+ ->StartObject("object")
+ ->RenderString("k1", "v1")
+ ->RenderString("k1", "v2")
+ ->EndObject()
+ ->EndObject();
+}
+
+TEST_P(ProtoStreamObjectWriterStructTest, RepeatedStructMapListKeyTest) {
+ EXPECT_CALL(
+ listener_,
+ InvalidName(_, StringPiece("k1"),
+ StringPiece("Repeated map key: 'k1' is already set.")));
+ ow_->StartObject("")
+ ->StartObject("object")
+ ->RenderString("k1", "v1")
+ ->StartList("k1")
+ ->RenderString("", "v2")
+ ->EndList()
+ ->EndObject()
+ ->EndObject();
+}
+
+TEST_P(ProtoStreamObjectWriterStructTest, RepeatedStructMapObjectKeyTest) {
+ EXPECT_CALL(
+ listener_,
+ InvalidName(_, StringPiece("k1"),
+ StringPiece("Repeated map key: 'k1' is already set.")));
+ ow_->StartObject("")
+ ->StartObject("object")
+ ->StartObject("k1")
+ ->RenderString("sub_k1", "v1")
+ ->EndObject()
+ ->StartObject("k1")
+ ->RenderString("sub_k2", "v2")
+ ->EndObject()
+ ->EndObject()
+ ->EndObject();
+}
+
class ProtoStreamObjectWriterMapTest : public BaseProtoStreamObjectWriterTest {
protected:
ProtoStreamObjectWriterMapTest()
: BaseProtoStreamObjectWriterTest(MapIn::descriptor()) {}
};
+INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest,
+ ProtoStreamObjectWriterMapTest,
+ ::testing::Values(
+ testing::USE_TYPE_RESOLVER));
+
TEST_P(ProtoStreamObjectWriterMapTest, MapShouldNotAcceptList) {
MapIn mm;
EXPECT_CALL(listener_,
@@ -1066,17 +1133,37 @@
CheckOutput(mm);
}
+TEST_P(ProtoStreamObjectWriterMapTest, RepeatedMapKeyTest) {
+ EXPECT_CALL(
+ listener_,
+ InvalidName(_, StringPiece("k1"),
+ StringPiece("Repeated map key: 'k1' is already set.")));
+ ow_->StartObject("")
+ ->RenderString("other", "test")
+ ->StartObject("map_input")
+ ->RenderString("k1", "v1")
+ ->RenderString("k1", "v2")
+ ->EndObject()
+ ->EndObject();
+}
+
class ProtoStreamObjectWriterAnyTest : public BaseProtoStreamObjectWriterTest {
protected:
ProtoStreamObjectWriterAnyTest() {
vector<const Descriptor*> descriptors;
descriptors.push_back(AnyOut::descriptor());
descriptors.push_back(google::protobuf::DoubleValue::descriptor());
+ descriptors.push_back(google::protobuf::Timestamp::descriptor());
descriptors.push_back(google::protobuf::Any::descriptor());
ResetTypeInfo(descriptors);
}
};
+INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest,
+ ProtoStreamObjectWriterAnyTest,
+ ::testing::Values(
+ testing::USE_TYPE_RESOLVER));
+
TEST_P(ProtoStreamObjectWriterAnyTest, AnyRenderSuccess) {
AnyOut any;
google::protobuf::Any* any_type = any.mutable_any();
@@ -1119,8 +1206,6 @@
->EndObject()
->EndObject()
->EndObject();
-
- CheckOutput(out, 115);
}
TEST_P(ProtoStreamObjectWriterAnyTest, DoubleRecursiveAny) {
@@ -1155,8 +1240,6 @@
->EndObject()
->EndObject()
->EndObject();
-
- CheckOutput(out, 159);
}
TEST_P(ProtoStreamObjectWriterAnyTest, EmptyAnyFromEmptyObject) {
@@ -1263,6 +1346,23 @@
CheckOutput(any);
}
+TEST_P(ProtoStreamObjectWriterAnyTest, AnyWellKnownTypeErrorTest) {
+ EXPECT_CALL(listener_, InvalidValue(_, StringPiece("Any"),
+ StringPiece("Invalid time format: ")));
+
+ AnyOut any;
+ google::protobuf::Any* any_type = any.mutable_any();
+ any_type->set_type_url("type.googleapis.com/google.protobuf.Timestamp");
+
+ ow_->StartObject("")
+ ->StartObject("any")
+ ->RenderString("@type", "type.googleapis.com/google.protobuf.Timestamp")
+ ->RenderString("value", "")
+ ->EndObject()
+ ->EndObject();
+ CheckOutput(any);
+}
+
class ProtoStreamObjectWriterFieldMaskTest
: public BaseProtoStreamObjectWriterTest {
protected:
@@ -1274,6 +1374,11 @@
}
};
+INSTANTIATE_TEST_CASE_P(DifferentTypeInfoSourceTest,
+ ProtoStreamObjectWriterFieldMaskTest,
+ ::testing::Values(
+ testing::USE_TYPE_RESOLVER));
+
TEST_P(ProtoStreamObjectWriterFieldMaskTest, SimpleFieldMaskTest) {
FieldMaskTest expected;
expected.set_id("1");
@@ -1683,6 +1788,7 @@
ow_->RenderString("strData", "blah");
ow_->RenderInt32("intData", 123);
ow_->EndObject();
+ ow_->EndObject();
}
} // namespace converter
diff --git a/src/google/protobuf/util/internal/utility.cc b/src/google/protobuf/util/internal/utility.cc
index 5d7dcc8..61899c2 100644
--- a/src/google/protobuf/util/internal/utility.cc
+++ b/src/google/protobuf/util/internal/utility.cc
@@ -298,16 +298,21 @@
"google.protobuf.MessageOptions.map_entry", false));
}
+bool IsMessageSetWireFormat(const google::protobuf::Type& type) {
+ return GetBoolOptionOrDefault(
+ type.options(), "google.protobuf.MessageOptions.message_set_wire_format", false);
+}
+
string DoubleAsString(double value) {
- if (google::protobuf::MathLimits<double>::IsPosInf(value)) return "Infinity";
- if (google::protobuf::MathLimits<double>::IsNegInf(value)) return "-Infinity";
- if (google::protobuf::MathLimits<double>::IsNaN(value)) return "NaN";
+ if (MathLimits<double>::IsPosInf(value)) return "Infinity";
+ if (MathLimits<double>::IsNegInf(value)) return "-Infinity";
+ if (MathLimits<double>::IsNaN(value)) return "NaN";
return SimpleDtoa(value);
}
string FloatAsString(float value) {
- if (google::protobuf::MathLimits<float>::IsFinite(value)) return SimpleFtoa(value);
+ if (MathLimits<float>::IsFinite(value)) return SimpleFtoa(value);
return DoubleAsString(value);
}
@@ -318,7 +323,7 @@
}
*value = static_cast<float>(double_value);
- if (google::protobuf::MathLimits<float>::IsInf(*value)) {
+ if (MathLimits<float>::IsInf(*value)) {
return false;
}
return true;
diff --git a/src/google/protobuf/util/internal/utility.h b/src/google/protobuf/util/internal/utility.h
index 87f7602..5ba97bd 100644
--- a/src/google/protobuf/util/internal/utility.h
+++ b/src/google/protobuf/util/internal/utility.h
@@ -138,9 +138,6 @@
const google::protobuf::Enum* enum_type, int32 value);
// Converts input to camel-case and returns it.
-// Tests are in wrappers/translator/snake2camel_objectwriter_test.cc
-// TODO(skarvaje): Isolate tests for this function and put them in
-// utility_test.cc
LIBPROTOBUF_EXPORT string ToCamelCase(const StringPiece input);
// Converts input to snake_case and returns it.
@@ -157,6 +154,9 @@
LIBPROTOBUF_EXPORT bool IsMap(const google::protobuf::Field& field,
const google::protobuf::Type& type);
+// Returns true if the given type has special MessageSet wire format.
+bool IsMessageSetWireFormat(const google::protobuf::Type& type);
+
// Infinity/NaN-aware conversion to string.
LIBPROTOBUF_EXPORT string DoubleAsString(double value);
LIBPROTOBUF_EXPORT string FloatAsString(float value);
diff --git a/src/google/protobuf/util/json_format_proto3.proto b/src/google/protobuf/util/json_format_proto3.proto
index 7a28286..e813767 100644
--- a/src/google/protobuf/util/json_format_proto3.proto
+++ b/src/google/protobuf/util/json_format_proto3.proto
@@ -100,6 +100,16 @@
map<string, int32> string_map = 6;
}
+message TestNestedMap {
+ map<bool, int32> bool_map = 1;
+ map<int32, int32> int32_map = 2;
+ map<int64, int32> int64_map = 3;
+ map<uint32, int32> uint32_map = 4;
+ map<uint64, int32> uint64_map = 5;
+ map<string, int32> string_map = 6;
+ map<string, TestNestedMap> map_map = 7;
+}
+
message TestWrapper {
google.protobuf.BoolValue bool_value = 1;
google.protobuf.Int32Value int32_value = 2;
diff --git a/src/google/protobuf/util/json_util.cc b/src/google/protobuf/util/json_util.cc
index 6cd40fd..c3b8d50 100644
--- a/src/google/protobuf/util/json_util.cc
+++ b/src/google/protobuf/util/json_util.cc
@@ -34,7 +34,6 @@
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/util/internal/default_value_objectwriter.h>
-#include <google/protobuf/util/internal/snake2camel_objectwriter.h>
#include <google/protobuf/util/internal/error_listener.h>
#include <google/protobuf/util/internal/json_objectwriter.h>
#include <google/protobuf/util/internal/json_stream_parser.h>
@@ -83,13 +82,12 @@
io::CodedOutputStream out_stream(json_output);
converter::JsonObjectWriter json_writer(options.add_whitespace ? " " : "",
&out_stream);
- converter::Snake2CamelObjectWriter snake2camel_writer(&json_writer);
if (options.always_print_primitive_fields) {
converter::DefaultValueObjectWriter default_value_writer(
- resolver, type, &snake2camel_writer);
+ resolver, type, &json_writer);
return proto_source.WriteTo(&default_value_writer);
} else {
- return proto_source.WriteTo(&snake2camel_writer);
+ return proto_source.WriteTo(&json_writer);
}
}
diff --git a/src/google/protobuf/util/json_util_test.cc b/src/google/protobuf/util/json_util_test.cc
index f4dc356..da68495 100644
--- a/src/google/protobuf/util/json_util_test.cc
+++ b/src/google/protobuf/util/json_util_test.cc
@@ -163,7 +163,7 @@
class SegmentedZeroCopyOutputStream : public io::ZeroCopyOutputStream {
public:
explicit SegmentedZeroCopyOutputStream(list<Segment> segments)
- : segments_(segments), last_segment_(NULL, 0), byte_count_(0) {}
+ : segments_(segments), last_segment_(static_cast<char*>(NULL), 0), byte_count_(0) {}
virtual bool Next(void** buffer, int* length) {
if (segments_.empty()) {
diff --git a/src/google/protobuf/util/message_differencer.cc b/src/google/protobuf/util/message_differencer.cc
index d709da5..47237e5 100644
--- a/src/google/protobuf/util/message_differencer.cc
+++ b/src/google/protobuf/util/message_differencer.cc
@@ -946,6 +946,18 @@
return false;
}
+bool MessageDifferencer::IsUnknownFieldIgnored(
+ const Message& message1, const Message& message2,
+ const SpecificField& field, const vector<SpecificField>& parent_fields) {
+ for (int i = 0; i < ignore_criteria_.size(); ++i) {
+ if (ignore_criteria_[i]->IsUnknownFieldIgnored(message1, message2, field,
+ parent_fields)) {
+ return true;
+ }
+ }
+ return false;
+}
+
const MessageDifferencer::MapKeyComparator* MessageDifferencer
::GetMapKeyComparator(const FieldDescriptor* field) {
if (!field->is_repeated()) return NULL;
@@ -1127,15 +1139,6 @@
continue;
}
- if (change_type == ADDITION || change_type == DELETION ||
- change_type == MODIFICATION) {
- if (reporter_ == NULL) {
- // We found a difference and we have no reproter.
- return false;
- }
- is_different = true;
- }
-
// Build the SpecificField. This is slightly complicated.
SpecificField specific_field;
specific_field.unknown_field_number = focus_field->number();
@@ -1160,6 +1163,25 @@
specific_field.new_index = index2 - current_repeated_start2;
}
+ if (IsUnknownFieldIgnored(message1, message2, specific_field,
+ *parent_field)) {
+ if (reporter_ != NULL) {
+ parent_field->push_back(specific_field);
+ reporter_->ReportUnknownFieldIgnored(message1, message2, *parent_field);
+ parent_field->pop_back();
+ }
+ return true;
+ }
+
+ if (change_type == ADDITION || change_type == DELETION ||
+ change_type == MODIFICATION) {
+ if (reporter_ == NULL) {
+ // We found a difference and we have no reproter.
+ return false;
+ }
+ is_different = true;
+ }
+
parent_field->push_back(specific_field);
switch (change_type) {
@@ -1341,9 +1363,11 @@
// doesn't neccessarily imply Compare(b, c). Therefore a naive greedy
// algorithm will fail to find a maximum matching.
// Here we use the argumenting path algorithm.
- MaximumMatcher::NodeMatchCallback* callback = NewPermanentCallback(
- this, &MessageDifferencer::IsMatch, repeated_field, key_comparator,
- &message1, &message2, parent_fields);
+ MaximumMatcher::NodeMatchCallback* callback =
+ google::protobuf::internal::NewPermanentCallback(
+ this, &MessageDifferencer::IsMatch,
+ repeated_field, key_comparator,
+ &message1, &message2, parent_fields);
MaximumMatcher matcher(count1, count2, callback, match_list1,
match_list2);
// If diff info is not needed, we should end the matching process as
@@ -1625,6 +1649,18 @@
printer_->Print("\n"); // Print for newlines.
}
+void MessageDifferencer::StreamReporter::ReportUnknownFieldIgnored(
+ const Message& message1, const Message& message2,
+ const vector<SpecificField>& field_path) {
+ printer_->Print("ignored: ");
+ PrintPath(field_path, true);
+ if (CheckPathChanged(field_path)) {
+ printer_->Print(" -> ");
+ PrintPath(field_path, false);
+ }
+ printer_->Print("\n"); // Print for newlines.
+}
+
} // namespace util
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h
index e002a0f..34c173d 100644
--- a/src/google/protobuf/util/message_differencer.h
+++ b/src/google/protobuf/util/message_differencer.h
@@ -278,6 +278,13 @@
const Message& message2,
const vector<SpecificField>& field_path) { }
+ // Report that an unkown field is ignored. (see comment above).
+ // Note this is a different function since the last SpecificField in field
+ // path has a null field. This could break existing Reporter.
+ virtual void ReportUnknownFieldIgnored(
+ const Message& message1, const Message& message2,
+ const vector<SpecificField>& field_path) {}
+
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Reporter);
};
@@ -317,6 +324,16 @@
const Message& message2,
const FieldDescriptor* field,
const vector<SpecificField>& parent_fields) = 0;
+
+ // Returns true if the unknown field should be ignored.
+ // Note: This will be called for unknown fields as well in which case
+ // field.field will be null.
+ virtual bool IsUnknownFieldIgnored(
+ const Message& message1, const Message& message2,
+ const SpecificField& field,
+ const vector<SpecificField>& parent_fields) {
+ return false;
+ }
};
// To add a Reporter, construct default here, then use ReportDifferencesTo or
@@ -583,6 +600,10 @@
const Message& message2,
const vector<SpecificField>& field_path);
+ virtual void ReportUnknownFieldIgnored(
+ const Message& message1, const Message& message2,
+ const vector<SpecificField>& field_path);
+
protected:
// Prints the specified path of fields to the buffer.
virtual void PrintPath(const vector<SpecificField>& field_path,
@@ -722,6 +743,12 @@
const FieldDescriptor* field,
const vector<SpecificField>& parent_fields);
+ // Returns true if this unknown field is to be ignored when this
+ // MessageDifferencer compares messages.
+ bool IsUnknownFieldIgnored(const Message& message1, const Message& message2,
+ const SpecificField& field,
+ const vector<SpecificField>& parent_fields);
+
// Returns MapKeyComparator* when this field has been configured to
// be treated as a map. If not, returns NULL.
const MapKeyComparator* GetMapKeyComparator(const FieldDescriptor* field);
diff --git a/src/google/protobuf/util/time_util.h b/src/google/protobuf/util/time_util.h
index 58dbf8e..1bac089 100644
--- a/src/google/protobuf/util/time_util.h
+++ b/src/google/protobuf/util/time_util.h
@@ -41,7 +41,6 @@
#endif
#include <google/protobuf/duration.pb.h>
-#include <google/protobuf/stubs/port.h>
#include <google/protobuf/timestamp.pb.h>
namespace google {
@@ -243,10 +242,8 @@
// Overloaded operators for Timestamp
//
// Assignement operators.
-LIBPROTOBUF_EXPORT
-Timestamp& operator+=(Timestamp& t, const Duration& d); // NOLINT
-LIBPROTOBUF_EXPORT
-Timestamp& operator-=(Timestamp& t, const Duration& d); // NOLINT
+LIBPROTOBUF_EXPORT Timestamp& operator+=(Timestamp& t, const Duration& d); // NOLINT
+LIBPROTOBUF_EXPORT Timestamp& operator-=(Timestamp& t, const Duration& d); // NOLINT
// Relational operators.
inline bool operator<(const Timestamp& t1, const Timestamp& t2) {
if (t1.seconds() == t2.seconds()) {
diff --git a/src/google/protobuf/util/type_resolver_util.cc b/src/google/protobuf/util/type_resolver_util.cc
index 908634e..a099695 100644
--- a/src/google/protobuf/util/type_resolver_util.cc
+++ b/src/google/protobuf/util/type_resolver_util.cc
@@ -34,6 +34,7 @@
#include <google/protobuf/wrappers.pb.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/util/type_resolver.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/status.h>
@@ -53,8 +54,7 @@
using util::error::INVALID_ARGUMENT;
using util::error::NOT_FOUND;
-bool SplitTypeUrl(const string& type_url,
- string* url_prefix,
+bool SplitTypeUrl(const string& type_url, string* url_prefix,
string* message_name) {
size_t pos = type_url.find_last_of("/");
if (pos == string::npos) {
@@ -65,60 +65,19 @@
return true;
}
-// This code is originally defined in
-// //google/protobuf/util/converter/utility.h. Copied here due to component
-// dependency.
-// TODO(xiaofeng): Remove this when converter code is in components.
-string ToCamelCase(const StringPiece input) {
- bool capitalize_next = false;
- bool was_cap = true;
- bool is_cap = false;
- bool first_word = true;
- string result;
- result.reserve(input.size());
-
- for (size_t i = 0; i < input.size(); ++i, was_cap = is_cap) {
- is_cap = ascii_isupper(input[i]);
- if (input[i] == '_') {
- capitalize_next = true;
- if (!result.empty()) first_word = false;
- continue;
- } else if (first_word) {
- // Consider when the current character B is capitalized,
- // first word ends when:
- // 1) following a lowercase: "...aB..."
- // 2) followed by a lowercase: "...ABc..."
- if (!result.empty() && is_cap &&
- (!was_cap || (i + 1 < input.size() && ascii_islower(input[i + 1])))) {
- first_word = false;
- } else {
- result.push_back(ascii_tolower(input[i]));
- continue;
- }
- } else if (capitalize_next) {
- capitalize_next = false;
- if (ascii_islower(input[i])) {
- result.push_back(ascii_toupper(input[i]));
- continue;
- }
- }
- result.push_back(input[i]);
- }
- return result;
-}
-
class DescriptorPoolTypeResolver : public TypeResolver {
public:
DescriptorPoolTypeResolver(const string& url_prefix,
const DescriptorPool* pool)
- : url_prefix_(url_prefix), pool_(pool) {
- }
+ : url_prefix_(url_prefix), pool_(pool) {}
Status ResolveMessageType(const string& type_url, Type* type) {
string url_prefix, message_name;
if (!SplitTypeUrl(type_url, &url_prefix, &message_name) ||
url_prefix != url_prefix_) {
- return Status(INVALID_ARGUMENT, "Failed to parse type url: " + type_url);
+ return Status(INVALID_ARGUMENT,
+ StrCat("Invalid type URL, type URLs must be of the form '",
+ url_prefix_, "/<typename>', got: ", type_url));
}
if (url_prefix != url_prefix_) {
return Status(INVALID_ARGUMENT,
@@ -126,7 +85,8 @@
}
const Descriptor* descriptor = pool_->FindMessageTypeByName(message_name);
if (descriptor == NULL) {
- return Status(NOT_FOUND, "Cannot found the type: " + message_name);
+ return Status(NOT_FOUND,
+ "Invalid type URL, unknown type: " + message_name);
}
ConvertDescriptor(descriptor, type);
return Status();
@@ -136,7 +96,9 @@
string url_prefix, type_name;
if (!SplitTypeUrl(type_url, &url_prefix, &type_name) ||
url_prefix != url_prefix_) {
- return Status(INVALID_ARGUMENT, "Failed to parse type url: " + type_url);
+ return Status(INVALID_ARGUMENT,
+ StrCat("Invalid type URL, type URLs must be of the form '",
+ url_prefix_, "/<typename>', got: ", type_url));
}
if (url_prefix != url_prefix_) {
return Status(INVALID_ARGUMENT,
@@ -144,7 +106,7 @@
}
const EnumDescriptor* descriptor = pool_->FindEnumTypeByName(type_name);
if (descriptor == NULL) {
- return Status(NOT_FOUND, "Cannot found the type: " + type_name);
+ return Status(NOT_FOUND, "Invalid type URL, unknown type: " + type_name);
}
ConvertEnumDescriptor(descriptor, enum_type);
return Status();
@@ -197,7 +159,7 @@
}
field->set_number(descriptor->number());
field->set_name(descriptor->name());
- field->set_json_name(ToCamelCase(descriptor->name()));
+ field->set_json_name(converter::ToCamelCase(descriptor->name()));
if (descriptor->type() == FieldDescriptor::TYPE_MESSAGE) {
field->set_type_url(GetTypeUrl(descriptor->message_type()));
} else if (descriptor->type() == FieldDescriptor::TYPE_ENUM) {
@@ -221,8 +183,7 @@
descriptor->file()->name());
for (int i = 0; i < descriptor->value_count(); ++i) {
const EnumValueDescriptor* value_descriptor = descriptor->value(i);
- EnumValue* value =
- enum_type->mutable_enumvalue()->Add();
+ EnumValue* value = enum_type->mutable_enumvalue()->Add();
value->set_name(value_descriptor->name());
value->set_number(value_descriptor->number());
@@ -245,8 +206,8 @@
} // namespace
-TypeResolver* NewTypeResolverForDescriptorPool(
- const string& url_prefix, const DescriptorPool* pool) {
+TypeResolver* NewTypeResolverForDescriptorPool(const string& url_prefix,
+ const DescriptorPool* pool) {
return new DescriptorPoolTypeResolver(url_prefix, pool);
}
diff --git a/travis.sh b/travis.sh
index a5208fe..6b05073 100755
--- a/travis.sh
+++ b/travis.sh
@@ -113,12 +113,14 @@
internal_install_python_deps() {
sudo pip install tox
- # Only install Python2.6 on Linux.
+ # Only install Python2.6/3.x on Linux.
if [ $(uname -s) == "Linux" ]; then
sudo apt-get install -y python-software-properties # for apt-add-repository
sudo apt-add-repository -y ppa:fkrull/deadsnakes
sudo apt-get update -qq
sudo apt-get install -y python2.6 python2.6-dev
+ sudo apt-get install -y python3.3 python3.3-dev
+ sudo apt-get install -y python3.4 python3.4-dev
fi
}
@@ -127,9 +129,10 @@
internal_build_cpp
internal_install_python_deps
cd python
- # Only test Python 2.6 on Linux
+ # Only test Python 2.6/3.x on Linux
if [ $(uname -s) == "Linux" ]; then
- envlist=py26-python,py27-python
+ # py26 is currently disabled due to json_format
+ envlist=py\{27,33,34\}-python
else
envlist=py27-python
fi
@@ -143,9 +146,10 @@
export LD_LIBRARY_PATH=../src/.libs # for Linux
export DYLD_LIBRARY_PATH=../src/.libs # for OS X
cd python
- # Only test Python 2.6 on Linux
+ # Only test Python 2.6/3.x on Linux
if [ $(uname -s) == "Linux" ]; then
- envlist=py26-cpp,py27-cpp
+ # py26 is currently disabled due to json_format
+ envlist=py\{27,33,34\}-cpp
else
envlist=py27-cpp
fi