[Mono-devel-list] Patch for System.ComponentModel.Design.Serialization namespace

A-Soft Technologies A-Soft at A-SoftTech.com
Thu Jun 12 16:27:01 EDT 2003


Hi,

it's me again. Here is the rest of the System.ComponentModel namespace:
System.ComponentModel.Design.Serialization
As always: Most implementations are complete (I think there should only
remain a single MonoTODO in that namespace)
Could someone review and commit it?

also attatched is a Changelog file that should go into the directory for
System.ComponentModel.Design.Serialization (does not exist yet)

A.Nahr


Index: ContextStack.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel.Design.Serialization/ContextSta
ck.cs,v
retrieving revision 1.2
diff -u -r1.2 ContextStack.cs
--- ContextStack.cs 29 Mar 2003 18:43:37 -0000 1.2
+++ ContextStack.cs 12 Jun 2003 20:25:10 -0000
@@ -1,44 +1,72 @@
+//
 // System.ComponentModel.Design.Serialization.ContextStack.cs
 //
 // Author:
-//      Alejandro Sánchez Acosta   <raciel at gnome.org>
+//  Alejandro Sánchez Acosta   <raciel at gnome.org>
+//  Andreas Nahr (ClassDevelopment at A-SoftTech.com)
 //
 // (C) Alejandro Sánchez Acosta
