Mon Jun 30 19:12:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Mon, 30 Jun 2003 17:21:47 +0000 (17:21 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Mon, 30 Jun 2003 17:21:47 +0000 (17:21 -0000)
* Pointer.cs: implemented.

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

mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/Pointer.cs [new file with mode: 0755]
mcs/class/corlib/unix.args

index 6270109069eacfbbbaf5ad0759416f4157b6d2f7..94464d858271e50eb945a7e1f834d394c666a914 100644 (file)
@@ -1,3 +1,8 @@
+
+Mon Jun 30 19:12:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
+
+       * Pointer.cs: implemented.
+
 2003-06-15  Zoltan Varga  <vargaz@freemail.hu>
 
        * EventInfo.cs: Implement IsSpecialName.
diff --git a/mcs/class/corlib/System.Reflection/Pointer.cs b/mcs/class/corlib/System.Reflection/Pointer.cs
new file mode 100755 (executable)
index 0000000..c892f41
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// System.Reflection/Pointer.cs
+//
+// Author:
+//   Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2003 Ximian, Inc.  http://www.ximian.com
+//
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+
+namespace System.Reflection {
+
+       [Serializable]
+       [CLSCompliant(false)]
+       public unsafe sealed class Pointer : ISerializable {
+
+               void *data;
+               Type type;
+
+               private Pointer () {
+               }
+               
+               public static Pointer Box (void *ptr, Type type) 
+               {
+
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+                       if (!type.IsPointer)
+                               throw new ArgumentException ("type");
+                       Pointer res = new Pointer ();
+                       res.data = ptr;
+                       res.type = type;
+                       return res;
+               }
+
+               public static void* Unbox (object ptr)
+               {
+                       Pointer p = ptr as Pointer;
+                       if (p == null)
+                               throw new ArgumentException ("ptr");
+                       return p.data;
+               }
+
+               void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       throw new NotSupportedException ("Pointer deserializatioon not supported.");
+               }
+       }
+}
index af14fd301d3fae0c0605cee3441b1a107f19cd25..9c7ea088d5b96428c7e38cd42f634e3d449db0e7 100755 (executable)
@@ -341,6 +341,7 @@ System.Reflection/MonoProperty.cs
 System.Reflection/ParameterAttributes.cs
 System.Reflection/ParameterInfo.cs
 System.Reflection/ParameterModifier.cs
+System.Reflection/Pointer.cs
 System.Reflection/PropertyAttributes.cs
 System.Reflection/PropertyInfo.cs
 System.Reflection/ReflectionTypeLoadException.cs