2005-11-28 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 28 Nov 2005 05:10:05 +0000 (05:10 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 28 Nov 2005 05:10:05 +0000 (05:10 -0000)
* Encoding.cs : added UTF32.

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

mcs/class/corlib/System.Text/ChangeLog
mcs/class/corlib/System.Text/Encoding.cs

index 72dc4bb7d27f6f471e82295e748735e2609d9726..498c9a73418df32f296996191953ea13ccd952db 100644 (file)
@@ -1,3 +1,7 @@
+2005-11-28  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Encoding.cs : added UTF32.
+
 2005-11-28  Atsushi Enomoto  <atsushi@ximian.com>
 
        * UTF32Encoding.cs : surrogate pairs vanished in GetBytes() when the 
index 85f97043a5f351ef069d5cef78c79c4f0a13ab7e..1a141c0a56f7563ae50de41eb9bc3cb5f149e588 100644 (file)
@@ -405,6 +405,11 @@ public abstract class Encoding
                        case UTF8Encoding.UTF8_CODE_PAGE:
                                return UTF8;
 
+#if NET_2_0
+                       case UTF32Encoding.UTF32_CODE_PAGE:
+                               return UTF32;
+#endif
+
                        case UnicodeEncoding.UNICODE_CODE_PAGE:
                                return Unicode;
 
@@ -514,6 +519,14 @@ public abstract class Encoding
                        UnicodeEncoding.BIG_UNICODE_CODE_PAGE,
                        "unicodefffe", "utf_16be",
 
+#if NET_2_0
+                       UTF32Encoding.UTF32_CODE_PAGE,
+                       "utf_32", "UTF_32LE", "ucs_4",
+
+                       UTF32Encoding.BIG_UTF32_CODE_PAGE,
+                       "UTF_32BE",
+#endif
+
                        Latin1Encoding.ISOLATIN_CODE_PAGE,
                        "iso_8859_1", "latin1"
                };
@@ -707,7 +720,10 @@ public abstract class Encoding
        static volatile Encoding unicodeEncoding;
        static volatile Encoding isoLatin1Encoding;
        static volatile Encoding unixConsoleEncoding;
-       
+#if NET_2_0
+       static volatile Encoding utf32Encoding;
+#endif
+
        static readonly object lockobj = new object ();
 
        // Get the standard ASCII encoding object.
@@ -878,6 +894,25 @@ public abstract class Encoding
                }
        }
 
+#if NET_2_0
+       // Get the standard little-endian UTF-32 encoding object.
+       public static Encoding UTF32
+       {
+               get {
+                       if (utf32Encoding == null) {
+                               lock (lockobj) {
+                                       if (utf32Encoding == null) {
+                                               utf32Encoding = new UTF32Encoding (false, true);
+                                               utf32Encoding.is_readonly = true;
+                                       }
+                               }
+                       }
+
+                       return utf32Encoding;
+               }
+       }
+#endif
+
        // Forwarding decoder implementation.
        private sealed class ForwardingDecoder : Decoder
        {