Browse Source

Stubbed CppTypeInfo.Cast<TBase>(ICppObject subClass)

pull/1/head
Alex Corrado 14 years ago
parent
commit
cc5623da09
  1. 2
      src/Mono.VisualC.Interop/ABI/CppAbi.cs
  2. 2
      src/Mono.VisualC.Interop/ABI/Impl/ItaniumAbi.cs
  3. 2
      src/Mono.VisualC.Interop/ABI/Impl/MsvcAbi.cs
  4. 4
      src/Mono.VisualC.Interop/ABI/Impl/MsvcTypeInfo.cs
  5. 12
      src/Mono.VisualC.Interop/CppTypeInfo.cs

2
src/Mono.VisualC.Interop/ABI/CppAbi.cs

@ -136,7 +136,7 @@ namespace Mono.VisualC.Interop.ABI { @@ -136,7 +136,7 @@ namespace Mono.VisualC.Interop.ABI {
protected virtual CppTypeInfo MakeTypeInfo (IEnumerable<PInvokeSignature> methods)
{
return new CppTypeInfo (this, methods.Where (m => IsVirtual (m.OrigMethod)), layout_type);
return new CppTypeInfo (this, methods.Where (m => IsVirtual (m.OrigMethod)), layout_type, wrapper_type);
}
protected virtual IEnumerable<PropertyInfo> GetProperties ()

2
src/Mono.VisualC.Interop/ABI/Impl/ItaniumAbi.cs

@ -55,7 +55,7 @@ namespace Mono.VisualC.Interop.ABI { @@ -55,7 +55,7 @@ namespace Mono.VisualC.Interop.ABI {
protected override CppTypeInfo MakeTypeInfo (IEnumerable<PInvokeSignature> methods)
{
return new CppTypeInfo (this, GetVirtualMethodSlots (methods), layout_type);
return new CppTypeInfo (this, GetVirtualMethodSlots (methods), layout_type, wrapper_type);
}
private IEnumerable<PInvokeSignature> GetVirtualMethodSlots (IEnumerable<PInvokeSignature> methods)

2
src/Mono.VisualC.Interop/ABI/Impl/MsvcAbi.cs

@ -49,7 +49,7 @@ namespace Mono.VisualC.Interop.ABI { @@ -49,7 +49,7 @@ namespace Mono.VisualC.Interop.ABI {
protected override CppTypeInfo MakeTypeInfo (IEnumerable<PInvokeSignature> methods)
{
return new MsvcTypeInfo (this, methods.Where (m => IsVirtual (m.OrigMethod)), layout_type);
return new MsvcTypeInfo (this, methods.Where (m => IsVirtual (m.OrigMethod)), layout_type, wrapper_type);
}
public override CallingConvention? GetCallingConvention (MethodInfo methodInfo)

4
src/Mono.VisualC.Interop/ABI/Impl/MsvcTypeInfo.cs

@ -33,8 +33,8 @@ using Mono.VisualC.Interop.Util; @@ -33,8 +33,8 @@ using Mono.VisualC.Interop.Util;
namespace Mono.VisualC.Interop.ABI {
public class MsvcTypeInfo : CppTypeInfo {
public MsvcTypeInfo (MsvcAbi abi, IEnumerable<PInvokeSignature> virtualMethods, Type nativeLayout)
: base (abi, virtualMethods, nativeLayout)
public MsvcTypeInfo (MsvcAbi abi, IEnumerable<PInvokeSignature> virtualMethods, Type nativeLayout, Type wrapperType)
: base (abi, virtualMethods, nativeLayout, wrapperType)
{
}

12
src/Mono.VisualC.Interop/CppTypeInfo.cs

@ -44,7 +44,8 @@ namespace Mono.VisualC.Interop { @@ -44,7 +44,8 @@ namespace Mono.VisualC.Interop {
public class CppTypeInfo {
public CppAbi Abi { get; private set; }
public Type NativeLayout {get; private set; }
public Type NativeLayout { get; private set; }
public Type WrapperType { get; private set; }
public IList<PInvokeSignature> VirtualMethods { get; private set; } // read only version
protected List<PInvokeSignature> virtual_methods;
@ -69,10 +70,11 @@ namespace Mono.VisualC.Interop { @@ -69,10 +70,11 @@ namespace Mono.VisualC.Interop {
private VTable lazy_vtable;
public CppTypeInfo (CppAbi abi, IEnumerable<PInvokeSignature> virtualMethods, Type nativeLayout)
public CppTypeInfo (CppAbi abi, IEnumerable<PInvokeSignature> virtualMethods, Type nativeLayout, Type/*?*/ wrapperType)
{
Abi = abi;
NativeLayout = nativeLayout;
WrapperType = wrapperType;
virtual_methods = new List<PInvokeSignature> (virtualMethods);
VirtualMethods = new ReadOnlyCollection<PInvokeSignature> (virtual_methods);
@ -130,6 +132,12 @@ namespace Mono.VisualC.Interop { @@ -130,6 +132,12 @@ namespace Mono.VisualC.Interop {
(addVTablePointer? baseType.FieldOffsetPadding : baseType.field_offset_padding_without_vtptr);
}
public virtual TBase Cast<TBase> (ICppObject instance)
where TBase : ICppObject
{
throw new NotImplementedException ();
}
public int CountBases (Func<CppTypeInfo, bool> predicate)
{
int count = 0;

Loading…
Cancel
Save