diff options
author | Jon Skeet <jonskeet@google.com> | 2015-06-30 13:16:20 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-06-30 13:20:31 +0100 |
commit | f34d37a3d4d64621bc87aa0a65a05cab64062399 (patch) | |
tree | 416cceb9b343b21004b030deea069553644928d3 /csharp/src/ProtocolBuffers/WireFormat.cs | |
parent | b9d1d3891f4e68886398bbf0caf40229275a448a (diff) | |
download | protobuf-f34d37a3d4d64621bc87aa0a65a05cab64062399.tar.gz protobuf-f34d37a3d4d64621bc87aa0a65a05cab64062399.tar.bz2 protobuf-f34d37a3d4d64621bc87aa0a65a05cab64062399.zip |
Tidying up and extra tests.
This is mostly just making things internal instead of public, removing and reordering a bunch of code in CodedInputStream/CodedOutputStream, and generally tidying up.
Diffstat (limited to 'csharp/src/ProtocolBuffers/WireFormat.cs')
-rw-r--r-- | csharp/src/ProtocolBuffers/WireFormat.cs | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/csharp/src/ProtocolBuffers/WireFormat.cs b/csharp/src/ProtocolBuffers/WireFormat.cs index 221ffef6..974665f1 100644 --- a/csharp/src/ProtocolBuffers/WireFormat.cs +++ b/csharp/src/ProtocolBuffers/WireFormat.cs @@ -53,13 +53,13 @@ namespace Google.Protobuf #region Fixed sizes.
// TODO(jonskeet): Move these somewhere else. They're messy. Consider making FieldType a smarter kind of enum
- public const int Fixed32Size = 4;
- public const int Fixed64Size = 8;
- public const int SFixed32Size = 4;
- public const int SFixed64Size = 8;
- public const int FloatSize = 4;
- public const int DoubleSize = 8;
- public const int BoolSize = 1;
+ internal const int Fixed32Size = 4;
+ internal const int Fixed64Size = 8;
+ internal const int SFixed32Size = 4;
+ internal const int SFixed64Size = 8;
+ internal const int FloatSize = 4;
+ internal const int DoubleSize = 8;
+ internal const int BoolSize = 1;
#endregion
@@ -72,22 +72,7 @@ namespace Google.Protobuf EndGroup = 4,
Fixed32 = 5
}
-
- internal static class MessageSetField
- {
- internal const int Item = 1;
- internal const int TypeID = 2;
- internal const int Message = 3;
- }
-
- internal static class MessageSetTag
- {
- internal static readonly uint ItemStart = MakeTag(MessageSetField.Item, WireType.StartGroup);
- internal static readonly uint ItemEnd = MakeTag(MessageSetField.Item, WireType.EndGroup);
- internal static readonly uint TypeID = MakeTag(MessageSetField.TypeID, WireType.Varint);
- internal static readonly uint Message = MakeTag(MessageSetField.Message, WireType.LengthDelimited);
- }
-
+
private const int TagTypeBits = 3;
private const uint TagTypeMask = (1 << TagTypeBits) - 1;
@@ -120,7 +105,6 @@ namespace Google.Protobuf return (uint) (fieldNumber << TagTypeBits) | (uint) wireType;
}
-#if !LITE
public static uint MakeTag(FieldDescriptor field)
{
return MakeTag(field.FieldNumber, GetWireType(field));
@@ -135,8 +119,6 @@ namespace Google.Protobuf return descriptor.IsPacked ? WireType.LengthDelimited : GetWireType(descriptor.FieldType);
}
-#endif
-
/// <summary>
/// Converts a field type to its wire type. Done with a switch for the sake
/// of speed - this is significantly faster than a dictionary lookup.
@@ -177,7 +159,7 @@ namespace Google.Protobuf case FieldType.Enum:
return WireType.Varint;
default:
- throw new ArgumentOutOfRangeException("No such field type");
+ throw new ArgumentOutOfRangeException("fieldType", "No such field type");
}
}
}
|