Author: joncham
Date: 2007-04-24 08:13:23 -0400 (Tue, 24 Apr 2007)
New Revision: 76183
Added:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ChangeLog
Modified:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumerableToDispatchMarshaler.cs
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ExpandoToDispatchExMarshaler.cs
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/TypeToTypeInfoMarshaler.cs
Log:
2007-04-24 Jonathan Chambers <[EMAIL PROTECTED]>
* EnumeratorToEnumVariantMarshaler.cs: Implement.
Added:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ChangeLog
===================================================================
---
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ChangeLog
2007-04-24 12:11:23 UTC (rev 76182)
+++
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ChangeLog
2007-04-24 12:13:23 UTC (rev 76183)
@@ -0,0 +1,3 @@
+2007-04-24 Jonathan Chambers <[EMAIL PROTECTED]>
+
+ * EnumeratorToEnumVariantMarshaler.cs: Implement.
Property changes on:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ChangeLog
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumerableToDispatchMarshaler.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs
===================================================================
---
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs
2007-04-24 12:11:23 UTC (rev 76182)
+++
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs
2007-04-24 12:13:23 UTC (rev 76183)
@@ -3,8 +3,10 @@
//
// Authors:
// Martin Willemoes Hansen ([EMAIL PROTECTED])
+// Jonathan Chambers ([EMAIL PROTECTED])
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2007 Jonathan Chambers
//
//
@@ -28,43 +30,91 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
namespace System.Runtime.InteropServices.CustomMarshalers
{
- public class EnumeratorToEnumVariantMarshaler : ICustomMarshaler {
- [MonoTODO]
- public void CleanUpManagedData (object pManagedObj)
- {
- throw new NotImplementedException();
+ public class EnumeratorToEnumVariantMarshaler : ICustomMarshaler
+ {
+ static EnumeratorToEnumVariantMarshaler instance;
+ public void CleanUpManagedData (object pManagedObj) {
+ throw new NotImplementedException ();
}
- [MonoTODO]
- public void CleanUpNativeData (IntPtr pNativeData)
- {
- throw new NotImplementedException();
+ public void CleanUpNativeData (IntPtr pNativeData) {
+ Marshal.Release (pNativeData);
}
- [MonoTODO]
- public static ICustomMarshaler GetInstance (string pstrCookie)
- {
- throw new NotImplementedException();
+ public static ICustomMarshaler GetInstance (string pstrCookie) {
+ if (instance == null)
+ instance = new EnumeratorToEnumVariantMarshaler
();
+ return instance;
}
- [MonoTODO]
- public int GetNativeDataSize()
- {
- throw new NotImplementedException();
+ public int GetNativeDataSize () {
+ throw new NotImplementedException ();
}
- [MonoTODO]
- public IntPtr MarshalManagedToNative (object pManagedObj)
+ public IntPtr MarshalManagedToNative (object pManagedObj) {
+ throw new NotImplementedException ();
+ }
+
+ public object MarshalNativeToManaged (IntPtr pNativeData) {
+ IEnumVARIANT ienumvariant =
(IEnumVARIANT)Marshal.GetObjectForIUnknown (pNativeData);
+ VARIANTEnumerator e = new VARIANTEnumerator
(ienumvariant);
+ return e;
+ }
+
+ [ComImport]
+ [Guid ("00020404-0000-0000-C000-000000000046")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ interface IEnumVARIANT
{
- throw new NotImplementedException();
+ [MethodImpl (MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
+ void Next (int celt, [MarshalAs
(UnmanagedType.Struct)]out object rgvar, out uint pceltFetched);
+ [MethodImpl (MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
+ void Skip (uint celt);
+ [MethodImpl (MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
+ void Reset ();
+ [return: MarshalAs (UnmanagedType.Interface)]
+ [MethodImpl (MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime)]
+ IEnumVARIANT Clone ();
+
}
- [MonoTODO]
- public object MarshalNativeToManaged (IntPtr pNativeData)
+ class VARIANTEnumerator : IEnumerator
{
- throw new NotImplementedException();
+ IEnumVARIANT com_enum;
+ object current;
+ public VARIANTEnumerator (IEnumVARIANT com_enum) {
+ this.com_enum = com_enum;
+ }
+ #region IEnumerator Members
+
+ public object Current {
+ get {
+ return current;
+ }
+ }
+
+ public bool MoveNext () {
+ object val;
+ uint fetched = 0;
+ com_enum.Next (1, out val, out fetched);
+ if (fetched == 0)
+ return false;
+ current = val;
+ return true;
+ }
+
+ public void Reset () {
+ com_enum.Reset ();
+ }
+
+ #endregion
}
}
}
Property changes on:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/ExpandoToDispatchExMarshaler.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/CustomMarshalers/System.Runtime.InteropServices.CustomMarshalers/TypeToTypeInfoMarshaler.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches