Commit 7d396f9d authored by csharptest's avatar csharptest Committed by unknown

Testing and related fixes

parent 487da48a
......@@ -150,7 +150,8 @@
<arg file="${protos-dir}/google/protobuf/unittest_lite.proto" />
<arg file="${protos-dir}/google/protobuf/unittest_lite_imports_nonlite.proto" />
<arg file="${protos-dir}/google/protobuf/unittest_no_generic_services.proto" />
<arg file="${protos-dir}/extest/unittest_extras_lite.proto" />
<arg file="${protos-dir}/tutorial/addressbook.proto" />
</exec>
......@@ -178,7 +179,6 @@
<include name="UnitTestEmptyProtoFile.cs" />
<include name="UnitTestEnormousDescriptorProtoFile.cs" />
<include name="UnitTestImportProtoFile.cs" />
<include name="UnitTestLiteImportNonLiteProtoFile.cs" />
<include name="UnitTestMessageSetProtoFile.cs" />
<include name="UnitTestNoGenericServicesProtoFile.cs" />
<include name="UnitTestOptimizeForProtoFile.cs" />
......@@ -188,8 +188,12 @@
<copy todir="${src}/ProtocolBuffersLite.Test/TestProtos">
<fileset basedir="${tmp-dir}">
<include name="UnitTestExtrasLiteProtoFile.cs" />
<include name="UnitTestImportLiteProtoFile.cs" />
<include name="UnitTestImportProtoFile.cs" />
<include name="UnitTestLiteImportNonLiteProtoFile.cs" />
<include name="UnitTestLiteProtoFile.cs" />
<include name="UnitTestProtoFile.cs" />
</fileset>
</copy>
......@@ -273,6 +277,8 @@
<nunit2>
<formatter type="Plain" />
<test assemblyname="${src}/ProtocolBuffers.Test/bin/${build-configuration}/Google.ProtocolBuffers.Test.dll" />
<test assemblyname="${src}/ProtocolBuffersLite.Test/bin/${build-configuration}/Google.ProtocolBuffersLite.Test.dll" />
<test assemblyname="${src}/ProtocolBuffersLite.Test/bin/${build-configuration}/Google.ProtocolBuffersMixedLite.Test.dll" />
<test assemblyname="${src}/Protogen.Test/bin/${build-configuration}/Google.ProtocolBuffers.ProtoGen.Test.dll" />
</nunit2>
</target>
......
// 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.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile";
package protobuf_unittest_extra;
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
message TestRequiredLite {
required int32 d = 1;
required ExtraEnum en = 2 [default = DEFAULT];
}
enum ExtraEnum {
DEFAULT = 1;
EXLITE_FOO = 7;
EXLITE_BAR = 8;
EXLITE_BAZ = 9;
}
......@@ -99,7 +99,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("{0},", Descriptor.HasDefaultValue ? DefaultValue : IsNullableType ? "null" : "default(" + type + ")");
writer.WriteLine("{0},", (Descriptor.MappedType == MappedType.Message) ? type + ".DefaultInstance" : "null");
writer.WriteLine("{0},", (Descriptor.MappedType == MappedType.Enum) ? "new EnumLiteMap<" + type + ">()" : "null");
writer.WriteLine("{0},", Descriptor.Index);
writer.WriteLine("{0}.{1}FieldNumber,", scope, name);
writer.Write("pbd::FieldType.{0}", Descriptor.FieldType);
if (Descriptor.IsRepeated) {
writer.WriteLine(",");
......
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// 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.
#endregion
using System;
using System.Collections.Generic;
using Google.ProtocolBuffers;
using Google.ProtocolBuffers.TestProtos;
using NUnit.Framework;
namespace Google.ProtocolBuffers {
[TestFixture]
public class ExtendableMessageTest {
[Test]
public void ExtensionWriterTest() {
TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder()
.SetExtension(UnitTestProtoFile.DefaultBoolExtension, true)
.SetExtension(UnitTestProtoFile.DefaultBytesExtension, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestProtoFile.DefaultCordExtension, "123")
.SetExtension(UnitTestProtoFile.DefaultDoubleExtension, 123)
.SetExtension(UnitTestProtoFile.DefaultFixed32Extension, 123u)
.SetExtension(UnitTestProtoFile.DefaultFixed64Extension, 123u)
.SetExtension(UnitTestProtoFile.DefaultFloatExtension, 123)
.SetExtension(UnitTestProtoFile.DefaultForeignEnumExtension, ForeignEnum.FOREIGN_BAZ)
.SetExtension(UnitTestProtoFile.DefaultImportEnumExtension, ImportEnum.IMPORT_BAZ)
.SetExtension(UnitTestProtoFile.DefaultInt32Extension, 123)
.SetExtension(UnitTestProtoFile.DefaultInt64Extension, 123)
.SetExtension(UnitTestProtoFile.DefaultNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO)
.SetExtension(UnitTestProtoFile.DefaultSfixed32Extension, 123)
.SetExtension(UnitTestProtoFile.DefaultSfixed64Extension, 123)
.SetExtension(UnitTestProtoFile.DefaultSint32Extension, 123)
.SetExtension(UnitTestProtoFile.DefaultSint64Extension, 123)
.SetExtension(UnitTestProtoFile.DefaultStringExtension, "123")
.SetExtension(UnitTestProtoFile.DefaultStringPieceExtension, "123")
.SetExtension(UnitTestProtoFile.DefaultUint32Extension, 123u)
.SetExtension(UnitTestProtoFile.DefaultUint64Extension, 123u)
//Optional
.SetExtension(UnitTestProtoFile.OptionalBoolExtension, true)
.SetExtension(UnitTestProtoFile.OptionalBytesExtension, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestProtoFile.OptionalCordExtension, "123")
.SetExtension(UnitTestProtoFile.OptionalDoubleExtension, 123)
.SetExtension(UnitTestProtoFile.OptionalFixed32Extension, 123u)
.SetExtension(UnitTestProtoFile.OptionalFixed64Extension, 123u)
.SetExtension(UnitTestProtoFile.OptionalFloatExtension, 123)
.SetExtension(UnitTestProtoFile.OptionalForeignEnumExtension, ForeignEnum.FOREIGN_BAZ)
.SetExtension(UnitTestProtoFile.OptionalImportEnumExtension, ImportEnum.IMPORT_BAZ)
.SetExtension(UnitTestProtoFile.OptionalInt32Extension, 123)
.SetExtension(UnitTestProtoFile.OptionalInt64Extension, 123)
.SetExtension(UnitTestProtoFile.OptionalNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO)
.SetExtension(UnitTestProtoFile.OptionalSfixed32Extension, 123)
.SetExtension(UnitTestProtoFile.OptionalSfixed64Extension, 123)
.SetExtension(UnitTestProtoFile.OptionalSint32Extension, 123)
.SetExtension(UnitTestProtoFile.OptionalSint64Extension, 123)
.SetExtension(UnitTestProtoFile.OptionalStringExtension, "123")
.SetExtension(UnitTestProtoFile.OptionalStringPieceExtension, "123")
.SetExtension(UnitTestProtoFile.OptionalUint32Extension, 123u)
.SetExtension(UnitTestProtoFile.OptionalUint64Extension, 123u)
//Repeated
.AddExtension(UnitTestProtoFile.RepeatedBoolExtension, true)
.AddExtension(UnitTestProtoFile.RepeatedBytesExtension, ByteString.CopyFromUtf8("123"))
.AddExtension(UnitTestProtoFile.RepeatedCordExtension, "123")
.AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 123)
.AddExtension(UnitTestProtoFile.RepeatedFixed32Extension, 123u)
.AddExtension(UnitTestProtoFile.RepeatedFixed64Extension, 123u)
.AddExtension(UnitTestProtoFile.RepeatedFloatExtension, 123)
.AddExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAZ)
.AddExtension(UnitTestProtoFile.RepeatedImportEnumExtension, ImportEnum.IMPORT_BAZ)
.AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 123)
.AddExtension(UnitTestProtoFile.RepeatedInt64Extension, 123)
.AddExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO)
.AddExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 123)
.AddExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 123)
.AddExtension(UnitTestProtoFile.RepeatedSint32Extension, 123)
.AddExtension(UnitTestProtoFile.RepeatedSint64Extension, 123)
.AddExtension(UnitTestProtoFile.RepeatedStringExtension, "123")
.AddExtension(UnitTestProtoFile.RepeatedStringPieceExtension, "123")
.AddExtension(UnitTestProtoFile.RepeatedUint32Extension, 123u)
.AddExtension(UnitTestProtoFile.RepeatedUint64Extension, 123u)
;
TestAllExtensions msg = builder.Build();
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
UnitTestProtoFile.RegisterAllExtensions(registry);
TestAllExtensions.Builder copyBuilder = TestAllExtensions.CreateBuilder().MergeFrom(msg.ToByteArray(), registry);
TestAllExtensions copy = copyBuilder.Build();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
Assert.AreEqual(true, copy.GetExtension(UnitTestProtoFile.DefaultBoolExtension));
Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestProtoFile.DefaultBytesExtension));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.DefaultCordExtension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultDoubleExtension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultFixed32Extension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultFixed64Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultFloatExtension));
Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(UnitTestProtoFile.DefaultForeignEnumExtension));
Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(UnitTestProtoFile.DefaultImportEnumExtension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultInt32Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultInt64Extension));
Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, copy.GetExtension(UnitTestProtoFile.DefaultNestedEnumExtension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSfixed32Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSfixed64Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSint32Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSint64Extension));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.DefaultStringExtension));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.DefaultStringPieceExtension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultUint32Extension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultUint64Extension));
Assert.AreEqual(true, copy.GetExtension(UnitTestProtoFile.OptionalBoolExtension));
Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestProtoFile.OptionalBytesExtension));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.OptionalCordExtension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalDoubleExtension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalFixed32Extension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalFixed64Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalFloatExtension));
Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(UnitTestProtoFile.OptionalForeignEnumExtension));
Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(UnitTestProtoFile.OptionalImportEnumExtension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalInt32Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalInt64Extension));
Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, copy.GetExtension(UnitTestProtoFile.OptionalNestedEnumExtension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSfixed32Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSfixed64Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSint32Extension));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSint64Extension));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.OptionalStringExtension));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.OptionalStringPieceExtension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalUint32Extension));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalUint64Extension));
Assert.AreEqual(true, copy.GetExtension(UnitTestProtoFile.RepeatedBoolExtension, 0));
Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestProtoFile.RepeatedBytesExtension, 0));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.RepeatedCordExtension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedFloatExtension, 0));
Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 0));
Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedInt32Extension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedInt64Extension, 0));
Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, copy.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSint32Extension, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSint64Extension, 0));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.RepeatedStringExtension, 0));
Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedUint32Extension, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedUint64Extension, 0));
}
}
}
......@@ -63,6 +63,7 @@
<Compile Include="DescriptorsTest.cs" />
<Compile Include="Descriptors\MessageDescriptorTest.cs" />
<Compile Include="DynamicMessageTest.cs" />
<Compile Include="ExtendableMessageTest.cs" />
<Compile Include="GeneratedMessageTest.cs" />
<Compile Include="MessageStreamIteratorTest.cs" />
<Compile Include="MessageStreamWriterTest.cs" />
......@@ -80,7 +81,6 @@
<Compile Include="TestProtos\UnitTestEnormousDescriptorProtoFile.cs" />
<Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestImportProtoFile.cs" />
<Compile Include="TestProtos\UnitTestLiteImportNonLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestMessageSetProtoFile.cs" />
<Compile Include="TestProtos\UnitTestNoGenericServicesProtoFile.cs" />
<Compile Include="TestProtos\UnitTestOptimizeForProtoFile.cs" />
......
......@@ -5,7 +5,7 @@ using System.Text;
namespace Google.ProtocolBuffers.TestProtos {
public sealed partial class TestExtremeDefaultValues {
//These values are not currently handled by the generator...
#warning ToDo - These values are not currently handled by the generator...
const double InfinityD = double.PositiveInfinity;
const double NaND = double.NaN;
const float InfinityF = float.PositiveInfinity;
......
......@@ -38,6 +38,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8
..\protos\google\protobuf\unittest_embed_optimize_for.proto = ..\protos\google\protobuf\unittest_embed_optimize_for.proto
..\protos\google\protobuf\unittest_empty.proto = ..\protos\google\protobuf\unittest_empty.proto
..\protos\google\protobuf\unittest_enormous_descriptor.proto = ..\protos\google\protobuf\unittest_enormous_descriptor.proto
..\protos\extest\unittest_extras_lite.proto = ..\protos\extest\unittest_extras_lite.proto
..\protos\google\protobuf\unittest_import.proto = ..\protos\google\protobuf\unittest_import.proto
..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.proto
..\protos\google\protobuf\unittest_lite.proto = ..\protos\google\protobuf\unittest_lite.proto
......@@ -47,6 +48,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8
..\protos\google\protobuf\unittest_optimize_for.proto = ..\protos\google\protobuf\unittest_optimize_for.proto
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -114,6 +117,12 @@ Global
{EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
{EE01ED24-3750-4567-9A23-1DB676A15610}.Silverlight2|Any CPU.ActiveCfg = Silverlight2|Any CPU
{EE01ED24-3750-4567-9A23-1DB676A15610}.Silverlight2|Any CPU.Build.0 = Silverlight2|Any CPU
{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
{EEFFED24-3750-4567-9A23-1DB676A15610}.Silverlight2|Any CPU.ActiveCfg = Silverlight2|Any CPU
{EEFFED24-3750-4567-9A23-1DB676A15610}.Silverlight2|Any CPU.Build.0 = Silverlight2|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -72,7 +72,10 @@ namespace Google.ProtocolBuffers {
}
public sealed override TBuilder MergeFrom(IMessageLite other) {
return MergeFrom((IMessage)other);
if (other is IMessage) {
return MergeFrom((IMessage) other);
}
throw new ArgumentException("MergeFrom(Message) can only merge messages of the same type.");
}
/// <summary>
......@@ -112,13 +115,13 @@ namespace Google.ProtocolBuffers {
}
} else if (field.MappedType == MappedType.Message) {
// Merge singular messages
IMessage existingValue = (IMessage) this[field];
IMessageLite existingValue = (IMessageLite)this[field];
if (existingValue == existingValue.WeakDefaultInstanceForType) {
this[field] = entry.Value;
} else {
this[field] = existingValue.WeakCreateBuilderForType()
.WeakMergeFrom(existingValue)
.WeakMergeFrom((IMessage) entry.Value)
.WeakMergeFrom((IMessageLite)entry.Value)
.WeakBuild();
}
} else {
......
......@@ -81,13 +81,13 @@ namespace Google.ProtocolBuffers {
if (field.IsRepeated) {
// We know it's an IList<T>, but not the exact type - so
// IEnumerable is the best we can do. (C# generics aren't covariant yet.)
foreach (IMessage element in (IEnumerable) entry.Value) {
foreach (IMessageLite element in (IEnumerable)entry.Value) {
if (!element.IsInitialized) {
return false;
}
}
} else {
if (!((IMessage)entry.Value).IsInitialized) {
if (!((IMessageLite)entry.Value).IsInitialized) {
return false;
}
}
......
......@@ -30,6 +30,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using Google.ProtocolBuffers.Collections;
namespace Google.ProtocolBuffers.Descriptors {
......@@ -46,5 +48,29 @@ namespace Google.ProtocolBuffers.Descriptors {
internal MappedType MappedType { get; private set; }
internal WireFormat.WireType WireType { get; private set; }
/// <summary>
/// Immutable mapping from field type to mapped type. Built using the attributes on
/// FieldType values.
/// </summary>
static readonly IDictionary<FieldType, FieldMappingAttribute> FieldTypeToMappedTypeMap = MapFieldTypes();
private static IDictionary<FieldType, FieldMappingAttribute> MapFieldTypes() {
var map = new Dictionary<FieldType, FieldMappingAttribute>();
foreach (System.Reflection.FieldInfo field in typeof(FieldType).GetFields(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public)) {
FieldType fieldType = (FieldType)field.GetValue(null);
FieldMappingAttribute mapping = (FieldMappingAttribute)field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
map[fieldType] = mapping;
}
return Dictionaries.AsReadOnly(map);
}
internal static MappedType MappedTypeFromFieldType(FieldType type) {
return FieldTypeToMappedTypeMap[type].MappedType;
}
internal static WireFormat.WireType WireTypeFromFieldType(FieldType type, bool packed) {
return packed ? WireFormat.WireType.LengthDelimited : FieldTypeToMappedTypeMap[type].WireType;
}
}
}
......@@ -295,7 +295,8 @@ namespace Google.ProtocolBuffers {
}
public override Builder MergeFrom(DynamicMessage other) {
return MergeFrom((IMessage)other);
IMessage downcast = other;
return MergeFrom(downcast);
}
public override DynamicMessage Build() {
......
......@@ -68,16 +68,13 @@ namespace Google.ProtocolBuffers {
public class EnumLiteMap<TEnum> : IEnumLiteMap<IEnumLite>
where TEnum : struct, IComparable, IFormattable {
struct EnumValue : IEnumLite, IComparable<IEnumLite> {
int _value;
struct EnumValue : IEnumLite {
readonly int value;
public EnumValue(int value) {
_value = value;
this.value = value;
}
int IEnumLite.Number {
get { return _value; }
}
int IComparable<IEnumLite>.CompareTo(IEnumLite other) {
return _value.CompareTo(other.Number);
get { return value; }
}
}
......
......@@ -94,21 +94,21 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Appends a value to a repeated extension.
/// </summary>
public ExtendableBuilder<TMessage, TBuilder> AddExtension<TExtension>(GeneratedExtensionBase<IList<TExtension>> extension, TExtension value) {
public TBuilder AddExtension<TExtension>(GeneratedExtensionBase<IList<TExtension>> extension, TExtension value) {
ExtendableMessage<TMessage, TBuilder> message = MessageBeingBuilt;
message.VerifyExtensionContainingType(extension);
message.Extensions.AddRepeatedField(extension.Descriptor, extension.SingularToReflectionType(value));
return this;
return ThisBuilder;
}
/// <summary>
/// Clears an extension.
/// </summary>
public ExtendableBuilder<TMessage, TBuilder> ClearExtension<TExtension>(GeneratedExtensionBase<TExtension> extension) {
public TBuilder ClearExtension<TExtension>(GeneratedExtensionBase<TExtension> extension) {
ExtendableMessage<TMessage, TBuilder> message = MessageBeingBuilt;
message.VerifyExtensionContainingType(extension);
message.Extensions.ClearField(extension.Descriptor);
return this;
return ThisBuilder;
}
/// <summary>
......
......@@ -34,6 +34,7 @@
using System;
using System.Collections.Generic;
using Google.ProtocolBuffers.Descriptors;
namespace Google.ProtocolBuffers {
public abstract class ExtendableBuilderLite<TMessage, TBuilder> : GeneratedBuilderLite<TMessage, TBuilder>
......@@ -93,21 +94,21 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Appends a value to a repeated extension.
/// </summary>
public ExtendableBuilderLite<TMessage, TBuilder> AddExtension<TExtension>(GeneratedExtensionLite<TMessage, IList<TExtension>> extension, TExtension value) {
public TBuilder AddExtension<TExtension>(GeneratedExtensionLite<TMessage, IList<TExtension>> extension, TExtension value) {
ExtendableMessageLite<TMessage, TBuilder> message = MessageBeingBuilt;
message.VerifyExtensionContainingType(extension);
message.Extensions.AddRepeatedField(extension.Descriptor, extension.SingularToReflectionType(value));
return this;
return ThisBuilder;
}
/// <summary>
/// Clears an extension.
/// </summary>
public ExtendableBuilderLite<TMessage, TBuilder> ClearExtension<TExtension>(GeneratedExtensionLite<TMessage, TExtension> extension) {
public TBuilder ClearExtension<TExtension>(GeneratedExtensionLite<TMessage, TExtension> extension) {
ExtendableMessageLite<TMessage, TBuilder> message = MessageBeingBuilt;
message.VerifyExtensionContainingType(extension);
message.Extensions.ClearField(extension.Descriptor);
return this;
return ThisBuilder;
}
/// <summary>
......@@ -117,11 +118,99 @@ namespace Google.ProtocolBuffers {
[CLSCompliant(false)]
protected override bool ParseUnknownField(CodedInputStream input,
ExtensionRegistry extensionRegistry, uint tag) {
return input.SkipField(tag);
FieldSet extensions = MessageBeingBuilt.Extensions;
WireFormat.WireType wireType = WireFormat.GetTagWireType(tag);
int fieldNumber = WireFormat.GetTagFieldNumber(tag);
IGeneratedExtensionLite extension = extensionRegistry[DefaultInstanceForType, fieldNumber];
bool unknown = false;
bool packed = false;
if (extension == null) {
unknown = true; // Unknown field.
} else if (wireType == FieldMappingAttribute.WireTypeFromFieldType(extension.Descriptor.FieldType, false /* isPacked */)) {
packed = false; // Normal, unpacked value.
} else if (extension.Descriptor.IsRepeated &&
//?? just returns true ?? extension.Descriptor.type.isPackable() &&
wireType == FieldMappingAttribute.WireTypeFromFieldType(extension.Descriptor.FieldType, true /* isPacked */)) {
packed = true; // Packed value.
} else {
unknown = true; // Wrong wire type.
}
if (unknown) { // Unknown field or wrong wire type. Skip.
return input.SkipField(tag);
}
if (packed) {
int length = (int)Math.Min(int.MaxValue, input.ReadRawVarint32());
int limit = input.PushLimit(length);
if (extension.Descriptor.FieldType == FieldType.Enum) {
while (!input.ReachedLimit) {
int rawValue = input.ReadEnum();
Object value =
extension.Descriptor.EnumType.FindValueByNumber(rawValue);
if (value == null) {
// If the number isn't recognized as a valid value for this
// enum, drop it (don't even add it to unknownFields).
return true;
}
extensions.AddRepeatedField(extension.Descriptor, value);
}
} else {
while (!input.ReachedLimit) {
Object value = input.ReadPrimitiveField(extension.Descriptor.FieldType);
extensions.AddRepeatedField(extension.Descriptor, value);
}
}
input.PopLimit(limit);
} else {
Object value;
switch (extension.Descriptor.MappedType) {
case MappedType.Message: {
IBuilderLite subBuilder = null;
if (!extension.Descriptor.IsRepeated) {
IMessageLite existingValue = extensions[extension.Descriptor] as IMessageLite;
if (existingValue != null) {
subBuilder = existingValue.WeakToBuilder();
}
}
if (subBuilder == null) {
subBuilder = extension.MessageDefaultInstance.WeakCreateBuilderForType();
}
if (extension.Descriptor.FieldType == FieldType.Group) {
input.ReadGroup(extension.Number, subBuilder, extensionRegistry);
} else {
input.ReadMessage(subBuilder, extensionRegistry);
}
value = subBuilder.WeakBuild();
break;
}
case MappedType.Enum:
int rawValue = input.ReadEnum();
value = extension.Descriptor.EnumType.FindValueByNumber(rawValue);
// If the number isn't recognized as a valid value for this enum,
// drop it.
if (value == null) {
return true;
}
break;
default:
value = input.ReadPrimitiveField(extension.Descriptor.FieldType);
break;
}
if (extension.Descriptor.IsRepeated) {
extensions.AddRepeatedField(extension.Descriptor, value);
} else {
extensions[extension.Descriptor] = value;
}
}
return true;
}
// ---------------------------------------------------------------
// Reflection
#region Reflection
public object this[IFieldDescriptorLite field, int index] {
set {
......@@ -168,5 +257,6 @@ namespace Google.ProtocolBuffers {
protected void MergeExtensionFields(ExtendableMessageLite<TMessage, TBuilder> other) {
MessageBeingBuilt.Extensions.MergeFrom(other.Extensions);
}
#endregion
}
}
......@@ -42,7 +42,9 @@ namespace Google.ProtocolBuffers
/// </summary>
public FieldDescriptor Descriptor { get; private set; }
/// <summary>
IFieldDescriptorLite IGeneratedExtensionLite.Descriptor { get { return Descriptor; } }
/// <summary>
/// A default instance of the extensions's type, if it has a message type,
/// or null otherwise.
/// </summary>
......
......@@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.FieldAccess {
}
// No... so let's create a builder of the right type, and merge the value in.
IMessage message = (IMessage) value;
IMessageLite message = (IMessageLite) value;
return CreateBuilder().WeakMergeFrom(message).WeakBuild();
}
......
......@@ -67,7 +67,7 @@ namespace Google.ProtocolBuffers.FieldAccess {
}
// No... so let's create a builder of the right type, and merge the value in.
IMessage message = (IMessage) value;
IMessageLite message = (IMessageLite) value;
return CreateBuilder().WeakMergeFrom(message).WeakBuild();
}
......
......@@ -486,7 +486,9 @@ namespace Google.ProtocolBuffers {
IMessageLite messageValue = value as IMessageLite;
isValid = messageValue != null;
#if !LITE
isValid = isValid && ((IMessage)messageValue).DescriptorForType == ((Google.ProtocolBuffers.Descriptors.FieldDescriptor)field).MessageType;
if (isValid && messageValue is IMessage && field is FieldDescriptor) {
isValid = ((IMessage) messageValue).DescriptorForType == ((FieldDescriptor) field).MessageType;
}
#endif
break;
}
......
......@@ -148,10 +148,10 @@ namespace Google.ProtocolBuffers {
}
} else if (field.MappedType == MappedType.Message && HasField(field)) {
// Merge singular embedded messages
IMessage oldValue = (IMessage)this[field];
IMessageLite oldValue = (IMessageLite)this[field];
this[field] = oldValue.WeakCreateBuilderForType()
.WeakMergeFrom(oldValue)
.WeakMergeFrom((IMessage)entry.Value)
.WeakMergeFrom((IMessageLite)entry.Value)
.WeakBuildPartial();
} else {
// Just overwrite
......
......@@ -80,6 +80,7 @@ namespace Google.ProtocolBuffers {
if (defaultInstanceProperty == null) {
throw new ArgumentException("No public static DefaultInstance property for type " + typeof(TExtension).Name);
}
#warning ToDo - Invalid cast, could be IMessageLite
messageDefaultInstance = (IMessage)defaultInstanceProperty.GetValue(null, null);
}
}
......@@ -112,7 +113,7 @@ namespace Google.ProtocolBuffers {
// This should not happen in normal use. But, to be nice, we'll
// copy the message to whatever type the caller was expecting.
return MessageDefaultInstance.WeakCreateBuilderForType()
.WeakMergeFrom((IMessage)value).WeakBuild();
.WeakMergeFrom((IMessageLite)value).WeakBuild();
}
case MappedType.Enum:
// Just return a boxed int - that can be unboxed to the enum
......
......@@ -44,25 +44,10 @@ namespace Google.ProtocolBuffers {
int Number { get; }
object ContainingType { get; }
IMessageLite MessageDefaultInstance { get; }
IFieldDescriptorLite Descriptor { get; }
}
public class ExtensionDescriptorLite : IFieldDescriptorLite {
/// <summary>
/// Immutable mapping from field type to mapped type. Built using the attributes on
/// FieldType values.
/// </summary>
public static readonly IDictionary<FieldType, MappedType> FieldTypeToMappedTypeMap = MapFieldTypes();
private static IDictionary<FieldType, MappedType> MapFieldTypes() {
var map = new Dictionary<FieldType, MappedType>();
foreach (System.Reflection.FieldInfo field in typeof(FieldType).GetFields(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public)) {
FieldType fieldType = (FieldType)field.GetValue(null);
FieldMappingAttribute mapping = (FieldMappingAttribute)field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
map[fieldType] = mapping.MappedType;
}
return Dictionaries.AsReadOnly(map);
}
private readonly IEnumLiteMap enumTypeMap;
private readonly int number;
private readonly FieldType type;
......@@ -75,7 +60,7 @@ namespace Google.ProtocolBuffers {
this.enumTypeMap = enumTypeMap;
this.number = number;
this.type = type;
this.mapType = FieldTypeToMappedTypeMap[type];
this.mapType = FieldMappingAttribute.MappedTypeFromFieldType(type);
this.isRepeated = isRepeated;
this.isPacked = isPacked;
this.defaultValue = defaultValue;
......@@ -99,7 +84,7 @@ namespace Google.ProtocolBuffers {
#warning ToDo - Discover the meaning and purpose of this durring serialization and return the correct value
public bool MessageSetWireFormat {
get { return true; }
get { return false; }
}
public int FieldNumber {
......@@ -135,11 +120,11 @@ namespace Google.ProtocolBuffers {
}
public override object ToReflectionType(object value) {
IList<TExtensionType> result = new List<TExtensionType>();
foreach (object element in (IEnumerable)value) {
result.Add((TExtensionType)SingularToReflectionType(element));
}
return result;
IList<object> result = new List<object>();
foreach (object element in (IEnumerable) value) {
result.Add(SingularToReflectionType(element));
}
return result;
}
public override object FromReflectionType(object value) {
......@@ -191,6 +176,7 @@ namespace Google.ProtocolBuffers {
false /* isRepeated */, false /* isPacked */)) {
}
private static readonly IList<object> Empty = new object[0];
/** Repeating fields: For use by generated code only. */
protected GeneratedExtensionLite(
TContainingType containingTypeDefaultInstance,
......@@ -201,7 +187,7 @@ namespace Google.ProtocolBuffers {
FieldType type,
bool isPacked)
: this(containingTypeDefaultInstance, defaultValue, messageDefaultInstance,
new ExtensionDescriptorLite(enumTypeMap, number, type, defaultValue,
new ExtensionDescriptorLite(enumTypeMap, number, type, Empty,
true /* isRepeated */, isPacked)) {
}
......
......@@ -99,13 +99,13 @@ namespace Google.ProtocolBuffers {
if (field.IsRepeated) {
// We know it's an IList<T>, but not the exact type - so
// IEnumerable is the best we can do. (C# generics aren't covariant yet.)
foreach (IMessage element in (IEnumerable) this[field]) {
foreach (IMessageLite element in (IEnumerable) this[field]) {
if (!element.IsInitialized) {
return false;
}
}
} else {
if (HasField(field) && !((IMessage) this[field]).IsInitialized) {
if (HasField(field) && !((IMessageLite) this[field]).IsInitialized) {
return false;
}
}
......
......@@ -176,7 +176,11 @@ namespace Google.ProtocolBuffers {
case FieldType.Message:
case FieldType.Group:
Print((IMessage) value, generator);
if (value is IMessage) {
Print((IMessage)value, generator);
} else {
#warning ToDo - What do we print for IMessageLite?
}
break;
}
}
......
......@@ -124,7 +124,7 @@ namespace Google.ProtocolBuffers {
foreach (KeyValuePair<FieldDescriptor, object> entry in message.AllFields) {
FieldDescriptor field = entry.Key;
object value = entry.Value;
#warning ToDo - bad assumption, could be IMessageLite
if (field.MappedType == MappedType.Message) {
if (field.IsRepeated) {
int i = 0;
......
......@@ -578,14 +578,14 @@ namespace Google.ProtocolBuffers {
switch (field.FieldType) {
case FieldType.Group:
case FieldType.Message: {
IBuilder subBuilder;
IBuilderLite subBuilder;
if (defaultFieldInstance != null) {
subBuilder = defaultFieldInstance.WeakCreateBuilderForType();
} else {
subBuilder = builder.CreateBuilderForField(field);
}
if (!field.IsRepeated) {
subBuilder.WeakMergeFrom((IMessage)builder[field]);
subBuilder.WeakMergeFrom((IMessageLite)builder[field]);
}
if (field.FieldType == FieldType.Group) {
input.ReadGroup(field.FieldNumber, subBuilder, extensionRegistry);
......@@ -661,7 +661,7 @@ namespace Google.ProtocolBuffers {
if (extension != null) {
field = extension.Descriptor;
subBuilder = extension.DefaultInstance.WeakCreateBuilderForType();
IMessage originalMessage = (IMessage)builder[field];
IMessageLite originalMessage = (IMessageLite)builder[field];
if (originalMessage != null) {
subBuilder.WeakMergeFrom(originalMessage);
}
......
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using Google.ProtocolBuffers;
using Google.ProtocolBuffers.TestProtos;
using NUnit.Framework;
namespace Google.ProtocolBuffers {
[TestFixture]
public class AbstractBuilderLiteTest {
[Test]
public void TestMergeFromCodedInputStream() {
TestAllTypesLite copy, msg = TestAllTypesLite.CreateBuilder()
.SetOptionalUint32(uint.MaxValue).Build();
copy = TestAllTypesLite.DefaultInstance;
Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray());
using (MemoryStream ms = new MemoryStream(msg.ToByteArray())) {
CodedInputStream ci = CodedInputStream.CreateInstance(ms);
copy = copy.ToBuilder().MergeFrom(ci).Build();
}
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
[Test]
public void TestIBuilderLiteWeakClear() {
TestAllTypesLite copy, msg = TestAllTypesLite.DefaultInstance;
copy = msg.ToBuilder().SetOptionalString("Should be removed.").Build();
Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray());
copy = (TestAllTypesLite)((IBuilderLite)copy.ToBuilder()).WeakClear().WeakBuild();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
[Test]
public void TestIBuilderLiteWeakMergeFromByteString() {
TestAllTypesLite copy, msg = TestAllTypesLite.CreateBuilder()
.SetOptionalString("Should be merged.").Build();
copy = TestAllTypesLite.DefaultInstance;
Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray());
copy = (TestAllTypesLite)((IBuilderLite)copy.ToBuilder()).WeakMergeFrom(msg.ToByteString()).WeakBuild();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
//again with extension registry
copy = TestAllTypesLite.DefaultInstance;
Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray());
copy = (TestAllTypesLite)((IBuilderLite)copy.ToBuilder()).WeakMergeFrom(msg.ToByteString(), ExtensionRegistry.Empty).WeakBuild();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
[Test]
public void TestIBuilderLiteWeakMergeFromCodedInputStream() {
TestAllTypesLite copy, msg = TestAllTypesLite.CreateBuilder()
.SetOptionalUint32(uint.MaxValue).Build();
copy = TestAllTypesLite.DefaultInstance;
Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray());
using (MemoryStream ms = new MemoryStream(msg.ToByteArray())) {
CodedInputStream ci = CodedInputStream.CreateInstance(ms);
copy = (TestAllTypesLite)((IBuilderLite)copy.ToBuilder()).WeakMergeFrom(ci).WeakBuild();
}
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
[Test]
public void TestIBuilderLiteWeakBuildPartial() {
IBuilderLite builder = TestRequiredLite.CreateBuilder();
Assert.IsFalse(builder.IsInitialized);
IMessageLite msg = builder.WeakBuildPartial();
Assert.IsFalse(msg.IsInitialized);
Assert.AreEqual(msg.ToByteArray(), TestRequiredLite.DefaultInstance.ToByteArray());
}
[Test, ExpectedException(typeof(UninitializedMessageException ))]
public void TestIBuilderLiteWeakBuildUninitialized() {
IBuilderLite builder = TestRequiredLite.CreateBuilder();
Assert.IsFalse(builder.IsInitialized);
builder.WeakBuild();
}
[Test]
public void TestIBuilderLiteWeakBuild() {
IBuilderLite builder = TestRequiredLite.CreateBuilder()
.SetD(0)
.SetEn(ExtraEnum.EXLITE_BAZ);
Assert.IsTrue(builder.IsInitialized);
builder.WeakBuild();
}
[Test]
public void TestIBuilderLiteWeakClone() {
TestRequiredLite msg = TestRequiredLite.CreateBuilder()
.SetD(1).SetEn(ExtraEnum.EXLITE_BAR).Build();
Assert.IsTrue(msg.IsInitialized);
IMessageLite copy = ((IBuilderLite)msg.ToBuilder()).WeakClone().WeakBuild();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
[Test]
public void TestIBuilderLiteWeakDefaultInstance() {
Assert.IsTrue(ReferenceEquals(TestRequiredLite.DefaultInstance,
((IBuilderLite)TestRequiredLite.CreateBuilder()).WeakDefaultInstanceForType));
}
}
}
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// 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.
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using Google.ProtocolBuffers;
using Google.ProtocolBuffers.TestProtos;
using NUnit.Framework;
namespace Google.ProtocolBuffers {
[TestFixture]
public class ExtendableBuilderLiteTest {
[Test]
public void TestHasExtensionT() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 123);
Assert.IsTrue(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
}
[Test]
public void TestHasExtensionTMissing() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
Assert.IsFalse(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
}
[Test]
public void TestGetExtensionCountT() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 3);
Assert.AreEqual(3, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
}
[Test]
public void TestGetExtensionCountTEmpty() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
}
[Test]
public void TestGetExtensionTNull() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
string value = builder.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite);
Assert.IsNull(value);
}
[Test]
public void TestGetExtensionTValue() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 3);
Assert.AreEqual(3, builder.GetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
}
[Test]
public void TestGetExtensionTEmpty() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
Assert.AreEqual(0, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite).Count);
}
[Test]
public void TestGetExtensionTList() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 3);
IList<int> values = builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite);
Assert.AreEqual(3, values.Count);
}
[Test]
public void TestGetExtensionTIndex() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2);
for(int i = 0; i < 3; i++ )
Assert.AreEqual(i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i));
}
[Test,ExpectedException(typeof(ArgumentOutOfRangeException))]
public void TestGetExtensionTIndexOutOfRange() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0);
}
[Test]
public void TestSetExtensionTIndex() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2);
for (int i = 0; i < 3; i++)
Assert.AreEqual(i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i));
builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0, 5);
builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1, 6);
builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2, 7);
for (int i = 0; i < 3; i++)
Assert.AreEqual(5 + i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i));
}
[Test, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void TestSetExtensionTIndexOutOfRange() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0, -1);
}
[Test]
public void TestClearExtensionTList() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0);
Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
builder.ClearExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite);
Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
}
[Test]
public void TestClearExtensionTValue() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 0);
Assert.IsTrue(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
builder.ClearExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite);
Assert.IsFalse(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
}
[Test]
public void TestIndexedByDescriptor() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
Assert.IsFalse(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
builder[UnitTestLiteProtoFile.OptionalInt32ExtensionLite.Descriptor] = 123;
Assert.IsTrue(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
}
[Test]
public void TestIndexedByDescriptorAndOrdinal() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0);
Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor;
builder[f, 0] = 123;
Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0));
}
[Test, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void TestIndexedByDescriptorAndOrdinalOutOfRange() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder();
Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor;
builder[f, 0] = 123;
}
[Test]
public void TestClearFieldByDescriptor() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0);
Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor;
builder.ClearField(f);
Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
}
[Test]
public void TestAddRepeatedFieldByDescriptor() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0);
Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor;
builder.AddRepeatedField(f, 123);
Assert.AreEqual(2, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite));
Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1));
}
}
}
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using Google.ProtocolBuffers;
using Google.ProtocolBuffers.TestProtos;
using NUnit.Framework;
namespace Google.ProtocolBuffers {
[TestFixture]
public class ExtendableMessageLiteTest {
[Test]
public void ExtensionWriterTest() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.SetExtension(UnitTestLiteProtoFile.DefaultBoolExtensionLite, true)
.SetExtension(UnitTestLiteProtoFile.DefaultBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestLiteProtoFile.DefaultCordExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultDoubleExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultFixed32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultFixed64ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultFloatExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.DefaultImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.DefaultInt32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultInt64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.SetExtension(UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSint32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSint64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultStringExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultStringPieceExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultUint32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultUint64ExtensionLite, 123u)
//Optional
.SetExtension(UnitTestLiteProtoFile.OptionalBoolExtensionLite, true)
.SetExtension(UnitTestLiteProtoFile.OptionalBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestLiteProtoFile.OptionalCordExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.OptionalDoubleExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalFixed32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.OptionalFixed64ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.OptionalFloatExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.OptionalImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalInt64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.SetExtension(UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalSint32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalSint64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.OptionalStringPieceExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.OptionalUint32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.OptionalUint64ExtensionLite, 123u)
//Repeated
.AddExtension(UnitTestLiteProtoFile.RepeatedBoolExtensionLite, true)
.AddExtension(UnitTestLiteProtoFile.RepeatedBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.AddExtension(UnitTestLiteProtoFile.RepeatedCordExtensionLite, "123")
.AddExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite, 123u)
.AddExtension(UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite, 123u)
.AddExtension(UnitTestLiteProtoFile.RepeatedFloatExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ)
.AddExtension(UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt64ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.AddExtension(UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedSint32ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedSint64ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedStringExtensionLite, "123")
.AddExtension(UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite, "123")
.AddExtension(UnitTestLiteProtoFile.RepeatedUint32ExtensionLite, 123u)
.AddExtension(UnitTestLiteProtoFile.RepeatedUint64ExtensionLite, 123u)
;
TestAllExtensionsLite msg = builder.Build();
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
UnitTestLiteProtoFile.RegisterAllExtensions(registry);
TestAllExtensionsLite.Builder copyBuilder = TestAllExtensionsLite.CreateBuilder().MergeFrom(msg.ToByteArray(), registry);
TestAllExtensionsLite copy = copyBuilder.Build();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.DefaultBoolExtensionLite));
Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestLiteProtoFile.DefaultBytesExtensionLite));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.DefaultCordExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultDoubleExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultFixed32ExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultFixed64ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultFloatExtensionLite));
Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_BAZ, copy.GetExtension(UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite));
Assert.AreEqual(ImportEnumLite.IMPORT_LITE_BAZ, copy.GetExtension(UnitTestLiteProtoFile.DefaultImportEnumExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultInt32ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultInt64ExtensionLite));
Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.FOO, copy.GetExtension(UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSint32ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSint64ExtensionLite));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.DefaultStringExtensionLite));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.DefaultStringPieceExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultUint32ExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultUint64ExtensionLite));
Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.OptionalBoolExtensionLite));
Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestLiteProtoFile.OptionalBytesExtensionLite));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.OptionalCordExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalDoubleExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalFixed32ExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalFixed64ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalFloatExtensionLite));
Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_BAZ, copy.GetExtension(UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite));
Assert.AreEqual(ImportEnumLite.IMPORT_LITE_BAZ, copy.GetExtension(UnitTestLiteProtoFile.OptionalImportEnumExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalInt64ExtensionLite));
Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.FOO, copy.GetExtension(UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSint32ExtensionLite));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSint64ExtensionLite));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringPieceExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalUint32ExtensionLite));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalUint64ExtensionLite));
Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.RepeatedBoolExtensionLite, 0));
Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestLiteProtoFile.RepeatedBytesExtensionLite, 0));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.RepeatedCordExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedFloatExtensionLite, 0));
Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_BAZ, copy.GetExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, 0));
Assert.AreEqual(ImportEnumLite.IMPORT_LITE_BAZ, copy.GetExtension(UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedInt64ExtensionLite, 0));
Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.FOO, copy.GetExtension(UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSint32ExtensionLite, 0));
Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSint64ExtensionLite, 0));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.RepeatedStringExtensionLite, 0));
Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedUint32ExtensionLite, 0));
Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedUint64ExtensionLite, 0));
}
/*
[Test]
public void ExtensionWriterTest() {
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder()
.SetExtension(UnitTestLiteProtoFile.DefaultBoolExtensionLite, true)
.SetExtension(UnitTestLiteProtoFile.DefaultBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestLiteProtoFile.DefaultCordExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultDoubleExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultFixed32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultFixed64ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultFloatExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_FOO)
.SetExtension(UnitTestLiteProtoFile.DefaultImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.DefaultInt32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultInt64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.SetExtension(UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSint32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSint64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultStringExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultStringPieceExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultUint32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultUint64ExtensionLite, 123u)
//Optional
.SetExtension(UnitTestLiteProtoFile.OptionalBoolExtensionLite, true)
.SetExtension(UnitTestLiteProtoFile.OptionalBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestLiteProtoFile.OptionalCordExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.OptionalDoubleExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalFixed32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.OptionalFixed64ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.OptionalFloatExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_FOO)
.SetExtension(UnitTestLiteProtoFile.OptionalImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalInt64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.SetExtension(UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalSint32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalSint64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.OptionalStringPieceExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.OptionalUint32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.OptionalUint64ExtensionLite, 123u)
//Repeated
.AddExtension(UnitTestLiteProtoFile.RepeatedBoolExtensionLite, true)
.AddExtension(UnitTestLiteProtoFile.RepeatedBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.AddExtension(UnitTestLiteProtoFile.RepeatedCordExtensionLite, "123")
.AddExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite, 123u)
.AddExtension(UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite, 123u)
.AddExtension(UnitTestLiteProtoFile.RepeatedFloatExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_FOO)
.AddExtension(UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedInt64ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.AddExtension(UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedSint32ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedSint64ExtensionLite, 123)
.AddExtension(UnitTestLiteProtoFile.RepeatedStringExtensionLite, "123")
.AddExtension(UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite, "123")
.AddExtension(UnitTestLiteProtoFile.RepeatedUint32ExtensionLite, 123u)
.AddExtension(UnitTestLiteProtoFile.RepeatedUint64ExtensionLite, 123u)
;
builder = TestAllExtensionsLite.CreateBuilder()
.SetExtension(UnitTestLiteProtoFile.DefaultBoolExtensionLite, true)
.SetExtension(UnitTestLiteProtoFile.DefaultBytesExtensionLite, ByteString.CopyFromUtf8("123"))
.SetExtension(UnitTestLiteProtoFile.DefaultCordExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultDoubleExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultFixed32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultFixed64ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultFloatExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_FOO)
.SetExtension(UnitTestLiteProtoFile.DefaultImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
.SetExtension(UnitTestLiteProtoFile.DefaultInt32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultInt64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite, TestAllTypesLite.Types.NestedEnum.FOO)
.SetExtension(UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSint32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultSint64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.DefaultStringExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultStringPieceExtensionLite, "123")
.SetExtension(UnitTestLiteProtoFile.DefaultUint32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.DefaultUint64ExtensionLite, 123u)
;
TestAllExtensionsLite msg = builder.Build();
byte[] data = msg.ToByteArray();
TestAllExtensionsLite.Builder copyBuilder = TestAllExtensionsLite.CreateBuilder().MergeFrom(data);
TestAllExtensionsLite copy = copyBuilder.Build();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
*
//Packed
.SetExtension(UnitTestLiteProtoFile.PackedBoolExtensionLite, true)
.SetExtension(UnitTestLiteProtoFile.PackedDoubleExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedFixed32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.PackedFixed64ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.PackedFloatExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedInt32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedInt64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedSfixed32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedSfixed64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedSint32ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedSint64ExtensionLite, 123)
.SetExtension(UnitTestLiteProtoFile.PackedUint32ExtensionLite, 123u)
.SetExtension(UnitTestLiteProtoFile.PackedUint64ExtensionLite, 123u)
*/
}
}
......@@ -57,7 +57,12 @@
<Compile Include="..\ProtocolBuffers.Test\Properties\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="AbstractBuilderLiteTest.cs" />
<Compile Include="ExtendableBuilderLiteTest.cs" />
<Compile Include="ExtendableMessageLiteTest.cs" />
<Compile Include="LiteTest.cs" />
<Compile Include="TestLiteByApi.cs" />
<Compile Include="TestProtos\UnitTestExtrasLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestLiteProtoFile.cs" />
</ItemGroup>
......@@ -70,6 +75,7 @@
<ProjectReference Include="..\ProtocolBuffers\ProtocolBuffersLite.csproj">
<Project>{6969BDCE-D925-43F3-94AC-A531E6DF2591}</Project>
<Name>ProtocolBuffersLite</Name>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// 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.
#endregion
using System;
using System.Collections.Generic;
using Google.ProtocolBuffers;
using Google.ProtocolBuffers.TestProtos;
using NUnit.Framework;
namespace Google.ProtocolBuffers {
[TestFixture]
public class TestLiteByApi {
[Test, Ignore("Currently broken as equality/hash is not implemented")]
public void TestAllTypesEquality() {
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
TestAllTypesLite copy = msg.ToBuilder().Build();
Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
Assert.IsTrue(msg.Equals(copy));
}
[Test]
public void TestAllTypesDefaultedRoundTrip() {
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
Assert.IsTrue(msg.IsInitialized);
TestAllTypesLite copy = TestAllTypesLite.CreateBuilder().MergeFrom(msg.ToByteArray()).Build();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
[Test]
public void TestAllTypesModifiedRoundTrip() {
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
msg.ToBuilder()
.SetOptionalBool(true)
.SetOptionalCord("Hi")
.SetOptionalDouble(1.123)
.SetOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_FOO)
.SetOptionalForeignMessage(ForeignMessageLite.CreateBuilder().SetC('c').Build())
.SetOptionalGroup(TestAllTypesLite.Types.OptionalGroup.CreateBuilder().SetA('a').Build())
.SetOptionalImportEnum(ImportEnumLite.IMPORT_LITE_BAR)
.SetOptionalInt32(32)
.SetOptionalInt64(64)
.SetOptionalNestedEnum(TestAllTypesLite.Types.NestedEnum.FOO)
.SetOptionalString("SetOptionalString")
.AddRepeatedGroup(TestAllTypesLite.Types.RepeatedGroup.CreateBuilder().SetA('a').Build())
.AddRepeatedGroup(TestAllTypesLite.Types.RepeatedGroup.CreateBuilder().SetA('A').Build())
;
TestAllTypesLite copy = TestAllTypesLite.CreateBuilder().MergeFrom(msg.ToByteArray()).Build();
Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
}
}
......@@ -6,7 +6,7 @@ using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
namespace Google.ProtocolBuffers.TestProtos {
public static partial class UnitTestLiteImportNonLiteProtoFile {
public static partial class UnitTestExtrasLiteProtoFile {
#region Extension registration
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
......@@ -16,47 +16,72 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion
#region Extensions
internal static readonly object Descriptor;
static UnitTestLiteImportNonLiteProtoFile() {
static UnitTestExtrasLiteProtoFile() {
Descriptor = null;
}
#endregion
}
#region Enums
public enum ExtraEnum {
DEFAULT = 1,
EXLITE_FOO = 7,
EXLITE_BAR = 8,
EXLITE_BAZ = 9,
}
#endregion
#region Messages
public sealed partial class TestLiteImportsNonlite : pb::GeneratedMessageLite<TestLiteImportsNonlite, TestLiteImportsNonlite.Builder> {
private static readonly TestLiteImportsNonlite defaultInstance = new Builder().BuildPartial();
public static TestLiteImportsNonlite DefaultInstance {
public sealed partial class TestRequiredLite : pb::GeneratedMessageLite<TestRequiredLite, TestRequiredLite.Builder> {
private static readonly TestRequiredLite defaultInstance = new Builder().BuildPartial();
public static TestRequiredLite DefaultInstance {
get { return defaultInstance; }
}
public override TestLiteImportsNonlite DefaultInstanceForType {
public override TestRequiredLite DefaultInstanceForType {
get { return defaultInstance; }
}
protected override TestLiteImportsNonlite ThisMessage {
protected override TestRequiredLite ThisMessage {
get { return this; }
}
public const int MessageFieldNumber = 1;
private bool hasMessage;
private global::Google.ProtocolBuffers.TestProtos.TestAllTypes message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance;
public bool HasMessage {
get { return hasMessage; }
public const int DFieldNumber = 1;
private bool hasD;
private int d_ = 0;
public bool HasD {
get { return hasD; }
}
public global::Google.ProtocolBuffers.TestProtos.TestAllTypes Message {
get { return message_; }
public int D {
get { return d_; }
}
public const int EnFieldNumber = 2;
private bool hasEn;
private global::Google.ProtocolBuffers.TestProtos.ExtraEnum en_ = global::Google.ProtocolBuffers.TestProtos.ExtraEnum.DEFAULT;
public bool HasEn {
get { return hasEn; }
}
public global::Google.ProtocolBuffers.TestProtos.ExtraEnum En {
get { return en_; }
}
public override bool IsInitialized {
get {
if (!hasD) return false;
if (!hasEn) return false;
return true;
}
}
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasMessage) {
output.WriteMessage(1, Message);
if (HasD) {
output.WriteInt32(1, D);
}
if (HasEn) {
output.WriteEnum(2, (int) En);
}
}
......@@ -67,65 +92,68 @@ namespace Google.ProtocolBuffers.TestProtos {
if (size != -1) return size;
size = 0;
if (HasMessage) {
size += pb::CodedOutputStream.ComputeMessageSize(1, Message);
if (HasD) {
size += pb::CodedOutputStream.ComputeInt32Size(1, D);
}
if (HasEn) {
size += pb::CodedOutputStream.ComputeEnumSize(2, (int) En);
}
memoizedSerializedSize = size;
return size;
}
}
public static TestLiteImportsNonlite ParseFrom(pb::ByteString data) {
public static TestRequiredLite ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
public static TestRequiredLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(byte[] data) {
public static TestRequiredLite ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
public static TestRequiredLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(global::System.IO.Stream input) {
public static TestRequiredLite ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
public static TestRequiredLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
}
public static TestLiteImportsNonlite ParseDelimitedFrom(global::System.IO.Stream input) {
public static TestRequiredLite ParseDelimitedFrom(global::System.IO.Stream input) {
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
}
public static TestLiteImportsNonlite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
public static TestRequiredLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(pb::CodedInputStream input) {
public static TestRequiredLite ParseFrom(pb::CodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static TestLiteImportsNonlite ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
public static TestRequiredLite ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
}
public static Builder CreateBuilder() { return new Builder(); }
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestLiteImportsNonlite prototype) {
public static Builder CreateBuilder(TestRequiredLite prototype) {
return (Builder) new Builder().MergeFrom(prototype);
}
public sealed partial class Builder : pb::GeneratedBuilderLite<TestLiteImportsNonlite, Builder> {
public sealed partial class Builder : pb::GeneratedBuilderLite<TestRequiredLite, Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
TestLiteImportsNonlite result = new TestLiteImportsNonlite();
TestRequiredLite result = new TestRequiredLite();
protected override TestLiteImportsNonlite MessageBeingBuilt {
protected override TestRequiredLite MessageBeingBuilt {
get { return result; }
}
public override Builder Clear() {
result = new TestLiteImportsNonlite();
result = new TestRequiredLite();
return this;
}
......@@ -133,32 +161,35 @@ namespace Google.ProtocolBuffers.TestProtos {
return new Builder().MergeFrom(result);
}
public override TestLiteImportsNonlite DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.TestLiteImportsNonlite.DefaultInstance; }
public override TestRequiredLite DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredLite.DefaultInstance; }
}
public override TestLiteImportsNonlite BuildPartial() {
public override TestRequiredLite BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
}
TestLiteImportsNonlite returnMe = result;
TestRequiredLite returnMe = result;
result = null;
return returnMe;
}
public override Builder MergeFrom(pb::IMessageLite other) {
if (other is TestLiteImportsNonlite) {
return MergeFrom((TestLiteImportsNonlite) other);
if (other is TestRequiredLite) {
return MergeFrom((TestRequiredLite) other);
} else {
base.MergeFrom(other);
return this;
}
}
public override Builder MergeFrom(TestLiteImportsNonlite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestLiteImportsNonlite.DefaultInstance) return this;
if (other.HasMessage) {
MergeMessage(other.Message);
public override Builder MergeFrom(TestRequiredLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredLite.DefaultInstance) return this;
if (other.HasD) {
D = other.D;
}
if (other.HasEn) {
En = other.En;
}
return this;
}
......@@ -181,13 +212,16 @@ namespace Google.ProtocolBuffers.TestProtos {
ParseUnknownField(input, extensionRegistry, tag);
break;
}
case 10: {
global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.CreateBuilder();
if (HasMessage) {
subBuilder.MergeFrom(Message);
case 8: {
D = input.ReadInt32();
break;
}
case 16: {
int rawValue = input.ReadEnum();
if (!global::System.Enum.IsDefined(typeof(global::Google.ProtocolBuffers.TestProtos.ExtraEnum), rawValue)) {
} else {
En = (global::Google.ProtocolBuffers.TestProtos.ExtraEnum) rawValue;
}
input.ReadMessage(subBuilder, extensionRegistry);
Message = subBuilder.BuildPartial();
break;
}
}
......@@ -195,44 +229,44 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public bool HasMessage {
get { return result.HasMessage; }
public bool HasD {
get { return result.HasD; }
}
public global::Google.ProtocolBuffers.TestProtos.TestAllTypes Message {
get { return result.Message; }
set { SetMessage(value); }
public int D {
get { return result.D; }
set { SetD(value); }
}
public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
result.hasMessage = true;
result.message_ = value;
public Builder SetD(int value) {
result.hasD = true;
result.d_ = value;
return this;
}
public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
result.hasMessage = true;
result.message_ = builderForValue.Build();
public Builder ClearD() {
result.hasD = false;
result.d_ = 0;
return this;
}
public Builder MergeMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
if (result.HasMessage &&
result.message_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) {
result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.CreateBuilder(result.message_).MergeFrom(value).BuildPartial();
} else {
result.message_ = value;
}
result.hasMessage = true;
public bool HasEn {
get { return result.HasEn; }
}
public global::Google.ProtocolBuffers.TestProtos.ExtraEnum En {
get { return result.En; }
set { SetEn(value); }
}
public Builder SetEn(global::Google.ProtocolBuffers.TestProtos.ExtraEnum value) {
result.hasEn = true;
result.en_ = value;
return this;
}
public Builder ClearMessage() {
result.hasMessage = false;
result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance;
public Builder ClearEn() {
result.hasEn = false;
result.en_ = global::Google.ProtocolBuffers.TestProtos.ExtraEnum.DEFAULT;
return this;
}
}
static TestLiteImportsNonlite() {
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteImportNonLiteProtoFile.Descriptor, null);
static TestRequiredLite() {
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null);
}
}
......
// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd. 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 Extension registration
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
}
#endregion
#region Static variables
internal static pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor;
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessage, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder> internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable;
#endregion
#region Descriptor
public static pbd::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbd::FileDescriptor descriptor;
static UnitTestImportProtoFile() {
byte[] descriptorData = global::System.Convert.FromBase64String(
"CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0LnByb3RvEhhwcm90" +
"b2J1Zl91bml0dGVzdF9pbXBvcnQaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBf" +
"b3B0aW9ucy5wcm90byIaCg1JbXBvcnRNZXNzYWdlEgkKAWQYASABKAUqPAoK" +
"SW1wb3J0RW51bRIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JBUhAIEg4K" +
"CklNUE9SVF9CQVoQCUJbChhjb20uZ29vZ2xlLnByb3RvYnVmLnRlc3RIAcI+" +
"PAohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEhdVbml0VGVz" +
"dEltcG9ydFByb3RvRmlsZQ==");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_protobuf_unittest_import_ImportMessage__Descriptor = Descriptor.MessageTypes[0];
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", });
pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();
RegisterAllExtensions(registry);
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry);
return registry;
};
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbd::FileDescriptor[] {
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor,
}, assigner);
}
#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; }
}
public const int DFieldNumber = 1;
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) {
int size = SerializedSize;
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 ParseDelimitedFrom(global::System.IO.Stream input) {
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
}
public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
return CreateBuilder().MergeDelimitedFrom(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 ToBuilder() { return CreateBuilder(this); }
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 global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; }
}
public override ImportMessage DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; }
}
public override ImportMessage BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
}
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 == global::Google.ProtocolBuffers.TestProtos.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 = null;
while (true) {
uint tag = input.ReadTag();
switch (tag) {
case 0: {
if (unknownFields != null) {
this.UnknownFields = unknownFields.Build();
}
return this;
}
default: {
if (pb::WireFormat.IsEndGroupTag(tag)) {
if (unknownFields != null) {
this.UnknownFields = unknownFields.Build();
}
return this;
}
if (unknownFields == null) {
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
}
ParseUnknownField(input, unknownFields, extensionRegistry, tag);
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;
}
}
static ImportMessage() {
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, null);
}
}
#endregion
}
......@@ -290,7 +290,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(int),
null,
null,
0,
global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.NestedExtensionFieldNumber,
pbd::FieldType.Int32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, int>(
......@@ -298,7 +298,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(int),
null,
null,
0,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt32ExtensionLiteFieldNumber,
pbd::FieldType.Int32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, long>(
......@@ -306,7 +306,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(long),
null,
null,
1,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt64ExtensionLiteFieldNumber,
pbd::FieldType.Int64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, uint>(
......@@ -314,7 +314,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(uint),
null,
null,
2,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint32ExtensionLiteFieldNumber,
pbd::FieldType.UInt32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, ulong>(
......@@ -322,7 +322,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(ulong),
null,
null,
3,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint64ExtensionLiteFieldNumber,
pbd::FieldType.UInt64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, int>(
......@@ -330,7 +330,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(int),
null,
null,
4,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint32ExtensionLiteFieldNumber,
pbd::FieldType.SInt32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, long>(
......@@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(long),
null,
null,
5,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint64ExtensionLiteFieldNumber,
pbd::FieldType.SInt64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, uint>(
......@@ -346,7 +346,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(uint),
null,
null,
6,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed32ExtensionLiteFieldNumber,
pbd::FieldType.Fixed32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, ulong>(
......@@ -354,7 +354,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(ulong),
null,
null,
7,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed64ExtensionLiteFieldNumber,
pbd::FieldType.Fixed64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, int>(
......@@ -362,7 +362,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(int),
null,
null,
8,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed32ExtensionLiteFieldNumber,
pbd::FieldType.SFixed32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, long>(
......@@ -370,7 +370,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(long),
null,
null,
9,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed64ExtensionLiteFieldNumber,
pbd::FieldType.SFixed64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFloatExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, float>(
......@@ -378,7 +378,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(float),
null,
null,
10,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFloatExtensionLiteFieldNumber,
pbd::FieldType.Float);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalDoubleExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, double>(
......@@ -386,7 +386,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(double),
null,
null,
11,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalDoubleExtensionLiteFieldNumber,
pbd::FieldType.Double);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBoolExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, bool>(
......@@ -394,7 +394,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(bool),
null,
null,
12,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBoolExtensionLiteFieldNumber,
pbd::FieldType.Bool);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, string>(
......@@ -402,7 +402,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
null,
null,
13,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringExtensionLiteFieldNumber,
pbd::FieldType.String);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBytesExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, pb::ByteString>(
......@@ -410,7 +410,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
null,
null,
14,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBytesExtensionLiteFieldNumber,
pbd::FieldType.Bytes);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalGroupExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite>(
......@@ -418,7 +418,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite.DefaultInstance,
null,
15,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalGroupExtensionLiteFieldNumber,
pbd::FieldType.Group);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedMessageExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage>(
......@@ -426,7 +426,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance,
null,
16,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedMessageExtensionLiteFieldNumber,
pbd::FieldType.Message);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignMessageExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite>(
......@@ -434,7 +434,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance,
null,
17,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignMessageExtensionLiteFieldNumber,
pbd::FieldType.Message);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportMessageExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite>(
......@@ -442,7 +442,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance,
null,
18,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportMessageExtensionLiteFieldNumber,
pbd::FieldType.Message);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum>(
......@@ -450,7 +450,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum),
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum>(),
19,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite>(
......@@ -458,7 +458,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite),
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite>(),
20,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportEnumExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.ImportEnumLite>(
......@@ -466,7 +466,7 @@ namespace Google.ProtocolBuffers.TestProtos {
default(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite),
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite>(),
21,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringPieceExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, string>(
......@@ -474,7 +474,7 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
null,
null,
22,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringPieceExtensionLiteFieldNumber,
pbd::FieldType.String);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalCordExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, string>(
......@@ -482,14 +482,14 @@ namespace Google.ProtocolBuffers.TestProtos {
null,
null,
null,
23,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalCordExtensionLiteFieldNumber,
pbd::FieldType.String);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt32ExtensionLite =
new pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, int>(
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
24,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt32ExtensionLiteFieldNumber,
pbd::FieldType.Int32,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt64ExtensionLite =
......@@ -497,7 +497,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
25,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt64ExtensionLiteFieldNumber,
pbd::FieldType.Int64,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint32ExtensionLite =
......@@ -505,7 +505,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
26,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint32ExtensionLiteFieldNumber,
pbd::FieldType.UInt32,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint64ExtensionLite =
......@@ -513,7 +513,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
27,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint64ExtensionLiteFieldNumber,
pbd::FieldType.UInt64,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint32ExtensionLite =
......@@ -521,7 +521,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
28,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint32ExtensionLiteFieldNumber,
pbd::FieldType.SInt32,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint64ExtensionLite =
......@@ -529,7 +529,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
29,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint64ExtensionLiteFieldNumber,
pbd::FieldType.SInt64,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite =
......@@ -537,7 +537,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
30,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed32ExtensionLiteFieldNumber,
pbd::FieldType.Fixed32,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite =
......@@ -545,7 +545,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
31,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed64ExtensionLiteFieldNumber,
pbd::FieldType.Fixed64,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite =
......@@ -553,7 +553,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
32,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLiteFieldNumber,
pbd::FieldType.SFixed32,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite =
......@@ -561,7 +561,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
33,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLiteFieldNumber,
pbd::FieldType.SFixed64,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFloatExtensionLite =
......@@ -569,7 +569,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
34,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFloatExtensionLiteFieldNumber,
pbd::FieldType.Float,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedDoubleExtensionLite =
......@@ -577,7 +577,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
35,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedDoubleExtensionLiteFieldNumber,
pbd::FieldType.Double,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBoolExtensionLite =
......@@ -585,7 +585,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
36,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBoolExtensionLiteFieldNumber,
pbd::FieldType.Bool,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringExtensionLite =
......@@ -593,7 +593,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
37,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringExtensionLiteFieldNumber,
pbd::FieldType.String,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBytesExtensionLite =
......@@ -601,7 +601,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
38,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBytesExtensionLiteFieldNumber,
pbd::FieldType.Bytes,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedGroupExtensionLite =
......@@ -609,7 +609,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension_lite.DefaultInstance,
null,
39,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedGroupExtensionLiteFieldNumber,
pbd::FieldType.Group,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedMessageExtensionLite =
......@@ -617,7 +617,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance,
null,
40,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedMessageExtensionLiteFieldNumber,
pbd::FieldType.Message,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignMessageExtensionLite =
......@@ -625,7 +625,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance,
null,
41,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignMessageExtensionLiteFieldNumber,
pbd::FieldType.Message,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportMessageExtensionLite =
......@@ -633,7 +633,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance,
null,
42,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportMessageExtensionLiteFieldNumber,
pbd::FieldType.Message,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite =
......@@ -641,7 +641,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum>(),
43,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite =
......@@ -649,7 +649,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite>(),
44,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite =
......@@ -657,7 +657,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite>(),
45,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite =
......@@ -665,7 +665,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
46,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringPieceExtensionLiteFieldNumber,
pbd::FieldType.String,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedCordExtensionLite =
......@@ -673,7 +673,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance,
null,
null,
47,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedCordExtensionLiteFieldNumber,
pbd::FieldType.String,
false);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt32ExtensionLite =
......@@ -682,7 +682,7 @@ namespace Google.ProtocolBuffers.TestProtos {
41,
null,
null,
48,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt32ExtensionLiteFieldNumber,
pbd::FieldType.Int32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, long>(
......@@ -690,7 +690,7 @@ namespace Google.ProtocolBuffers.TestProtos {
42L,
null,
null,
49,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt64ExtensionLiteFieldNumber,
pbd::FieldType.Int64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, uint>(
......@@ -698,7 +698,7 @@ namespace Google.ProtocolBuffers.TestProtos {
43,
null,
null,
50,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint32ExtensionLiteFieldNumber,
pbd::FieldType.UInt32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, ulong>(
......@@ -706,7 +706,7 @@ namespace Google.ProtocolBuffers.TestProtos {
44UL,
null,
null,
51,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint64ExtensionLiteFieldNumber,
pbd::FieldType.UInt64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, int>(
......@@ -714,7 +714,7 @@ namespace Google.ProtocolBuffers.TestProtos {
-45,
null,
null,
52,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint32ExtensionLiteFieldNumber,
pbd::FieldType.SInt32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, long>(
......@@ -722,7 +722,7 @@ namespace Google.ProtocolBuffers.TestProtos {
46,
null,
null,
53,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint64ExtensionLiteFieldNumber,
pbd::FieldType.SInt64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, uint>(
......@@ -730,7 +730,7 @@ namespace Google.ProtocolBuffers.TestProtos {
47,
null,
null,
54,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed32ExtensionLiteFieldNumber,
pbd::FieldType.Fixed32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, ulong>(
......@@ -738,7 +738,7 @@ namespace Google.ProtocolBuffers.TestProtos {
48,
null,
null,
55,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed64ExtensionLiteFieldNumber,
pbd::FieldType.Fixed64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, int>(
......@@ -746,7 +746,7 @@ namespace Google.ProtocolBuffers.TestProtos {
49,
null,
null,
56,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed32ExtensionLiteFieldNumber,
pbd::FieldType.SFixed32);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, long>(
......@@ -754,7 +754,7 @@ namespace Google.ProtocolBuffers.TestProtos {
-50,
null,
null,
57,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed64ExtensionLiteFieldNumber,
pbd::FieldType.SFixed64);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFloatExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, float>(
......@@ -762,7 +762,7 @@ namespace Google.ProtocolBuffers.TestProtos {
51.5F,
null,
null,
58,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFloatExtensionLiteFieldNumber,
pbd::FieldType.Float);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultDoubleExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, double>(
......@@ -770,7 +770,7 @@ namespace Google.ProtocolBuffers.TestProtos {
52000D,
null,
null,
59,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultDoubleExtensionLiteFieldNumber,
pbd::FieldType.Double);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBoolExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, bool>(
......@@ -778,7 +778,7 @@ namespace Google.ProtocolBuffers.TestProtos {
true,
null,
null,
60,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBoolExtensionLiteFieldNumber,
pbd::FieldType.Bool);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, string>(
......@@ -786,7 +786,7 @@ namespace Google.ProtocolBuffers.TestProtos {
"hello",
null,
null,
61,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringExtensionLiteFieldNumber,
pbd::FieldType.String);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBytesExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, pb::ByteString>(
......@@ -794,7 +794,7 @@ namespace Google.ProtocolBuffers.TestProtos {
ByteString.FromBase64("d29ybGQ="),
null,
null,
62,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBytesExtensionLiteFieldNumber,
pbd::FieldType.Bytes);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum>(
......@@ -802,7 +802,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.BAR,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum>(),
63,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultNestedEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite>(
......@@ -810,7 +810,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_BAR,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite>(),
64,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultForeignEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultImportEnumExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, global::Google.ProtocolBuffers.TestProtos.ImportEnumLite>(
......@@ -818,7 +818,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_BAR,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite>(),
65,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultImportEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringPieceExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, string>(
......@@ -826,7 +826,7 @@ namespace Google.ProtocolBuffers.TestProtos {
"abc",
null,
null,
66,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringPieceExtensionLiteFieldNumber,
pbd::FieldType.String);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultCordExtensionLite =
new pb::GeneratedExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite, string>(
......@@ -834,14 +834,14 @@ namespace Google.ProtocolBuffers.TestProtos {
"123",
null,
null,
67,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultCordExtensionLiteFieldNumber,
pbd::FieldType.String);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt32ExtensionLite =
new pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite, int>(
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
68,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt32ExtensionLiteFieldNumber,
pbd::FieldType.Int32,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt64ExtensionLite =
......@@ -849,7 +849,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
69,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt64ExtensionLiteFieldNumber,
pbd::FieldType.Int64,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint32ExtensionLite =
......@@ -857,7 +857,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
70,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint32ExtensionLiteFieldNumber,
pbd::FieldType.UInt32,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint64ExtensionLite =
......@@ -865,7 +865,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
71,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint64ExtensionLiteFieldNumber,
pbd::FieldType.UInt64,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint32ExtensionLite =
......@@ -873,7 +873,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
72,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint32ExtensionLiteFieldNumber,
pbd::FieldType.SInt32,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint64ExtensionLite =
......@@ -881,7 +881,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
73,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint64ExtensionLiteFieldNumber,
pbd::FieldType.SInt64,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed32ExtensionLite =
......@@ -889,7 +889,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
74,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed32ExtensionLiteFieldNumber,
pbd::FieldType.Fixed32,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed64ExtensionLite =
......@@ -897,7 +897,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
75,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed64ExtensionLiteFieldNumber,
pbd::FieldType.Fixed64,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed32ExtensionLite =
......@@ -905,7 +905,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
76,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed32ExtensionLiteFieldNumber,
pbd::FieldType.SFixed32,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed64ExtensionLite =
......@@ -913,7 +913,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
77,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed64ExtensionLiteFieldNumber,
pbd::FieldType.SFixed64,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFloatExtensionLite =
......@@ -921,7 +921,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
78,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFloatExtensionLiteFieldNumber,
pbd::FieldType.Float,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedDoubleExtensionLite =
......@@ -929,7 +929,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
79,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedDoubleExtensionLiteFieldNumber,
pbd::FieldType.Double,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedBoolExtensionLite =
......@@ -937,7 +937,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
null,
80,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedBoolExtensionLiteFieldNumber,
pbd::FieldType.Bool,
true);
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedEnumExtensionLite =
......@@ -945,7 +945,7 @@ namespace Google.ProtocolBuffers.TestProtos {
global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance,
null,
new EnumLiteMap<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite>(),
81,
global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedEnumExtensionLiteFieldNumber,
pbd::FieldType.Enum,
true);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment