commit
92e504e660
375 changed files with 13530 additions and 30055 deletions
@ -0,0 +1,57 @@ |
||||
#!/bin/bash |
||||
|
||||
set -x |
||||
echo $@ |
||||
|
||||
set -euo pipefail |
||||
# --- begin runfiles.bash initialization --- |
||||
if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then |
||||
if [[ -f "$0.runfiles_manifest" ]]; then |
||||
export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" |
||||
elif [[ -f "$0.runfiles/MANIFEST" ]]; then |
||||
export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" |
||||
elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then |
||||
export RUNFILES_DIR="$0.runfiles" |
||||
fi |
||||
fi |
||||
if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then |
||||
source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" |
||||
elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then |
||||
source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ |
||||
"$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" |
||||
else |
||||
echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" |
||||
exit 1 |
||||
fi |
||||
# --- end runfiles.bash initialization --- |
||||
|
||||
TESTEE=unset |
||||
FAILURE_LIST=unset |
||||
TEXT_FORMAT_FAILURE_LIST=unset |
||||
|
||||
while [[ -n "$@" ]]; do |
||||
arg="$1"; shift |
||||
val="$1"; shift |
||||
case "$arg" in |
||||
"--testee") TESTEE="$val" ;; |
||||
"--failure_list") FAILURE_LIST="$val" ;; |
||||
"--text_format_failure_list") TEXT_FORMAT_FAILURE_LIST="$val" ;; |
||||
*) echo "Flag $arg is not recognized." && exit 1 ;; |
||||
esac |
||||
done |
||||
|
||||
conformance_test_runner=$(rlocation com_google_protobuf/conformance_test_runner) |
||||
conformance_testee=$(rlocation $TESTEE) |
||||
args=(--enforce_recommended) |
||||
|
||||
failure_list=$(rlocation $FAILURE_LIST) |
||||
if [ "$failure_list" != "1" ] ; then |
||||
args+=(--failure_list $failure_list) |
||||
fi |
||||
|
||||
text_format_failure_list=$(rlocation $TEXT_FORMAT_FAILURE_LIST) |
||||
if [ "$text_format_failure_list" != "1" ]; then |
||||
args+=(--text_format_failure_list $text_format_failure_list) |
||||
fi |
||||
|
||||
$conformance_test_runner "${args[@]}" $conformance_testee |
@ -1,3 +1,7 @@ |
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput |
||||
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput |
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator |
||||
Required.Proto3.JsonInput.OneofFieldNullFirst.JsonOutput |
||||
Required.Proto3.JsonInput.OneofFieldNullFirst.ProtobufOutput |
||||
Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput |
||||
Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput |
||||
|
@ -0,0 +1,10 @@ |
||||
# This is the list of conformance tests that are known to fail for the Java |
||||
# implementation right now. These should be fixed. |
||||
# |
||||
# By listing them here we can keep tabs on which ones are failing and be sure |
||||
# that we don't introduce regressions in other tests. |
||||
|
||||
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE |
||||
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE |
||||
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE |
||||
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE |
@ -1,2 +1,4 @@ |
||||
Recommended.Proto2.JsonInput.FieldNameExtension.Validator |
||||
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator |
||||
Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput |
||||
Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput |
||||
|
@ -0,0 +1,5 @@ |
||||
# This is the list of conformance tests that are known to fail for the Java |
||||
# Lite TextFormat implementation right now. These should be fixed. |
||||
# |
||||
# By listing them here we can keep tabs on which ones are failing and be sure |
||||
# that we don't introduce regressions in other tests. |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@ |
||||
# PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE. |
||||
|
||||
def conformance_test(name, testee, failure_list = None, text_format_failure_list = None): |
||||
args = ["--testee %s" % _strip_bazel(testee)] |
||||
failure_lists = [] |
||||
if failure_list: |
||||
args = args + ["--failure_list %s" % _strip_bazel(failure_list)] |
||||
failure_lists = failure_lists + [failure_list] |
||||
if text_format_failure_list: |
||||
args = args + ["--text_format_failure_list %s" % _strip_bazel(text_format_failure_list)] |
||||
failure_lists = failure_lists + [text_format_failure_list] |
||||
|
||||
native.sh_test( |
||||
name = name, |
||||
srcs = ["//:conformance/conformance_test_runner.sh"], |
||||
data = [testee] + failure_lists + [ |
||||
"//:conformance_test_runner", |
||||
], |
||||
args = args, |
||||
deps = [ |
||||
"@bazel_tools//tools/bash/runfiles", |
||||
], |
||||
) |
||||
|
||||
|
||||
def _strip_bazel(testee): |
||||
if testee.startswith("//"): |
||||
testee = testee.replace("//", "com_google_protobuf") |
||||
return testee.replace(":", "/") |
@ -0,0 +1,8 @@ |
||||
test_suite( |
||||
name = "tests", |
||||
tests = [ |
||||
"//java/core:tests", |
||||
"//java/lite:tests", |
||||
"//java/util:tests", |
||||
], |
||||
) |
@ -1,50 +0,0 @@ |
||||
# Protobuf Java Compatibility Tests |
||||
|
||||
This directory contains tests to ensure protobuf library is compatible with |
||||
previously released versions. |
||||
|
||||
## Directory Layout |
||||
|
||||
For each released protobuf version we are testing compatibility with, there |
||||
is a sub-directory with the following layout (take v2.5.0 as an example): |
||||
|
||||
* v2.5.0 |
||||
* test.sh |
||||
* pom.xml |
||||
* protos/ - unittest protos. |
||||
* more_protos/ - unittest protos that import the ones in "protos". |
||||
* tests/ - actual Java test classes. |
||||
|
||||
The testing code is extracted from regular protobuf unittests by removing: |
||||
|
||||
* tests that access package private methods/classes. |
||||
* tests that are known to be broken by an intended behavior change (e.g., we |
||||
changed the parsing recursion limit from 64 to 100). |
||||
* all lite runtime tests. |
||||
|
||||
It's also divided into 3 submodule with tests depending on more_protos and |
||||
more_protos depending on protos. This way we can test scenarios where only part |
||||
of the dependency is upgraded to the new version. |
||||
|
||||
## How to Run The Tests |
||||
|
||||
We use a shell script to drive the test of different scenarios so the test |
||||
will only run on unix-like environments. The script expects a few command |
||||
line tools to be available on PATH: git, mvn, wget, grep, sed, java. |
||||
|
||||
Before running the tests, make sure you have already built the protoc binary |
||||
following [the C++ installation instructions](../../src/README.md). The test |
||||
scripts will use the built binary located at ${protobuf}/src/protoc. |
||||
|
||||
To start a test, simply run the test.sh script in each version directory. For |
||||
example: |
||||
|
||||
$ v2.5.0/test.sh |
||||
|
||||
For each version, the test script will test: |
||||
|
||||
* only upgrading protos to the new version |
||||
* only upgrading more_protos to the new version |
||||
|
||||
and see whether everything builds/runs fine. Both source compatibility and |
||||
binary compatibility will be tested. |
@ -1,43 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-test-deps</artifactId> |
||||
<version>2.5.0</version> |
||||
|
||||
<name>Compatibility Test Dependencies</name> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<version>4.4</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.easymock</groupId> |
||||
<artifactId>easymock</artifactId> |
||||
<version>2.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.easymock</groupId> |
||||
<artifactId>easymockclassextension</artifactId> |
||||
<version>2.2.1</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<artifactId>maven-assembly-plugin</artifactId> |
||||
<version>2.6</version> |
||||
<configuration> |
||||
<descriptorRefs> |
||||
<descriptorRef>jar-with-dependencies</descriptorRef> |
||||
</descriptorRefs> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
@ -1,69 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-test-suite</artifactId> |
||||
<version>2.5.0</version> |
||||
<relativePath>..</relativePath> |
||||
</parent> |
||||
|
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-more-protos</artifactId> |
||||
<version>2.5.0</version> |
||||
|
||||
<name>More protos for Compatibility test</name> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.google.protobuf</groupId> |
||||
<artifactId>protobuf-java</artifactId> |
||||
<version>${more_protos.protobuf.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-protos</artifactId> |
||||
<version>2.5.0</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<artifactId>maven-compiler-plugin</artifactId> |
||||
<version>3.3</version> |
||||
<configuration> |
||||
<source>1.6</source> |
||||
<target>1.6</target> |
||||
</configuration> |
||||
</plugin> |
||||
<plugin> |
||||
<artifactId>maven-antrun-plugin</artifactId> |
||||
<executions> |
||||
<execution> |
||||
<id>generate-sources</id> |
||||
<phase>generate-sources</phase> |
||||
<configuration> |
||||
<tasks> |
||||
<mkdir dir="target/generated-sources" /> |
||||
<exec executable="${more_protos.protoc.path}"> |
||||
<arg value="--java_out=target/generated-sources" /> |
||||
<arg value="--proto_path=src/proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest.proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_optimize_for.proto" /> |
||||
<arg value="src/proto/com/google/protobuf/multiple_files_test.proto" /> |
||||
</exec> |
||||
</tasks> |
||||
<sourceRoot>target/generated-sources</sourceRoot> |
||||
</configuration> |
||||
<goals> |
||||
<goal>run</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
@ -1,71 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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) |
||||
// |
||||
// A proto file which tests the java_multiple_files option. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option java_generic_services = true; // auto-added |
||||
|
||||
import "google/protobuf/unittest.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "MultipleFilesTestProto"; |
||||
|
||||
message MessageWithNoOuter { |
||||
message NestedMessage { |
||||
optional int32 i = 1; |
||||
} |
||||
enum NestedEnum { |
||||
BAZ = 3; |
||||
} |
||||
optional NestedMessage nested = 1; |
||||
repeated TestAllTypes foreign = 2; |
||||
optional NestedEnum nested_enum = 3; |
||||
optional EnumWithNoOuter foreign_enum = 4; |
||||
} |
||||
|
||||
enum EnumWithNoOuter { |
||||
FOO = 1; |
||||
BAR = 2; |
||||
} |
||||
|
||||
service ServiceWithNoOuter { |
||||
rpc Foo(MessageWithNoOuter) returns(TestAllTypes); |
||||
} |
||||
|
||||
extend TestAllExtensions { |
||||
optional int32 extension_with_outer = 1234567; |
||||
} |
@ -1,53 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: jonp@google.com (Jon Perlow) |
||||
// |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "NestedBuilders"; |
||||
|
||||
|
||||
message Vehicle { |
||||
optional Engine engine = 1; |
||||
repeated Wheel wheel = 2; |
||||
} |
||||
|
||||
message Engine { |
||||
optional int32 cylinder = 1; |
||||
optional int32 liters = 2; |
||||
} |
||||
|
||||
message Wheel { |
||||
optional int32 radius = 1; |
||||
optional int32 width = 2; |
||||
} |
@ -1,45 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with nested extensions. Note that this must be defined in |
||||
// a separate file to properly test the initialization of the outer class. |
||||
|
||||
|
||||
import "com/google/protobuf/non_nested_extension.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
message MyNestedExtension { |
||||
extend MessageToBeExtended { |
||||
optional MessageToBeExtended recursiveExtension = 2; |
||||
} |
||||
} |
@ -1,48 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with nested extensions for a MessageLite messages. Note that |
||||
// this must be defined in a separate file to properly test the initialization |
||||
// of the outer class. |
||||
|
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
import "com/google/protobuf/non_nested_extension_lite.proto"; |
||||
|
||||
message MyNestedExtensionLite { |
||||
extend MessageLiteToBeExtended { |
||||
optional MessageLiteToBeExtended recursiveExtensionLite = 3; |
||||
} |
||||
} |
@ -1,48 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with extensions. |
||||
|
||||
|
||||
package protobuf_unittest; |
||||
|
||||
message MessageToBeExtended { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
message MyNonNestedExtension { |
||||
} |
||||
|
||||
extend MessageToBeExtended { |
||||
optional MyNonNestedExtension nonNestedExtension = 1; |
||||
} |
||||
|
@ -1,50 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with extensions for a MessageLite messages. |
||||
|
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
message MessageLiteToBeExtended { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
message MyNonNestedExtensionLite { |
||||
} |
||||
|
||||
extend MessageLiteToBeExtended { |
||||
optional MyNonNestedExtensionLite nonNestedExtensionLite = 1; |
||||
} |
||||
|
@ -1,108 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: jonp@google.com (Jon Perlow) |
||||
|
||||
// This file tests that various identifiers work as field and type names even |
||||
// though the same identifiers are used internally by the java code generator. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option java_generic_services = true; // auto-added |
||||
|
||||
package io_protocol_tests; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
option java_outer_classname = "TestBadIdentifiersProto"; |
||||
|
||||
message TestMessage { |
||||
} |
||||
|
||||
message Descriptor { |
||||
option no_standard_descriptor_accessor = true; |
||||
optional string descriptor = 1; |
||||
message NestedDescriptor { |
||||
option no_standard_descriptor_accessor = true; |
||||
optional string descriptor = 1; |
||||
} |
||||
optional NestedDescriptor nested_descriptor = 2; |
||||
} |
||||
|
||||
message Parser { |
||||
enum ParserEnum { |
||||
PARSER = 1; |
||||
} |
||||
optional ParserEnum parser = 1; |
||||
} |
||||
|
||||
message Deprecated { |
||||
enum TestEnum { |
||||
FOO = 1; |
||||
} |
||||
|
||||
optional int32 field1 = 1 [deprecated=true]; |
||||
optional TestEnum field2 = 2 [deprecated=true]; |
||||
optional TestMessage field3 = 3 [deprecated=true]; |
||||
} |
||||
|
||||
message Override { |
||||
optional int32 override = 1; |
||||
} |
||||
|
||||
message Object { |
||||
optional int32 object = 1; |
||||
optional string string_object = 2; |
||||
} |
||||
|
||||
message String { |
||||
optional string string = 1; |
||||
} |
||||
|
||||
message Integer { |
||||
optional int32 integer = 1; |
||||
} |
||||
|
||||
message Long { |
||||
optional int32 long = 1; |
||||
} |
||||
|
||||
message Float { |
||||
optional float float = 1; |
||||
} |
||||
|
||||
message Double { |
||||
optional double double = 1; |
||||
} |
||||
|
||||
service TestConflictingMethodNames { |
||||
rpc Override(TestMessage) returns (TestMessage); |
||||
} |
||||
|
@ -1,620 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// The messages in this file describe the definitions found in .proto files. |
||||
// A valid .proto file can be translated directly to a FileDescriptorProto |
||||
// without any other information (e.g. without reading its imports). |
||||
|
||||
|
||||
|
||||
package google.protobuf; |
||||
option java_package = "com.google.protobuf"; |
||||
option java_outer_classname = "DescriptorProtos"; |
||||
|
||||
// descriptor.proto must be optimized for speed because reflection-based |
||||
// algorithms don't work during bootstrapping. |
||||
option optimize_for = SPEED; |
||||
|
||||
// The protocol compiler can output a FileDescriptorSet containing the .proto |
||||
// files it parses. |
||||
message FileDescriptorSet { |
||||
repeated FileDescriptorProto file = 1; |
||||
} |
||||
|
||||
// Describes a complete .proto file. |
||||
message FileDescriptorProto { |
||||
optional string name = 1; // file name, relative to root of source tree |
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc. |
||||
|
||||
// Names of files imported by this file. |
||||
repeated string dependency = 3; |
||||
// Indexes of the public imported files in the dependency list above. |
||||
repeated int32 public_dependency = 10; |
||||
// Indexes of the weak imported files in the dependency list. |
||||
// For Google-internal migration only. Do not use. |
||||
repeated int32 weak_dependency = 11; |
||||
|
||||
// All top-level definitions in this file. |
||||
repeated DescriptorProto message_type = 4; |
||||
repeated EnumDescriptorProto enum_type = 5; |
||||
repeated ServiceDescriptorProto service = 6; |
||||
repeated FieldDescriptorProto extension = 7; |
||||
|
||||
optional FileOptions options = 8; |
||||
|
||||
// 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. |
||||
optional SourceCodeInfo source_code_info = 9; |
||||
} |
||||
|
||||
// Describes a message type. |
||||
message DescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
repeated FieldDescriptorProto field = 2; |
||||
repeated FieldDescriptorProto extension = 6; |
||||
|
||||
repeated DescriptorProto nested_type = 3; |
||||
repeated EnumDescriptorProto enum_type = 4; |
||||
|
||||
message ExtensionRange { |
||||
optional int32 start = 1; |
||||
optional int32 end = 2; |
||||
} |
||||
repeated ExtensionRange extension_range = 5; |
||||
|
||||
optional MessageOptions options = 7; |
||||
} |
||||
|
||||
// Describes a field within a message. |
||||
message FieldDescriptorProto { |
||||
enum Type { |
||||
// 0 is reserved for errors. |
||||
// Order is weird for historical reasons. |
||||
TYPE_DOUBLE = 1; |
||||
TYPE_FLOAT = 2; |
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if |
||||
// negative values are likely. |
||||
TYPE_INT64 = 3; |
||||
TYPE_UINT64 = 4; |
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if |
||||
// negative values are likely. |
||||
TYPE_INT32 = 5; |
||||
TYPE_FIXED64 = 6; |
||||
TYPE_FIXED32 = 7; |
||||
TYPE_BOOL = 8; |
||||
TYPE_STRING = 9; |
||||
TYPE_GROUP = 10; // Tag-delimited aggregate. |
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate. |
||||
|
||||
// New in version 2. |
||||
TYPE_BYTES = 12; |
||||
TYPE_UINT32 = 13; |
||||
TYPE_ENUM = 14; |
||||
TYPE_SFIXED32 = 15; |
||||
TYPE_SFIXED64 = 16; |
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding. |
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding. |
||||
}; |
||||
|
||||
enum Label { |
||||
// 0 is reserved for errors |
||||
LABEL_OPTIONAL = 1; |
||||
LABEL_REQUIRED = 2; |
||||
LABEL_REPEATED = 3; |
||||
// TODO(sanjay): Should we add LABEL_MAP? |
||||
}; |
||||
|
||||
optional string name = 1; |
||||
optional int32 number = 3; |
||||
optional Label label = 4; |
||||
|
||||
// If type_name is set, this need not be set. If both this and type_name |
||||
// are set, this must be either TYPE_ENUM or TYPE_MESSAGE. |
||||
optional Type type = 5; |
||||
|
||||
// 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). |
||||
optional string type_name = 6; |
||||
|
||||
// For extensions, this is the name of the type being extended. It is |
||||
// resolved in the same manner as type_name. |
||||
optional string extendee = 2; |
||||
|
||||
// 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? |
||||
optional string default_value = 7; |
||||
|
||||
optional FieldOptions options = 8; |
||||
} |
||||
|
||||
// Describes an enum type. |
||||
message EnumDescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
repeated EnumValueDescriptorProto value = 2; |
||||
|
||||
optional EnumOptions options = 3; |
||||
} |
||||
|
||||
// Describes a value within an enum. |
||||
message EnumValueDescriptorProto { |
||||
optional string name = 1; |
||||
optional int32 number = 2; |
||||
|
||||
optional EnumValueOptions options = 3; |
||||
} |
||||
|
||||
// Describes a service. |
||||
message ServiceDescriptorProto { |
||||
optional string name = 1; |
||||
repeated MethodDescriptorProto method = 2; |
||||
|
||||
optional ServiceOptions options = 3; |
||||
} |
||||
|
||||
// Describes a method of a service. |
||||
message MethodDescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
// Input and output type names. These are resolved in the same way as |
||||
// FieldDescriptorProto.type_name, but must refer to a message type. |
||||
optional string input_type = 2; |
||||
optional string output_type = 3; |
||||
|
||||
optional MethodOptions options = 4; |
||||
} |
||||
|
||||
|
||||
// =================================================================== |
||||
// Options |
||||
|
||||
// Each of the definitions above may have "options" attached. These are |
||||
// just annotations which may cause code to be generated slightly differently |
||||
// or may contain hints for code that manipulates protocol messages. |
||||
// |
||||
// Clients may define custom options as extensions of the *Options messages. |
||||
// These extensions may not yet be known at parsing time, so the parser cannot |
||||
// store the values in them. Instead it stores them in a field in the *Options |
||||
// message called uninterpreted_option. This field must have the same name |
||||
// across all *Options messages. We then use this field to populate the |
||||
// extensions when we build a descriptor, at which point all protos have been |
||||
// parsed and so all extensions are known. |
||||
// |
||||
// Extension numbers for custom options may be chosen as follows: |
||||
// * For options which will only be used within a single application or |
||||
// organization, or for experimental options, use field numbers 50000 |
||||
// through 99999. It is up to you to ensure that you do not use the |
||||
// same number for multiple options. |
||||
// * For options which will be published and used publicly by multiple |
||||
// independent entities, e-mail protobuf-global-extension-registry@google.com |
||||
// to reserve extension numbers. Simply provide your project name (e.g. |
||||
// Object-C plugin) and your project website (if available) -- there's no need |
||||
// to explain how you intend to use them. Usually you only need one extension |
||||
// number. You can declare multiple options with only one extension number by |
||||
// putting them in a sub-message. See the Custom Options section of the docs |
||||
// for examples: |
||||
// http://code.google.com/apis/protocolbuffers/docs/proto.html#options |
||||
// If this turns out to be popular, a web service will be set up |
||||
// to automatically assign option numbers. |
||||
|
||||
|
||||
message FileOptions { |
||||
|
||||
// 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. |
||||
optional string java_package = 1; |
||||
|
||||
|
||||
// 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). |
||||
optional string java_outer_classname = 8; |
||||
|
||||
// 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. |
||||
optional bool java_multiple_files = 10 [default=false]; |
||||
|
||||
// If set true, then the Java code generator will generate equals() and |
||||
// hashCode() methods for all messages defined in the .proto file. This is |
||||
// purely a speed optimization, as the AbstractMessage base class includes |
||||
// reflection-based implementations of these methods. |
||||
optional bool java_generate_equals_and_hash = 20 [default=false]; |
||||
|
||||
// Generated classes can be optimized for speed or code size. |
||||
enum OptimizeMode { |
||||
SPEED = 1; // Generate complete code for parsing, serialization, |
||||
// etc. |
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods. |
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. |
||||
} |
||||
optional OptimizeMode optimize_for = 9 [default=SPEED]; |
||||
|
||||
// Sets the Go package where structs generated from this .proto will be |
||||
// placed. There is no default. |
||||
optional string go_package = 11; |
||||
|
||||
|
||||
|
||||
// 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 proto2. |
||||
// |
||||
// 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. |
||||
optional bool cc_generic_services = 16 [default=false]; |
||||
optional bool java_generic_services = 17 [default=false]; |
||||
optional bool py_generic_services = 18 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message MessageOptions { |
||||
// 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. |
||||
optional bool message_set_wire_format = 1 [default=false]; |
||||
|
||||
// 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". |
||||
optional bool no_standard_descriptor_accessor = 2 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message FieldOptions { |
||||
// 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! |
||||
optional CType ctype = 1 [default = STRING]; |
||||
enum CType { |
||||
// Default mode. |
||||
STRING = 0; |
||||
|
||||
CORD = 1; |
||||
|
||||
STRING_PIECE = 2; |
||||
} |
||||
// 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. |
||||
optional bool packed = 2; |
||||
|
||||
|
||||
|
||||
// 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. |
||||
optional bool lazy = 5 [default=false]; |
||||
|
||||
// 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. |
||||
optional bool deprecated = 3 [default=false]; |
||||
|
||||
// EXPERIMENTAL. DO NOT USE. |
||||
// For "map" fields, the name of the field in the enclosed type that |
||||
// is the key for this map. For example, suppose we have: |
||||
// message Item { |
||||
// required string name = 1; |
||||
// required string value = 2; |
||||
// } |
||||
// message Config { |
||||
// repeated Item items = 1 [experimental_map_key="name"]; |
||||
// } |
||||
// In this situation, the map key for Item will be set to "name". |
||||
// TODO: Fully-implement this, then remove the "experimental_" prefix. |
||||
optional string experimental_map_key = 9; |
||||
|
||||
// For Google-internal migration only. Do not use. |
||||
optional bool weak = 10 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message EnumOptions { |
||||
|
||||
// Set this option to false to disallow mapping different tag names to a same |
||||
// value. |
||||
optional bool allow_alias = 2 [default=true]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message EnumValueOptions { |
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message ServiceOptions { |
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
||||
// framework. We apologize for hoarding these numbers to ourselves, but |
||||
// we were already using them long before we decided to release Protocol |
||||
// Buffers. |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message MethodOptions { |
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
||||
// framework. We apologize for hoarding these numbers to ourselves, but |
||||
// we were already using them long before we decided to release Protocol |
||||
// Buffers. |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
|
||||
// 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. |
||||
message UninterpretedOption { |
||||
// 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". |
||||
message NamePart { |
||||
required string name_part = 1; |
||||
required bool is_extension = 2; |
||||
} |
||||
repeated NamePart name = 2; |
||||
|
||||
// The value of the uninterpreted option, in whatever type the tokenizer |
||||
// identified it as during parsing. Exactly one of these should be set. |
||||
optional string identifier_value = 3; |
||||
optional uint64 positive_int_value = 4; |
||||
optional int64 negative_int_value = 5; |
||||
optional double double_value = 6; |
||||
optional bytes string_value = 7; |
||||
optional string aggregate_value = 8; |
||||
} |
||||
|
||||
// =================================================================== |
||||
// Optional source code info |
||||
|
||||
// Encapsulates information about the original source file from which a |
||||
// FileDescriptorProto was generated. |
||||
message SourceCodeInfo { |
||||
// 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. |
||||
repeated Location location = 1; |
||||
message Location { |
||||
// 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). |
||||
repeated int32 path = 1 [packed=true]; |
||||
|
||||
// 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. |
||||
repeated int32 span = 2 [packed=true]; |
||||
|
||||
// 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. |
||||
// |
||||
// 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; |
||||
// |
||||
// optional string corge = 5; |
||||
// /* Block comment attached |
||||
// * to corge. Leading asterisks |
||||
// * will be removed. */ |
||||
// /* Block comment attached to |
||||
// * grault. */ |
||||
// optional int32 grault = 6; |
||||
optional string leading_comments = 3; |
||||
optional string trailing_comments = 4; |
||||
} |
||||
} |
@ -1,719 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// A proto file we will use for unit testing. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option cc_generic_services = true; // auto-added |
||||
option java_generic_services = true; // auto-added |
||||
option py_generic_services = true; // auto-added |
||||
|
||||
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 test_util.h we do "using namespace unittest = protobuf_unittest". |
||||
package protobuf_unittest; |
||||
|
||||
// Protos optimized for SPEED use a strict superset of the generated code |
||||
// of equivalent ones optimized for CODE_SIZE, so we should optimize all our |
||||
// tests for speed unless explicitly testing code size optimization. |
||||
option optimize_for = SPEED; |
||||
|
||||
option java_outer_classname = "UnittestProto"; |
||||
|
||||
// This proto includes every type of field in both singular and repeated |
||||
// forms. |
||||
message TestAllTypes { |
||||
message NestedMessage { |
||||
// 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. |
||||
optional int32 bb = 1; |
||||
} |
||||
|
||||
enum NestedEnum { |
||||
FOO = 1; |
||||
BAR = 2; |
||||
BAZ = 3; |
||||
} |
||||
|
||||
// Singular |
||||
optional int32 optional_int32 = 1; |
||||
optional int64 optional_int64 = 2; |
||||
optional uint32 optional_uint32 = 3; |
||||
optional uint64 optional_uint64 = 4; |
||||
optional sint32 optional_sint32 = 5; |
||||
optional sint64 optional_sint64 = 6; |
||||
optional fixed32 optional_fixed32 = 7; |
||||
optional fixed64 optional_fixed64 = 8; |
||||
optional sfixed32 optional_sfixed32 = 9; |
||||
optional sfixed64 optional_sfixed64 = 10; |
||||
optional float optional_float = 11; |
||||
optional double optional_double = 12; |
||||
optional bool optional_bool = 13; |
||||
optional string optional_string = 14; |
||||
optional bytes optional_bytes = 15; |
||||
|
||||
optional group OptionalGroup = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional NestedMessage optional_nested_message = 18; |
||||
optional ForeignMessage optional_foreign_message = 19; |
||||
optional protobuf_unittest_import.ImportMessage optional_import_message = 20; |
||||
|
||||
optional NestedEnum optional_nested_enum = 21; |
||||
optional ForeignEnum optional_foreign_enum = 22; |
||||
optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; |
||||
|
||||
optional string optional_string_piece = 24 [ctype=STRING_PIECE]; |
||||
optional string optional_cord = 25 [ctype=CORD]; |
||||
|
||||
// Defined in unittest_import_public.proto |
||||
optional protobuf_unittest_import.PublicImportMessage |
||||
optional_public_import_message = 26; |
||||
|
||||
optional NestedMessage optional_lazy_message = 27 [lazy=true]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32 = 31; |
||||
repeated int64 repeated_int64 = 32; |
||||
repeated uint32 repeated_uint32 = 33; |
||||
repeated uint64 repeated_uint64 = 34; |
||||
repeated sint32 repeated_sint32 = 35; |
||||
repeated sint64 repeated_sint64 = 36; |
||||
repeated fixed32 repeated_fixed32 = 37; |
||||
repeated fixed64 repeated_fixed64 = 38; |
||||
repeated sfixed32 repeated_sfixed32 = 39; |
||||
repeated sfixed64 repeated_sfixed64 = 40; |
||||
repeated float repeated_float = 41; |
||||
repeated double repeated_double = 42; |
||||
repeated bool repeated_bool = 43; |
||||
repeated string repeated_string = 44; |
||||
repeated bytes repeated_bytes = 45; |
||||
|
||||
repeated group RepeatedGroup = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated NestedMessage repeated_nested_message = 48; |
||||
repeated ForeignMessage repeated_foreign_message = 49; |
||||
repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; |
||||
|
||||
repeated NestedEnum repeated_nested_enum = 51; |
||||
repeated ForeignEnum repeated_foreign_enum = 52; |
||||
repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; |
||||
|
||||
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; |
||||
repeated string repeated_cord = 55 [ctype=CORD]; |
||||
|
||||
repeated NestedMessage repeated_lazy_message = 57 [lazy=true]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32 = 61 [default = 41 ]; |
||||
optional int64 default_int64 = 62 [default = 42 ]; |
||||
optional uint32 default_uint32 = 63 [default = 43 ]; |
||||
optional uint64 default_uint64 = 64 [default = 44 ]; |
||||
optional sint32 default_sint32 = 65 [default = -45 ]; |
||||
optional sint64 default_sint64 = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32 = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64 = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32 = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64 = 70 [default = -50 ]; |
||||
optional float default_float = 71 [default = 51.5 ]; |
||||
optional double default_double = 72 [default = 52e3 ]; |
||||
optional bool default_bool = 73 [default = true ]; |
||||
optional string default_string = 74 [default = "hello"]; |
||||
optional bytes default_bytes = 75 [default = "world"]; |
||||
|
||||
optional NestedEnum default_nested_enum = 81 [default = BAR ]; |
||||
optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; |
||||
optional protobuf_unittest_import.ImportEnum |
||||
default_import_enum = 83 [default = IMPORT_BAR]; |
||||
|
||||
optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
||||
optional string default_cord = 85 [ctype=CORD,default="123"]; |
||||
} |
||||
|
||||
message TestDeprecatedFields { |
||||
optional int32 deprecated_int32 = 1 [deprecated=true]; |
||||
} |
||||
|
||||
// Define these after TestAllTypes to make sure the compiler can handle |
||||
// that. |
||||
message ForeignMessage { |
||||
optional int32 c = 1; |
||||
} |
||||
|
||||
enum ForeignEnum { |
||||
FOREIGN_FOO = 4; |
||||
FOREIGN_BAR = 5; |
||||
FOREIGN_BAZ = 6; |
||||
} |
||||
|
||||
message TestAllExtensions { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestAllExtensions { |
||||
// Singular |
||||
optional int32 optional_int32_extension = 1; |
||||
optional int64 optional_int64_extension = 2; |
||||
optional uint32 optional_uint32_extension = 3; |
||||
optional uint64 optional_uint64_extension = 4; |
||||
optional sint32 optional_sint32_extension = 5; |
||||
optional sint64 optional_sint64_extension = 6; |
||||
optional fixed32 optional_fixed32_extension = 7; |
||||
optional fixed64 optional_fixed64_extension = 8; |
||||
optional sfixed32 optional_sfixed32_extension = 9; |
||||
optional sfixed64 optional_sfixed64_extension = 10; |
||||
optional float optional_float_extension = 11; |
||||
optional double optional_double_extension = 12; |
||||
optional bool optional_bool_extension = 13; |
||||
optional string optional_string_extension = 14; |
||||
optional bytes optional_bytes_extension = 15; |
||||
|
||||
optional group OptionalGroup_extension = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional TestAllTypes.NestedMessage optional_nested_message_extension = 18; |
||||
optional ForeignMessage optional_foreign_message_extension = 19; |
||||
optional protobuf_unittest_import.ImportMessage |
||||
optional_import_message_extension = 20; |
||||
|
||||
optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21; |
||||
optional ForeignEnum optional_foreign_enum_extension = 22; |
||||
optional protobuf_unittest_import.ImportEnum |
||||
optional_import_enum_extension = 23; |
||||
|
||||
optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE]; |
||||
optional string optional_cord_extension = 25 [ctype=CORD]; |
||||
|
||||
optional protobuf_unittest_import.PublicImportMessage |
||||
optional_public_import_message_extension = 26; |
||||
|
||||
optional TestAllTypes.NestedMessage |
||||
optional_lazy_message_extension = 27 [lazy=true]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32_extension = 31; |
||||
repeated int64 repeated_int64_extension = 32; |
||||
repeated uint32 repeated_uint32_extension = 33; |
||||
repeated uint64 repeated_uint64_extension = 34; |
||||
repeated sint32 repeated_sint32_extension = 35; |
||||
repeated sint64 repeated_sint64_extension = 36; |
||||
repeated fixed32 repeated_fixed32_extension = 37; |
||||
repeated fixed64 repeated_fixed64_extension = 38; |
||||
repeated sfixed32 repeated_sfixed32_extension = 39; |
||||
repeated sfixed64 repeated_sfixed64_extension = 40; |
||||
repeated float repeated_float_extension = 41; |
||||
repeated double repeated_double_extension = 42; |
||||
repeated bool repeated_bool_extension = 43; |
||||
repeated string repeated_string_extension = 44; |
||||
repeated bytes repeated_bytes_extension = 45; |
||||
|
||||
repeated group RepeatedGroup_extension = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; |
||||
repeated ForeignMessage repeated_foreign_message_extension = 49; |
||||
repeated protobuf_unittest_import.ImportMessage |
||||
repeated_import_message_extension = 50; |
||||
|
||||
repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; |
||||
repeated ForeignEnum repeated_foreign_enum_extension = 52; |
||||
repeated protobuf_unittest_import.ImportEnum |
||||
repeated_import_enum_extension = 53; |
||||
|
||||
repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE]; |
||||
repeated string repeated_cord_extension = 55 [ctype=CORD]; |
||||
|
||||
repeated TestAllTypes.NestedMessage |
||||
repeated_lazy_message_extension = 57 [lazy=true]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32_extension = 61 [default = 41 ]; |
||||
optional int64 default_int64_extension = 62 [default = 42 ]; |
||||
optional uint32 default_uint32_extension = 63 [default = 43 ]; |
||||
optional uint64 default_uint64_extension = 64 [default = 44 ]; |
||||
optional sint32 default_sint32_extension = 65 [default = -45 ]; |
||||
optional sint64 default_sint64_extension = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32_extension = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64_extension = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32_extension = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64_extension = 70 [default = -50 ]; |
||||
optional float default_float_extension = 71 [default = 51.5 ]; |
||||
optional double default_double_extension = 72 [default = 52e3 ]; |
||||
optional bool default_bool_extension = 73 [default = true ]; |
||||
optional string default_string_extension = 74 [default = "hello"]; |
||||
optional bytes default_bytes_extension = 75 [default = "world"]; |
||||
|
||||
optional TestAllTypes.NestedEnum |
||||
default_nested_enum_extension = 81 [default = BAR]; |
||||
optional ForeignEnum |
||||
default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; |
||||
optional protobuf_unittest_import.ImportEnum |
||||
default_import_enum_extension = 83 [default = IMPORT_BAR]; |
||||
|
||||
optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, |
||||
default="abc"]; |
||||
optional string default_cord_extension = 85 [ctype=CORD, default="123"]; |
||||
} |
||||
|
||||
message TestNestedExtension { |
||||
extend TestAllExtensions { |
||||
// Check for bug where string extensions declared in tested scope did not |
||||
// compile. |
||||
optional string test = 1002 [default="test"]; |
||||
} |
||||
} |
||||
|
||||
// We have separate messages for testing required fields because it's |
||||
// annoying to have to fill in required fields in TestProto in order to |
||||
// do anything with it. Note that we don't need to test every type of |
||||
// required filed because the code output is basically identical to |
||||
// optional fields for all types. |
||||
message TestRequired { |
||||
required int32 a = 1; |
||||
optional int32 dummy2 = 2; |
||||
required int32 b = 3; |
||||
|
||||
extend TestAllExtensions { |
||||
optional TestRequired single = 1000; |
||||
repeated TestRequired multi = 1001; |
||||
} |
||||
|
||||
// Pad the field count to 32 so that we can test that IsInitialized() |
||||
// properly checks multiple elements of has_bits_. |
||||
optional int32 dummy4 = 4; |
||||
optional int32 dummy5 = 5; |
||||
optional int32 dummy6 = 6; |
||||
optional int32 dummy7 = 7; |
||||
optional int32 dummy8 = 8; |
||||
optional int32 dummy9 = 9; |
||||
optional int32 dummy10 = 10; |
||||
optional int32 dummy11 = 11; |
||||
optional int32 dummy12 = 12; |
||||
optional int32 dummy13 = 13; |
||||
optional int32 dummy14 = 14; |
||||
optional int32 dummy15 = 15; |
||||
optional int32 dummy16 = 16; |
||||
optional int32 dummy17 = 17; |
||||
optional int32 dummy18 = 18; |
||||
optional int32 dummy19 = 19; |
||||
optional int32 dummy20 = 20; |
||||
optional int32 dummy21 = 21; |
||||
optional int32 dummy22 = 22; |
||||
optional int32 dummy23 = 23; |
||||
optional int32 dummy24 = 24; |
||||
optional int32 dummy25 = 25; |
||||
optional int32 dummy26 = 26; |
||||
optional int32 dummy27 = 27; |
||||
optional int32 dummy28 = 28; |
||||
optional int32 dummy29 = 29; |
||||
optional int32 dummy30 = 30; |
||||
optional int32 dummy31 = 31; |
||||
optional int32 dummy32 = 32; |
||||
|
||||
required int32 c = 33; |
||||
} |
||||
|
||||
message TestRequiredForeign { |
||||
optional TestRequired optional_message = 1; |
||||
repeated TestRequired repeated_message = 2; |
||||
optional int32 dummy = 3; |
||||
} |
||||
|
||||
// Test that we can use NestedMessage from outside TestAllTypes. |
||||
message TestForeignNested { |
||||
optional TestAllTypes.NestedMessage foreign_nested = 1; |
||||
} |
||||
|
||||
// TestEmptyMessage is used to test unknown field support. |
||||
message TestEmptyMessage { |
||||
} |
||||
|
||||
// Like above, but declare all field numbers as potential extensions. No |
||||
// actual extensions should ever be defined for this type. |
||||
message TestEmptyMessageWithExtensions { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
message TestMultipleExtensionRanges { |
||||
extensions 42; |
||||
extensions 4143 to 4243; |
||||
extensions 65536 to max; |
||||
} |
||||
|
||||
// Test that really large tag numbers don't break anything. |
||||
message TestReallyLargeTagNumber { |
||||
// The largest possible tag number is 2^28 - 1, since the wire format uses |
||||
// three bits to communicate wire type. |
||||
optional int32 a = 1; |
||||
optional int32 bb = 268435455; |
||||
} |
||||
|
||||
message TestRecursiveMessage { |
||||
optional TestRecursiveMessage a = 1; |
||||
optional int32 i = 2; |
||||
} |
||||
|
||||
// Test that mutual recursion works. |
||||
message TestMutualRecursionA { |
||||
optional TestMutualRecursionB bb = 1; |
||||
} |
||||
|
||||
message TestMutualRecursionB { |
||||
optional TestMutualRecursionA a = 1; |
||||
optional int32 optional_int32 = 2; |
||||
} |
||||
|
||||
// Test that groups have disjoint field numbers from their siblings and |
||||
// parents. This is NOT possible in proto1; only proto2. When attempting |
||||
// to compile with proto1, this will emit an error; so we only include it |
||||
// in protobuf_unittest_proto. |
||||
message TestDupFieldNumber { // NO_PROTO1 |
||||
optional int32 a = 1; // NO_PROTO1 |
||||
optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 |
||||
optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 |
||||
} // NO_PROTO1 |
||||
|
||||
// Additional messages for testing lazy fields. |
||||
message TestEagerMessage { |
||||
optional TestAllTypes sub_message = 1 [lazy=false]; |
||||
} |
||||
message TestLazyMessage { |
||||
optional TestAllTypes sub_message = 1 [lazy=true]; |
||||
} |
||||
|
||||
// Needed for a Python test. |
||||
message TestNestedMessageHasBits { |
||||
message NestedMessage { |
||||
repeated int32 nestedmessage_repeated_int32 = 1; |
||||
repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; |
||||
} |
||||
optional NestedMessage optional_nested_message = 1; |
||||
} |
||||
|
||||
|
||||
// Test an enum that has multiple values with the same number. |
||||
enum TestEnumWithDupValue { |
||||
option allow_alias = true; |
||||
FOO1 = 1; |
||||
BAR1 = 2; |
||||
BAZ = 3; |
||||
FOO2 = 1; |
||||
BAR2 = 2; |
||||
} |
||||
|
||||
// Test an enum with large, unordered values. |
||||
enum TestSparseEnum { |
||||
SPARSE_A = 123; |
||||
SPARSE_B = 62374; |
||||
SPARSE_C = 12589234; |
||||
SPARSE_D = -15; |
||||
SPARSE_E = -53452; |
||||
SPARSE_F = 0; |
||||
SPARSE_G = 2; |
||||
} |
||||
|
||||
// Test message with CamelCase field names. This violates Protocol Buffer |
||||
// standard style. |
||||
message TestCamelCaseFieldNames { |
||||
optional int32 PrimitiveField = 1; |
||||
optional string StringField = 2; |
||||
optional ForeignEnum EnumField = 3; |
||||
optional ForeignMessage MessageField = 4; |
||||
optional string StringPieceField = 5 [ctype=STRING_PIECE]; |
||||
optional string CordField = 6 [ctype=CORD]; |
||||
|
||||
repeated int32 RepeatedPrimitiveField = 7; |
||||
repeated string RepeatedStringField = 8; |
||||
repeated ForeignEnum RepeatedEnumField = 9; |
||||
repeated ForeignMessage RepeatedMessageField = 10; |
||||
repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE]; |
||||
repeated string RepeatedCordField = 12 [ctype=CORD]; |
||||
} |
||||
|
||||
|
||||
// We list fields out of order, to ensure that we're using field number and not |
||||
// field index to determine serialization order. |
||||
message TestFieldOrderings { |
||||
optional string my_string = 11; |
||||
extensions 2 to 10; |
||||
optional int64 my_int = 1; |
||||
extensions 12 to 100; |
||||
optional float my_float = 101; |
||||
} |
||||
|
||||
|
||||
extend TestFieldOrderings { |
||||
optional string my_extension_string = 50; |
||||
optional int32 my_extension_int = 5; |
||||
} |
||||
|
||||
|
||||
message TestExtremeDefaultValues { |
||||
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"]; |
||||
optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF]; |
||||
optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF]; |
||||
optional int32 small_int32 = 4 [default = -0x7FFFFFFF]; |
||||
optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF]; |
||||
optional int32 really_small_int32 = 21 [default = -0x80000000]; |
||||
optional int64 really_small_int64 = 22 [default = -0x8000000000000000]; |
||||
|
||||
// The default value here is UTF-8 for "\u1234". (We could also just type |
||||
// the UTF-8 text directly into this text file rather than escape it, but |
||||
// lots of people use editors that would be confused by this.) |
||||
optional string utf8_string = 6 [default = "\341\210\264"]; |
||||
|
||||
// Tests for single-precision floating-point values. |
||||
optional float zero_float = 7 [default = 0]; |
||||
optional float one_float = 8 [default = 1]; |
||||
optional float small_float = 9 [default = 1.5]; |
||||
optional float negative_one_float = 10 [default = -1]; |
||||
optional float negative_float = 11 [default = -1.5]; |
||||
// Using exponents |
||||
optional float large_float = 12 [default = 2E8]; |
||||
optional float small_negative_float = 13 [default = -8e-28]; |
||||
|
||||
// Text for nonfinite floating-point values. |
||||
optional double inf_double = 14 [default = inf]; |
||||
optional double neg_inf_double = 15 [default = -inf]; |
||||
optional double nan_double = 16 [default = nan]; |
||||
optional float inf_float = 17 [default = inf]; |
||||
optional float neg_inf_float = 18 [default = -inf]; |
||||
optional float nan_float = 19 [default = nan]; |
||||
|
||||
// Tests for C++ trigraphs. |
||||
// Trigraphs should be escaped in C++ generated files, but they should not be |
||||
// escaped for other languages. |
||||
// Note that in .proto file, "\?" is a valid way to escape ? in string |
||||
// literals. |
||||
optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; |
||||
|
||||
// String defaults containing the character '\000' |
||||
optional string string_with_zero = 23 [default = "hel\000lo"]; |
||||
optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; |
||||
optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, |
||||
default="ab\000c"]; |
||||
optional string cord_with_zero = 26 [ctype=CORD, |
||||
default="12\0003"]; |
||||
} |
||||
|
||||
message SparseEnumMessage { |
||||
optional TestSparseEnum sparse_enum = 1; |
||||
} |
||||
|
||||
// Test String and Bytes: string is for valid UTF-8 strings |
||||
message OneString { |
||||
optional string data = 1; |
||||
} |
||||
|
||||
message MoreString { |
||||
repeated string data = 1; |
||||
} |
||||
|
||||
message OneBytes { |
||||
optional bytes data = 1; |
||||
} |
||||
|
||||
message MoreBytes { |
||||
repeated bytes data = 1; |
||||
} |
||||
|
||||
|
||||
// Test messages for packed fields |
||||
|
||||
message TestPackedTypes { |
||||
repeated int32 packed_int32 = 90 [packed = true]; |
||||
repeated int64 packed_int64 = 91 [packed = true]; |
||||
repeated uint32 packed_uint32 = 92 [packed = true]; |
||||
repeated uint64 packed_uint64 = 93 [packed = true]; |
||||
repeated sint32 packed_sint32 = 94 [packed = true]; |
||||
repeated sint64 packed_sint64 = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32 = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64 = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32 = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64 = 99 [packed = true]; |
||||
repeated float packed_float = 100 [packed = true]; |
||||
repeated double packed_double = 101 [packed = true]; |
||||
repeated bool packed_bool = 102 [packed = true]; |
||||
repeated ForeignEnum packed_enum = 103 [packed = true]; |
||||
} |
||||
|
||||
// A message with the same fields as TestPackedTypes, but without packing. Used |
||||
// to test packed <-> unpacked wire compatibility. |
||||
message TestUnpackedTypes { |
||||
repeated int32 unpacked_int32 = 90 [packed = false]; |
||||
repeated int64 unpacked_int64 = 91 [packed = false]; |
||||
repeated uint32 unpacked_uint32 = 92 [packed = false]; |
||||
repeated uint64 unpacked_uint64 = 93 [packed = false]; |
||||
repeated sint32 unpacked_sint32 = 94 [packed = false]; |
||||
repeated sint64 unpacked_sint64 = 95 [packed = false]; |
||||
repeated fixed32 unpacked_fixed32 = 96 [packed = false]; |
||||
repeated fixed64 unpacked_fixed64 = 97 [packed = false]; |
||||
repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; |
||||
repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; |
||||
repeated float unpacked_float = 100 [packed = false]; |
||||
repeated double unpacked_double = 101 [packed = false]; |
||||
repeated bool unpacked_bool = 102 [packed = false]; |
||||
repeated ForeignEnum unpacked_enum = 103 [packed = false]; |
||||
} |
||||
|
||||
message TestPackedExtensions { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestPackedExtensions { |
||||
repeated int32 packed_int32_extension = 90 [packed = true]; |
||||
repeated int64 packed_int64_extension = 91 [packed = true]; |
||||
repeated uint32 packed_uint32_extension = 92 [packed = true]; |
||||
repeated uint64 packed_uint64_extension = 93 [packed = true]; |
||||
repeated sint32 packed_sint32_extension = 94 [packed = true]; |
||||
repeated sint64 packed_sint64_extension = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32_extension = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64_extension = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; |
||||
repeated float packed_float_extension = 100 [packed = true]; |
||||
repeated double packed_double_extension = 101 [packed = true]; |
||||
repeated bool packed_bool_extension = 102 [packed = true]; |
||||
repeated ForeignEnum packed_enum_extension = 103 [packed = true]; |
||||
} |
||||
|
||||
// Used by ExtensionSetTest/DynamicExtensions. The test actually builds |
||||
// a set of extensions to TestAllExtensions dynamically, based on the fields |
||||
// of this message type. |
||||
message TestDynamicExtensions { |
||||
enum DynamicEnumType { |
||||
DYNAMIC_FOO = 2200; |
||||
DYNAMIC_BAR = 2201; |
||||
DYNAMIC_BAZ = 2202; |
||||
} |
||||
message DynamicMessageType { |
||||
optional int32 dynamic_field = 2100; |
||||
} |
||||
|
||||
optional fixed32 scalar_extension = 2000; |
||||
optional ForeignEnum enum_extension = 2001; |
||||
optional DynamicEnumType dynamic_enum_extension = 2002; |
||||
|
||||
optional ForeignMessage message_extension = 2003; |
||||
optional DynamicMessageType dynamic_message_extension = 2004; |
||||
|
||||
repeated string repeated_extension = 2005; |
||||
repeated sint32 packed_extension = 2006 [packed = true]; |
||||
} |
||||
|
||||
message TestRepeatedScalarDifferentTagSizes { |
||||
// 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. |
||||
repeated fixed32 repeated_fixed32 = 12; |
||||
// Check for a varint type, just for good measure. |
||||
repeated int32 repeated_int32 = 13; |
||||
|
||||
// These have two-byte tags. |
||||
repeated fixed64 repeated_fixed64 = 2046; |
||||
repeated int64 repeated_int64 = 2047; |
||||
|
||||
// Three byte tags. |
||||
repeated float repeated_float = 262142; |
||||
repeated uint64 repeated_uint64 = 262143; |
||||
} |
||||
|
||||
// Test that if an optional or required message/group field appears multiple |
||||
// times in the input, they need to be merged. |
||||
message TestParsingMerge { |
||||
// RepeatedFieldsGenerator defines matching field types as TestParsingMerge, |
||||
// except that all fields are repeated. In the tests, we will serialize the |
||||
// RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge. |
||||
// Repeated fields in RepeatedFieldsGenerator are expected to be merged into |
||||
// the corresponding required/optional fields in TestParsingMerge. |
||||
message RepeatedFieldsGenerator { |
||||
repeated TestAllTypes field1 = 1; |
||||
repeated TestAllTypes field2 = 2; |
||||
repeated TestAllTypes field3 = 3; |
||||
repeated group Group1 = 10 { |
||||
optional TestAllTypes field1 = 11; |
||||
} |
||||
repeated group Group2 = 20 { |
||||
optional TestAllTypes field1 = 21; |
||||
} |
||||
repeated TestAllTypes ext1 = 1000; |
||||
repeated TestAllTypes ext2 = 1001; |
||||
} |
||||
required TestAllTypes required_all_types = 1; |
||||
optional TestAllTypes optional_all_types = 2; |
||||
repeated TestAllTypes repeated_all_types = 3; |
||||
optional group OptionalGroup = 10 { |
||||
optional TestAllTypes optional_group_all_types = 11; |
||||
} |
||||
repeated group RepeatedGroup = 20 { |
||||
optional TestAllTypes repeated_group_all_types = 21; |
||||
} |
||||
extensions 1000 to max; |
||||
extend TestParsingMerge { |
||||
optional TestAllTypes optional_ext = 1000; |
||||
repeated TestAllTypes repeated_ext = 1001; |
||||
} |
||||
} |
||||
|
||||
message TestCommentInjectionMessage { |
||||
// */ <- This should not close the generated doc comment |
||||
optional string a = 1 [default="*/ <- Neither should this."]; |
||||
} |
||||
|
||||
|
||||
// Test that RPC services work. |
||||
message FooRequest {} |
||||
message FooResponse {} |
||||
|
||||
message FooClientMessage {} |
||||
message FooServerMessage{} |
||||
|
||||
service TestService { |
||||
rpc Foo(FooRequest) returns (FooResponse); |
||||
rpc Bar(BarRequest) returns (BarResponse); |
||||
} |
||||
|
||||
|
||||
message BarRequest {} |
||||
message BarResponse {} |
@ -1,387 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: benjy@google.com (Benjy Weinberger) |
||||
// Based on original Protocol Buffers design by |
||||
// Sanjay Ghemawat, Jeff Dean, and others. |
||||
// |
||||
// A proto file used to test the "custom options" feature of proto2. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option cc_generic_services = true; // auto-added |
||||
option java_generic_services = true; // auto-added |
||||
option py_generic_services = true; |
||||
|
||||
// A custom file option (defined below). |
||||
option (file_opt1) = 9876543210; |
||||
|
||||
import "google/protobuf/descriptor.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. |
||||
package protobuf_unittest; |
||||
|
||||
|
||||
// Some simple test custom options of various types. |
||||
|
||||
extend google.protobuf.FileOptions { |
||||
optional uint64 file_opt1 = 7736974; |
||||
} |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional int32 message_opt1 = 7739036; |
||||
} |
||||
|
||||
extend google.protobuf.FieldOptions { |
||||
optional fixed64 field_opt1 = 7740936; |
||||
// This is useful for testing that we correctly register default values for |
||||
// extension options. |
||||
optional int32 field_opt2 = 7753913 [default=42]; |
||||
} |
||||
|
||||
extend google.protobuf.EnumOptions { |
||||
optional sfixed32 enum_opt1 = 7753576; |
||||
} |
||||
|
||||
extend google.protobuf.EnumValueOptions { |
||||
optional int32 enum_value_opt1 = 1560678; |
||||
} |
||||
|
||||
extend google.protobuf.ServiceOptions { |
||||
optional sint64 service_opt1 = 7887650; |
||||
} |
||||
|
||||
enum MethodOpt1 { |
||||
METHODOPT1_VAL1 = 1; |
||||
METHODOPT1_VAL2 = 2; |
||||
} |
||||
|
||||
extend google.protobuf.MethodOptions { |
||||
optional MethodOpt1 method_opt1 = 7890860; |
||||
} |
||||
|
||||
// A test message with custom options at all possible locations (and also some |
||||
// regular options, to make sure they interact nicely). |
||||
message TestMessageWithCustomOptions { |
||||
option message_set_wire_format = false; |
||||
|
||||
option (message_opt1) = -56; |
||||
|
||||
optional string field1 = 1 [ctype=CORD, |
||||
(field_opt1)=8765432109]; |
||||
|
||||
enum AnEnum { |
||||
option (enum_opt1) = -789; |
||||
|
||||
ANENUM_VAL1 = 1; |
||||
ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; |
||||
} |
||||
} |
||||
|
||||
|
||||
// A test RPC service with custom options at all possible locations (and also |
||||
// some regular options, to make sure they interact nicely). |
||||
message CustomOptionFooRequest { |
||||
} |
||||
|
||||
message CustomOptionFooResponse { |
||||
} |
||||
|
||||
message CustomOptionFooClientMessage { |
||||
} |
||||
|
||||
message CustomOptionFooServerMessage { |
||||
} |
||||
|
||||
service TestServiceWithCustomOptions { |
||||
option (service_opt1) = -9876543210; |
||||
|
||||
rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { |
||||
option (method_opt1) = METHODOPT1_VAL2; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
// Options of every possible field type, so we can test them all exhaustively. |
||||
|
||||
message DummyMessageContainingEnum { |
||||
enum TestEnumType { |
||||
TEST_OPTION_ENUM_TYPE1 = 22; |
||||
TEST_OPTION_ENUM_TYPE2 = -23; |
||||
} |
||||
} |
||||
|
||||
message DummyMessageInvalidAsOptionType { |
||||
} |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional bool bool_opt = 7706090; |
||||
optional int32 int32_opt = 7705709; |
||||
optional int64 int64_opt = 7705542; |
||||
optional uint32 uint32_opt = 7704880; |
||||
optional uint64 uint64_opt = 7702367; |
||||
optional sint32 sint32_opt = 7701568; |
||||
optional sint64 sint64_opt = 7700863; |
||||
optional fixed32 fixed32_opt = 7700307; |
||||
optional fixed64 fixed64_opt = 7700194; |
||||
optional sfixed32 sfixed32_opt = 7698645; |
||||
optional sfixed64 sfixed64_opt = 7685475; |
||||
optional float float_opt = 7675390; |
||||
optional double double_opt = 7673293; |
||||
optional string string_opt = 7673285; |
||||
optional bytes bytes_opt = 7673238; |
||||
optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233; |
||||
optional DummyMessageInvalidAsOptionType message_type_opt = 7665967; |
||||
} |
||||
|
||||
message CustomOptionMinIntegerValues { |
||||
option (bool_opt) = false; |
||||
option (int32_opt) = -0x80000000; |
||||
option (int64_opt) = -0x8000000000000000; |
||||
option (uint32_opt) = 0; |
||||
option (uint64_opt) = 0; |
||||
option (sint32_opt) = -0x80000000; |
||||
option (sint64_opt) = -0x8000000000000000; |
||||
option (fixed32_opt) = 0; |
||||
option (fixed64_opt) = 0; |
||||
option (sfixed32_opt) = -0x80000000; |
||||
option (sfixed64_opt) = -0x8000000000000000; |
||||
} |
||||
|
||||
message CustomOptionMaxIntegerValues { |
||||
option (bool_opt) = true; |
||||
option (int32_opt) = 0x7FFFFFFF; |
||||
option (int64_opt) = 0x7FFFFFFFFFFFFFFF; |
||||
option (uint32_opt) = 0xFFFFFFFF; |
||||
option (uint64_opt) = 0xFFFFFFFFFFFFFFFF; |
||||
option (sint32_opt) = 0x7FFFFFFF; |
||||
option (sint64_opt) = 0x7FFFFFFFFFFFFFFF; |
||||
option (fixed32_opt) = 0xFFFFFFFF; |
||||
option (fixed64_opt) = 0xFFFFFFFFFFFFFFFF; |
||||
option (sfixed32_opt) = 0x7FFFFFFF; |
||||
option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF; |
||||
} |
||||
|
||||
message CustomOptionOtherValues { |
||||
option (int32_opt) = -100; // To test sign-extension. |
||||
option (float_opt) = 12.3456789; |
||||
option (double_opt) = 1.234567890123456789; |
||||
option (string_opt) = "Hello, \"World\""; |
||||
option (bytes_opt) = "Hello\0World"; |
||||
option (enum_opt) = TEST_OPTION_ENUM_TYPE2; |
||||
} |
||||
|
||||
message SettingRealsFromPositiveInts { |
||||
option (float_opt) = 12; |
||||
option (double_opt) = 154; |
||||
} |
||||
|
||||
message SettingRealsFromNegativeInts { |
||||
option (float_opt) = -12; |
||||
option (double_opt) = -154; |
||||
} |
||||
|
||||
// Options of complex message types, themselves combined and extended in |
||||
// various ways. |
||||
|
||||
message ComplexOptionType1 { |
||||
optional int32 foo = 1; |
||||
optional int32 foo2 = 2; |
||||
optional int32 foo3 = 3; |
||||
|
||||
extensions 100 to max; |
||||
} |
||||
|
||||
message ComplexOptionType2 { |
||||
optional ComplexOptionType1 bar = 1; |
||||
optional int32 baz = 2; |
||||
|
||||
message ComplexOptionType4 { |
||||
optional int32 waldo = 1; |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional ComplexOptionType4 complex_opt4 = 7633546; |
||||
} |
||||
} |
||||
|
||||
optional ComplexOptionType4 fred = 3; |
||||
|
||||
extensions 100 to max; |
||||
} |
||||
|
||||
message ComplexOptionType3 { |
||||
optional int32 qux = 1; |
||||
|
||||
optional group ComplexOptionType5 = 2 { |
||||
optional int32 plugh = 3; |
||||
} |
||||
} |
||||
|
||||
extend ComplexOptionType1 { |
||||
optional int32 quux = 7663707; |
||||
optional ComplexOptionType3 corge = 7663442; |
||||
} |
||||
|
||||
extend ComplexOptionType2 { |
||||
optional int32 grault = 7650927; |
||||
optional ComplexOptionType1 garply = 7649992; |
||||
} |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756; |
||||
optional ComplexOptionType2 complex_opt2 = 7636949; |
||||
optional ComplexOptionType3 complex_opt3 = 7636463; |
||||
optional group ComplexOpt6 = 7595468 { |
||||
optional int32 xyzzy = 7593951; |
||||
} |
||||
} |
||||
|
||||
// Note that we try various different ways of naming the same extension. |
||||
message VariousComplexOptions { |
||||
option (.protobuf_unittest.complex_opt1).foo = 42; |
||||
option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324; |
||||
option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876; |
||||
option (complex_opt2).baz = 987; |
||||
option (complex_opt2).(grault) = 654; |
||||
option (complex_opt2).bar.foo = 743; |
||||
option (complex_opt2).bar.(quux) = 1999; |
||||
option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008; |
||||
option (complex_opt2).(garply).foo = 741; |
||||
option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998; |
||||
option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121; |
||||
option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; |
||||
option (complex_opt2).fred.waldo = 321; |
||||
option (protobuf_unittest.complex_opt3).qux = 9; |
||||
option (complex_opt3).complexoptiontype5.plugh = 22; |
||||
option (complexopt6).xyzzy = 24; |
||||
} |
||||
|
||||
// ------------------------------------------------------ |
||||
// Definitions for testing aggregate option parsing. |
||||
// See descriptor_unittest.cc. |
||||
|
||||
message AggregateMessageSet { |
||||
option message_set_wire_format = true; |
||||
extensions 4 to max; |
||||
} |
||||
|
||||
message AggregateMessageSetElement { |
||||
extend AggregateMessageSet { |
||||
optional AggregateMessageSetElement message_set_extension = 15447542; |
||||
} |
||||
optional string s = 1; |
||||
} |
||||
|
||||
// A helper type used to test aggregate option parsing |
||||
message Aggregate { |
||||
optional int32 i = 1; |
||||
optional string s = 2; |
||||
|
||||
// A nested object |
||||
optional Aggregate sub = 3; |
||||
|
||||
// To test the parsing of extensions inside aggregate values |
||||
optional google.protobuf.FileOptions file = 4; |
||||
extend google.protobuf.FileOptions { |
||||
optional Aggregate nested = 15476903; |
||||
} |
||||
|
||||
// An embedded message set |
||||
optional AggregateMessageSet mset = 5; |
||||
} |
||||
|
||||
// Allow Aggregate to be used as an option at all possible locations |
||||
// in the .proto grammar. |
||||
extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; } |
||||
extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; } |
||||
extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; } |
||||
extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; } |
||||
extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; } |
||||
extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; } |
||||
extend google.protobuf.MethodOptions { optional Aggregate methodopt = 15512713; } |
||||
|
||||
// Try using AggregateOption at different points in the proto grammar |
||||
option (fileopt) = { |
||||
s: 'FileAnnotation' |
||||
// Also test the handling of comments |
||||
/* of both types */ i: 100 |
||||
|
||||
sub { s: 'NestedFileAnnotation' } |
||||
|
||||
// Include a google.protobuf.FileOptions and recursively extend it with |
||||
// another fileopt. |
||||
file { |
||||
[protobuf_unittest.fileopt] { |
||||
s:'FileExtensionAnnotation' |
||||
} |
||||
} |
||||
|
||||
// A message set inside an option value |
||||
mset { |
||||
[protobuf_unittest.AggregateMessageSetElement.message_set_extension] { |
||||
s: 'EmbeddedMessageSetElement' |
||||
} |
||||
} |
||||
}; |
||||
|
||||
message AggregateMessage { |
||||
option (msgopt) = { i:101 s:'MessageAnnotation' }; |
||||
optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }]; |
||||
} |
||||
|
||||
service AggregateService { |
||||
option (serviceopt) = { s:'ServiceAnnotation' }; |
||||
rpc Method (AggregateMessage) returns (AggregateMessage) { |
||||
option (methodopt) = { s:'MethodAnnotation' }; |
||||
} |
||||
} |
||||
|
||||
enum AggregateEnum { |
||||
option (enumopt) = { s:'EnumAnnotation' }; |
||||
VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }]; |
||||
} |
||||
|
||||
// Test custom options for nested type. |
||||
message NestedOptionType { |
||||
message NestedMessage { |
||||
option (message_opt1) = 1001; |
||||
optional int32 nested_field = 1 [(field_opt1) = 1002]; |
||||
} |
||||
enum NestedEnum { |
||||
option (enum_opt1) = 1003; |
||||
NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004]; |
||||
} |
||||
extend google.protobuf.FileOptions { |
||||
optional int32 nested_extension = 7912573 [(field_opt2) = 1005]; |
||||
} |
||||
} |
@ -1,50 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// A proto file which imports a proto file that uses optimize_for = CODE_SIZE. |
||||
|
||||
import "google/protobuf/unittest_optimize_for.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
// We optimize for speed here, but we are importing a proto that is optimized |
||||
// for code size. |
||||
option optimize_for = SPEED; |
||||
|
||||
message TestEmbedOptimizedForSize { |
||||
// Test that embedding a message which has optimize_for = CODE_SIZE into |
||||
// one optimized for speed works. |
||||
optional TestOptimizedForSize optional_message = 1; |
||||
repeated TestOptimizedForSize repeated_message = 2; |
||||
} |
@ -1,37 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// This file intentionally left blank. (At one point this wouldn't compile |
||||
// correctly.) |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// A proto file which is imported by unittest.proto to test importing. |
||||
|
||||
|
||||
// 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 test_util.h we do |
||||
// "using namespace unittest_import = protobuf_unittest_import". |
||||
package protobuf_unittest_import; |
||||
|
||||
option optimize_for = SPEED; |
||||
|
||||
// Exercise the java_package option. |
||||
option java_package = "com.google.protobuf.test"; |
||||
|
||||
// Do not set a java_outer_classname here to verify that Proto2 works without |
||||
// one. |
||||
|
||||
// Test public import |
||||
import public "google/protobuf/unittest_import_public.proto"; |
||||
|
||||
message ImportMessage { |
||||
optional int32 d = 1; |
||||
} |
||||
|
||||
enum ImportEnum { |
||||
IMPORT_FOO = 7; |
||||
IMPORT_BAR = 8; |
||||
IMPORT_BAZ = 9; |
||||
} |
||||
|
@ -1,51 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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) |
||||
// |
||||
// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME. |
||||
|
||||
package protobuf_unittest_import; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
import public "google/protobuf/unittest_import_public_lite.proto"; |
||||
|
||||
message ImportMessageLite { |
||||
optional int32 d = 1; |
||||
} |
||||
|
||||
enum ImportEnumLite { |
||||
IMPORT_LITE_FOO = 7; |
||||
IMPORT_LITE_BAR = 8; |
||||
IMPORT_LITE_BAZ = 9; |
||||
} |
@ -1,40 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: liujisi@google.com (Pherl Liu) |
||||
|
||||
|
||||
package protobuf_unittest_import; |
||||
|
||||
option java_package = "com.google.protobuf.test"; |
||||
|
||||
message PublicImportMessage { |
||||
optional int32 e = 1; |
||||
} |
@ -1,42 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: liujisi@google.com (Pherl Liu) |
||||
|
||||
|
||||
package protobuf_unittest_import; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
message PublicImportMessageLite { |
||||
optional int32 e = 1; |
||||
} |
@ -1,360 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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) |
||||
// |
||||
// This is like unittest.proto but with optimize_for = LITE_RUNTIME. |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
import "google/protobuf/unittest_import_lite.proto"; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
// Same as TestAllTypes but with the lite runtime. |
||||
message TestAllTypesLite { |
||||
message NestedMessage { |
||||
optional int32 bb = 1; |
||||
} |
||||
|
||||
enum NestedEnum { |
||||
FOO = 1; |
||||
BAR = 2; |
||||
BAZ = 3; |
||||
} |
||||
|
||||
// Singular |
||||
optional int32 optional_int32 = 1; |
||||
optional int64 optional_int64 = 2; |
||||
optional uint32 optional_uint32 = 3; |
||||
optional uint64 optional_uint64 = 4; |
||||
optional sint32 optional_sint32 = 5; |
||||
optional sint64 optional_sint64 = 6; |
||||
optional fixed32 optional_fixed32 = 7; |
||||
optional fixed64 optional_fixed64 = 8; |
||||
optional sfixed32 optional_sfixed32 = 9; |
||||
optional sfixed64 optional_sfixed64 = 10; |
||||
optional float optional_float = 11; |
||||
optional double optional_double = 12; |
||||
optional bool optional_bool = 13; |
||||
optional string optional_string = 14; |
||||
optional bytes optional_bytes = 15; |
||||
|
||||
optional group OptionalGroup = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional NestedMessage optional_nested_message = 18; |
||||
optional ForeignMessageLite optional_foreign_message = 19; |
||||
optional protobuf_unittest_import.ImportMessageLite |
||||
optional_import_message = 20; |
||||
|
||||
optional NestedEnum optional_nested_enum = 21; |
||||
optional ForeignEnumLite optional_foreign_enum = 22; |
||||
optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; |
||||
|
||||
optional string optional_string_piece = 24 [ctype=STRING_PIECE]; |
||||
optional string optional_cord = 25 [ctype=CORD]; |
||||
|
||||
// Defined in unittest_import_public.proto |
||||
optional protobuf_unittest_import.PublicImportMessageLite |
||||
optional_public_import_message = 26; |
||||
|
||||
optional NestedMessage optional_lazy_message = 27 [lazy=true]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32 = 31; |
||||
repeated int64 repeated_int64 = 32; |
||||
repeated uint32 repeated_uint32 = 33; |
||||
repeated uint64 repeated_uint64 = 34; |
||||
repeated sint32 repeated_sint32 = 35; |
||||
repeated sint64 repeated_sint64 = 36; |
||||
repeated fixed32 repeated_fixed32 = 37; |
||||
repeated fixed64 repeated_fixed64 = 38; |
||||
repeated sfixed32 repeated_sfixed32 = 39; |
||||
repeated sfixed64 repeated_sfixed64 = 40; |
||||
repeated float repeated_float = 41; |
||||
repeated double repeated_double = 42; |
||||
repeated bool repeated_bool = 43; |
||||
repeated string repeated_string = 44; |
||||
repeated bytes repeated_bytes = 45; |
||||
|
||||
repeated group RepeatedGroup = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated NestedMessage repeated_nested_message = 48; |
||||
repeated ForeignMessageLite repeated_foreign_message = 49; |
||||
repeated protobuf_unittest_import.ImportMessageLite |
||||
repeated_import_message = 50; |
||||
|
||||
repeated NestedEnum repeated_nested_enum = 51; |
||||
repeated ForeignEnumLite repeated_foreign_enum = 52; |
||||
repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53; |
||||
|
||||
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; |
||||
repeated string repeated_cord = 55 [ctype=CORD]; |
||||
|
||||
repeated NestedMessage repeated_lazy_message = 57 [lazy=true]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32 = 61 [default = 41 ]; |
||||
optional int64 default_int64 = 62 [default = 42 ]; |
||||
optional uint32 default_uint32 = 63 [default = 43 ]; |
||||
optional uint64 default_uint64 = 64 [default = 44 ]; |
||||
optional sint32 default_sint32 = 65 [default = -45 ]; |
||||
optional sint64 default_sint64 = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32 = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64 = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32 = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64 = 70 [default = -50 ]; |
||||
optional float default_float = 71 [default = 51.5 ]; |
||||
optional double default_double = 72 [default = 52e3 ]; |
||||
optional bool default_bool = 73 [default = true ]; |
||||
optional string default_string = 74 [default = "hello"]; |
||||
optional bytes default_bytes = 75 [default = "world"]; |
||||
|
||||
optional NestedEnum default_nested_enum = 81 [default = BAR]; |
||||
optional ForeignEnumLite default_foreign_enum = 82 |
||||
[default = FOREIGN_LITE_BAR]; |
||||
optional protobuf_unittest_import.ImportEnumLite |
||||
default_import_enum = 83 [default = IMPORT_LITE_BAR]; |
||||
|
||||
optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
||||
optional string default_cord = 85 [ctype=CORD,default="123"]; |
||||
} |
||||
|
||||
message ForeignMessageLite { |
||||
optional int32 c = 1; |
||||
} |
||||
|
||||
enum ForeignEnumLite { |
||||
FOREIGN_LITE_FOO = 4; |
||||
FOREIGN_LITE_BAR = 5; |
||||
FOREIGN_LITE_BAZ = 6; |
||||
} |
||||
|
||||
message TestPackedTypesLite { |
||||
repeated int32 packed_int32 = 90 [packed = true]; |
||||
repeated int64 packed_int64 = 91 [packed = true]; |
||||
repeated uint32 packed_uint32 = 92 [packed = true]; |
||||
repeated uint64 packed_uint64 = 93 [packed = true]; |
||||
repeated sint32 packed_sint32 = 94 [packed = true]; |
||||
repeated sint64 packed_sint64 = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32 = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64 = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32 = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64 = 99 [packed = true]; |
||||
repeated float packed_float = 100 [packed = true]; |
||||
repeated double packed_double = 101 [packed = true]; |
||||
repeated bool packed_bool = 102 [packed = true]; |
||||
repeated ForeignEnumLite packed_enum = 103 [packed = true]; |
||||
} |
||||
|
||||
message TestAllExtensionsLite { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestAllExtensionsLite { |
||||
// Singular |
||||
optional int32 optional_int32_extension_lite = 1; |
||||
optional int64 optional_int64_extension_lite = 2; |
||||
optional uint32 optional_uint32_extension_lite = 3; |
||||
optional uint64 optional_uint64_extension_lite = 4; |
||||
optional sint32 optional_sint32_extension_lite = 5; |
||||
optional sint64 optional_sint64_extension_lite = 6; |
||||
optional fixed32 optional_fixed32_extension_lite = 7; |
||||
optional fixed64 optional_fixed64_extension_lite = 8; |
||||
optional sfixed32 optional_sfixed32_extension_lite = 9; |
||||
optional sfixed64 optional_sfixed64_extension_lite = 10; |
||||
optional float optional_float_extension_lite = 11; |
||||
optional double optional_double_extension_lite = 12; |
||||
optional bool optional_bool_extension_lite = 13; |
||||
optional string optional_string_extension_lite = 14; |
||||
optional bytes optional_bytes_extension_lite = 15; |
||||
|
||||
optional group OptionalGroup_extension_lite = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite |
||||
= 18; |
||||
optional ForeignMessageLite optional_foreign_message_extension_lite = 19; |
||||
optional protobuf_unittest_import.ImportMessageLite |
||||
optional_import_message_extension_lite = 20; |
||||
|
||||
optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21; |
||||
optional ForeignEnumLite optional_foreign_enum_extension_lite = 22; |
||||
optional protobuf_unittest_import.ImportEnumLite |
||||
optional_import_enum_extension_lite = 23; |
||||
|
||||
optional string optional_string_piece_extension_lite = 24 |
||||
[ctype=STRING_PIECE]; |
||||
optional string optional_cord_extension_lite = 25 [ctype=CORD]; |
||||
|
||||
optional protobuf_unittest_import.PublicImportMessageLite |
||||
optional_public_import_message_extension_lite = 26; |
||||
|
||||
optional TestAllTypesLite.NestedMessage |
||||
optional_lazy_message_extension_lite = 27 [lazy=true]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32_extension_lite = 31; |
||||
repeated int64 repeated_int64_extension_lite = 32; |
||||
repeated uint32 repeated_uint32_extension_lite = 33; |
||||
repeated uint64 repeated_uint64_extension_lite = 34; |
||||
repeated sint32 repeated_sint32_extension_lite = 35; |
||||
repeated sint64 repeated_sint64_extension_lite = 36; |
||||
repeated fixed32 repeated_fixed32_extension_lite = 37; |
||||
repeated fixed64 repeated_fixed64_extension_lite = 38; |
||||
repeated sfixed32 repeated_sfixed32_extension_lite = 39; |
||||
repeated sfixed64 repeated_sfixed64_extension_lite = 40; |
||||
repeated float repeated_float_extension_lite = 41; |
||||
repeated double repeated_double_extension_lite = 42; |
||||
repeated bool repeated_bool_extension_lite = 43; |
||||
repeated string repeated_string_extension_lite = 44; |
||||
repeated bytes repeated_bytes_extension_lite = 45; |
||||
|
||||
repeated group RepeatedGroup_extension_lite = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite |
||||
= 48; |
||||
repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49; |
||||
repeated protobuf_unittest_import.ImportMessageLite |
||||
repeated_import_message_extension_lite = 50; |
||||
|
||||
repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51; |
||||
repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52; |
||||
repeated protobuf_unittest_import.ImportEnumLite |
||||
repeated_import_enum_extension_lite = 53; |
||||
|
||||
repeated string repeated_string_piece_extension_lite = 54 |
||||
[ctype=STRING_PIECE]; |
||||
repeated string repeated_cord_extension_lite = 55 [ctype=CORD]; |
||||
|
||||
repeated TestAllTypesLite.NestedMessage |
||||
repeated_lazy_message_extension_lite = 57 [lazy=true]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32_extension_lite = 61 [default = 41 ]; |
||||
optional int64 default_int64_extension_lite = 62 [default = 42 ]; |
||||
optional uint32 default_uint32_extension_lite = 63 [default = 43 ]; |
||||
optional uint64 default_uint64_extension_lite = 64 [default = 44 ]; |
||||
optional sint32 default_sint32_extension_lite = 65 [default = -45 ]; |
||||
optional sint64 default_sint64_extension_lite = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32_extension_lite = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64_extension_lite = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50 ]; |
||||
optional float default_float_extension_lite = 71 [default = 51.5 ]; |
||||
optional double default_double_extension_lite = 72 [default = 52e3 ]; |
||||
optional bool default_bool_extension_lite = 73 [default = true ]; |
||||
optional string default_string_extension_lite = 74 [default = "hello"]; |
||||
optional bytes default_bytes_extension_lite = 75 [default = "world"]; |
||||
|
||||
optional TestAllTypesLite.NestedEnum |
||||
default_nested_enum_extension_lite = 81 [default = BAR]; |
||||
optional ForeignEnumLite |
||||
default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; |
||||
optional protobuf_unittest_import.ImportEnumLite |
||||
default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; |
||||
|
||||
optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE, |
||||
default="abc"]; |
||||
optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"]; |
||||
} |
||||
|
||||
message TestPackedExtensionsLite { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestPackedExtensionsLite { |
||||
repeated int32 packed_int32_extension_lite = 90 [packed = true]; |
||||
repeated int64 packed_int64_extension_lite = 91 [packed = true]; |
||||
repeated uint32 packed_uint32_extension_lite = 92 [packed = true]; |
||||
repeated uint64 packed_uint64_extension_lite = 93 [packed = true]; |
||||
repeated sint32 packed_sint32_extension_lite = 94 [packed = true]; |
||||
repeated sint64 packed_sint64_extension_lite = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true]; |
||||
repeated float packed_float_extension_lite = 100 [packed = true]; |
||||
repeated double packed_double_extension_lite = 101 [packed = true]; |
||||
repeated bool packed_bool_extension_lite = 102 [packed = true]; |
||||
repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true]; |
||||
} |
||||
|
||||
message TestNestedExtensionLite { |
||||
extend TestAllExtensionsLite { |
||||
optional int32 nested_extension = 12345; |
||||
} |
||||
} |
||||
|
||||
// Test that deprecated fields work. We only verify that they compile (at one |
||||
// point this failed). |
||||
message TestDeprecatedLite { |
||||
optional int32 deprecated_field = 1 [deprecated = true]; |
||||
} |
||||
|
||||
// See the comments of the same type in unittest.proto. |
||||
message TestParsingMergeLite { |
||||
message RepeatedFieldsGenerator { |
||||
repeated TestAllTypesLite field1 = 1; |
||||
repeated TestAllTypesLite field2 = 2; |
||||
repeated TestAllTypesLite field3 = 3; |
||||
repeated group Group1 = 10 { |
||||
optional TestAllTypesLite field1 = 11; |
||||
} |
||||
repeated group Group2 = 20 { |
||||
optional TestAllTypesLite field1 = 21; |
||||
} |
||||
repeated TestAllTypesLite ext1 = 1000; |
||||
repeated TestAllTypesLite ext2 = 1001; |
||||
} |
||||
required TestAllTypesLite required_all_types = 1; |
||||
optional TestAllTypesLite optional_all_types = 2; |
||||
repeated TestAllTypesLite repeated_all_types = 3; |
||||
optional group OptionalGroup = 10 { |
||||
optional TestAllTypesLite optional_group_all_types = 11; |
||||
} |
||||
repeated group RepeatedGroup = 20 { |
||||
optional TestAllTypesLite repeated_group_all_types = 21; |
||||
} |
||||
extensions 1000 to max; |
||||
extend TestParsingMergeLite { |
||||
optional TestAllTypesLite optional_ext = 1000; |
||||
repeated TestAllTypesLite repeated_ext = 1001; |
||||
} |
||||
} |
@ -1,43 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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) |
||||
// |
||||
// Tests that a "lite" message can import a regular message. |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
import "google/protobuf/unittest.proto"; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
message TestLiteImportsNonlite { |
||||
optional TestAllTypes message = 1; |
||||
} |
@ -1,72 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// This file contains messages for testing message_set_wire_format. |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option optimize_for = SPEED; |
||||
|
||||
// A message with message_set_wire_format. |
||||
message TestMessageSet { |
||||
option message_set_wire_format = true; |
||||
extensions 4 to max; |
||||
} |
||||
|
||||
message TestMessageSetContainer { |
||||
optional TestMessageSet message_set = 1; |
||||
} |
||||
|
||||
message TestMessageSetExtension1 { |
||||
extend TestMessageSet { |
||||
optional TestMessageSetExtension1 message_set_extension = 1545008; |
||||
} |
||||
optional int32 i = 15; |
||||
} |
||||
|
||||
message TestMessageSetExtension2 { |
||||
extend TestMessageSet { |
||||
optional TestMessageSetExtension2 message_set_extension = 1547769; |
||||
} |
||||
optional string str = 25; |
||||
} |
||||
|
||||
// MessageSet wire format is equivalent to this. |
||||
message RawMessageSet { |
||||
repeated group Item = 1 { |
||||
required int32 type_id = 2; |
||||
required bytes message = 3; |
||||
} |
||||
} |
||||
|
@ -1,52 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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) |
||||
|
||||
package google.protobuf.no_generic_services_test; |
||||
|
||||
// *_generic_services are false by default. |
||||
|
||||
message TestMessage { |
||||
optional int32 a = 1; |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
enum TestEnum { |
||||
FOO = 1; |
||||
} |
||||
|
||||
extend TestMessage { |
||||
optional int32 test_extension = 1000; |
||||
} |
||||
|
||||
service TestService { |
||||
rpc Foo(TestMessage) returns(TestMessage); |
||||
} |
@ -1,61 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// A proto file which uses optimize_for = CODE_SIZE. |
||||
|
||||
import "google/protobuf/unittest.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option optimize_for = CODE_SIZE; |
||||
|
||||
message TestOptimizedForSize { |
||||
optional int32 i = 1; |
||||
optional ForeignMessage msg = 19; |
||||
|
||||
extensions 1000 to max; |
||||
|
||||
extend TestOptimizedForSize { |
||||
optional int32 test_extension = 1234; |
||||
optional TestRequiredOptimizedForSize test_extension2 = 1235; |
||||
} |
||||
} |
||||
|
||||
message TestRequiredOptimizedForSize { |
||||
required int32 x = 1; |
||||
} |
||||
|
||||
message TestOptionalOptimizedForSize { |
||||
optional TestRequiredOptimizedForSize o = 1; |
||||
} |
@ -1,30 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-test-suite</artifactId> |
||||
<version>2.5.0</version> |
||||
<name>Protocol Buffer Java API compatibility tests</name> |
||||
<packaging>pom</packaging> |
||||
<modules> |
||||
<module>protos</module> |
||||
<module>more_protos</module> |
||||
<module>tests</module> |
||||
</modules> |
||||
<properties> |
||||
<protoc.path>protoc</protoc.path> |
||||
<protobuf.version>2.5.0</protobuf.version> |
||||
|
||||
<protos.protoc.path>${protoc.path}</protos.protoc.path> |
||||
<protos.protobuf.version>${protobuf.version}</protos.protobuf.version> |
||||
|
||||
<more_protos.protoc.path>${protoc.path}</more_protos.protoc.path> |
||||
<more_protos.protobuf.version>${protobuf.version}</more_protos.protobuf.version> |
||||
|
||||
<tests.protobuf.version>${protobuf.version}</tests.protobuf.version> |
||||
|
||||
<protobuf.test.source.path>.</protobuf.test.source.path> |
||||
</properties> |
||||
</project> |
@ -1,71 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-test-suite</artifactId> |
||||
<version>2.5.0</version> |
||||
<relativePath>..</relativePath> |
||||
</parent> |
||||
|
||||
<groupId>com.google.protobuf.compatibility</groupId> |
||||
<artifactId>compatibility-protos</artifactId> |
||||
<version>2.5.0</version> |
||||
|
||||
<name>Protos for Compatibility test</name> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.google.protobuf</groupId> |
||||
<artifactId>protobuf-java</artifactId> |
||||
<version>${protos.protobuf.version}</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<artifactId>maven-compiler-plugin</artifactId> |
||||
<version>3.6.0</version> |
||||
<configuration> |
||||
<source>1.6</source> |
||||
<target>1.6</target> |
||||
</configuration> |
||||
</plugin> |
||||
<plugin> |
||||
<artifactId>maven-antrun-plugin</artifactId> |
||||
<executions> |
||||
<execution> |
||||
<id>generate-sources</id> |
||||
<phase>generate-sources</phase> |
||||
<configuration> |
||||
<tasks> |
||||
<mkdir dir="target/generated-sources" /> |
||||
<exec executable="${protos.protoc.path}"> |
||||
<arg value="--java_out=target/generated-sources" /> |
||||
<arg value="--proto_path=src/proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_custom_options.proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_enormous_descriptor.proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_import.proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_import_public.proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_mset.proto" /> |
||||
<arg value="src/proto/google/protobuf/unittest_no_generic_services.proto" /> |
||||
<arg value="src/proto/com/google/protobuf/nested_builders_test.proto" /> |
||||
<arg value="src/proto/com/google/protobuf/nested_extension.proto" /> |
||||
<arg value="src/proto/com/google/protobuf/non_nested_extension.proto" /> |
||||
<arg value="src/proto/com/google/protobuf/test_bad_identifiers.proto" /> |
||||
</exec> |
||||
</tasks> |
||||
<sourceRoot>target/generated-sources</sourceRoot> |
||||
</configuration> |
||||
<goals> |
||||
<goal>run</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
@ -1,71 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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) |
||||
// |
||||
// A proto file which tests the java_multiple_files option. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option java_generic_services = true; // auto-added |
||||
|
||||
import "google/protobuf/unittest.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "MultipleFilesTestProto"; |
||||
|
||||
message MessageWithNoOuter { |
||||
message NestedMessage { |
||||
optional int32 i = 1; |
||||
} |
||||
enum NestedEnum { |
||||
BAZ = 3; |
||||
} |
||||
optional NestedMessage nested = 1; |
||||
repeated TestAllTypes foreign = 2; |
||||
optional NestedEnum nested_enum = 3; |
||||
optional EnumWithNoOuter foreign_enum = 4; |
||||
} |
||||
|
||||
enum EnumWithNoOuter { |
||||
FOO = 1; |
||||
BAR = 2; |
||||
} |
||||
|
||||
service ServiceWithNoOuter { |
||||
rpc Foo(MessageWithNoOuter) returns(TestAllTypes); |
||||
} |
||||
|
||||
extend TestAllExtensions { |
||||
optional int32 extension_with_outer = 1234567; |
||||
} |
@ -1,53 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: jonp@google.com (Jon Perlow) |
||||
// |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "NestedBuilders"; |
||||
|
||||
|
||||
message Vehicle { |
||||
optional Engine engine = 1; |
||||
repeated Wheel wheel = 2; |
||||
} |
||||
|
||||
message Engine { |
||||
optional int32 cylinder = 1; |
||||
optional int32 liters = 2; |
||||
} |
||||
|
||||
message Wheel { |
||||
optional int32 radius = 1; |
||||
optional int32 width = 2; |
||||
} |
@ -1,45 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with nested extensions. Note that this must be defined in |
||||
// a separate file to properly test the initialization of the outer class. |
||||
|
||||
|
||||
import "com/google/protobuf/non_nested_extension.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
message MyNestedExtension { |
||||
extend MessageToBeExtended { |
||||
optional MessageToBeExtended recursiveExtension = 2; |
||||
} |
||||
} |
@ -1,48 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with nested extensions for a MessageLite messages. Note that |
||||
// this must be defined in a separate file to properly test the initialization |
||||
// of the outer class. |
||||
|
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
import "com/google/protobuf/non_nested_extension_lite.proto"; |
||||
|
||||
message MyNestedExtensionLite { |
||||
extend MessageLiteToBeExtended { |
||||
optional MessageLiteToBeExtended recursiveExtensionLite = 3; |
||||
} |
||||
} |
@ -1,48 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with extensions. |
||||
|
||||
|
||||
package protobuf_unittest; |
||||
|
||||
message MessageToBeExtended { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
message MyNonNestedExtension { |
||||
} |
||||
|
||||
extend MessageToBeExtended { |
||||
optional MyNonNestedExtension nonNestedExtension = 1; |
||||
} |
||||
|
@ -1,50 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: Darick Tong (darick@google.com) |
||||
// |
||||
// A proto file with extensions for a MessageLite messages. |
||||
|
||||
|
||||
package protobuf_unittest; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
message MessageLiteToBeExtended { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
message MyNonNestedExtensionLite { |
||||
} |
||||
|
||||
extend MessageLiteToBeExtended { |
||||
optional MyNonNestedExtensionLite nonNestedExtensionLite = 1; |
||||
} |
||||
|
@ -1,108 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: jonp@google.com (Jon Perlow) |
||||
|
||||
// This file tests that various identifiers work as field and type names even |
||||
// though the same identifiers are used internally by the java code generator. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option java_generic_services = true; // auto-added |
||||
|
||||
package io_protocol_tests; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
option java_outer_classname = "TestBadIdentifiersProto"; |
||||
|
||||
message TestMessage { |
||||
} |
||||
|
||||
message Descriptor { |
||||
option no_standard_descriptor_accessor = true; |
||||
optional string descriptor = 1; |
||||
message NestedDescriptor { |
||||
option no_standard_descriptor_accessor = true; |
||||
optional string descriptor = 1; |
||||
} |
||||
optional NestedDescriptor nested_descriptor = 2; |
||||
} |
||||
|
||||
message Parser { |
||||
enum ParserEnum { |
||||
PARSER = 1; |
||||
} |
||||
optional ParserEnum parser = 1; |
||||
} |
||||
|
||||
message Deprecated { |
||||
enum TestEnum { |
||||
FOO = 1; |
||||
} |
||||
|
||||
optional int32 field1 = 1 [deprecated=true]; |
||||
optional TestEnum field2 = 2 [deprecated=true]; |
||||
optional TestMessage field3 = 3 [deprecated=true]; |
||||
} |
||||
|
||||
message Override { |
||||
optional int32 override = 1; |
||||
} |
||||
|
||||
message Object { |
||||
optional int32 object = 1; |
||||
optional string string_object = 2; |
||||
} |
||||
|
||||
message String { |
||||
optional string string = 1; |
||||
} |
||||
|
||||
message Integer { |
||||
optional int32 integer = 1; |
||||
} |
||||
|
||||
message Long { |
||||
optional int32 long = 1; |
||||
} |
||||
|
||||
message Float { |
||||
optional float float = 1; |
||||
} |
||||
|
||||
message Double { |
||||
optional double double = 1; |
||||
} |
||||
|
||||
service TestConflictingMethodNames { |
||||
rpc Override(TestMessage) returns (TestMessage); |
||||
} |
||||
|
@ -1,620 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// The messages in this file describe the definitions found in .proto files. |
||||
// A valid .proto file can be translated directly to a FileDescriptorProto |
||||
// without any other information (e.g. without reading its imports). |
||||
|
||||
|
||||
|
||||
package google.protobuf; |
||||
option java_package = "com.google.protobuf"; |
||||
option java_outer_classname = "DescriptorProtos"; |
||||
|
||||
// descriptor.proto must be optimized for speed because reflection-based |
||||
// algorithms don't work during bootstrapping. |
||||
option optimize_for = SPEED; |
||||
|
||||
// The protocol compiler can output a FileDescriptorSet containing the .proto |
||||
// files it parses. |
||||
message FileDescriptorSet { |
||||
repeated FileDescriptorProto file = 1; |
||||
} |
||||
|
||||
// Describes a complete .proto file. |
||||
message FileDescriptorProto { |
||||
optional string name = 1; // file name, relative to root of source tree |
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc. |
||||
|
||||
// Names of files imported by this file. |
||||
repeated string dependency = 3; |
||||
// Indexes of the public imported files in the dependency list above. |
||||
repeated int32 public_dependency = 10; |
||||
// Indexes of the weak imported files in the dependency list. |
||||
// For Google-internal migration only. Do not use. |
||||
repeated int32 weak_dependency = 11; |
||||
|
||||
// All top-level definitions in this file. |
||||
repeated DescriptorProto message_type = 4; |
||||
repeated EnumDescriptorProto enum_type = 5; |
||||
repeated ServiceDescriptorProto service = 6; |
||||
repeated FieldDescriptorProto extension = 7; |
||||
|
||||
optional FileOptions options = 8; |
||||
|
||||
// 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. |
||||
optional SourceCodeInfo source_code_info = 9; |
||||
} |
||||
|
||||
// Describes a message type. |
||||
message DescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
repeated FieldDescriptorProto field = 2; |
||||
repeated FieldDescriptorProto extension = 6; |
||||
|
||||
repeated DescriptorProto nested_type = 3; |
||||
repeated EnumDescriptorProto enum_type = 4; |
||||
|
||||
message ExtensionRange { |
||||
optional int32 start = 1; |
||||
optional int32 end = 2; |
||||
} |
||||
repeated ExtensionRange extension_range = 5; |
||||
|
||||
optional MessageOptions options = 7; |
||||
} |
||||
|
||||
// Describes a field within a message. |
||||
message FieldDescriptorProto { |
||||
enum Type { |
||||
// 0 is reserved for errors. |
||||
// Order is weird for historical reasons. |
||||
TYPE_DOUBLE = 1; |
||||
TYPE_FLOAT = 2; |
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if |
||||
// negative values are likely. |
||||
TYPE_INT64 = 3; |
||||
TYPE_UINT64 = 4; |
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if |
||||
// negative values are likely. |
||||
TYPE_INT32 = 5; |
||||
TYPE_FIXED64 = 6; |
||||
TYPE_FIXED32 = 7; |
||||
TYPE_BOOL = 8; |
||||
TYPE_STRING = 9; |
||||
TYPE_GROUP = 10; // Tag-delimited aggregate. |
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate. |
||||
|
||||
// New in version 2. |
||||
TYPE_BYTES = 12; |
||||
TYPE_UINT32 = 13; |
||||
TYPE_ENUM = 14; |
||||
TYPE_SFIXED32 = 15; |
||||
TYPE_SFIXED64 = 16; |
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding. |
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding. |
||||
}; |
||||
|
||||
enum Label { |
||||
// 0 is reserved for errors |
||||
LABEL_OPTIONAL = 1; |
||||
LABEL_REQUIRED = 2; |
||||
LABEL_REPEATED = 3; |
||||
// TODO(sanjay): Should we add LABEL_MAP? |
||||
}; |
||||
|
||||
optional string name = 1; |
||||
optional int32 number = 3; |
||||
optional Label label = 4; |
||||
|
||||
// If type_name is set, this need not be set. If both this and type_name |
||||
// are set, this must be either TYPE_ENUM or TYPE_MESSAGE. |
||||
optional Type type = 5; |
||||
|
||||
// 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). |
||||
optional string type_name = 6; |
||||
|
||||
// For extensions, this is the name of the type being extended. It is |
||||
// resolved in the same manner as type_name. |
||||
optional string extendee = 2; |
||||
|
||||
// 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? |
||||
optional string default_value = 7; |
||||
|
||||
optional FieldOptions options = 8; |
||||
} |
||||
|
||||
// Describes an enum type. |
||||
message EnumDescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
repeated EnumValueDescriptorProto value = 2; |
||||
|
||||
optional EnumOptions options = 3; |
||||
} |
||||
|
||||
// Describes a value within an enum. |
||||
message EnumValueDescriptorProto { |
||||
optional string name = 1; |
||||
optional int32 number = 2; |
||||
|
||||
optional EnumValueOptions options = 3; |
||||
} |
||||
|
||||
// Describes a service. |
||||
message ServiceDescriptorProto { |
||||
optional string name = 1; |
||||
repeated MethodDescriptorProto method = 2; |
||||
|
||||
optional ServiceOptions options = 3; |
||||
} |
||||
|
||||
// Describes a method of a service. |
||||
message MethodDescriptorProto { |
||||
optional string name = 1; |
||||
|
||||
// Input and output type names. These are resolved in the same way as |
||||
// FieldDescriptorProto.type_name, but must refer to a message type. |
||||
optional string input_type = 2; |
||||
optional string output_type = 3; |
||||
|
||||
optional MethodOptions options = 4; |
||||
} |
||||
|
||||
|
||||
// =================================================================== |
||||
// Options |
||||
|
||||
// Each of the definitions above may have "options" attached. These are |
||||
// just annotations which may cause code to be generated slightly differently |
||||
// or may contain hints for code that manipulates protocol messages. |
||||
// |
||||
// Clients may define custom options as extensions of the *Options messages. |
||||
// These extensions may not yet be known at parsing time, so the parser cannot |
||||
// store the values in them. Instead it stores them in a field in the *Options |
||||
// message called uninterpreted_option. This field must have the same name |
||||
// across all *Options messages. We then use this field to populate the |
||||
// extensions when we build a descriptor, at which point all protos have been |
||||
// parsed and so all extensions are known. |
||||
// |
||||
// Extension numbers for custom options may be chosen as follows: |
||||
// * For options which will only be used within a single application or |
||||
// organization, or for experimental options, use field numbers 50000 |
||||
// through 99999. It is up to you to ensure that you do not use the |
||||
// same number for multiple options. |
||||
// * For options which will be published and used publicly by multiple |
||||
// independent entities, e-mail protobuf-global-extension-registry@google.com |
||||
// to reserve extension numbers. Simply provide your project name (e.g. |
||||
// Object-C plugin) and your project website (if available) -- there's no need |
||||
// to explain how you intend to use them. Usually you only need one extension |
||||
// number. You can declare multiple options with only one extension number by |
||||
// putting them in a sub-message. See the Custom Options section of the docs |
||||
// for examples: |
||||
// http://code.google.com/apis/protocolbuffers/docs/proto.html#options |
||||
// If this turns out to be popular, a web service will be set up |
||||
// to automatically assign option numbers. |
||||
|
||||
|
||||
message FileOptions { |
||||
|
||||
// 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. |
||||
optional string java_package = 1; |
||||
|
||||
|
||||
// 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). |
||||
optional string java_outer_classname = 8; |
||||
|
||||
// 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. |
||||
optional bool java_multiple_files = 10 [default=false]; |
||||
|
||||
// If set true, then the Java code generator will generate equals() and |
||||
// hashCode() methods for all messages defined in the .proto file. This is |
||||
// purely a speed optimization, as the AbstractMessage base class includes |
||||
// reflection-based implementations of these methods. |
||||
optional bool java_generate_equals_and_hash = 20 [default=false]; |
||||
|
||||
// Generated classes can be optimized for speed or code size. |
||||
enum OptimizeMode { |
||||
SPEED = 1; // Generate complete code for parsing, serialization, |
||||
// etc. |
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods. |
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. |
||||
} |
||||
optional OptimizeMode optimize_for = 9 [default=SPEED]; |
||||
|
||||
// Sets the Go package where structs generated from this .proto will be |
||||
// placed. There is no default. |
||||
optional string go_package = 11; |
||||
|
||||
|
||||
|
||||
// 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 proto2. |
||||
// |
||||
// 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. |
||||
optional bool cc_generic_services = 16 [default=false]; |
||||
optional bool java_generic_services = 17 [default=false]; |
||||
optional bool py_generic_services = 18 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message MessageOptions { |
||||
// 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. |
||||
optional bool message_set_wire_format = 1 [default=false]; |
||||
|
||||
// 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". |
||||
optional bool no_standard_descriptor_accessor = 2 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message FieldOptions { |
||||
// 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! |
||||
optional CType ctype = 1 [default = STRING]; |
||||
enum CType { |
||||
// Default mode. |
||||
STRING = 0; |
||||
|
||||
CORD = 1; |
||||
|
||||
STRING_PIECE = 2; |
||||
} |
||||
// 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. |
||||
optional bool packed = 2; |
||||
|
||||
|
||||
|
||||
// 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. |
||||
optional bool lazy = 5 [default=false]; |
||||
|
||||
// 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. |
||||
optional bool deprecated = 3 [default=false]; |
||||
|
||||
// EXPERIMENTAL. DO NOT USE. |
||||
// For "map" fields, the name of the field in the enclosed type that |
||||
// is the key for this map. For example, suppose we have: |
||||
// message Item { |
||||
// required string name = 1; |
||||
// required string value = 2; |
||||
// } |
||||
// message Config { |
||||
// repeated Item items = 1 [experimental_map_key="name"]; |
||||
// } |
||||
// In this situation, the map key for Item will be set to "name". |
||||
// TODO: Fully-implement this, then remove the "experimental_" prefix. |
||||
optional string experimental_map_key = 9; |
||||
|
||||
// For Google-internal migration only. Do not use. |
||||
optional bool weak = 10 [default=false]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message EnumOptions { |
||||
|
||||
// Set this option to false to disallow mapping different tag names to a same |
||||
// value. |
||||
optional bool allow_alias = 2 [default=true]; |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message EnumValueOptions { |
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message ServiceOptions { |
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
||||
// framework. We apologize for hoarding these numbers to ourselves, but |
||||
// we were already using them long before we decided to release Protocol |
||||
// Buffers. |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
message MethodOptions { |
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
||||
// framework. We apologize for hoarding these numbers to ourselves, but |
||||
// we were already using them long before we decided to release Protocol |
||||
// Buffers. |
||||
|
||||
// The parser stores options it doesn't recognize here. See above. |
||||
repeated UninterpretedOption uninterpreted_option = 999; |
||||
|
||||
// Clients can define custom options in extensions of this message. See above. |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
|
||||
// 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. |
||||
message UninterpretedOption { |
||||
// 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". |
||||
message NamePart { |
||||
required string name_part = 1; |
||||
required bool is_extension = 2; |
||||
} |
||||
repeated NamePart name = 2; |
||||
|
||||
// The value of the uninterpreted option, in whatever type the tokenizer |
||||
// identified it as during parsing. Exactly one of these should be set. |
||||
optional string identifier_value = 3; |
||||
optional uint64 positive_int_value = 4; |
||||
optional int64 negative_int_value = 5; |
||||
optional double double_value = 6; |
||||
optional bytes string_value = 7; |
||||
optional string aggregate_value = 8; |
||||
} |
||||
|
||||
// =================================================================== |
||||
// Optional source code info |
||||
|
||||
// Encapsulates information about the original source file from which a |
||||
// FileDescriptorProto was generated. |
||||
message SourceCodeInfo { |
||||
// 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. |
||||
repeated Location location = 1; |
||||
message Location { |
||||
// 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). |
||||
repeated int32 path = 1 [packed=true]; |
||||
|
||||
// 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. |
||||
repeated int32 span = 2 [packed=true]; |
||||
|
||||
// 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. |
||||
// |
||||
// 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; |
||||
// |
||||
// optional string corge = 5; |
||||
// /* Block comment attached |
||||
// * to corge. Leading asterisks |
||||
// * will be removed. */ |
||||
// /* Block comment attached to |
||||
// * grault. */ |
||||
// optional int32 grault = 6; |
||||
optional string leading_comments = 3; |
||||
optional string trailing_comments = 4; |
||||
} |
||||
} |
@ -1,719 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// A proto file we will use for unit testing. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option cc_generic_services = true; // auto-added |
||||
option java_generic_services = true; // auto-added |
||||
option py_generic_services = true; // auto-added |
||||
|
||||
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 test_util.h we do "using namespace unittest = protobuf_unittest". |
||||
package protobuf_unittest; |
||||
|
||||
// Protos optimized for SPEED use a strict superset of the generated code |
||||
// of equivalent ones optimized for CODE_SIZE, so we should optimize all our |
||||
// tests for speed unless explicitly testing code size optimization. |
||||
option optimize_for = SPEED; |
||||
|
||||
option java_outer_classname = "UnittestProto"; |
||||
|
||||
// This proto includes every type of field in both singular and repeated |
||||
// forms. |
||||
message TestAllTypes { |
||||
message NestedMessage { |
||||
// 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. |
||||
optional int32 bb = 1; |
||||
} |
||||
|
||||
enum NestedEnum { |
||||
FOO = 1; |
||||
BAR = 2; |
||||
BAZ = 3; |
||||
} |
||||
|
||||
// Singular |
||||
optional int32 optional_int32 = 1; |
||||
optional int64 optional_int64 = 2; |
||||
optional uint32 optional_uint32 = 3; |
||||
optional uint64 optional_uint64 = 4; |
||||
optional sint32 optional_sint32 = 5; |
||||
optional sint64 optional_sint64 = 6; |
||||
optional fixed32 optional_fixed32 = 7; |
||||
optional fixed64 optional_fixed64 = 8; |
||||
optional sfixed32 optional_sfixed32 = 9; |
||||
optional sfixed64 optional_sfixed64 = 10; |
||||
optional float optional_float = 11; |
||||
optional double optional_double = 12; |
||||
optional bool optional_bool = 13; |
||||
optional string optional_string = 14; |
||||
optional bytes optional_bytes = 15; |
||||
|
||||
optional group OptionalGroup = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional NestedMessage optional_nested_message = 18; |
||||
optional ForeignMessage optional_foreign_message = 19; |
||||
optional protobuf_unittest_import.ImportMessage optional_import_message = 20; |
||||
|
||||
optional NestedEnum optional_nested_enum = 21; |
||||
optional ForeignEnum optional_foreign_enum = 22; |
||||
optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; |
||||
|
||||
optional string optional_string_piece = 24 [ctype=STRING_PIECE]; |
||||
optional string optional_cord = 25 [ctype=CORD]; |
||||
|
||||
// Defined in unittest_import_public.proto |
||||
optional protobuf_unittest_import.PublicImportMessage |
||||
optional_public_import_message = 26; |
||||
|
||||
optional NestedMessage optional_lazy_message = 27 [lazy=true]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32 = 31; |
||||
repeated int64 repeated_int64 = 32; |
||||
repeated uint32 repeated_uint32 = 33; |
||||
repeated uint64 repeated_uint64 = 34; |
||||
repeated sint32 repeated_sint32 = 35; |
||||
repeated sint64 repeated_sint64 = 36; |
||||
repeated fixed32 repeated_fixed32 = 37; |
||||
repeated fixed64 repeated_fixed64 = 38; |
||||
repeated sfixed32 repeated_sfixed32 = 39; |
||||
repeated sfixed64 repeated_sfixed64 = 40; |
||||
repeated float repeated_float = 41; |
||||
repeated double repeated_double = 42; |
||||
repeated bool repeated_bool = 43; |
||||
repeated string repeated_string = 44; |
||||
repeated bytes repeated_bytes = 45; |
||||
|
||||
repeated group RepeatedGroup = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated NestedMessage repeated_nested_message = 48; |
||||
repeated ForeignMessage repeated_foreign_message = 49; |
||||
repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; |
||||
|
||||
repeated NestedEnum repeated_nested_enum = 51; |
||||
repeated ForeignEnum repeated_foreign_enum = 52; |
||||
repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; |
||||
|
||||
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; |
||||
repeated string repeated_cord = 55 [ctype=CORD]; |
||||
|
||||
repeated NestedMessage repeated_lazy_message = 57 [lazy=true]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32 = 61 [default = 41 ]; |
||||
optional int64 default_int64 = 62 [default = 42 ]; |
||||
optional uint32 default_uint32 = 63 [default = 43 ]; |
||||
optional uint64 default_uint64 = 64 [default = 44 ]; |
||||
optional sint32 default_sint32 = 65 [default = -45 ]; |
||||
optional sint64 default_sint64 = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32 = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64 = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32 = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64 = 70 [default = -50 ]; |
||||
optional float default_float = 71 [default = 51.5 ]; |
||||
optional double default_double = 72 [default = 52e3 ]; |
||||
optional bool default_bool = 73 [default = true ]; |
||||
optional string default_string = 74 [default = "hello"]; |
||||
optional bytes default_bytes = 75 [default = "world"]; |
||||
|
||||
optional NestedEnum default_nested_enum = 81 [default = BAR ]; |
||||
optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; |
||||
optional protobuf_unittest_import.ImportEnum |
||||
default_import_enum = 83 [default = IMPORT_BAR]; |
||||
|
||||
optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
||||
optional string default_cord = 85 [ctype=CORD,default="123"]; |
||||
} |
||||
|
||||
message TestDeprecatedFields { |
||||
optional int32 deprecated_int32 = 1 [deprecated=true]; |
||||
} |
||||
|
||||
// Define these after TestAllTypes to make sure the compiler can handle |
||||
// that. |
||||
message ForeignMessage { |
||||
optional int32 c = 1; |
||||
} |
||||
|
||||
enum ForeignEnum { |
||||
FOREIGN_FOO = 4; |
||||
FOREIGN_BAR = 5; |
||||
FOREIGN_BAZ = 6; |
||||
} |
||||
|
||||
message TestAllExtensions { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestAllExtensions { |
||||
// Singular |
||||
optional int32 optional_int32_extension = 1; |
||||
optional int64 optional_int64_extension = 2; |
||||
optional uint32 optional_uint32_extension = 3; |
||||
optional uint64 optional_uint64_extension = 4; |
||||
optional sint32 optional_sint32_extension = 5; |
||||
optional sint64 optional_sint64_extension = 6; |
||||
optional fixed32 optional_fixed32_extension = 7; |
||||
optional fixed64 optional_fixed64_extension = 8; |
||||
optional sfixed32 optional_sfixed32_extension = 9; |
||||
optional sfixed64 optional_sfixed64_extension = 10; |
||||
optional float optional_float_extension = 11; |
||||
optional double optional_double_extension = 12; |
||||
optional bool optional_bool_extension = 13; |
||||
optional string optional_string_extension = 14; |
||||
optional bytes optional_bytes_extension = 15; |
||||
|
||||
optional group OptionalGroup_extension = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional TestAllTypes.NestedMessage optional_nested_message_extension = 18; |
||||
optional ForeignMessage optional_foreign_message_extension = 19; |
||||
optional protobuf_unittest_import.ImportMessage |
||||
optional_import_message_extension = 20; |
||||
|
||||
optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21; |
||||
optional ForeignEnum optional_foreign_enum_extension = 22; |
||||
optional protobuf_unittest_import.ImportEnum |
||||
optional_import_enum_extension = 23; |
||||
|
||||
optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE]; |
||||
optional string optional_cord_extension = 25 [ctype=CORD]; |
||||
|
||||
optional protobuf_unittest_import.PublicImportMessage |
||||
optional_public_import_message_extension = 26; |
||||
|
||||
optional TestAllTypes.NestedMessage |
||||
optional_lazy_message_extension = 27 [lazy=true]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32_extension = 31; |
||||
repeated int64 repeated_int64_extension = 32; |
||||
repeated uint32 repeated_uint32_extension = 33; |
||||
repeated uint64 repeated_uint64_extension = 34; |
||||
repeated sint32 repeated_sint32_extension = 35; |
||||
repeated sint64 repeated_sint64_extension = 36; |
||||
repeated fixed32 repeated_fixed32_extension = 37; |
||||
repeated fixed64 repeated_fixed64_extension = 38; |
||||
repeated sfixed32 repeated_sfixed32_extension = 39; |
||||
repeated sfixed64 repeated_sfixed64_extension = 40; |
||||
repeated float repeated_float_extension = 41; |
||||
repeated double repeated_double_extension = 42; |
||||
repeated bool repeated_bool_extension = 43; |
||||
repeated string repeated_string_extension = 44; |
||||
repeated bytes repeated_bytes_extension = 45; |
||||
|
||||
repeated group RepeatedGroup_extension = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; |
||||
repeated ForeignMessage repeated_foreign_message_extension = 49; |
||||
repeated protobuf_unittest_import.ImportMessage |
||||
repeated_import_message_extension = 50; |
||||
|
||||
repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; |
||||
repeated ForeignEnum repeated_foreign_enum_extension = 52; |
||||
repeated protobuf_unittest_import.ImportEnum |
||||
repeated_import_enum_extension = 53; |
||||
|
||||
repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE]; |
||||
repeated string repeated_cord_extension = 55 [ctype=CORD]; |
||||
|
||||
repeated TestAllTypes.NestedMessage |
||||
repeated_lazy_message_extension = 57 [lazy=true]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32_extension = 61 [default = 41 ]; |
||||
optional int64 default_int64_extension = 62 [default = 42 ]; |
||||
optional uint32 default_uint32_extension = 63 [default = 43 ]; |
||||
optional uint64 default_uint64_extension = 64 [default = 44 ]; |
||||
optional sint32 default_sint32_extension = 65 [default = -45 ]; |
||||
optional sint64 default_sint64_extension = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32_extension = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64_extension = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32_extension = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64_extension = 70 [default = -50 ]; |
||||
optional float default_float_extension = 71 [default = 51.5 ]; |
||||
optional double default_double_extension = 72 [default = 52e3 ]; |
||||
optional bool default_bool_extension = 73 [default = true ]; |
||||
optional string default_string_extension = 74 [default = "hello"]; |
||||
optional bytes default_bytes_extension = 75 [default = "world"]; |
||||
|
||||
optional TestAllTypes.NestedEnum |
||||
default_nested_enum_extension = 81 [default = BAR]; |
||||
optional ForeignEnum |
||||
default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; |
||||
optional protobuf_unittest_import.ImportEnum |
||||
default_import_enum_extension = 83 [default = IMPORT_BAR]; |
||||
|
||||
optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, |
||||
default="abc"]; |
||||
optional string default_cord_extension = 85 [ctype=CORD, default="123"]; |
||||
} |
||||
|
||||
message TestNestedExtension { |
||||
extend TestAllExtensions { |
||||
// Check for bug where string extensions declared in tested scope did not |
||||
// compile. |
||||
optional string test = 1002 [default="test"]; |
||||
} |
||||
} |
||||
|
||||
// We have separate messages for testing required fields because it's |
||||
// annoying to have to fill in required fields in TestProto in order to |
||||
// do anything with it. Note that we don't need to test every type of |
||||
// required filed because the code output is basically identical to |
||||
// optional fields for all types. |
||||
message TestRequired { |
||||
required int32 a = 1; |
||||
optional int32 dummy2 = 2; |
||||
required int32 b = 3; |
||||
|
||||
extend TestAllExtensions { |
||||
optional TestRequired single = 1000; |
||||
repeated TestRequired multi = 1001; |
||||
} |
||||
|
||||
// Pad the field count to 32 so that we can test that IsInitialized() |
||||
// properly checks multiple elements of has_bits_. |
||||
optional int32 dummy4 = 4; |
||||
optional int32 dummy5 = 5; |
||||
optional int32 dummy6 = 6; |
||||
optional int32 dummy7 = 7; |
||||
optional int32 dummy8 = 8; |
||||
optional int32 dummy9 = 9; |
||||
optional int32 dummy10 = 10; |
||||
optional int32 dummy11 = 11; |
||||
optional int32 dummy12 = 12; |
||||
optional int32 dummy13 = 13; |
||||
optional int32 dummy14 = 14; |
||||
optional int32 dummy15 = 15; |
||||
optional int32 dummy16 = 16; |
||||
optional int32 dummy17 = 17; |
||||
optional int32 dummy18 = 18; |
||||
optional int32 dummy19 = 19; |
||||
optional int32 dummy20 = 20; |
||||
optional int32 dummy21 = 21; |
||||
optional int32 dummy22 = 22; |
||||
optional int32 dummy23 = 23; |
||||
optional int32 dummy24 = 24; |
||||
optional int32 dummy25 = 25; |
||||
optional int32 dummy26 = 26; |
||||
optional int32 dummy27 = 27; |
||||
optional int32 dummy28 = 28; |
||||
optional int32 dummy29 = 29; |
||||
optional int32 dummy30 = 30; |
||||
optional int32 dummy31 = 31; |
||||
optional int32 dummy32 = 32; |
||||
|
||||
required int32 c = 33; |
||||
} |
||||
|
||||
message TestRequiredForeign { |
||||
optional TestRequired optional_message = 1; |
||||
repeated TestRequired repeated_message = 2; |
||||
optional int32 dummy = 3; |
||||
} |
||||
|
||||
// Test that we can use NestedMessage from outside TestAllTypes. |
||||
message TestForeignNested { |
||||
optional TestAllTypes.NestedMessage foreign_nested = 1; |
||||
} |
||||
|
||||
// TestEmptyMessage is used to test unknown field support. |
||||
message TestEmptyMessage { |
||||
} |
||||
|
||||
// Like above, but declare all field numbers as potential extensions. No |
||||
// actual extensions should ever be defined for this type. |
||||
message TestEmptyMessageWithExtensions { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
message TestMultipleExtensionRanges { |
||||
extensions 42; |
||||
extensions 4143 to 4243; |
||||
extensions 65536 to max; |
||||
} |
||||
|
||||
// Test that really large tag numbers don't break anything. |
||||
message TestReallyLargeTagNumber { |
||||
// The largest possible tag number is 2^28 - 1, since the wire format uses |
||||
// three bits to communicate wire type. |
||||
optional int32 a = 1; |
||||
optional int32 bb = 268435455; |
||||
} |
||||
|
||||
message TestRecursiveMessage { |
||||
optional TestRecursiveMessage a = 1; |
||||
optional int32 i = 2; |
||||
} |
||||
|
||||
// Test that mutual recursion works. |
||||
message TestMutualRecursionA { |
||||
optional TestMutualRecursionB bb = 1; |
||||
} |
||||
|
||||
message TestMutualRecursionB { |
||||
optional TestMutualRecursionA a = 1; |
||||
optional int32 optional_int32 = 2; |
||||
} |
||||
|
||||
// Test that groups have disjoint field numbers from their siblings and |
||||
// parents. This is NOT possible in proto1; only proto2. When attempting |
||||
// to compile with proto1, this will emit an error; so we only include it |
||||
// in protobuf_unittest_proto. |
||||
message TestDupFieldNumber { // NO_PROTO1 |
||||
optional int32 a = 1; // NO_PROTO1 |
||||
optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 |
||||
optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 |
||||
} // NO_PROTO1 |
||||
|
||||
// Additional messages for testing lazy fields. |
||||
message TestEagerMessage { |
||||
optional TestAllTypes sub_message = 1 [lazy=false]; |
||||
} |
||||
message TestLazyMessage { |
||||
optional TestAllTypes sub_message = 1 [lazy=true]; |
||||
} |
||||
|
||||
// Needed for a Python test. |
||||
message TestNestedMessageHasBits { |
||||
message NestedMessage { |
||||
repeated int32 nestedmessage_repeated_int32 = 1; |
||||
repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; |
||||
} |
||||
optional NestedMessage optional_nested_message = 1; |
||||
} |
||||
|
||||
|
||||
// Test an enum that has multiple values with the same number. |
||||
enum TestEnumWithDupValue { |
||||
option allow_alias = true; |
||||
FOO1 = 1; |
||||
BAR1 = 2; |
||||
BAZ = 3; |
||||
FOO2 = 1; |
||||
BAR2 = 2; |
||||
} |
||||
|
||||
// Test an enum with large, unordered values. |
||||
enum TestSparseEnum { |
||||
SPARSE_A = 123; |
||||
SPARSE_B = 62374; |
||||
SPARSE_C = 12589234; |
||||
SPARSE_D = -15; |
||||
SPARSE_E = -53452; |
||||
SPARSE_F = 0; |
||||
SPARSE_G = 2; |
||||
} |
||||
|
||||
// Test message with CamelCase field names. This violates Protocol Buffer |
||||
// standard style. |
||||
message TestCamelCaseFieldNames { |
||||
optional int32 PrimitiveField = 1; |
||||
optional string StringField = 2; |
||||
optional ForeignEnum EnumField = 3; |
||||
optional ForeignMessage MessageField = 4; |
||||
optional string StringPieceField = 5 [ctype=STRING_PIECE]; |
||||
optional string CordField = 6 [ctype=CORD]; |
||||
|
||||
repeated int32 RepeatedPrimitiveField = 7; |
||||
repeated string RepeatedStringField = 8; |
||||
repeated ForeignEnum RepeatedEnumField = 9; |
||||
repeated ForeignMessage RepeatedMessageField = 10; |
||||
repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE]; |
||||
repeated string RepeatedCordField = 12 [ctype=CORD]; |
||||
} |
||||
|
||||
|
||||
// We list fields out of order, to ensure that we're using field number and not |
||||
// field index to determine serialization order. |
||||
message TestFieldOrderings { |
||||
optional string my_string = 11; |
||||
extensions 2 to 10; |
||||
optional int64 my_int = 1; |
||||
extensions 12 to 100; |
||||
optional float my_float = 101; |
||||
} |
||||
|
||||
|
||||
extend TestFieldOrderings { |
||||
optional string my_extension_string = 50; |
||||
optional int32 my_extension_int = 5; |
||||
} |
||||
|
||||
|
||||
message TestExtremeDefaultValues { |
||||
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"]; |
||||
optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF]; |
||||
optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF]; |
||||
optional int32 small_int32 = 4 [default = -0x7FFFFFFF]; |
||||
optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF]; |
||||
optional int32 really_small_int32 = 21 [default = -0x80000000]; |
||||
optional int64 really_small_int64 = 22 [default = -0x8000000000000000]; |
||||
|
||||
// The default value here is UTF-8 for "\u1234". (We could also just type |
||||
// the UTF-8 text directly into this text file rather than escape it, but |
||||
// lots of people use editors that would be confused by this.) |
||||
optional string utf8_string = 6 [default = "\341\210\264"]; |
||||
|
||||
// Tests for single-precision floating-point values. |
||||
optional float zero_float = 7 [default = 0]; |
||||
optional float one_float = 8 [default = 1]; |
||||
optional float small_float = 9 [default = 1.5]; |
||||
optional float negative_one_float = 10 [default = -1]; |
||||
optional float negative_float = 11 [default = -1.5]; |
||||
// Using exponents |
||||
optional float large_float = 12 [default = 2E8]; |
||||
optional float small_negative_float = 13 [default = -8e-28]; |
||||
|
||||
// Text for nonfinite floating-point values. |
||||
optional double inf_double = 14 [default = inf]; |
||||
optional double neg_inf_double = 15 [default = -inf]; |
||||
optional double nan_double = 16 [default = nan]; |
||||
optional float inf_float = 17 [default = inf]; |
||||
optional float neg_inf_float = 18 [default = -inf]; |
||||
optional float nan_float = 19 [default = nan]; |
||||
|
||||
// Tests for C++ trigraphs. |
||||
// Trigraphs should be escaped in C++ generated files, but they should not be |
||||
// escaped for other languages. |
||||
// Note that in .proto file, "\?" is a valid way to escape ? in string |
||||
// literals. |
||||
optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; |
||||
|
||||
// String defaults containing the character '\000' |
||||
optional string string_with_zero = 23 [default = "hel\000lo"]; |
||||
optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; |
||||
optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, |
||||
default="ab\000c"]; |
||||
optional string cord_with_zero = 26 [ctype=CORD, |
||||
default="12\0003"]; |
||||
} |
||||
|
||||
message SparseEnumMessage { |
||||
optional TestSparseEnum sparse_enum = 1; |
||||
} |
||||
|
||||
// Test String and Bytes: string is for valid UTF-8 strings |
||||
message OneString { |
||||
optional string data = 1; |
||||
} |
||||
|
||||
message MoreString { |
||||
repeated string data = 1; |
||||
} |
||||
|
||||
message OneBytes { |
||||
optional bytes data = 1; |
||||
} |
||||
|
||||
message MoreBytes { |
||||
repeated bytes data = 1; |
||||
} |
||||
|
||||
|
||||
// Test messages for packed fields |
||||
|
||||
message TestPackedTypes { |
||||
repeated int32 packed_int32 = 90 [packed = true]; |
||||
repeated int64 packed_int64 = 91 [packed = true]; |
||||
repeated uint32 packed_uint32 = 92 [packed = true]; |
||||
repeated uint64 packed_uint64 = 93 [packed = true]; |
||||
repeated sint32 packed_sint32 = 94 [packed = true]; |
||||
repeated sint64 packed_sint64 = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32 = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64 = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32 = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64 = 99 [packed = true]; |
||||
repeated float packed_float = 100 [packed = true]; |
||||
repeated double packed_double = 101 [packed = true]; |
||||
repeated bool packed_bool = 102 [packed = true]; |
||||
repeated ForeignEnum packed_enum = 103 [packed = true]; |
||||
} |
||||
|
||||
// A message with the same fields as TestPackedTypes, but without packing. Used |
||||
// to test packed <-> unpacked wire compatibility. |
||||
message TestUnpackedTypes { |
||||
repeated int32 unpacked_int32 = 90 [packed = false]; |
||||
repeated int64 unpacked_int64 = 91 [packed = false]; |
||||
repeated uint32 unpacked_uint32 = 92 [packed = false]; |
||||
repeated uint64 unpacked_uint64 = 93 [packed = false]; |
||||
repeated sint32 unpacked_sint32 = 94 [packed = false]; |
||||
repeated sint64 unpacked_sint64 = 95 [packed = false]; |
||||
repeated fixed32 unpacked_fixed32 = 96 [packed = false]; |
||||
repeated fixed64 unpacked_fixed64 = 97 [packed = false]; |
||||
repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; |
||||
repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; |
||||
repeated float unpacked_float = 100 [packed = false]; |
||||
repeated double unpacked_double = 101 [packed = false]; |
||||
repeated bool unpacked_bool = 102 [packed = false]; |
||||
repeated ForeignEnum unpacked_enum = 103 [packed = false]; |
||||
} |
||||
|
||||
message TestPackedExtensions { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestPackedExtensions { |
||||
repeated int32 packed_int32_extension = 90 [packed = true]; |
||||
repeated int64 packed_int64_extension = 91 [packed = true]; |
||||
repeated uint32 packed_uint32_extension = 92 [packed = true]; |
||||
repeated uint64 packed_uint64_extension = 93 [packed = true]; |
||||
repeated sint32 packed_sint32_extension = 94 [packed = true]; |
||||
repeated sint64 packed_sint64_extension = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32_extension = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64_extension = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; |
||||
repeated float packed_float_extension = 100 [packed = true]; |
||||
repeated double packed_double_extension = 101 [packed = true]; |
||||
repeated bool packed_bool_extension = 102 [packed = true]; |
||||
repeated ForeignEnum packed_enum_extension = 103 [packed = true]; |
||||
} |
||||
|
||||
// Used by ExtensionSetTest/DynamicExtensions. The test actually builds |
||||
// a set of extensions to TestAllExtensions dynamically, based on the fields |
||||
// of this message type. |
||||
message TestDynamicExtensions { |
||||
enum DynamicEnumType { |
||||
DYNAMIC_FOO = 2200; |
||||
DYNAMIC_BAR = 2201; |
||||
DYNAMIC_BAZ = 2202; |
||||
} |
||||
message DynamicMessageType { |
||||
optional int32 dynamic_field = 2100; |
||||
} |
||||
|
||||
optional fixed32 scalar_extension = 2000; |
||||
optional ForeignEnum enum_extension = 2001; |
||||
optional DynamicEnumType dynamic_enum_extension = 2002; |
||||
|
||||
optional ForeignMessage message_extension = 2003; |
||||
optional DynamicMessageType dynamic_message_extension = 2004; |
||||
|
||||
repeated string repeated_extension = 2005; |
||||
repeated sint32 packed_extension = 2006 [packed = true]; |
||||
} |
||||
|
||||
message TestRepeatedScalarDifferentTagSizes { |
||||
// 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. |
||||
repeated fixed32 repeated_fixed32 = 12; |
||||
// Check for a varint type, just for good measure. |
||||
repeated int32 repeated_int32 = 13; |
||||
|
||||
// These have two-byte tags. |
||||
repeated fixed64 repeated_fixed64 = 2046; |
||||
repeated int64 repeated_int64 = 2047; |
||||
|
||||
// Three byte tags. |
||||
repeated float repeated_float = 262142; |
||||
repeated uint64 repeated_uint64 = 262143; |
||||
} |
||||
|
||||
// Test that if an optional or required message/group field appears multiple |
||||
// times in the input, they need to be merged. |
||||
message TestParsingMerge { |
||||
// RepeatedFieldsGenerator defines matching field types as TestParsingMerge, |
||||
// except that all fields are repeated. In the tests, we will serialize the |
||||
// RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge. |
||||
// Repeated fields in RepeatedFieldsGenerator are expected to be merged into |
||||
// the corresponding required/optional fields in TestParsingMerge. |
||||
message RepeatedFieldsGenerator { |
||||
repeated TestAllTypes field1 = 1; |
||||
repeated TestAllTypes field2 = 2; |
||||
repeated TestAllTypes field3 = 3; |
||||
repeated group Group1 = 10 { |
||||
optional TestAllTypes field1 = 11; |
||||
} |
||||
repeated group Group2 = 20 { |
||||
optional TestAllTypes field1 = 21; |
||||
} |
||||
repeated TestAllTypes ext1 = 1000; |
||||
repeated TestAllTypes ext2 = 1001; |
||||
} |
||||
required TestAllTypes required_all_types = 1; |
||||
optional TestAllTypes optional_all_types = 2; |
||||
repeated TestAllTypes repeated_all_types = 3; |
||||
optional group OptionalGroup = 10 { |
||||
optional TestAllTypes optional_group_all_types = 11; |
||||
} |
||||
repeated group RepeatedGroup = 20 { |
||||
optional TestAllTypes repeated_group_all_types = 21; |
||||
} |
||||
extensions 1000 to max; |
||||
extend TestParsingMerge { |
||||
optional TestAllTypes optional_ext = 1000; |
||||
repeated TestAllTypes repeated_ext = 1001; |
||||
} |
||||
} |
||||
|
||||
message TestCommentInjectionMessage { |
||||
// */ <- This should not close the generated doc comment |
||||
optional string a = 1 [default="*/ <- Neither should this."]; |
||||
} |
||||
|
||||
|
||||
// Test that RPC services work. |
||||
message FooRequest {} |
||||
message FooResponse {} |
||||
|
||||
message FooClientMessage {} |
||||
message FooServerMessage{} |
||||
|
||||
service TestService { |
||||
rpc Foo(FooRequest) returns (FooResponse); |
||||
rpc Bar(BarRequest) returns (BarResponse); |
||||
} |
||||
|
||||
|
||||
message BarRequest {} |
||||
message BarResponse {} |
@ -1,387 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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: benjy@google.com (Benjy Weinberger) |
||||
// Based on original Protocol Buffers design by |
||||
// Sanjay Ghemawat, Jeff Dean, and others. |
||||
// |
||||
// A proto file used to test the "custom options" feature of proto2. |
||||
|
||||
|
||||
// Some generic_services option(s) added automatically. |
||||
// See: http://go/proto2-generic-services-default |
||||
option cc_generic_services = true; // auto-added |
||||
option java_generic_services = true; // auto-added |
||||
option py_generic_services = true; |
||||
|
||||
// A custom file option (defined below). |
||||
option (file_opt1) = 9876543210; |
||||
|
||||
import "google/protobuf/descriptor.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. |
||||
package protobuf_unittest; |
||||
|
||||
|
||||
// Some simple test custom options of various types. |
||||
|
||||
extend google.protobuf.FileOptions { |
||||
optional uint64 file_opt1 = 7736974; |
||||
} |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional int32 message_opt1 = 7739036; |
||||
} |
||||
|
||||
extend google.protobuf.FieldOptions { |
||||
optional fixed64 field_opt1 = 7740936; |
||||
// This is useful for testing that we correctly register default values for |
||||
// extension options. |
||||
optional int32 field_opt2 = 7753913 [default=42]; |
||||
} |
||||
|
||||
extend google.protobuf.EnumOptions { |
||||
optional sfixed32 enum_opt1 = 7753576; |
||||
} |
||||
|
||||
extend google.protobuf.EnumValueOptions { |
||||
optional int32 enum_value_opt1 = 1560678; |
||||
} |
||||
|
||||
extend google.protobuf.ServiceOptions { |
||||
optional sint64 service_opt1 = 7887650; |
||||
} |
||||
|
||||
enum MethodOpt1 { |
||||
METHODOPT1_VAL1 = 1; |
||||
METHODOPT1_VAL2 = 2; |
||||
} |
||||
|
||||
extend google.protobuf.MethodOptions { |
||||
optional MethodOpt1 method_opt1 = 7890860; |
||||
} |
||||
|
||||
// A test message with custom options at all possible locations (and also some |
||||
// regular options, to make sure they interact nicely). |
||||
message TestMessageWithCustomOptions { |
||||
option message_set_wire_format = false; |
||||
|
||||
option (message_opt1) = -56; |
||||
|
||||
optional string field1 = 1 [ctype=CORD, |
||||
(field_opt1)=8765432109]; |
||||
|
||||
enum AnEnum { |
||||
option (enum_opt1) = -789; |
||||
|
||||
ANENUM_VAL1 = 1; |
||||
ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; |
||||
} |
||||
} |
||||
|
||||
|
||||
// A test RPC service with custom options at all possible locations (and also |
||||
// some regular options, to make sure they interact nicely). |
||||
message CustomOptionFooRequest { |
||||
} |
||||
|
||||
message CustomOptionFooResponse { |
||||
} |
||||
|
||||
message CustomOptionFooClientMessage { |
||||
} |
||||
|
||||
message CustomOptionFooServerMessage { |
||||
} |
||||
|
||||
service TestServiceWithCustomOptions { |
||||
option (service_opt1) = -9876543210; |
||||
|
||||
rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { |
||||
option (method_opt1) = METHODOPT1_VAL2; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
// Options of every possible field type, so we can test them all exhaustively. |
||||
|
||||
message DummyMessageContainingEnum { |
||||
enum TestEnumType { |
||||
TEST_OPTION_ENUM_TYPE1 = 22; |
||||
TEST_OPTION_ENUM_TYPE2 = -23; |
||||
} |
||||
} |
||||
|
||||
message DummyMessageInvalidAsOptionType { |
||||
} |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional bool bool_opt = 7706090; |
||||
optional int32 int32_opt = 7705709; |
||||
optional int64 int64_opt = 7705542; |
||||
optional uint32 uint32_opt = 7704880; |
||||
optional uint64 uint64_opt = 7702367; |
||||
optional sint32 sint32_opt = 7701568; |
||||
optional sint64 sint64_opt = 7700863; |
||||
optional fixed32 fixed32_opt = 7700307; |
||||
optional fixed64 fixed64_opt = 7700194; |
||||
optional sfixed32 sfixed32_opt = 7698645; |
||||
optional sfixed64 sfixed64_opt = 7685475; |
||||
optional float float_opt = 7675390; |
||||
optional double double_opt = 7673293; |
||||
optional string string_opt = 7673285; |
||||
optional bytes bytes_opt = 7673238; |
||||
optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233; |
||||
optional DummyMessageInvalidAsOptionType message_type_opt = 7665967; |
||||
} |
||||
|
||||
message CustomOptionMinIntegerValues { |
||||
option (bool_opt) = false; |
||||
option (int32_opt) = -0x80000000; |
||||
option (int64_opt) = -0x8000000000000000; |
||||
option (uint32_opt) = 0; |
||||
option (uint64_opt) = 0; |
||||
option (sint32_opt) = -0x80000000; |
||||
option (sint64_opt) = -0x8000000000000000; |
||||
option (fixed32_opt) = 0; |
||||
option (fixed64_opt) = 0; |
||||
option (sfixed32_opt) = -0x80000000; |
||||
option (sfixed64_opt) = -0x8000000000000000; |
||||
} |
||||
|
||||
message CustomOptionMaxIntegerValues { |
||||
option (bool_opt) = true; |
||||
option (int32_opt) = 0x7FFFFFFF; |
||||
option (int64_opt) = 0x7FFFFFFFFFFFFFFF; |
||||
option (uint32_opt) = 0xFFFFFFFF; |
||||
option (uint64_opt) = 0xFFFFFFFFFFFFFFFF; |
||||
option (sint32_opt) = 0x7FFFFFFF; |
||||
option (sint64_opt) = 0x7FFFFFFFFFFFFFFF; |
||||
option (fixed32_opt) = 0xFFFFFFFF; |
||||
option (fixed64_opt) = 0xFFFFFFFFFFFFFFFF; |
||||
option (sfixed32_opt) = 0x7FFFFFFF; |
||||
option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF; |
||||
} |
||||
|
||||
message CustomOptionOtherValues { |
||||
option (int32_opt) = -100; // To test sign-extension. |
||||
option (float_opt) = 12.3456789; |
||||
option (double_opt) = 1.234567890123456789; |
||||
option (string_opt) = "Hello, \"World\""; |
||||
option (bytes_opt) = "Hello\0World"; |
||||
option (enum_opt) = TEST_OPTION_ENUM_TYPE2; |
||||
} |
||||
|
||||
message SettingRealsFromPositiveInts { |
||||
option (float_opt) = 12; |
||||
option (double_opt) = 154; |
||||
} |
||||
|
||||
message SettingRealsFromNegativeInts { |
||||
option (float_opt) = -12; |
||||
option (double_opt) = -154; |
||||
} |
||||
|
||||
// Options of complex message types, themselves combined and extended in |
||||
// various ways. |
||||
|
||||
message ComplexOptionType1 { |
||||
optional int32 foo = 1; |
||||
optional int32 foo2 = 2; |
||||
optional int32 foo3 = 3; |
||||
|
||||
extensions 100 to max; |
||||
} |
||||
|
||||
message ComplexOptionType2 { |
||||
optional ComplexOptionType1 bar = 1; |
||||
optional int32 baz = 2; |
||||
|
||||
message ComplexOptionType4 { |
||||
optional int32 waldo = 1; |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional ComplexOptionType4 complex_opt4 = 7633546; |
||||
} |
||||
} |
||||
|
||||
optional ComplexOptionType4 fred = 3; |
||||
|
||||
extensions 100 to max; |
||||
} |
||||
|
||||
message ComplexOptionType3 { |
||||
optional int32 qux = 1; |
||||
|
||||
optional group ComplexOptionType5 = 2 { |
||||
optional int32 plugh = 3; |
||||
} |
||||
} |
||||
|
||||
extend ComplexOptionType1 { |
||||
optional int32 quux = 7663707; |
||||
optional ComplexOptionType3 corge = 7663442; |
||||
} |
||||
|
||||
extend ComplexOptionType2 { |
||||
optional int32 grault = 7650927; |
||||
optional ComplexOptionType1 garply = 7649992; |
||||
} |
||||
|
||||
extend google.protobuf.MessageOptions { |
||||
optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756; |
||||
optional ComplexOptionType2 complex_opt2 = 7636949; |
||||
optional ComplexOptionType3 complex_opt3 = 7636463; |
||||
optional group ComplexOpt6 = 7595468 { |
||||
optional int32 xyzzy = 7593951; |
||||
} |
||||
} |
||||
|
||||
// Note that we try various different ways of naming the same extension. |
||||
message VariousComplexOptions { |
||||
option (.protobuf_unittest.complex_opt1).foo = 42; |
||||
option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324; |
||||
option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876; |
||||
option (complex_opt2).baz = 987; |
||||
option (complex_opt2).(grault) = 654; |
||||
option (complex_opt2).bar.foo = 743; |
||||
option (complex_opt2).bar.(quux) = 1999; |
||||
option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008; |
||||
option (complex_opt2).(garply).foo = 741; |
||||
option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998; |
||||
option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121; |
||||
option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; |
||||
option (complex_opt2).fred.waldo = 321; |
||||
option (protobuf_unittest.complex_opt3).qux = 9; |
||||
option (complex_opt3).complexoptiontype5.plugh = 22; |
||||
option (complexopt6).xyzzy = 24; |
||||
} |
||||
|
||||
// ------------------------------------------------------ |
||||
// Definitions for testing aggregate option parsing. |
||||
// See descriptor_unittest.cc. |
||||
|
||||
message AggregateMessageSet { |
||||
option message_set_wire_format = true; |
||||
extensions 4 to max; |
||||
} |
||||
|
||||
message AggregateMessageSetElement { |
||||
extend AggregateMessageSet { |
||||
optional AggregateMessageSetElement message_set_extension = 15447542; |
||||
} |
||||
optional string s = 1; |
||||
} |
||||
|
||||
// A helper type used to test aggregate option parsing |
||||
message Aggregate { |
||||
optional int32 i = 1; |
||||
optional string s = 2; |
||||
|
||||
// A nested object |
||||
optional Aggregate sub = 3; |
||||
|
||||
// To test the parsing of extensions inside aggregate values |
||||
optional google.protobuf.FileOptions file = 4; |
||||
extend google.protobuf.FileOptions { |
||||
optional Aggregate nested = 15476903; |
||||
} |
||||
|
||||
// An embedded message set |
||||
optional AggregateMessageSet mset = 5; |
||||
} |
||||
|
||||
// Allow Aggregate to be used as an option at all possible locations |
||||
// in the .proto grammar. |
||||
extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; } |
||||
extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; } |
||||
extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; } |
||||
extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; } |
||||
extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; } |
||||
extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; } |
||||
extend google.protobuf.MethodOptions { optional Aggregate methodopt = 15512713; } |
||||
|
||||
// Try using AggregateOption at different points in the proto grammar |
||||
option (fileopt) = { |
||||
s: 'FileAnnotation' |
||||
// Also test the handling of comments |
||||
/* of both types */ i: 100 |
||||
|
||||
sub { s: 'NestedFileAnnotation' } |
||||
|
||||
// Include a google.protobuf.FileOptions and recursively extend it with |
||||
// another fileopt. |
||||
file { |
||||
[protobuf_unittest.fileopt] { |
||||
s:'FileExtensionAnnotation' |
||||
} |
||||
} |
||||
|
||||
// A message set inside an option value |
||||
mset { |
||||
[protobuf_unittest.AggregateMessageSetElement.message_set_extension] { |
||||
s: 'EmbeddedMessageSetElement' |
||||
} |
||||
} |
||||
}; |
||||
|
||||
message AggregateMessage { |
||||
option (msgopt) = { i:101 s:'MessageAnnotation' }; |
||||
optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }]; |
||||
} |
||||
|
||||
service AggregateService { |
||||
option (serviceopt) = { s:'ServiceAnnotation' }; |
||||
rpc Method (AggregateMessage) returns (AggregateMessage) { |
||||
option (methodopt) = { s:'MethodAnnotation' }; |
||||
} |
||||
} |
||||
|
||||
enum AggregateEnum { |
||||
option (enumopt) = { s:'EnumAnnotation' }; |
||||
VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }]; |
||||
} |
||||
|
||||
// Test custom options for nested type. |
||||
message NestedOptionType { |
||||
message NestedMessage { |
||||
option (message_opt1) = 1001; |
||||
optional int32 nested_field = 1 [(field_opt1) = 1002]; |
||||
} |
||||
enum NestedEnum { |
||||
option (enum_opt1) = 1003; |
||||
NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004]; |
||||
} |
||||
extend google.protobuf.FileOptions { |
||||
optional int32 nested_extension = 7912573 [(field_opt2) = 1005]; |
||||
} |
||||
} |
@ -1,50 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// A proto file which imports a proto file that uses optimize_for = CODE_SIZE. |
||||
|
||||
import "google/protobuf/unittest_optimize_for.proto"; |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
// We optimize for speed here, but we are importing a proto that is optimized |
||||
// for code size. |
||||
option optimize_for = SPEED; |
||||
|
||||
message TestEmbedOptimizedForSize { |
||||
// Test that embedding a message which has optimize_for = CODE_SIZE into |
||||
// one optimized for speed works. |
||||
optional TestOptimizedForSize optional_message = 1; |
||||
repeated TestOptimizedForSize repeated_message = 2; |
||||
} |
@ -1,37 +0,0 @@ |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// 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. |
||||
// |
||||
// This file intentionally left blank. (At one point this wouldn't compile |
||||
// correctly.) |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue