Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2009-03-13 09:59:28 +0300
committerAtsushi Eno <atsushieno@gmail.com>2009-03-13 09:59:28 +0300
commit019345956c3f32ac219941551e10d325ca702868 (patch)
tree8059b3837fb0bdbe67ffbe259cfc3d1672cbfe95 /mcs/class/System.XML/System.Xml.Serialization
parent834e1535170f2d722088deeed371fe6b204f780c (diff)
2009-03-13 Atsushi Enomoto <atsushi@ximian.com>
* SerializationSource.cs, KeyHelper.cs : split out KeyHelper from SerializationSource as the class is going to be used in 2.1 too. * XmlRootAttribute.cs : use KeyHelper above to add internal Key property that is used in SL2 System.Xml.Serialization.dll. * System.Xml.dll.sources, net_2_1_raw_System.Xml.dll.sources : added KeyHelper.cs. svn path=/trunk/mcs/; revision=129243
Diffstat (limited to 'mcs/class/System.XML/System.Xml.Serialization')
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/ChangeLog7
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/KeyHelper.cs80
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SerializationSource.cs43
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs12
4 files changed, 97 insertions, 45 deletions
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
index 4f3fe947bae..7f32c1c3821 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -1,3 +1,10 @@
+2009-03-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SerializationSource.cs, KeyHelper.cs : split out KeyHelper from
+ SerializationSource as the class is going to be used in 2.1 too.
+ * XmlRootAttribute.cs : use KeyHelper above to add internal Key
+ property that is used in SL2 System.Xml.Serialization.dll.
+
2009-02-19 Geoff Norton <gnorton@novell.com>
* SerializationSource.cs: KeyHelper is needed by
diff --git a/mcs/class/System.XML/System.Xml.Serialization/KeyHelper.cs b/mcs/class/System.XML/System.Xml.Serialization/KeyHelper.cs
new file mode 100644
index 00000000000..7945b07f361
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/KeyHelper.cs
@@ -0,0 +1,80 @@
+//
+// System.Xml.Serialization.KeyHelper.cs
+//
+// Author:
+// Lluis Sanchez Gual (lluis@ximian.com)
+//
+// Copyright (C) 2004 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+using System.Collections;
+using System.Globalization;
+using System.Text;
+
+namespace System.Xml.Serialization
+{
+ internal class KeyHelper
+ {
+ public static void AddField (StringBuilder sb, int n, string val)
+ {
+ AddField (sb, n, val, null);
+ }
+
+ public static void AddField (StringBuilder sb, int n, string val, string def)
+ {
+ if (val != def) {
+ sb.Append (n.ToString());
+ sb.Append (val.Length.ToString(CultureInfo.InvariantCulture));
+ sb.Append (val);
+ }
+ }
+
+ public static void AddField (StringBuilder sb, int n, bool val)
+ {
+ AddField (sb, n, val, false);
+ }
+
+ public static void AddField (StringBuilder sb, int n, bool val, bool def)
+ {
+ if (val != def)
+ sb.Append (n.ToString());
+ }
+
+ public static void AddField (StringBuilder sb, int n, int val, int def)
+ {
+ if (val != def) {
+ sb.Append (n.ToString());
+ sb.Append (val.ToString(CultureInfo.InvariantCulture));
+ }
+ }
+
+ public static void AddField (StringBuilder sb, int n, Type val)
+ {
+ if (val != null) {
+ sb.Append (n.ToString(CultureInfo.InvariantCulture));
+ sb.Append (val.ToString());
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SerializationSource.cs b/mcs/class/System.XML/System.Xml.Serialization/SerializationSource.cs
index 8f1b9115055..0816f42cfc2 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/SerializationSource.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/SerializationSource.cs
@@ -189,48 +189,5 @@ namespace System.Xml.Serialization
}
#endif
- internal class KeyHelper
- {
- public static void AddField (StringBuilder sb, int n, string val)
- {
- AddField (sb, n, val, null);
- }
-
- public static void AddField (StringBuilder sb, int n, string val, string def)
- {
- if (val != def) {
- sb.Append (n.ToString());
- sb.Append (val.Length.ToString(CultureInfo.InvariantCulture));
- sb.Append (val);
- }
- }
-
- public static void AddField (StringBuilder sb, int n, bool val)
- {
- AddField (sb, n, val, false);
- }
-
- public static void AddField (StringBuilder sb, int n, bool val, bool def)
- {
- if (val != def)
- sb.Append (n.ToString());
- }
-
- public static void AddField (StringBuilder sb, int n, int val, int def)
- {
- if (val != def) {
- sb.Append (n.ToString());
- sb.Append (val.ToString(CultureInfo.InvariantCulture));
- }
- }
-
- public static void AddField (StringBuilder sb, int n, Type val)
- {
- if (val != null) {
- sb.Append (n.ToString(CultureInfo.InvariantCulture));
- sb.Append (val.ToString());
- }
- }
- }
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
index f56378f3813..d909bbf48eb 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
@@ -29,6 +29,7 @@
//
using System;
+using System.Text;
namespace System.Xml.Serialization
{
@@ -83,7 +84,7 @@ namespace System.Xml.Serialization
get { return ns; }
set { ns = value; }
}
-#if !NET_2_1
+
internal void AddKeyHash (System.Text.StringBuilder sb)
{
sb.Append ("XRA ");
@@ -93,6 +94,13 @@ namespace System.Xml.Serialization
KeyHelper.AddField (sb, 4, isNullable);
sb.Append ('|');
}
-#endif
+
+ internal string Key {
+ get {
+ var sb = new StringBuilder ();
+ AddKeyHash (sb);
+ return sb.ToString ();
+ }
+ }
}
}