+// (C) 2003 Andreas Nahr
 //

 using System.Collections;

 namespace System.ComponentModel.Design.Serialization
 {
-        public sealed class ContextStack
-        {
-  public ArrayList list;
+    public sealed class ContextStack
+    {
+        private Stack stack;

-                public ContextStack () {
-                        list = new ArrayList ();
-                }
+        public ContextStack ()
+        {
+            stack = new Stack ();
+        }

-                public object Current {
-                        get {
-                                if (list.Count == 0) return null;
-                                return list [list.Count - 1];
-                        }
-
-   set {
-     list.Add (value);
-                        }
+        public object Current
+        {
+            get
+            {
+                try
+                {
+                    return stack.Peek ();
                 }
-
-                [MonoTODO]
-  public object this[Type type] {
-                        get { throw new NotImplementedException ();}
-                        set { throw new NotImplementedException ();}
+                catch
+                {
+                    return null;
                 }
+            }
+        }

-                [MonoTODO]
-                public object this[int level] {
-                        get { throw new NotImplementedException ();}
-                        set { throw new NotImplementedException ();}
-                }
- }
+        public object this[Type type]
+        {
+            get {
+                foreach (object o in stack.ToArray())
+                    if (o.GetType () == type)
+                        return o;
+                return null;
+            }
+        }
+
+        public object this[int level]
+        {
+            get {
+                if (level < 0)
+                    throw new ArgumentException ("level has to be >=
0","level");
+                Array A = stack.ToArray();
+                if (level > (A.Length - 1))
+                    return null;
+                return A.GetValue(level);
+            }
+        }
+
+        public object Pop ()
+        {
+            return stack.Pop ();
+        }
+
+        public void Push (object context)
+        {
+            stack.Push (context);
+        }
+    }
 }
Index: DesignerLoader.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel.Design.Serialization/DesignerLo
ader.cs,v
retrieving revision 1.2
diff -u -r1.2 DesignerLoader.cs
--- DesignerLoader.cs 27 Mar 2003 21:04:16 -0000 1.2
+++ DesignerLoader.cs 12 Jun 2003 20:25:10 -0000
@@ -1,37 +1,32 @@
 //
-// System.ComponentModel.Design.Serialization.DesignerLoader
+// System.ComponentModel.Design.Serialization.DesignerLoader.cs
 //
 // Authors:
-//      Martin Willemoes Hansen (mwh at sysrq.dk)
+//  Martin Willemoes Hansen (mwh at sysrq.dk)
+//  Andreas Nahr (ClassDevelopment at A-SoftTech.com)
 //
 // (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
 //

 namespace System.ComponentModel.Design.Serialization
 {
+    // This class is merely an interface with no implementation needed
  public abstract class DesignerLoader
  {
-  [MonoTODO]
+
   protected DesignerLoader()
   {
   }

   public virtual bool Loading {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
+   get { return false; }
   }

   public abstract void BeginLoad (IDesignerLoaderHost host);
   public abstract void Dispose();

-  [MonoTODO]
   public virtual void Flush()
-  {
-   throw new NotImplementedException();
-  }
-
-  [MonoTODO]
-  ~DesignerLoader()
   {
   }
  }
Index: DesignerSerializerAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel.Design.Serialization/DesignerSe
rializerAttribute.cs,v
retrieving revision 1.2
diff -u -r1.2 DesignerSerializerAttribute.cs
--- DesignerSerializerAttribute.cs 27 Mar 2003 21:04:16 -0000 1.2
+++ DesignerSerializerAttribute.cs 12 Jun 2003 20:25:10 -0000
@@ -2,54 +2,51 @@
 //
System.ComponentModel.Design.Serialization.DesignerSerializerAttribute.cs
 //
 // Authors:
-//      Martin Willemoes Hansen (mwh at sysrq.dk)
+//  Martin Willemoes Hansen (mwh at sysrq.dk)
+//  Andreas Nahr (ClassDevelopment at A-SoftTech.com)
 //
 // (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
 //

 namespace System.ComponentModel.Design.Serialization
 {
- [AttributeUsage(AttributeTargets.Class |
-   AttributeTargets.Interface)]
-        public sealed class DesignerSerializerAttribute : Attribute
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
+    public sealed class DesignerSerializerAttribute : Attribute
  {
-  [MonoTODO]
+
+        private string serializerTypeName;
+        private string baseSerializerTypeName;
+
   public DesignerSerializerAttribute (string serializerTypeName,
-          string baseSerializerTypeName)
+   string baseSerializerTypeName)
   {
+            this.serializerTypeName = serializerTypeName;
+            this.baseSerializerTypeName = baseSerializerTypeName;
   }

-  [MonoTODO]
   public DesignerSerializerAttribute (string serializerTypeName,
-          Type baseSerializerType)
+   Type baseSerializerType)
+            : this (serializerTypeName,
baseSerializerType.AssemblyQualifiedName)
   {
   }

-  [MonoTODO]
   public DesignerSerializerAttribute (Type serializerType,
-          Type baseSerializerType)
+   Type baseSerializerType)
+            : this (serializerType.AssemblyQualifiedName,
baseSerializerType.AssemblyQualifiedName)
   {
   }

   public string SerializerBaseTypeName {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
+   get { return baseSerializerTypeName; }
   }

   public string SerializerTypeName {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
+   get { return serializerTypeName; }
   }

   public override object TypeId {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
-  }
-
-  [MonoTODO]
-  public override int GetHashCode()
-  {
-   throw new NotImplementedException();
+   get { return string.Concat (this.ToString(), baseSerializerTypeName); }
   }
  }
 }
Index: InstanceDescriptor.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel.Design.Serialization/InstanceDe
scriptor.cs,v
retrieving revision 1.2
diff -u -r1.2 InstanceDescriptor.cs
--- InstanceDescriptor.cs 27 Mar 2003 21:04:16 -0000 1.2
+++ InstanceDescriptor.cs 12 Jun 2003 20:25:11 -0000
@@ -1,10 +1,12 @@
 //
-// System.ComponentModel.Design.Serialization.InstanceDescriptor
+// System.ComponentModel.Design.Serialization.InstanceDescriptor.cs
 //
 // Authors:
-//      Martin Willemoes Hansen (mwh at sysrq.dk)
+//  Martin Willemoes Hansen (mwh at sysrq.dk)
+//  Andreas Nahr (ClassDevelopment at A-SoftTech.com)
 //
 // (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
 //

 using System.Collections;
@@ -14,44 +16,40 @@
 {
  public sealed class InstanceDescriptor
  {
-  [MonoTODO]
-  public InstanceDescriptor (MemberInfo info,
-        ICollection collection)
+        private MemberInfo member;
+        private ICollection arguments;
+        private bool isComplete;
+
+
+  public InstanceDescriptor (MemberInfo member, ICollection arguments)
+            : this (member, arguments, true)
   {
   }

-  [MonoTODO]
-  public InstanceDescriptor(MemberInfo info,
-       ICollection coolection,
-       bool boolean)
+  public InstanceDescriptor(MemberInfo member,
+   ICollection arguments, bool isComplete)
   {
-   throw new NotImplementedException();
+            this.member = member;
+            this.arguments = arguments;
+            this.isComplete = isComplete;
   }

   public ICollection Arguments {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
+   get { return arguments; }
   }

   public bool IsComplete {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
+   get { return isComplete; }
   }

   public MemberInfo MemberInfo {
-   [MonoTODO]
-   get { throw new NotImplementedException(); }
+   get { return member; }
   }

   [MonoTODO]
   public object Invoke()
   {
    throw new NotImplementedException();
-  }
-
-  [MonoTODO]
-  ~InstanceDescriptor()
-  {
   }
  }
 }
Index: ResolveNameEventArgs.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel.Design.Serialization/ResolveNam
eEventArgs.cs,v
retrieving revision 1.2
diff -u -r1.2 ResolveNameEventArgs.cs
--- ResolveNameEventArgs.cs 29 Mar 2003 18:43:38 -0000 1.2
+++ ResolveNameEventArgs.cs 12 Jun 2003 20:25:11 -0000
@@ -1,3 +1,4 @@
+//
 // System.ComponentModel.Design.Serialization.ResolveNameEventArgs.cs
 //
 // Author:
@@ -10,7 +11,7 @@
 {
  public class ResolveNameEventArgs : EventArgs
  {
-  public string name;
+  private string name;

   public ResolveNameEventArgs (string name) {
    this.name = name;
Index: RootDesignerSerializerAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel.Design.Serialization/RootDesign
erSerializerAttribute.cs,v
retrieving revision 1.3
diff -u -r1.3 RootDesignerSerializerAttribute.cs
--- RootDesignerSerializerAttribute.cs 29 Mar 2003 18:43:38 -0000 1.3
+++ RootDesignerSerializerAttribute.cs 12 Jun 2003 20:25:11 -0000
@@ -1,9 +1,12 @@
+//
 //
System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute.c
s
 //
-// Author:
+// Authors:
 //  Alejandro Sánchez Acosta   <raciel at gnome.org>
+//  Andreas Nahr (ClassDevelopment at A-SoftTech.com)
 //
 // (C) Alejandro Sánchez Acosta
+// (C) 2003 Andreas Nahr
 //

 namespace System.ComponentModel.Design.Serialization
@@ -13,8 +16,6 @@
  {
   private string serializer;
   private string baseserializer;
-  private Type basetypeserializer;
-  private Type serializertype;
   private bool reload;

   public RootDesignerSerializerAttribute (string serializerTypeName, string
baseSerializerTypeName, bool reloadable) {
@@ -23,57 +24,36 @@
    this.reload = reloadable;
   }

-  public RootDesignerSerializerAttribute (string serializerTypeName, Type
baseSerializerType, bool reloadable) {
-   this.serializer = serializerTypeName;
-   this.basetypeserializer = baseSerializerType;
-   this.reload = reloadable;
+  public RootDesignerSerializerAttribute (string serializerTypeName, Type
baseSerializerType, bool reloadable)
+            : this (serializerTypeName,
baseSerializerType.AssemblyQualifiedName, reloadable)
+        {
   }

-  public RootDesignerSerializerAttribute (Type serializerType, Type
baseSerializerType, bool reloadable) {
-   this.serializertype = serializerType;
-   this.basetypeserializer = baseSerializerType;
-   this.reload = reloadable;
+  public RootDesignerSerializerAttribute (Type serializerType, Type
baseSerializerType, bool reloadable)
+            : this (serializerType.AssemblyQualifiedName,
baseSerializerType.AssemblyQualifiedName, reloadable)
+        {
   }

   public bool Reloadable {
    get {
     return this.reload;
    }
-
-   set {
-    this.reload = value;
-   }
   }

   public string SerializerBaseTypeName {
    get {
     return this.baseserializer;
    }
-
-   set {
-    this.baseserializer = value;
-   }
   }

   public string SerializerTypeName {
    get {
     return this.serializer;
    }
-
-   set {
-    serializer = value;
-   }
   }

-  [MonoTODO]
   public override object TypeId {
-   get { throw new NotImplementedException ();}
-  }
-
-  [MonoTODO]
-  public override int GetHashCode()
-  {
-   throw new NotImplementedException();
+   get { return string.Concat (this.ToString(), baseserializer);}
   }
  }
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Changelog
Type: application/octet-stream
Size: 379 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030612/e038d4e5/attachment.obj 


More information about the Mono-devel-list mailing list