Skip to content

Commit

Permalink
Revert "Added System.Buffers.ReaderWriter (dotnet#2155)"
Browse files Browse the repository at this point in the history
This reverts commit fd72e1a.
  • Loading branch information
ahsonkhan committed Mar 16, 2018
1 parent 4f02651 commit dafaa92
Show file tree
Hide file tree
Showing 29 changed files with 115 additions and 85 deletions.
15 changes: 0 additions & 15 deletions corefxlab.sln
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Azure.Experimental",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.IO.Pipelines.Extensions.Tests", "tests\System.IO.Pipelines.Extensions.Tests\System.IO.Pipelines.Extensions.Tests.csproj", "{64C08774-982C-4141-8F8D-2884B6FA0E4B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Buffers.ReaderWriter", "src\System.Buffers.ReaderWriter\System.Buffers.ReaderWriter.csproj", "{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -894,18 +892,6 @@ Global
{64C08774-982C-4141-8F8D-2884B6FA0E4B}.Release|x64.Build.0 = Release|Any CPU
{64C08774-982C-4141-8F8D-2884B6FA0E4B}.Release|x86.ActiveCfg = Release|Any CPU
{64C08774-982C-4141-8F8D-2884B6FA0E4B}.Release|x86.Build.0 = Release|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Debug|x64.ActiveCfg = Debug|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Debug|x64.Build.0 = Debug|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Debug|x86.Build.0 = Debug|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Release|Any CPU.Build.0 = Release|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Release|x64.ActiveCfg = Release|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Release|x64.Build.0 = Release|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Release|x86.ActiveCfg = Release|Any CPU
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -973,7 +959,6 @@ Global
{0BA3C0A9-64B9-445D-B085-8FFAC09D6E37} = {3079E458-D0E6-4F99-8CAB-80011D35C7DA}
{916370AB-B0D3-4136-850B-AA12FAB23ECD} = {4B000021-5278-4F2A-B734-DE49F55D4024}
{64C08774-982C-4141-8F8D-2884B6FA0E4B} = {3079E458-D0E6-4F99-8CAB-80011D35C7DA}
{C5F9D191-CA3B-4648-B8A9-62E33B4622EB} = {4B000021-5278-4F2A-B734-DE49F55D4024}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9DD4022C-A010-4A9B-BCC5-171566D4CB17}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<ItemGroup>
<ProjectReference Include="..\System.Binary.Base64\System.Binary.Base64.csproj" />
<ProjectReference Include="..\System.Buffers.Experimental\System.Buffers.Experimental.csproj" />
<ProjectReference Include="..\System.Buffers.ReaderWriter\System.Buffers.ReaderWriter.csproj" />
<ProjectReference Include="..\System.Text.Encodings.Web.Utf8\System.Text.Encodings.Web.Utf8.csproj" />
</ItemGroup>
</Project>
File renamed without changes.
File renamed without changes.

This file was deleted.

111 changes: 111 additions & 0 deletions src/System.Buffers.Primitives/System/Buffers/ThrowHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace System.Buffers
{
internal class ThrowHelper
{
public static void ThrowArgumentOutOfRangeException(ExceptionArgument argument)
{
throw GetArgumentOutOfRangeException(argument);
}

public static void ThrowInvalidOperationException(ExceptionResource resource)
{
throw GetInvalidOperationException(resource);
}

public static void ThrowArgumentNullException(ExceptionArgument argument)
{
throw GetArgumentNullException(argument);
}

public static void ThrowNotSupportedException()
{
throw GetNotSupportedException();
}

public static void ThrowCursorOutOfBoundsException()
{
throw GetCursorOutOfBoundsException();
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument)
{
return new ArgumentOutOfRangeException(GetArgumentName(argument));
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static InvalidOperationException GetInvalidOperationException(ExceptionResource resource)
{
return new InvalidOperationException(GetResourceString(resource));
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static NotSupportedException GetNotSupportedException()
{
return new NotSupportedException();
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static ArgumentNullException GetArgumentNullException(ExceptionArgument argument)
{
return new ArgumentNullException(GetArgumentName(argument));
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Exception GetCursorOutOfBoundsException()
{
return new InvalidOperationException("Cursor is out of bounds");
}

private static string GetArgumentName(ExceptionArgument argument)
{
Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument),
"The enum value is not defined, please check the ExceptionArgument Enum.");

return argument.ToString();
}

private static string GetResourceString(ExceptionResource argument)
{
Debug.Assert(Enum.IsDefined(typeof(ExceptionResource), argument),
"The enum value is not defined, please check the ExceptionResource Enum.");

// Should be look up with environment resources
string resourceString = null;
switch (argument)
{
case ExceptionResource.UnexpectedSegmentType:
resourceString = "Unexpected segment type";
break;
case ExceptionResource.EndCursorNotReached:
resourceString = "Segment chain ended without reaching end cursor location";
break;
}

resourceString = resourceString ?? $"Error ResourceKey not defined {argument}.";

return resourceString;
}
}

internal enum ExceptionArgument
{
destination,
offset,
length,
data,
size
}

internal enum ExceptionResource
{
UnexpectedSegmentType,
EndCursorNotReached
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ public interface IBufferOperation
{
OperationStatus Execute(ReadOnlySpan<byte> input, Span<byte> output, out int consumed, out int written);
}
public interface IBufferTransformation : IBufferOperation
{
OperationStatus Transform(Span<byte> buffer, int dataLength, out int written);
}
}
17 changes: 0 additions & 17 deletions src/System.Buffers.ReaderWriter/System.Buffers.ReaderWriter.csproj

This file was deleted.

37 changes: 0 additions & 37 deletions src/System.Buffers.ReaderWriter/System/ThrowHelper.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/System.Text.Http.Parser/System.Text.Http.Parser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\System.Buffers.Experimental\System.Buffers.Experimental.csproj" />
<ProjectReference Include="..\System.Buffers.ReaderWriter\System.Buffers.ReaderWriter.csproj" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/System.Text.Http/System.Text.Http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\System.Buffers.ReaderWriter\System.Buffers.ReaderWriter.csproj" />
<ProjectReference Include="..\System.Text.Formatting\System.Text.Formatting.csproj" />
<ProjectReference Include="..\System.Text.Http.Parser\System.Text.Http.Parser.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
</ItemGroup>
<!-- Project references -->
<ItemGroup>
<ProjectReference Include="..\..\src\System.Buffers.Experimental\System.Buffers.Experimental.csproj" />
<ProjectReference Include="..\..\src\System.Buffers.Primitives\System.Buffers.Primitives.csproj" />
<ProjectReference Include="..\..\src\System.Buffers.ReaderWriter\System.Buffers.ReaderWriter.csproj" />
</ItemGroup>
<!-- register for test discovery in Visual Studio -->
<ItemGroup>
Expand Down

0 comments on commit dafaa92

Please sign in to comment.