Commit b00ea13e authored by csharptest's avatar csharptest Committed by rogerk

Refactoring the ICoded interfaces (again) removing the use of some generic methods.

parent ced18e10
......@@ -461,7 +461,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
output.WriteString(3, field_names[0], Email);
}
if (phone_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 4, field_names[3], phone_);
output.WriteMessageArray(4, field_names[3], phone_);
}
UnknownFields.WriteTo(output);
}
......@@ -812,7 +812,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
int size = SerializedSize;
string[] field_names = _addressBookFieldNames;
if (person_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 1, field_names[0], person_);
output.WriteMessageArray(1, field_names[0], person_);
}
UnknownFields.WriteTo(output);
}
......
......@@ -72,6 +72,7 @@ namespace Google.ProtocolBuffers.ProtoBench
if (temp.Remove("/v2") || temp.Remove("-v2"))
{
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(1);
RunBenchmark = BenchmarkV2;
}
if (temp.Remove("/all") || temp.Remove("-all"))
......
......@@ -132,9 +132,9 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("if ({0}_.Count > 0) {{", Name);
writer.Indent();
if (Descriptor.IsPacked)
writer.WriteLine("output.WritePackedArray(pbd::FieldType.{3}, {0}, field_names[{2}], {1}MemoizedSerializedSize, {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.WriteLine("output.WritePackedEnumArray({0}, field_names[{2}], {1}MemoizedSerializedSize, {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
else
writer.WriteLine("output.WriteArray(pbd::FieldType.{3}, {0}, field_names[{2}], {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.WriteLine("output.WriteEnumArray({0}, field_names[{2}], {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.Outdent();
writer.WriteLine("}");
}
......
......@@ -129,7 +129,7 @@ namespace Google.ProtocolBuffers.ProtoGen
{
writer.WriteLine("if ({0}_.Count > 0) {{", Name);
writer.Indent();
writer.WriteLine("output.WriteArray(pbd::FieldType.{3}, {0}, field_names[{2}], {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.WriteLine("output.Write{0}Array({1}, field_names[{3}], {2}_);", MessageOrGroup, Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.Outdent();
writer.WriteLine("}");
}
......
......@@ -121,7 +121,7 @@ namespace Google.ProtocolBuffers.ProtoGen
public void GenerateParsingCode(TextGenerator writer)
{
writer.WriteLine("input.ReadPrimitiveArray(pbd::FieldType.{1}, tag, field_name, result.{0}_);", Name, Descriptor.FieldType);
writer.WriteLine("input.Read{0}Array(tag, field_name, result.{1}_);", CapitalizedTypeName, Name, Descriptor.FieldType);
}
public void GenerateSerializationCode(TextGenerator writer)
......@@ -129,9 +129,9 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("if ({0}_.Count > 0) {{", Name);
writer.Indent();
if (Descriptor.IsPacked)
writer.WriteLine("output.WritePackedArray(pbd::FieldType.{3}, {0}, field_names[{2}], {1}MemoizedSerializedSize, {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.WriteLine("output.WritePacked{0}Array({1}, field_names[{3}], {2}MemoizedSerializedSize, {2}_);", CapitalizedTypeName, Number, Name, FieldOrdinal, Descriptor.FieldType);
else
writer.WriteLine("output.WriteArray(pbd::FieldType.{3}, {0}, field_names[{2}], {1}_);", Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.WriteLine("output.Write{0}Array({1}, field_names[{3}], {2}_);", CapitalizedTypeName, Number, Name, FieldOrdinal, Descriptor.FieldType);
writer.Outdent();
writer.WriteLine("}");
}
......
......@@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteMessage(1, field_names[0], OptionalMessage);
}
if (repeatedMessage_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 2, field_names[1], repeatedMessage_);
output.WriteMessageArray(2, field_names[1], repeatedMessage_);
}
UnknownFields.WriteTo(output);
}
......
......@@ -597,7 +597,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteString(4, field_names[29], Field4);
}
if (field5_.Count > 0) {
output.WriteArray(pbd::FieldType.Fixed64, 5, field_names[30], field5_);
output.WriteFixed64Array(5, field_names[30], field5_);
}
if (hasField6) {
output.WriteInt32(6, field_names[32], Field6);
......@@ -1122,7 +1122,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
case 42:
case 41: {
input.ReadPrimitiveArray(pbd::FieldType.Fixed64, tag, field_name, result.field5_);
input.ReadFixed64Array(tag, field_name, result.field5_);
break;
}
case 48: {
......@@ -3348,7 +3348,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteString(13, field_names[2], Field13);
}
if (field14_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 14, field_names[3], field14_);
output.WriteStringArray(14, field_names[3], field14_);
}
if (hasField15) {
output.WriteUInt64(15, field_names[4], Field15);
......@@ -3360,7 +3360,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteInt32(20, field_names[6], Field20);
}
if (field22_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 22, field_names[7], field22_);
output.WriteStringArray(22, field_names[7], field22_);
}
if (hasField24) {
output.WriteString(24, field_names[8], Field24);
......@@ -3381,7 +3381,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteMessage(31, field_names[13], Field31);
}
if (field73_.Count > 0) {
output.WriteArray(pbd::FieldType.Int32, 73, field_names[15], field73_);
output.WriteInt32Array(73, field_names[15], field73_);
}
UnknownFields.WriteTo(output);
}
......@@ -3661,7 +3661,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 114: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.field14_);
input.ReadStringArray(tag, field_name, result.field14_);
break;
}
case 120: {
......@@ -3677,7 +3677,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 178: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.field22_);
input.ReadStringArray(tag, field_name, result.field22_);
break;
}
case 194: {
......@@ -3711,7 +3711,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
case 586:
case 584: {
input.ReadPrimitiveArray(pbd::FieldType.Int32, tag, field_name, result.field73_);
input.ReadInt32Array(tag, field_name, result.field73_);
break;
}
}
......@@ -4407,7 +4407,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteString(6, field_names[25], Field6);
}
if (group1_.Count > 0) {
output.WriteArray(pbd::FieldType.Group, 10, field_names[29], group1_);
output.WriteGroupArray(10, field_names[29], group1_);
}
if (hasField21) {
output.WriteInt32(21, field_names[10], Field21);
......@@ -4431,16 +4431,16 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteInt32(109, field_names[1], Field109);
}
if (field127_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 127, field_names[2], field127_);
output.WriteStringArray(127, field_names[2], field127_);
}
if (field128_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 128, field_names[3], field128_);
output.WriteStringArray(128, field_names[3], field128_);
}
if (hasField129) {
output.WriteInt32(129, field_names[4], Field129);
}
if (field130_.Count > 0) {
output.WriteArray(pbd::FieldType.Int64, 130, field_names[5], field130_);
output.WriteInt64Array(130, field_names[5], field130_);
}
if (hasField131) {
output.WriteInt64(131, field_names[6], Field131);
......@@ -4880,11 +4880,11 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 1018: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.field127_);
input.ReadStringArray(tag, field_name, result.field127_);
break;
}
case 1026: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.field128_);
input.ReadStringArray(tag, field_name, result.field128_);
break;
}
case 1032: {
......@@ -4893,7 +4893,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
case 1042:
case 1040: {
input.ReadPrimitiveArray(pbd::FieldType.Int64, tag, field_name, result.field130_);
input.ReadInt64Array(tag, field_name, result.field130_);
break;
}
case 1048: {
......
......@@ -1385,7 +1385,7 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
string[] field_names = _rawMessageSetFieldNames;
if (item_.Count > 0) {
output.WriteArray(pbd::FieldType.Group, 1, field_names[0], item_);
output.WriteGroupArray(1, field_names[0], item_);
}
UnknownFields.WriteTo(output);
}
......
......@@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
string[] field_names = _searchRequestFieldNames;
if (criteria_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 1, field_names[0], criteria_);
output.WriteStringArray(1, field_names[0], criteria_);
}
UnknownFields.WriteTo(output);
}
......@@ -288,7 +288,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 10: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.criteria_);
input.ReadStringArray(tag, field_name, result.criteria_);
break;
}
}
......@@ -677,7 +677,7 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
string[] field_names = _searchResponseFieldNames;
if (results_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 1, field_names[0], results_);
output.WriteMessageArray(1, field_names[0], results_);
}
UnknownFields.WriteTo(output);
}
......@@ -951,7 +951,7 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
string[] field_names = _refineSearchRequestFieldNames;
if (criteria_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 1, field_names[0], criteria_);
output.WriteStringArray(1, field_names[0], criteria_);
}
if (hasPreviousResults) {
output.WriteMessage(2, field_names[1], PreviousResults);
......@@ -1122,7 +1122,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 10: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.criteria_);
input.ReadStringArray(tag, field_name, result.criteria_);
break;
}
case 18: {
......
......@@ -183,7 +183,7 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
string[] field_names = _testXmlChildFieldNames;
if (options_.Count > 0) {
output.WriteArray(pbd::FieldType.Enum, 3, field_names[1], options_);
output.WriteEnumArray(3, field_names[1], options_);
}
if (hasBinary) {
output.WriteBytes(4, field_names[0], Binary);
......@@ -722,7 +722,7 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
string[] field_names = _childrenFieldNames;
if (options_.Count > 0) {
output.WriteArray(pbd::FieldType.Enum, 3, field_names[1], options_);
output.WriteEnumArray(3, field_names[1], options_);
}
if (hasBinary) {
output.WriteBytes(4, field_names[0], Binary);
......@@ -1066,7 +1066,7 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteMessage(1, field_names[0], Child);
}
if (numbers_.Count > 0) {
output.WriteArray(pbd::FieldType.Int32, 2, field_names[3], numbers_);
output.WriteInt32Array(2, field_names[3], numbers_);
}
if (hasText) {
output.WriteString(3, field_names[4], Text);
......@@ -1079,10 +1079,10 @@ namespace Google.ProtocolBuffers.TestProtos {
}
extensionWriter.WriteUntil(200, output);
if (children_.Count > 0) {
output.WriteArray(pbd::FieldType.Group, 401, field_names[1], children_);
output.WriteGroupArray(401, field_names[1], children_);
}
if (textlines_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 700, field_names[5], textlines_);
output.WriteStringArray(700, field_names[5], textlines_);
}
UnknownFields.WriteTo(output);
}
......@@ -1299,7 +1299,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
case 18:
case 16: {
input.ReadPrimitiveArray(pbd::FieldType.Int32, tag, field_name, result.numbers_);
input.ReadInt32Array(tag, field_name, result.numbers_);
break;
}
case 26: {
......@@ -1319,7 +1319,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break;
}
case 5602: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.textlines_);
input.ReadStringArray(tag, field_name, result.textlines_);
break;
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -279,7 +279,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
int size = SerializedSize;
string[] field_names = _fileDescriptorSetFieldNames;
if (file_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 1, field_names[0], file_);
output.WriteMessageArray(1, field_names[0], file_);
}
UnknownFields.WriteTo(output);
}
......@@ -640,19 +640,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteString(2, field_names[6], Package);
}
if (dependency_.Count > 0) {
output.WriteArray(pbd::FieldType.String, 3, field_names[0], dependency_);
output.WriteStringArray(3, field_names[0], dependency_);
}
if (messageType_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 4, field_names[3], messageType_);
output.WriteMessageArray(4, field_names[3], messageType_);
}
if (enumType_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 5, field_names[1], enumType_);
output.WriteMessageArray(5, field_names[1], enumType_);
}
if (service_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 6, field_names[7], service_);
output.WriteMessageArray(6, field_names[7], service_);
}
if (extension_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 7, field_names[2], extension_);
output.WriteMessageArray(7, field_names[2], extension_);
}
if (hasOptions) {
output.WriteMessage(8, field_names[5], Options);
......@@ -871,7 +871,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
break;
}
case 26: {
input.ReadPrimitiveArray(pbd::FieldType.String, tag, field_name, result.dependency_);
input.ReadStringArray(tag, field_name, result.dependency_);
break;
}
case 34: {
......@@ -1591,19 +1591,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteString(1, field_names[4], Name);
}
if (field_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 2, field_names[3], field_);
output.WriteMessageArray(2, field_names[3], field_);
}
if (nestedType_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 3, field_names[5], nestedType_);
output.WriteMessageArray(3, field_names[5], nestedType_);
}
if (enumType_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 4, field_names[0], enumType_);
output.WriteMessageArray(4, field_names[0], enumType_);
}
if (extensionRange_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 5, field_names[2], extensionRange_);
output.WriteMessageArray(5, field_names[2], extensionRange_);
}
if (extension_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 6, field_names[1], extension_);
output.WriteMessageArray(6, field_names[1], extension_);
}
if (hasOptions) {
output.WriteMessage(7, field_names[6], Options);
......@@ -2784,7 +2784,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteString(1, field_names[0], Name);
}
if (value_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 2, field_names[2], value_);
output.WriteMessageArray(2, field_names[2], value_);
}
if (hasOptions) {
output.WriteMessage(3, field_names[1], Options);
......@@ -3506,7 +3506,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteString(1, field_names[1], Name);
}
if (method_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 2, field_names[0], method_);
output.WriteMessageArray(2, field_names[0], method_);
}
if (hasOptions) {
output.WriteMessage(3, field_names[2], Options);
......@@ -4354,7 +4354,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteBool(18, field_names[6], PyGenericServices);
}
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[7], uninterpretedOption_);
output.WriteMessageArray(999, field_names[7], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -4856,7 +4856,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteBool(2, field_names[1], NoStandardDescriptorAccessor);
}
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[2], uninterpretedOption_);
output.WriteMessageArray(999, field_names[2], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -5250,7 +5250,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
output.WriteString(9, field_names[2], ExperimentalMapKey);
}
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[4], uninterpretedOption_);
output.WriteMessageArray(999, field_names[4], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -5641,7 +5641,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
string[] field_names = _enumOptionsFieldNames;
pb::ExtendableMessage<EnumOptions, EnumOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[0], uninterpretedOption_);
output.WriteMessageArray(999, field_names[0], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -5911,7 +5911,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
string[] field_names = _enumValueOptionsFieldNames;
pb::ExtendableMessage<EnumValueOptions, EnumValueOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[0], uninterpretedOption_);
output.WriteMessageArray(999, field_names[0], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -6181,7 +6181,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
string[] field_names = _serviceOptionsFieldNames;
pb::ExtendableMessage<ServiceOptions, ServiceOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[0], uninterpretedOption_);
output.WriteMessageArray(999, field_names[0], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -6451,7 +6451,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
string[] field_names = _methodOptionsFieldNames;
pb::ExtendableMessage<MethodOptions, MethodOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (uninterpretedOption_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 999, field_names[0], uninterpretedOption_);
output.WriteMessageArray(999, field_names[0], uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
......@@ -7061,7 +7061,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
int size = SerializedSize;
string[] field_names = _uninterpretedOptionFieldNames;
if (name_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 2, field_names[2], name_);
output.WriteMessageArray(2, field_names[2], name_);
}
if (hasIdentifierValue) {
output.WriteString(3, field_names[1], IdentifierValue);
......
......@@ -146,13 +146,6 @@ namespace Google.ProtocolBuffers
[CLSCompliant(false)]
void ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, ICollection<object> list);
/// <summary>
/// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed and the
/// type is numberic, it will read a packed array.
/// </summary>
[CLSCompliant(false)]
void ReadPrimitiveArray<T>(FieldType fieldType, uint fieldTag, string fieldName, ICollection<T> list);
/// <summary>
/// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
/// read a packed array.
......@@ -201,5 +194,50 @@ namespace Google.ProtocolBuffers
/// nothing is skipped. Otherwise, returns true.</returns>
[CLSCompliant(false)]
bool SkipField();
[CLSCompliant(false)]
void ReadStringArray(uint fieldTag, string fieldName, ICollection<string> list);
[CLSCompliant(false)]
void ReadBytesArray(uint fieldTag, string fieldName, ICollection<ByteString> list);
[CLSCompliant(false)]
void ReadBoolArray(uint fieldTag, string fieldName, ICollection<bool> list);
[CLSCompliant(false)]
void ReadInt32Array(uint fieldTag, string fieldName, ICollection<int> list);
[CLSCompliant(false)]
void ReadSInt32Array(uint fieldTag, string fieldName, ICollection<int> list);
[CLSCompliant(false)]
void ReadUInt32Array(uint fieldTag, string fieldName, ICollection<uint> list);
[CLSCompliant(false)]
void ReadFixed32Array(uint fieldTag, string fieldName, ICollection<uint> list);
[CLSCompliant(false)]
void ReadSFixed32Array(uint fieldTag, string fieldName, ICollection<int> list);
[CLSCompliant(false)]
void ReadInt64Array(uint fieldTag, string fieldName, ICollection<long> list);
[CLSCompliant(false)]
void ReadSInt64Array(uint fieldTag, string fieldName, ICollection<long> list);
[CLSCompliant(false)]
void ReadUInt64Array(uint fieldTag, string fieldName, ICollection<ulong> list);
[CLSCompliant(false)]
void ReadFixed64Array(uint fieldTag, string fieldName, ICollection<ulong> list);
[CLSCompliant(false)]
void ReadSFixed64Array(uint fieldTag, string fieldName, ICollection<long> list);
[CLSCompliant(false)]
void ReadDoubleArray(uint fieldTag, string fieldName, ICollection<double> list);
[CLSCompliant(false)]
void ReadFloatArray(uint fieldTag, string fieldName, ICollection<float> list);
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using Google.ProtocolBuffers.Descriptors;
//Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members
......@@ -8,6 +9,15 @@ namespace Google.ProtocolBuffers
{
public interface ICodedOutputStream
{
void Flush();
[Obsolete]
void WriteUnknownGroup(int fieldNumber, string fieldName, IMessageLite value);
void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value);
void WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value);
void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value);
/// <summary>
/// Writes a double field value, including tag, to the stream.
/// </summary>
......@@ -61,27 +71,114 @@ namespace Google.ProtocolBuffers
/// </summary>
void WriteGroup(int fieldNumber, string fieldName, IMessageLite value);
[Obsolete]
void WriteUnknownGroup(int fieldNumber, string fieldName, IMessageLite value);
/// <summary>
/// Writes a message field value, including tag, to the stream.
/// </summary>
void WriteMessage(int fieldNumber, string fieldName, IMessageLite value);
/// <summary>
/// Writes a byte array field value, including tag, to the stream.
/// </summary>
void WriteBytes(int fieldNumber, string fieldName, ByteString value);
/// <summary>
/// Writes a UInt32 field value, including tag, to the stream.
/// </summary>
[CLSCompliant(false)]
void WriteUInt32(int fieldNumber, string fieldName, uint value);
/// <summary>
/// Writes an enum field value, including tag, to the stream.
/// </summary>
void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue);
/// <summary>
/// Writes a fixed 32-bit field value, including tag, to the stream.
/// </summary>
void WriteSFixed32(int fieldNumber, string fieldName, int value);
/// <summary>
/// Writes a signed fixed 64-bit field value, including tag, to the stream.
/// </summary>
void WriteSFixed64(int fieldNumber, string fieldName, long value);
/// <summary>
/// Writes a signed 32-bit field value, including tag, to the stream.
/// </summary>
void WriteSInt32(int fieldNumber, string fieldName, int value);
/// <summary>
/// Writes a signed 64-bit field value, including tag, to the stream.
/// </summary>
void WriteSInt64(int fieldNumber, string fieldName, long value);
void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value);
void WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value);
void WriteArray(FieldType fieldType, int fieldNumber, string fieldName, System.Collections.IEnumerable list);
void WriteGroupArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
where T : IMessageLite;
void WriteMessageArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
where T : IMessageLite;
void WriteStringArray(int fieldNumber, string fieldName, IEnumerable<string> list);
void WriteBytesArray(int fieldNumber, string fieldName, IEnumerable<ByteString> list);
void WriteBoolArray(int fieldNumber, string fieldName, IEnumerable<bool> list);
void WriteInt32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
void WriteSInt32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
void WriteUInt32Array(int fieldNumber, string fieldName, IEnumerable<uint> list);
void WriteFixed32Array(int fieldNumber, string fieldName, IEnumerable<uint> list);
void WriteSFixed32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
void WriteInt64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
void WriteSInt64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
void WriteUInt64Array(int fieldNumber, string fieldName, IEnumerable<ulong> list);
void WriteFixed64Array(int fieldNumber, string fieldName, IEnumerable<ulong> list);
void WriteSFixed64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
void WriteDoubleArray(int fieldNumber, string fieldName, IEnumerable<double> list);
void WriteFloatArray(int fieldNumber, string fieldName, IEnumerable<float> list);
[CLSCompliant(false)]
void WriteEnumArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
where T : struct, IComparable, IFormattable, IConvertible;
void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, System.Collections.IEnumerable list);
void WriteArray<T>(FieldType fieldType, int fieldNumber, string fieldName, System.Collections.Generic.IEnumerable<T> list);
void WritePackedArray<T>(FieldType fieldType, int fieldNumber, string fieldName, int calculatedSize, System.Collections.Generic.IEnumerable<T> list);
void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value);
void Flush();
void WritePackedBoolArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<bool> list);
void WritePackedInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
void WritePackedSInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
void WritePackedUInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<uint> list);
void WritePackedFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<uint> list);
void WritePackedSFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
void WritePackedInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
void WritePackedSInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
void WritePackedUInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<ulong> list);
void WritePackedFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<ulong> list);
void WritePackedSFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
void WritePackedDoubleArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<double> list);
void WritePackedFloatArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<float> list);
[CLSCompliant(false)]
void WritePackedEnumArray<T>(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<T> list)
where T : struct, IComparable, IFormattable, IConvertible;
}
}
\ No newline at end of file
......@@ -1158,13 +1158,13 @@ namespace Google.ProtocolBuffers.TestProtos {
output.WriteString(3, field_names[2], Email);
}
if (phone_.Count > 0) {
output.WriteArray(pbd::FieldType.Message, 4, field_names[5], phone_);
output.WriteMessageArray(4, field_names[5], phone_);
}
if (addresses_.Count > 0) {
output.WriteArray(pbd::FieldType.Group, 5, field_names[0], addresses_);
output.WriteGroupArray(5, field_names[0], addresses_);
}
if (codes_.Count > 0) {
output.WritePackedArray(pbd::FieldType.Int32, 10, field_names[1], codesMemoizedSerializedSize, codes_);
output.WritePackedInt32Array(10, field_names[1], codesMemoizedSerializedSize, codes_);
}
extensionWriter.WriteUntil(200, output);
}
......@@ -1414,7 +1414,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
case 82:
case 80: {
input.ReadPrimitiveArray(pbd::FieldType.Int32, tag, field_name, result.codes_);
input.ReadInt32Array(tag, field_name, result.codes_);
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