Commit fb1547b3 authored by Jon Skeet's avatar Jon Skeet

Regenerate proto files

parent a8dae140
...@@ -130,39 +130,43 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -130,39 +130,43 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 0; int hash = 0;
if (Name != "") hash ^= Name.GetHashCode(); if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Id != 0) hash ^= Id.GetHashCode(); if (Id != 0) hash ^= Id.GetHashCode();
if (Email != "") hash ^= Email.GetHashCode(); if (Email.Length != 0) hash ^= Email.GetHashCode();
hash ^= phone_.GetHashCode(); hash ^= phone_.GetHashCode();
return hash; return hash;
} }
public void WriteTo(pb::CodedOutputStream output) { public void WriteTo(pb::CodedOutputStream output) {
if (Name != "") { if (Name.Length != 0) {
output.WriteString(1, Name); output.WriteString(1, Name);
} }
if (Id != 0) { if (Id != 0) {
output.WriteInt32(2, Id); output.WriteInt32(2, Id);
} }
if (Email != "") { if (Email.Length != 0) {
output.WriteString(3, Email); output.WriteString(3, Email);
} }
output.WriteMessageArray(4, phone_); if (phone_.Count > 0) {
output.WriteMessageArray(4, phone_);
}
} }
public int CalculateSize() { public int CalculateSize() {
int size = 0; int size = 0;
if (Name != "") { if (Name.Length != 0) {
size += pb::CodedOutputStream.ComputeStringSize(1, Name); size += pb::CodedOutputStream.ComputeStringSize(1, Name);
} }
if (Id != 0) { if (Id != 0) {
size += pb::CodedOutputStream.ComputeInt32Size(2, Id); size += pb::CodedOutputStream.ComputeInt32Size(2, Id);
} }
if (Email != "") { if (Email.Length != 0) {
size += pb::CodedOutputStream.ComputeStringSize(3, Email); size += pb::CodedOutputStream.ComputeStringSize(3, Email);
} }
foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) { if (phone_.Count > 0) {
size += pb::CodedOutputStream.ComputeMessageSize(4, element); foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) {
size += pb::CodedOutputStream.ComputeMessageSize(4, element);
}
} }
return size; return size;
} }
...@@ -170,13 +174,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -170,13 +174,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
if (other == null) { if (other == null) {
return; return;
} }
if (other.Name != "") { if (other.Name.Length != 0) {
Name = other.Name; Name = other.Name;
} }
if (other.Id != 0) { if (other.Id != 0) {
Id = other.Id; Id = other.Id;
} }
if (other.Email != "") { if (other.Email.Length != 0) {
Email = other.Email; Email = other.Email;
} }
phone_.Add(other.phone_); phone_.Add(other.phone_);
...@@ -194,15 +198,15 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -194,15 +198,15 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
} }
break; break;
case 10: { case 10: {
name_ = input.ReadString(); Name = input.ReadString();
break; break;
} }
case 16: { case 16: {
id_ = input.ReadInt32(); Id = input.ReadInt32();
break; break;
} }
case 26: { case 26: {
email_ = input.ReadString(); Email = input.ReadString();
break; break;
} }
case 34: { case 34: {
...@@ -275,13 +279,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -275,13 +279,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 0; int hash = 0;
if (Number != "") hash ^= Number.GetHashCode(); if (Number.Length != 0) hash ^= Number.GetHashCode();
if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) hash ^= Type.GetHashCode(); if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) hash ^= Type.GetHashCode();
return hash; return hash;
} }
public void WriteTo(pb::CodedOutputStream output) { public void WriteTo(pb::CodedOutputStream output) {
if (Number != "") { if (Number.Length != 0) {
output.WriteString(1, Number); output.WriteString(1, Number);
} }
if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) {
...@@ -291,7 +295,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -291,7 +295,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public int CalculateSize() { public int CalculateSize() {
int size = 0; int size = 0;
if (Number != "") { if (Number.Length != 0) {
size += pb::CodedOutputStream.ComputeStringSize(1, Number); size += pb::CodedOutputStream.ComputeStringSize(1, Number);
} }
if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) {
...@@ -303,7 +307,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -303,7 +307,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
if (other == null) { if (other == null) {
return; return;
} }
if (other.Number != "") { if (other.Number.Length != 0) {
Number = other.Number; Number = other.Number;
} }
if (other.Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { if (other.Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) {
...@@ -323,7 +327,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -323,7 +327,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
} }
break; break;
case 10: { case 10: {
number_ = input.ReadString(); Number = input.ReadString();
break; break;
} }
case 16: { case 16: {
...@@ -388,13 +392,17 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { ...@@ -388,13 +392,17 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
} }
public void WriteTo(pb::CodedOutputStream output) { public void WriteTo(pb::CodedOutputStream output) {
output.WriteMessageArray(1, person_); if (person_.Count > 0) {
output.WriteMessageArray(1, person_);
}
} }
public int CalculateSize() { public int CalculateSize() {
int size = 0; int size = 0;
foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in person_) { if (person_.Count > 0) {
size += pb::CodedOutputStream.ComputeMessageSize(1, element); foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in person_) {
size += pb::CodedOutputStream.ComputeMessageSize(1, element);
}
} }
return size; return size;
} }
......
...@@ -141,7 +141,7 @@ namespace Google.Protobuf.TestProtos { ...@@ -141,7 +141,7 @@ namespace Google.Protobuf.TestProtos {
} }
break; break;
case 8: { case 8: {
d_ = input.ReadInt32(); D = input.ReadInt32();
break; break;
} }
} }
......
...@@ -126,7 +126,7 @@ namespace Google.Protobuf.TestProtos { ...@@ -126,7 +126,7 @@ namespace Google.Protobuf.TestProtos {
} }
break; break;
case 8: { case 8: {
e_ = input.ReadInt32(); E = input.ReadInt32();
break; break;
} }
} }
......
...@@ -157,8 +157,12 @@ namespace UnitTest.Issues.TestProtos { ...@@ -157,8 +157,12 @@ namespace UnitTest.Issues.TestProtos {
if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) { if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) {
output.WriteEnum(1, (int) Value); output.WriteEnum(1, (int) Value);
} }
output.WriteEnumArray(2, values_); if (values_.Count > 0) {
output.WritePackedEnumArray(3, packedValues_); output.WriteEnumArray(2, values_);
}
if (packedValues_.Count > 0) {
output.WritePackedEnumArray(3, packedValues_);
}
} }
public int CalculateSize() { public int CalculateSize() {
...@@ -166,26 +170,22 @@ namespace UnitTest.Issues.TestProtos { ...@@ -166,26 +170,22 @@ namespace UnitTest.Issues.TestProtos {
if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) { if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) {
size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Value); size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Value);
} }
{ if (values_.Count > 0) {
int dataSize = 0; int dataSize = 0;
if (values_.Count > 0) { foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in values_) {
foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in values_) { dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
}
size += dataSize;
size += 1 * values_.Count;
} }
size += dataSize;
size += 1 * values_.Count;
} }
{ if (packedValues_.Count > 0) {
int dataSize = 0; int dataSize = 0;
if (packedValues_.Count > 0) { foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in packedValues_) {
foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in packedValues_) { dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
}
size += dataSize;
size += 1;
size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);
} }
size += dataSize;
size += 1;
size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);
} }
return size; return size;
} }
...@@ -399,15 +399,21 @@ namespace UnitTest.Issues.TestProtos { ...@@ -399,15 +399,21 @@ namespace UnitTest.Issues.TestProtos {
if (PrimitiveValue != 0) { if (PrimitiveValue != 0) {
output.WriteInt32(1, PrimitiveValue); output.WriteInt32(1, PrimitiveValue);
} }
output.WritePackedInt32Array(2, primitiveArray_); if (primitiveArray_.Count > 0) {
output.WritePackedInt32Array(2, primitiveArray_);
}
if (messageValue_ != null) { if (messageValue_ != null) {
output.WriteMessage(3, MessageValue); output.WriteMessage(3, MessageValue);
} }
output.WriteMessageArray(4, messageArray_); if (messageArray_.Count > 0) {
output.WriteMessageArray(4, messageArray_);
}
if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) { if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) {
output.WriteEnum(5, (int) EnumValue); output.WriteEnum(5, (int) EnumValue);
} }
output.WritePackedEnumArray(6, enumArray_); if (enumArray_.Count > 0) {
output.WritePackedEnumArray(6, enumArray_);
}
} }
public int CalculateSize() { public int CalculateSize() {
...@@ -415,35 +421,33 @@ namespace UnitTest.Issues.TestProtos { ...@@ -415,35 +421,33 @@ namespace UnitTest.Issues.TestProtos {
if (PrimitiveValue != 0) { if (PrimitiveValue != 0) {
size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveValue); size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveValue);
} }
{ if (primitiveArray_.Count > 0) {
int dataSize = 0; int dataSize = 0;
foreach (int element in primitiveArray_) { foreach (int element in primitiveArray_) {
dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element);
} }
size += dataSize; size += dataSize;
if (primitiveArray_.Count != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
}
} }
if (messageValue_ != null) { if (messageValue_ != null) {
size += pb::CodedOutputStream.ComputeMessageSize(3, MessageValue); size += pb::CodedOutputStream.ComputeMessageSize(3, MessageValue);
} }
foreach (global::UnitTest.Issues.TestProtos.DeprecatedChild element in messageArray_) { if (messageArray_.Count > 0) {
size += pb::CodedOutputStream.ComputeMessageSize(4, element); foreach (global::UnitTest.Issues.TestProtos.DeprecatedChild element in messageArray_) {
size += pb::CodedOutputStream.ComputeMessageSize(4, element);
}
} }
if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) { if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) {
size += pb::CodedOutputStream.ComputeEnumSize(5, (int) EnumValue); size += pb::CodedOutputStream.ComputeEnumSize(5, (int) EnumValue);
} }
{ if (enumArray_.Count > 0) {
int dataSize = 0; int dataSize = 0;
if (enumArray_.Count > 0) { foreach (global::UnitTest.Issues.TestProtos.DeprecatedEnum element in enumArray_) {
foreach (global::UnitTest.Issues.TestProtos.DeprecatedEnum element in enumArray_) { dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
}
size += dataSize;
size += 1;
size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);
} }
size += dataSize;
size += 1;
size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);
} }
return size; return size;
} }
...@@ -480,7 +484,7 @@ namespace UnitTest.Issues.TestProtos { ...@@ -480,7 +484,7 @@ namespace UnitTest.Issues.TestProtos {
} }
break; break;
case 8: { case 8: {
primitiveValue_ = input.ReadInt32(); PrimitiveValue = input.ReadInt32();
break; break;
} }
case 18: case 18:
...@@ -596,7 +600,7 @@ namespace UnitTest.Issues.TestProtos { ...@@ -596,7 +600,7 @@ namespace UnitTest.Issues.TestProtos {
} }
break; break;
case 8: { case 8: {
item_ = input.ReadInt32(); Item = input.ReadInt32();
break; break;
} }
} }
......
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