parent
f0589506c9
commit
6803686bc0
154 changed files with 48277 additions and 22 deletions
@ -1,25 +1,14 @@ |
||||
# Untracked files |
||||
|
||||
csharp/ProtocolBuffers/bin/ |
||||
csharp/ProtocolBuffers/obj/ |
||||
csharp/ProtocolBuffers.Test/bin/ |
||||
csharp/ProtocolBuffers.Test/obj/ |
||||
csharp/ProtoGen/bin/ |
||||
csharp/ProtoGen/obj/ |
||||
csharp/ProtoGen.Test/bin/ |
||||
csharp/ProtoGen.Test/obj/ |
||||
csharp/TestBed |
||||
java/.classpath |
||||
java/.project |
||||
java/.settings/ |
||||
java/bin/ |
||||
java/lib/ |
||||
java/src/.classpath |
||||
java/src/.project |
||||
java/src/bin/ |
||||
java/target/ |
||||
src/tmp/ |
||||
src/ProtocolBuffers/bin/ |
||||
src/ProtocolBuffers/obj/ |
||||
src/ProtocolBuffers.Test/bin/ |
||||
src/ProtocolBuffers.Test/obj/ |
||||
src/ProtoGen/bin/ |
||||
src/ProtoGen/obj/ |
||||
src/ProtoGen.Test/bin/ |
||||
src/ProtoGen.Test/obj/ |
||||
tmp/ |
||||
vsprojects/* |
||||
vsprojects/protobuf.sln |
||||
benchmark.txt |
||||
*.user |
||||
*.suo |
||||
_ReSharper.* |
@ -0,0 +1,126 @@ |
||||
<?xml version="1.0"?> |
||||
<project name="Protocol Buffers" default="build" basedir="."> |
||||
<description>Port of Google's Protocol Buffers to C#/.NET</description> |
||||
|
||||
<!-- NAntContrib configuration. TODO(jonskeet): Improve this? --> |
||||
<property name="nantcontrib-dir" |
||||
value="${path::combine(nant::get-base-directory(), '../../NAntContrib')}" |
||||
overwrite="false" /> |
||||
|
||||
<loadtasks assembly="${path::combine(nantcontrib-dir, 'bin/NAnt.Contrib.Tasks.dll')}" /> |
||||
|
||||
<property name="build-configuration" |
||||
value="Debug" |
||||
overwrite="false" /> |
||||
|
||||
<property name="src" |
||||
value="${project::get-base-directory()}/src" /> |
||||
|
||||
<property name="tools-protoc" |
||||
value="${project::get-base-directory()}/lib/protoc.exe" |
||||
overwrite="false" /> |
||||
|
||||
<!-- Base directory to find protos (core, C# options, tests) --> |
||||
<property name="protos-dir" |
||||
value="${path::combine(project::get-base-directory(), 'protos')}" |
||||
overwrite="false" /> |
||||
|
||||
<!-- Scratch directory used when generating code --> |
||||
<property name="tmp-dir" |
||||
value="${path::combine(project::get-base-directory(), 'tmp')}" |
||||
overwrite="false" /> |
||||
|
||||
<!-- Which version of protogen to use when regenerating source --> |
||||
<property name="tools-protogen-config" |
||||
value="Debug" |
||||
overwrite="false" /> |
||||
|
||||
<property name="tools-protogen" |
||||
value="${src}/ProtoGen/bin/${tools-protogen-config}/protogen.exe" |
||||
overwrite="false"/> |
||||
|
||||
<target name="clean" |
||||
description="Removes built binaries (of all configurations) and the source generation directory"> |
||||
<delete> |
||||
<fileset> |
||||
<include name="${src}/ProtoGen/bin/**" /> |
||||
<include name="${src}/ProtoGen/obj/**" /> |
||||
<include name="${src}/ProtoGen.Test/bin/**" /> |
||||
<include name="${src}/ProtoGen.Test/obj/**" /> |
||||
<include name="${src}/ProtocolBuffers/bin/**" /> |
||||
<include name="${src}/ProtocolBuffers/obj/**" /> |
||||
<include name="${src}/ProtocolBuffers.Test/bin/**" /> |
||||
<include name="${src}/ProtocolBuffers.Test/obj/**" /> |
||||
<include name="${tmp-dir}" /> |
||||
</fileset> |
||||
</delete> |
||||
</target> |
||||
|
||||
<target name="generate-source" |
||||
description="Generate source (unit tests, core messages etc). Does not copy source."> |
||||
<fail message="protoc and protogen must both exist" |
||||
unless="${file::exists(tools-protoc) and file::exists(tools-protogen)}" /> |
||||
<delete dir="${tmp-dir}" /> |
||||
<mkdir dir="${tmp-dir}" /> |
||||
<exec program="${tools-protoc}" |
||||
workingdir="${tmp-dir}"> |
||||
<arg value="--proto_path=${protos-dir}" /> |
||||
<arg value="--descriptor_set_out=compiled.pb" /> |
||||
<arg file="${protos-dir}/google/protobuf/descriptor.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/csharp_options.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/unittest.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/unittest_custom_options.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/unittest_embed_optimize_for.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/unittest_import.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/unittest_mset.proto" /> |
||||
<arg file="${protos-dir}/google/protobuf/unittest_optimize_for.proto" /> |
||||
</exec> |
||||
|
||||
<exec program="${tools-protogen}" |
||||
workingdir="${tmp-dir}"> |
||||
<arg value="compiled.pb" /> |
||||
</exec> |
||||
</target> |
||||
|
||||
<target name="copy-generated-source" |
||||
description="Copies generated source from temporary directory to source tree. Use with care!"> |
||||
<copy todir="${src}/ProtocolBuffers/DescriptorProtos"> |
||||
<fileset basedir="${tmp-dir}"> |
||||
<include name="DescriptorProtoFile.cs" /> |
||||
<include name="CSharpOptions.cs" /> |
||||
</fileset> |
||||
</copy> |
||||
|
||||
<copy todir="${src}/ProtocolBuffers.Test/TestProtos"> |
||||
<fileset basedir="${tmp-dir}"> |
||||
<include name="UnitTestProtoFile.cs" /> |
||||
<include name="UnitTestCustomOptionsProtoFile.cs" /> |
||||
<include name="UnitTestEmbedOptimizeForProtoFile.cs" /> |
||||
<include name="UnitTestImportProtoFile.cs" /> |
||||
<include name="UnitTestMessageSetProtoFile.cs" /> |
||||
<include name="UnitTestOptimizeForProtoFile.cs" /> |
||||
</fileset> |
||||
</copy> |
||||
</target> |
||||
|
||||
<target name="build" description="Builds all C# code"> |
||||
<msbuild project="${src}/ProtocolBuffers.sln"> |
||||
<property name="Configuration" |
||||
value="${build-configuration}" /> |
||||
</msbuild> |
||||
</target> |
||||
|
||||
<target name="test" description="Runs all unit tests"> |
||||
<nunit2> |
||||
<formatter type="Plain" /> |
||||
<test assemblyname="${src}/ProtocolBuffers.Test/bin/${build-configuration}/Google.ProtocolBuffers.Test.dll" /> |
||||
<test assemblyname="${src}/Protogen.Test/bin/${build-configuration}/Google.ProtocolBuffers.ProtoGen.Test.dll" /> |
||||
</nunit2> |
||||
</target> |
||||
|
||||
<target name="perf-test" description="Runs all performance tests"> |
||||
<fail message="Performance tests not implemented yet" /> |
||||
</target> |
||||
|
||||
|
||||
</project> |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@ |
||||
Copyright © 2002-2007 Charlie Poole |
||||
Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov |
||||
Copyright © 2000-2002 Philip A. Craig |
||||
|
||||
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. |
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: |
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. |
||||
|
||||
Portions Copyright © 2002-2007 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig |
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
||||
|
||||
3. This notice may not be removed or altered from any source distribution. |
Binary file not shown.
@ -0,0 +1,36 @@ |
||||
protoc.exe was built from the original source at http://code.google.com/p/protobuf/ |
||||
The licence for this code is as follows: |
||||
|
||||
Copyright 2008, Google Inc. |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
* Redistributions of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above |
||||
copyright notice, this list of conditions and the following disclaimer |
||||
in the documentation and/or other materials provided with the |
||||
distribution. |
||||
* Neither the name of 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. |
||||
|
||||
Code generated by the Protocol Buffer compiler is owned by the owner |
||||
of the input file used when generating it. This code is not |
||||
standalone and requires a support library to be linked with it. This |
||||
support library is itself covered by the above license. |
Binary file not shown.
@ -0,0 +1,25 @@ |
||||
Copyright (c) 2005 - 2008 Ayende Rahien (ayende@ayende.com) |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, |
||||
are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, |
||||
this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright notice, |
||||
this list of conditions and the following disclaimer in the documentation |
||||
and/or other materials provided with the distribution. |
||||
* Neither the name of Ayende Rahien 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. |
@ -0,0 +1,16 @@ |
||||
// Extra options for C# generator |
||||
|
||||
import "google/protobuf/descriptor.proto"; |
||||
|
||||
package google.protobuf; |
||||
|
||||
option (CSharpNamespace) = "Google.ProtocolBuffers.DescriptorProtos"; |
||||
option (CSharpUmbrellaClassname) = "CSharpOptions"; |
||||
|
||||
extend FileOptions { |
||||
optional string CSharpNamespace = 20000; |
||||
optional string CSharpUmbrellaClassname = 20001; |
||||
optional bool CSharpMultipleFiles = 20002; |
||||
optional bool CSharpNestClasses = 20003; |
||||
optional bool CSharpPublicClasses = 20004; |
||||
} |
@ -0,0 +1,392 @@ |
||||
// 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; |
||||
|
||||
// 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; |
||||
} |
||||
|
||||
// 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; |
||||
TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers |
||||
// take 10 bytes. Use TYPE_SINT64 if negative |
||||
// values are likely. |
||||
TYPE_UINT64 = 4; |
||||
TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers |
||||
// take 10 bytes. Use TYPE_SINT32 if negative |
||||
// values are likely. |
||||
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 kenton@google.com to reserve extension |
||||
// numbers. Simply tell me how many you need and I'll send you back a |
||||
// set of numbers to use -- there's no need to explain how you intend to |
||||
// use them. 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]; |
||||
|
||||
// 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. |
||||
} |
||||
optional OptimizeMode optimize_for = 9 [default=CODE_SIZE]; |
||||
|
||||
// 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]; |
||||
|
||||
// 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; |
||||
enum CType { |
||||
CORD = 1; |
||||
|
||||
STRING_PIECE = 2; |
||||
} |
||||
|
||||
// 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; |
||||
|
||||
// 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 { |
||||
// 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; |
||||
} |
@ -0,0 +1,473 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
import "google/protobuf/descriptor.proto"; |
||||
option (google.protobuf.CSharpNamespace) = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.CSharpUmbrellaClassname) = "UnitTestProtoFile"; |
||||
|
||||
// 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. |
||||
|
||||
|
||||
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]; |
||||
|
||||
// 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]; |
||||
|
||||
// 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"]; |
||||
} |
||||
|
||||
// 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]; |
||||
|
||||
// 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]; |
||||
|
||||
// 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"]; |
||||
} |
||||
|
||||
// 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; |
||||
} |
||||
|
||||
// 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 outputting |
||||
// proto1, the dup fields should be dropped. |
||||
message TestDupFieldNumber { |
||||
optional int32 a = 1; |
||||
optional group Foo = 2 { optional int32 a = 1; } |
||||
optional group Bar = 3 { optional int32 a = 1; } |
||||
} |
||||
|
||||
|
||||
// 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 { |
||||
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]; |
||||
|
||||
// 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"]; |
||||
} |
||||
|
||||
// Test that RPC services work. |
||||
message FooRequest {} |
||||
message FooResponse {} |
||||
|
||||
service TestService { |
||||
rpc Foo(FooRequest) returns (FooResponse); |
||||
rpc Bar(BarRequest) returns (BarResponse); |
||||
} |
||||
|
||||
|
||||
message BarRequest {} |
||||
message BarResponse {} |
@ -0,0 +1,277 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.CSharpNamespace) = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.CSharpUmbrellaClassname) = "UnitTestCustomOptionsProtoFile"; |
||||
|
||||
// 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. |
||||
|
||||
|
||||
// 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; |
||||
} |
||||
|
||||
// TODO(benjy): Test options on enum values when the parser supports them. |
||||
|
||||
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; |
||||
} |
||||
} |
||||
|
||||
|
||||
// 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 { |
||||
} |
||||
|
||||
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; |
||||
|
||||
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; |
||||
} |
@ -0,0 +1,57 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
import "google/protobuf/descriptor.proto"; |
||||
option (google.protobuf.CSharpNamespace) = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.CSharpUmbrellaClassname) = "UnitTestEmbedOptimizeForProtoFile"; |
||||
|
||||
// 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; |
||||
} |
@ -0,0 +1,68 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
import "google/protobuf/descriptor.proto"; |
||||
option (google.protobuf.CSharpNamespace) = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.CSharpUmbrellaClassname) = "UnitTestImportProtoFile"; |
||||
|
||||
// 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; |
||||
|
||||
// Excercise 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. |
||||
|
||||
message ImportMessage { |
||||
optional int32 d = 1; |
||||
} |
||||
|
||||
enum ImportEnum { |
||||
IMPORT_FOO = 7; |
||||
IMPORT_BAR = 8; |
||||
IMPORT_BAZ = 9; |
||||
} |
||||
|
@ -0,0 +1,79 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
import "google/protobuf/descriptor.proto"; |
||||
option (google.protobuf.CSharpNamespace) = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.CSharpUmbrellaClassname) = "UnitTestMessageSetProtoFile"; |
||||
|
||||
// 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; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,67 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
import "google/protobuf/descriptor.proto"; |
||||
option (google.protobuf.CSharpNamespace) = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.CSharpUmbrellaClassname) = "UnitTestOptimizeForProtoFile"; |
||||
|
||||
// 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; |
||||
} |
||||
} |
||||
|
||||
message TestRequiredOptimizedForSize { |
||||
required int32 x = 1; |
||||
} |
||||
|
||||
message TestOptionalOptimizedForSize { |
||||
optional TestRequiredOptimizedForSize o = 1; |
||||
} |
@ -0,0 +1 @@ |
||||
Welcome! This is, of course, a placeholder file. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,324 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestEmbedOptimizeForProtoFile { |
||||
|
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( |
||||
global::System.Convert.FromBase64String( |
||||
"CjFnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfZW1iZWRfb3B0aW1pemVfZm9y" + |
||||
"LnByb3RvEhFwcm90b2J1Zl91bml0dGVzdBokZ29vZ2xlL3Byb3RvYnVmL2Nz" + |
||||
"aGFycF9vcHRpb25zLnByb3RvGiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRv" + |
||||
"ci5wcm90bxorZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0X29wdGltaXplX2Zv" + |
||||
"ci5wcm90byKhAQoZVGVzdEVtYmVkT3B0aW1pemVkRm9yU2l6ZRJBChBvcHRp" + |
||||
"b25hbF9tZXNzYWdlGAEgASgLMicucHJvdG9idWZfdW5pdHRlc3QuVGVzdE9w" + |
||||
"dGltaXplZEZvclNpemUSQQoQcmVwZWF0ZWRfbWVzc2FnZRgCIAMoCzInLnBy" + |
||||
"b3RvYnVmX3VuaXR0ZXN0LlRlc3RPcHRpbWl6ZWRGb3JTaXplQkxIAYLiCSFH" + |
||||
"b29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3OK4gkhVW5pdFRlc3RF" + |
||||
"bWJlZE9wdGltaXplRm9yUHJvdG9GaWxl"), |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, |
||||
global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.Descriptor, |
||||
}); |
||||
#endregion |
||||
|
||||
#region Static variables |
||||
internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor |
||||
= Descriptor.MessageTypes[0]; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.Builder> internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable |
||||
= new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.Builder>(internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor, |
||||
new string[] { "OptionalMessage", "RepeatedMessage", }); |
||||
#endregion |
||||
} |
||||
#region Messages |
||||
public sealed partial class TestEmbedOptimizedForSize : pb::GeneratedMessage<TestEmbedOptimizedForSize, TestEmbedOptimizedForSize.Builder> { |
||||
private static readonly TestEmbedOptimizedForSize defaultInstance = new Builder().BuildPartial(); |
||||
public static TestEmbedOptimizedForSize DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override TestEmbedOptimizedForSize DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override TestEmbedOptimizedForSize ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<TestEmbedOptimizedForSize, TestEmbedOptimizedForSize.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable; } |
||||
} |
||||
|
||||
private bool hasOptionalMessage; |
||||
private global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; |
||||
public bool HasOptionalMessage { |
||||
get { return hasOptionalMessage; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage { |
||||
get { return optionalMessage_; } |
||||
} |
||||
|
||||
private pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> repeatedMessage_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize>(); |
||||
public scg::IList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> RepeatedMessageList { |
||||
get { return repeatedMessage_; } |
||||
} |
||||
public int RepeatedMessageCount { |
||||
get { return repeatedMessage_.Count; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize GetRepeatedMessage(int index) { |
||||
return repeatedMessage_[index]; |
||||
} |
||||
|
||||
public override bool IsInitialized { |
||||
get { |
||||
if (HasOptionalMessage) { |
||||
if (!OptionalMessage.IsInitialized) return false; |
||||
} |
||||
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) { |
||||
if (!element.IsInitialized) return false; |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) { |
||||
if (HasOptionalMessage) { |
||||
output.WriteMessage(1, OptionalMessage); |
||||
} |
||||
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) { |
||||
output.WriteMessage(2, element); |
||||
} |
||||
UnknownFields.WriteTo(output); |
||||
} |
||||
|
||||
private int memoizedSerializedSize = -1; |
||||
public override int SerializedSize { |
||||
get { |
||||
int size = memoizedSerializedSize; |
||||
if (size != -1) return size; |
||||
|
||||
size = 0; |
||||
if (HasOptionalMessage) { |
||||
size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage); |
||||
} |
||||
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) { |
||||
size += pb::CodedOutputStream.ComputeMessageSize(2, element); |
||||
} |
||||
size += UnknownFields.SerializedSize; |
||||
memoizedSerializedSize = size; |
||||
return size; |
||||
} |
||||
} |
||||
|
||||
public static TestEmbedOptimizedForSize ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestEmbedOptimizedForSize ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(TestEmbedOptimizedForSize prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<TestEmbedOptimizedForSize, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
TestEmbedOptimizedForSize result = new TestEmbedOptimizedForSize(); |
||||
|
||||
protected override TestEmbedOptimizedForSize MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new TestEmbedOptimizedForSize(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return TestEmbedOptimizedForSize.Descriptor; } |
||||
} |
||||
|
||||
public override TestEmbedOptimizedForSize DefaultInstanceForType { |
||||
get { return TestEmbedOptimizedForSize.DefaultInstance; } |
||||
} |
||||
|
||||
public override TestEmbedOptimizedForSize BuildPartial() { |
||||
result.repeatedMessage_.MakeReadOnly(); |
||||
TestEmbedOptimizedForSize returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) { |
||||
if (other is TestEmbedOptimizedForSize) { |
||||
return MergeFrom((TestEmbedOptimizedForSize) other); |
||||
} else { |
||||
base.MergeFrom(other); |
||||
return this; |
||||
} |
||||
} |
||||
|
||||
public override Builder MergeFrom(TestEmbedOptimizedForSize other) { |
||||
if (other == TestEmbedOptimizedForSize.DefaultInstance) return this; |
||||
if (other.HasOptionalMessage) { |
||||
MergeOptionalMessage(other.OptionalMessage); |
||||
} |
||||
if (other.repeatedMessage_.Count != 0) { |
||||
base.AddRange(other.repeatedMessage_, result.repeatedMessage_); |
||||
} |
||||
this.MergeUnknownFields(other.UnknownFields); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) { |
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty); |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
||||
while (true) { |
||||
uint tag = input.ReadTag(); |
||||
switch (tag) { |
||||
case 0: { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
return this; |
||||
} |
||||
default: { |
||||
if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
return this; |
||||
} |
||||
break; |
||||
} |
||||
case 10: { |
||||
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(); |
||||
if (HasOptionalMessage) { |
||||
subBuilder.MergeFrom(OptionalMessage); |
||||
} |
||||
input.ReadMessage(subBuilder, extensionRegistry); |
||||
OptionalMessage = subBuilder.BuildPartial(); |
||||
break; |
||||
} |
||||
case 18: { |
||||
global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(); |
||||
input.ReadMessage(subBuilder, extensionRegistry); |
||||
AddRepeatedMessage(subBuilder.BuildPartial()); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public bool HasOptionalMessage { |
||||
get { return result.HasOptionalMessage; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage { |
||||
get { return result.OptionalMessage; } |
||||
set { SetOptionalMessage(value); } |
||||
} |
||||
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { |
||||
result.hasOptionalMessage = true; |
||||
result.optionalMessage_ = value; |
||||
return this; |
||||
} |
||||
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { |
||||
result.hasOptionalMessage = true; |
||||
result.optionalMessage_ = builderForValue.Build(); |
||||
return this; |
||||
} |
||||
public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { |
||||
if (result.HasOptionalMessage && |
||||
result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance) { |
||||
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); |
||||
} else { |
||||
result.optionalMessage_ = value; |
||||
} |
||||
result.hasOptionalMessage = true; |
||||
return this; |
||||
} |
||||
public Builder ClearOptionalMessage() { |
||||
result.hasOptionalMessage = false; |
||||
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; |
||||
return this; |
||||
} |
||||
|
||||
public scg::IList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> RepeatedMessageList { |
||||
get { return result.repeatedMessage_; } |
||||
} |
||||
public int RepeatedMessageCount { |
||||
get { return result.RepeatedMessageCount; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize GetRepeatedMessage(int index) { |
||||
return result.GetRepeatedMessage(index); |
||||
} |
||||
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { |
||||
result.repeatedMessage_[index] = value; |
||||
return this; |
||||
} |
||||
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { |
||||
result.repeatedMessage_[index] = builderForValue.Build(); |
||||
return this; |
||||
} |
||||
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { |
||||
result.repeatedMessage_.Add(value); |
||||
return this; |
||||
} |
||||
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { |
||||
result.repeatedMessage_.Add(builderForValue.Build()); |
||||
return this; |
||||
} |
||||
public Builder AddRangeRepeatedMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> values) { |
||||
base.AddRange(values, result.repeatedMessage_); |
||||
return this; |
||||
} |
||||
public Builder ClearRepeatedMessage() { |
||||
result.repeatedMessage_.Clear(); |
||||
return this; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
@ -0,0 +1,243 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestImportProtoFile { |
||||
|
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( |
||||
global::System.Convert.FromBase64String( |
||||
"CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0LnByb3RvEhhwcm90" + |
||||
"b2J1Zl91bml0dGVzdF9pbXBvcnQaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBf" + |
||||
"b3B0aW9ucy5wcm90bxogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJv" + |
||||
"dG8iGgoNSW1wb3J0TWVzc2FnZRIJCgFkGAEgASgFKjwKCkltcG9ydEVudW0S" + |
||||
"DgoKSU1QT1JUX0ZPTxAHEg4KCklNUE9SVF9CQVIQCBIOCgpJTVBPUlRfQkFa" + |
||||
"EAlCXAoYY29tLmdvb2dsZS5wcm90b2J1Zi50ZXN0SAGC4gkhR29vZ2xlLlBy" + |
||||
"b3RvY29sQnVmZmVycy5UZXN0UHJvdG9ziuIJF1VuaXRUZXN0SW1wb3J0UHJv" + |
||||
"dG9GaWxl"), |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, |
||||
}); |
||||
#endregion |
||||
|
||||
#region Static variables |
||||
internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor |
||||
= Descriptor.MessageTypes[0]; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessage, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder> internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable |
||||
= new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessage, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder>(internal__static_protobuf_unittest_import_ImportMessage__Descriptor, |
||||
new string[] { "D", }); |
||||
#endregion |
||||
} |
||||
#region Enums |
||||
public enum ImportEnum { |
||||
IMPORT_FOO = 7, |
||||
IMPORT_BAR = 8, |
||||
IMPORT_BAZ = 9, |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Messages |
||||
public sealed partial class ImportMessage : pb::GeneratedMessage<ImportMessage, ImportMessage.Builder> { |
||||
private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); |
||||
public static ImportMessage DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessage DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override ImportMessage ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<ImportMessage, ImportMessage.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } |
||||
} |
||||
|
||||
private bool hasD; |
||||
private int d_ = 0; |
||||
public bool HasD { |
||||
get { return hasD; } |
||||
} |
||||
public int D { |
||||
get { return d_; } |
||||
} |
||||
|
||||
public override bool IsInitialized { |
||||
get { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) { |
||||
if (HasD) { |
||||
output.WriteInt32(1, D); |
||||
} |
||||
UnknownFields.WriteTo(output); |
||||
} |
||||
|
||||
private int memoizedSerializedSize = -1; |
||||
public override int SerializedSize { |
||||
get { |
||||
int size = memoizedSerializedSize; |
||||
if (size != -1) return size; |
||||
|
||||
size = 0; |
||||
if (HasD) { |
||||
size += pb::CodedOutputStream.ComputeInt32Size(1, D); |
||||
} |
||||
size += UnknownFields.SerializedSize; |
||||
memoizedSerializedSize = size; |
||||
return size; |
||||
} |
||||
} |
||||
|
||||
public static ImportMessage ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(ImportMessage prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<ImportMessage, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
ImportMessage result = new ImportMessage(); |
||||
|
||||
protected override ImportMessage MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new ImportMessage(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return ImportMessage.Descriptor; } |
||||
} |
||||
|
||||
public override ImportMessage DefaultInstanceForType { |
||||
get { return ImportMessage.DefaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessage BuildPartial() { |
||||
ImportMessage returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) { |
||||
if (other is ImportMessage) { |
||||
return MergeFrom((ImportMessage) other); |
||||
} else { |
||||
base.MergeFrom(other); |
||||
return this; |
||||
} |
||||
} |
||||
|
||||
public override Builder MergeFrom(ImportMessage other) { |
||||
if (other == ImportMessage.DefaultInstance) return this; |
||||
if (other.HasD) { |
||||
D = other.D; |
||||
} |
||||
this.MergeUnknownFields(other.UnknownFields); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) { |
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty); |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
||||
while (true) { |
||||
uint tag = input.ReadTag(); |
||||
switch (tag) { |
||||
case 0: { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
return this; |
||||
} |
||||
default: { |
||||
if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
return this; |
||||
} |
||||
break; |
||||
} |
||||
case 8: { |
||||
D = input.ReadInt32(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public bool HasD { |
||||
get { return result.HasD; } |
||||
} |
||||
public int D { |
||||
get { return result.D; } |
||||
set { SetD(value); } |
||||
} |
||||
public Builder SetD(int value) { |
||||
result.hasD = true; |
||||
result.d_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearD() { |
||||
result.hasD = false; |
||||
result.d_ = 0; |
||||
return this; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,467 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestOptimizeForProtoFile { |
||||
|
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( |
||||
global::System.Convert.FromBase64String( |
||||
"Citnb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfb3B0aW1pemVfZm9yLnByb3Rv" + |
||||
"EhFwcm90b2J1Zl91bml0dGVzdBokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9v" + |
||||
"cHRpb25zLnByb3RvGiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90" + |
||||
"bxoeZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0LnByb3RvIp4BChRUZXN0T3B0" + |
||||
"aW1pemVkRm9yU2l6ZRIJCgFpGAEgASgFEi4KA21zZxgTIAEoCzIhLnByb3Rv" + |
||||
"YnVmX3VuaXR0ZXN0LkZvcmVpZ25NZXNzYWdlKgkI6AcQgICAgAIyQAoOdGVz" + |
||||
"dF9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0T3B0aW1pemVk" + |
||||
"Rm9yU2l6ZRjSCSABKAUiKQocVGVzdFJlcXVpcmVkT3B0aW1pemVkRm9yU2l6" + |
||||
"ZRIJCgF4GAEgAigFIloKHFRlc3RPcHRpb25hbE9wdGltaXplZEZvclNpemUS" + |
||||
"OgoBbxgBIAEoCzIvLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RSZXF1aXJlZE9w" + |
||||
"dGltaXplZEZvclNpemVCR0gCguIJIUdvb2dsZS5Qcm90b2NvbEJ1ZmZlcnMu" + |
||||
"VGVzdFByb3Rvc4riCRxVbml0VGVzdE9wdGltaXplRm9yUHJvdG9GaWxl"), |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, |
||||
global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, |
||||
}); |
||||
#endregion |
||||
|
||||
#region Static variables |
||||
internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor |
||||
= Descriptor.MessageTypes[0]; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder> internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable |
||||
= new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder>(internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor, |
||||
new string[] { "I", "Msg", }); |
||||
internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor |
||||
= Descriptor.MessageTypes[1]; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.Builder> internal__static_protobuf_unittest_TestRequiredOptimizedForSize__FieldAccessorTable |
||||
= new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.Builder>(internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor, |
||||
new string[] { "X", }); |
||||
internal static readonly pbd::MessageDescriptor internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor |
||||
= Descriptor.MessageTypes[2]; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestOptionalOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestOptionalOptimizedForSize.Builder> internal__static_protobuf_unittest_TestOptionalOptimizedForSize__FieldAccessorTable |
||||
= new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.TestOptionalOptimizedForSize, global::Google.ProtocolBuffers.TestProtos.TestOptionalOptimizedForSize.Builder>(internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor, |
||||
new string[] { "O", }); |
||||
#endregion |
||||
} |
||||
#region Messages |
||||
public sealed partial class TestOptimizedForSize : pb::ExtendableMessage<TestOptimizedForSize, TestOptimizedForSize.Builder> { |
||||
private static readonly TestOptimizedForSize defaultInstance = new Builder().BuildPartial(); |
||||
public static TestOptimizedForSize DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override TestOptimizedForSize DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override TestOptimizedForSize ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<TestOptimizedForSize, TestOptimizedForSize.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable; } |
||||
} |
||||
|
||||
public static readonly pb::GeneratedExtensionBase<int> TestExtension = |
||||
pb::GeneratedSingleExtension<int>.CreateInstance(Descriptor.Extensions[0]); |
||||
private bool hasI; |
||||
private int i_ = 0; |
||||
public bool HasI { |
||||
get { return hasI; } |
||||
} |
||||
public int I { |
||||
get { return i_; } |
||||
} |
||||
|
||||
private bool hasMsg; |
||||
private global::Google.ProtocolBuffers.TestProtos.ForeignMessage msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; |
||||
public bool HasMsg { |
||||
get { return hasMsg; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg { |
||||
get { return msg_; } |
||||
} |
||||
|
||||
public static TestOptimizedForSize ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestOptimizedForSize ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(TestOptimizedForSize prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::ExtendableBuilder<TestOptimizedForSize, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
TestOptimizedForSize result = new TestOptimizedForSize(); |
||||
|
||||
protected override TestOptimizedForSize MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new TestOptimizedForSize(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return TestOptimizedForSize.Descriptor; } |
||||
} |
||||
|
||||
public override TestOptimizedForSize DefaultInstanceForType { |
||||
get { return TestOptimizedForSize.DefaultInstance; } |
||||
} |
||||
|
||||
public override TestOptimizedForSize BuildPartial() { |
||||
TestOptimizedForSize returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
|
||||
public bool HasI { |
||||
get { return result.HasI; } |
||||
} |
||||
public int I { |
||||
get { return result.I; } |
||||
set { SetI(value); } |
||||
} |
||||
public Builder SetI(int value) { |
||||
result.hasI = true; |
||||
result.i_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearI() { |
||||
result.hasI = false; |
||||
result.i_ = 0; |
||||
return this; |
||||
} |
||||
|
||||
public bool HasMsg { |
||||
get { return result.HasMsg; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg { |
||||
get { return result.Msg; } |
||||
set { SetMsg(value); } |
||||
} |
||||
public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { |
||||
result.hasMsg = true; |
||||
result.msg_ = value; |
||||
return this; |
||||
} |
||||
public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { |
||||
result.hasMsg = true; |
||||
result.msg_ = builderForValue.Build(); |
||||
return this; |
||||
} |
||||
public Builder MergeMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { |
||||
if (result.HasMsg && |
||||
result.msg_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { |
||||
result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.msg_).MergeFrom(value).BuildPartial(); |
||||
} else { |
||||
result.msg_ = value; |
||||
} |
||||
result.hasMsg = true; |
||||
return this; |
||||
} |
||||
public Builder ClearMsg() { |
||||
result.hasMsg = false; |
||||
result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; |
||||
return this; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public sealed partial class TestRequiredOptimizedForSize : pb::GeneratedMessage<TestRequiredOptimizedForSize, TestRequiredOptimizedForSize.Builder> { |
||||
private static readonly TestRequiredOptimizedForSize defaultInstance = new Builder().BuildPartial(); |
||||
public static TestRequiredOptimizedForSize DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override TestRequiredOptimizedForSize DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override TestRequiredOptimizedForSize ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<TestRequiredOptimizedForSize, TestRequiredOptimizedForSize.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestRequiredOptimizedForSize__FieldAccessorTable; } |
||||
} |
||||
|
||||
private bool hasX; |
||||
private int x_ = 0; |
||||
public bool HasX { |
||||
get { return hasX; } |
||||
} |
||||
public int X { |
||||
get { return x_; } |
||||
} |
||||
|
||||
public static TestRequiredOptimizedForSize ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestRequiredOptimizedForSize ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(TestRequiredOptimizedForSize prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<TestRequiredOptimizedForSize, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
TestRequiredOptimizedForSize result = new TestRequiredOptimizedForSize(); |
||||
|
||||
protected override TestRequiredOptimizedForSize MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new TestRequiredOptimizedForSize(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return TestRequiredOptimizedForSize.Descriptor; } |
||||
} |
||||
|
||||
public override TestRequiredOptimizedForSize DefaultInstanceForType { |
||||
get { return TestRequiredOptimizedForSize.DefaultInstance; } |
||||
} |
||||
|
||||
public override TestRequiredOptimizedForSize BuildPartial() { |
||||
TestRequiredOptimizedForSize returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
|
||||
public bool HasX { |
||||
get { return result.HasX; } |
||||
} |
||||
public int X { |
||||
get { return result.X; } |
||||
set { SetX(value); } |
||||
} |
||||
public Builder SetX(int value) { |
||||
result.hasX = true; |
||||
result.x_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearX() { |
||||
result.hasX = false; |
||||
result.x_ = 0; |
||||
return this; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public sealed partial class TestOptionalOptimizedForSize : pb::GeneratedMessage<TestOptionalOptimizedForSize, TestOptionalOptimizedForSize.Builder> { |
||||
private static readonly TestOptionalOptimizedForSize defaultInstance = new Builder().BuildPartial(); |
||||
public static TestOptionalOptimizedForSize DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override TestOptionalOptimizedForSize DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override TestOptionalOptimizedForSize ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<TestOptionalOptimizedForSize, TestOptionalOptimizedForSize.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptionalOptimizedForSize__FieldAccessorTable; } |
||||
} |
||||
|
||||
private bool hasO; |
||||
private global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; |
||||
public bool HasO { |
||||
get { return hasO; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize O { |
||||
get { return o_; } |
||||
} |
||||
|
||||
public static TestOptionalOptimizedForSize ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestOptionalOptimizedForSize ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(TestOptionalOptimizedForSize prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<TestOptionalOptimizedForSize, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
TestOptionalOptimizedForSize result = new TestOptionalOptimizedForSize(); |
||||
|
||||
protected override TestOptionalOptimizedForSize MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new TestOptionalOptimizedForSize(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return TestOptionalOptimizedForSize.Descriptor; } |
||||
} |
||||
|
||||
public override TestOptionalOptimizedForSize DefaultInstanceForType { |
||||
get { return TestOptionalOptimizedForSize.DefaultInstance; } |
||||
} |
||||
|
||||
public override TestOptionalOptimizedForSize BuildPartial() { |
||||
TestOptionalOptimizedForSize returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
|
||||
public bool HasO { |
||||
get { return result.HasO; } |
||||
} |
||||
public global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize O { |
||||
get { return result.O; } |
||||
set { SetO(value); } |
||||
} |
||||
public Builder SetO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize value) { |
||||
result.hasO = true; |
||||
result.o_ = value; |
||||
return this; |
||||
} |
||||
public Builder SetO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.Builder builderForValue) { |
||||
result.hasO = true; |
||||
result.o_ = builderForValue.Build(); |
||||
return this; |
||||
} |
||||
public Builder MergeO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize value) { |
||||
if (result.HasO && |
||||
result.o_ != global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance) { |
||||
result.o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.CreateBuilder(result.o_).MergeFrom(value).BuildPartial(); |
||||
} else { |
||||
result.o_ = value; |
||||
} |
||||
result.hasO = true; |
||||
return this; |
||||
} |
||||
public Builder ClearO() { |
||||
result.hasO = false; |
||||
result.o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; |
||||
return this; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,49 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.DescriptorProtos { |
||||
|
||||
public static partial class CSharpOptions { |
||||
|
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( |
||||
global::System.Convert.FromBase64String( |
||||
"CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" + |
||||
"ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG86" + |
||||
"NwoPQ1NoYXJwTmFtZXNwYWNlEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRp" + |
||||
"b25zGKCcASABKAk6PwoXQ1NoYXJwVW1icmVsbGFDbGFzc25hbWUSHC5nb29n" + |
||||
"bGUucHJvdG9idWYuRmlsZU9wdGlvbnMYoZwBIAEoCTo7ChNDU2hhcnBNdWx0" + |
||||
"aXBsZUZpbGVzEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGKKcASAB" + |
||||
"KAg6OQoRQ1NoYXJwTmVzdENsYXNzZXMSHC5nb29nbGUucHJvdG9idWYuRmls" + |
||||
"ZU9wdGlvbnMYo5wBIAEoCDo7ChNDU2hhcnBQdWJsaWNDbGFzc2VzEhwuZ29v" + |
||||
"Z2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGKScASABKAhCPILiCSdHb29nbGUu" + |
||||
"UHJvdG9jb2xCdWZmZXJzLkRlc2NyaXB0b3JQcm90b3OK4gkNQ1NoYXJwT3B0" + |
||||
"aW9ucw=="), |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, |
||||
}); |
||||
#endregion |
||||
|
||||
#region Extensions |
||||
public static readonly pb::GeneratedExtensionBase<string> CSharpNamespace = |
||||
pb::GeneratedSingleExtension<string>.CreateInstance(Descriptor.Extensions[0]); |
||||
public static readonly pb::GeneratedExtensionBase<string> CSharpUmbrellaClassname = |
||||
pb::GeneratedSingleExtension<string>.CreateInstance(Descriptor.Extensions[1]); |
||||
public static readonly pb::GeneratedExtensionBase<bool> CSharpMultipleFiles = |
||||
pb::GeneratedSingleExtension<bool>.CreateInstance(Descriptor.Extensions[2]); |
||||
public static readonly pb::GeneratedExtensionBase<bool> CSharpNestClasses = |
||||
pb::GeneratedSingleExtension<bool>.CreateInstance(Descriptor.Extensions[3]); |
||||
public static readonly pb::GeneratedExtensionBase<bool> CSharpPublicClasses = |
||||
pb::GeneratedSingleExtension<bool>.CreateInstance(Descriptor.Extensions[4]); |
||||
#endregion |
||||
|
||||
#region Static variables |
||||
#endregion |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue