2005-11-14 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Tue, 15 Nov 2005 00:06:58 +0000 (00:06 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Tue, 15 Nov 2005 00:06:58 +0000 (00:06 -0000)
* DecoderFallbackBuffer.cs, DecoderFallback.cs,
  DecoderExceptionFallbackBuffer.cs,
  DecoderReplacementFallbackBuffer.cs,
  DecoderFallbackException.cs,
  DecoderExceptionFallback.cs,
  DecoderReplacementFallback.cs : new files (not actually used yet).

* corlib.dll.sources: added new .NET 2.0 Decoder support types in
  System.Text.

svn path=/trunk/mcs/; revision=53035

mcs/class/corlib/ChangeLog
mcs/class/corlib/System.Text/ChangeLog
mcs/class/corlib/System.Text/DecoderExceptionFallback.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/DecoderExceptionFallbackBuffer.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/DecoderFallback.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/DecoderFallbackBuffer.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/DecoderFallbackException.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/DecoderReplacementFallback.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/DecoderReplacementFallbackBuffer.cs [new file with mode: 0644]
mcs/class/corlib/corlib.dll.sources

index 9ecd0148f3c02318e89262817f2878e67d2c349a..7ede290464f6ff941080efbe9bc5b04adbde834f 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * corlib.dll.sources: added new .NET 2.0 Decoder support types in
+         System.Text.
+
 2005-11-06  Zoltan Varga  <vargaz@freemail.hu>
 
        * corlib.dll.sources: Add System.IO/SearchOption.cs.
index 9524d217e75285a6777e485ae3845c5dafc71fea..ba04a5e75139d0e0d66893b4e692f0d15f1493ec 100644 (file)
@@ -1,3 +1,12 @@
+2005-11-14  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DecoderFallbackBuffer.cs, DecoderFallback.cs,
+         DecoderExceptionFallbackBuffer.cs,
+         DecoderReplacementFallbackBuffer.cs,
+         DecoderFallbackException.cs,
+         DecoderExceptionFallback.cs,
+         DecoderReplacementFallback.cs : new files (not actually used yet).
+
 2005-11-14  Miguel de Icaza  <miguel@novell.com>
 
        * ASCIIEncoding.cs, Encoding: Another snack, just a few methods
diff --git a/mcs/class/corlib/System.Text/DecoderExceptionFallback.cs b/mcs/class/corlib/System.Text/DecoderExceptionFallback.cs
new file mode 100644 (file)
index 0000000..f69ad5a
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// DecoderExceptionFallback.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_2_0
+
+namespace System.Text
+{
+       public class DecoderExceptionFallback : DecoderFallback
+       {
+               public DecoderExceptionFallback ()
+               {
+               }
+
+               public override int MaxCharCount {
+                       get { return 0; }
+               }
+
+               public override DecoderFallbackBuffer CreateFallbackBuffer ()
+               {
+                       return new DecoderExceptionFallbackBuffer ();
+               }
+
+               public override bool Equals (object value)
+               {
+                       return value as DecoderExceptionFallback != null;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return 0;
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Text/DecoderExceptionFallbackBuffer.cs b/mcs/class/corlib/System.Text/DecoderExceptionFallbackBuffer.cs
new file mode 100644 (file)
index 0000000..80280d5
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// DecoderExceptionFallbackBuffer.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Text
+{
+       public sealed class DecoderExceptionFallbackBuffer
+               : DecoderFallbackBuffer
+       {
+               public DecoderExceptionFallbackBuffer ()
+               {
+               }
+
+               public override int Remaining {
+                       get { return 0; }
+               }
+
+               public override bool Fallback (byte [] bytesUnknown, int index)
+               {
+                       throw new DecoderFallbackException (null, bytesUnknown, index);
+               }
+
+               public override char GetNextChar ()
+               {
+                       return char.MinValue;
+               }
+
+               public override bool MovePrevious ()
+               {
+                       return false;
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Text/DecoderFallback.cs b/mcs/class/corlib/System.Text/DecoderFallback.cs
new file mode 100644 (file)
index 0000000..6baa764
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// DecoderFallback.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Text
+{
+       public abstract class DecoderFallback
+       {
+               static DecoderFallback exception_fallback =
+                       new DecoderExceptionFallback ();
+               static DecoderFallback replacement_fallback =
+                       new DecoderReplacementFallback ();
+
+               protected DecoderFallback ()
+               {
+               }
+
+               public static DecoderFallback ExceptionFallback {
+                       get { return exception_fallback; }
+               }
+
+               public abstract int MaxCharCount { get; }
+
+               public static DecoderFallback ReplacementFallback {
+                       get { return replacement_fallback; }
+               }
+
+               public abstract DecoderFallbackBuffer CreateFallbackBuffer ();
+       }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Text/DecoderFallbackBuffer.cs b/mcs/class/corlib/System.Text/DecoderFallbackBuffer.cs
new file mode 100644 (file)
index 0000000..9a9dbbf
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// DecoderFallbackBuffer.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Text
+{
+       public abstract class DecoderFallbackBuffer
+       {
+               protected DecoderFallbackBuffer ()
+               {
+               }
+
+               public abstract int Remaining { get; }
+
+               public abstract bool Fallback (byte [] bytesUnknown, int index);
+
+               public abstract char GetNextChar ();
+
+               public abstract bool MovePrevious ();
+
+               [MonoTODO]
+               public virtual void Reset ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Text/DecoderFallbackException.cs b/mcs/class/corlib/System.Text/DecoderFallbackException.cs
new file mode 100644 (file)
index 0000000..cdadf9b
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// DecoderFallbackException.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Text
+{
+       public sealed class DecoderFallbackException : ArgumentException
+       {
+               const string defaultMessage =
+                       "Failed to decode the input byte sequence to Unicode characters.";
+
+               public DecoderFallbackException ()
+                       : this (null)
+               {
+               }
+
+               public DecoderFallbackException (string message)
+                       : base (message)
+               {
+               }
+
+               public DecoderFallbackException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+
+               public DecoderFallbackException (string message,
+                       byte [] bytesUnknown, int index)
+                       : base (message)
+               {
+                       bytes_unknown = bytesUnknown;
+                       this.index = index;
+               }
+
+               byte [] bytes_unknown;
+               int index = - 1;
+
+               [MonoTODO]
+               public byte [] BytesUnknown {
+                       get { return bytes_unknown; }
+               }
+
+               [MonoTODO]
+               public int Index {
+                       get { return index; }
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Text/DecoderReplacementFallback.cs b/mcs/class/corlib/System.Text/DecoderReplacementFallback.cs
new file mode 100644 (file)
index 0000000..106292f
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// DecoderReplacementFallback.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Text
+{
+       public class DecoderReplacementFallback : DecoderFallback
+       {
+               [MonoTODO]
+               public DecoderReplacementFallback ()
+                       : this ("?")
+               {
+               }
+
+               [MonoTODO]
+               public DecoderReplacementFallback (string replacement)
+               {
+                       if (replacement == null)
+                               throw new ArgumentNullException ();
+                       // FIXME: check replacement validity (invalid surrogate)
+
+                       this.replacement = replacement;
+               }
+
+               string replacement;
+
+               [MonoTODO]
+               public string DefaultString {
+                       get { return replacement; }
+               }
+
+               [MonoTODO]
+               public override int MaxCharCount {
+                       get { return replacement.Length; }
+               }
+
+               [MonoTODO]
+               public override DecoderFallbackBuffer CreateFallbackBuffer ()
+               {
+                       return new DecoderReplacementFallbackBuffer (this);
+               }
+
+               [MonoTODO]
+               public override bool Equals (object value)
+               {
+                       DecoderReplacementFallback f = value as DecoderReplacementFallback;
+                       return f != null && replacement == f.replacement;
+               }
+
+               [MonoTODO]
+               public override int GetHashCode ()
+               {
+                       return replacement.GetHashCode ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Text/DecoderReplacementFallbackBuffer.cs b/mcs/class/corlib/System.Text/DecoderReplacementFallbackBuffer.cs
new file mode 100644 (file)
index 0000000..533b722
--- /dev/null
@@ -0,0 +1,71 @@
+//
+// DecoderReplacementFallbackBuffer.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Text
+{
+       public sealed class DecoderReplacementFallbackBuffer
+               : DecoderFallbackBuffer
+       {
+               DecoderReplacementFallback fallback;
+
+               public DecoderReplacementFallbackBuffer (
+                       DecoderReplacementFallback fallback)
+               {
+                       this.fallback = fallback;
+               }
+
+               [MonoTODO]
+               public override int Remaining {
+                       get { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public override bool Fallback (byte [] bytesUnknown, int index)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override char GetNextChar ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override bool MovePrevious ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
index 6d9c98b5c7337e2cfc38fd16a24230669a8ac299..70ba17e00b5435db8185775aff3b2c5c3c72f75c 100644 (file)
@@ -1242,6 +1242,13 @@ System.Security.Principal/WindowsImpersonationContext.cs
 System.Security.Principal/WindowsPrincipal.cs
 System.Text/ASCIIEncoding.cs
 System.Text/Decoder.cs
+System.Text/DecoderExceptionFallback.cs
+System.Text/DecoderExceptionFallbackBuffer.cs
+System.Text/DecoderFallback.cs
+System.Text/DecoderFallbackBuffer.cs
+System.Text/DecoderFallbackException.cs
+System.Text/DecoderReplacementFallback.cs
+System.Text/DecoderReplacementFallbackBuffer.cs
 System.Text/Encoder.cs
 System.Text/Encoding.cs
 System.Text/Latin1Encoding.cs