diff --git a/src/Core/Parser/ASTConverter.cs b/src/Core/Parser/ASTConverter.cs index 3c491929..8da4fa1f 100644 --- a/src/Core/Parser/ASTConverter.cs +++ b/src/Core/Parser/ASTConverter.cs @@ -957,8 +957,6 @@ namespace CppSharp expression.Declaration = typeConverter.declConverter.Visit(statement.Decl); expression.String = statement.String; - NativeObjects.Add(statement); - return expression; } @@ -1314,8 +1312,6 @@ namespace CppSharp _layout.VFTables.Add(_vftableInfo); } - NativeObjects.Add(layout); - return _layout; } diff --git a/src/CppParser/AST.cpp b/src/CppParser/AST.cpp index 64f0eef3..a03eb9b0 100644 --- a/src/CppParser/AST.cpp +++ b/src/CppParser/AST.cpp @@ -178,6 +178,10 @@ Declaration::Declaration(const Declaration& rhs) { } +Declaration::~Declaration() +{ +} + DEF_STRING(Declaration, Name) DEF_STRING(Declaration, DebugText) DEF_VECTOR(Declaration, PreprocessedEntity*, PreprocessedEntities) @@ -492,6 +496,12 @@ DEF_VECTOR(CXXConstructExpr, Expression*, Arguments) Parameter::Parameter() : Declaration(DeclarationKind::Parameter), IsIndirect(false), HasDefaultValue(false), DefaultArgument(0) {} +Parameter::~Parameter() +{ + if (DefaultArgument) + delete DefaultArgument; +} + Function::Function() : Declaration(DeclarationKind::Function) , IsReturnIndirect(false) @@ -569,6 +579,12 @@ Class::Class() { } +Class::~Class() +{ + if (Layout) + delete Layout; +} + DEF_VECTOR(Class, BaseClassSpecifier*, Bases) DEF_VECTOR(Class, Field*, Fields) DEF_VECTOR(Class, Method*, Methods) diff --git a/src/CppParser/AST.h b/src/CppParser/AST.h index ceb4597e..37772206 100644 --- a/src/CppParser/AST.h +++ b/src/CppParser/AST.h @@ -387,6 +387,7 @@ class CS_API Declaration public: Declaration(DeclarationKind kind); Declaration(const Declaration&); + ~Declaration(); DeclarationKind Kind; AccessSpecifier Access; @@ -522,6 +523,7 @@ class CS_API Parameter : public Declaration { public: Parameter(); + ~Parameter(); CppSharp::CppParser::AST::QualifiedType QualifiedType; bool IsIndirect; @@ -709,6 +711,7 @@ class CS_API Class : public DeclarationContext { public: Class(); + ~Class(); VECTOR(BaseClassSpecifier*, Bases) VECTOR(Field*, Fields) diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs index ab3e4196..fddc8734 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -266,8 +266,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Type __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -302,18 +303,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Type(CppSharp.Parser.AST.Type _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -323,20 +324,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Type __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TypeKind Kind @@ -356,12 +348,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } } @@ -372,13 +364,13 @@ namespace CppSharp public partial struct Internal { [FieldOffset(0)] - public bool IsConst; + public byte IsConst; [FieldOffset(1)] - public bool IsVolatile; + public byte IsVolatile; [FieldOffset(2)] - public bool IsRestrict; + public byte IsRestrict; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -388,8 +380,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TypeQualifiers __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -424,8 +417,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(3); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TypeQualifiers.Internal*) __Instance) = *((TypeQualifiers.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public TypeQualifiers() @@ -442,32 +435,23 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TypeQualifiers __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public bool IsConst { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -475,12 +459,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVolatile; + return ((Internal*) __Instance)->IsVolatile != 0; } set { - ((Internal*) __Instance)->IsVolatile = value; + ((Internal*) __Instance)->IsVolatile = (byte) (value ? 1 : 0); } } @@ -488,12 +472,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsRestrict; + return ((Internal*) __Instance)->IsRestrict != 0; } set { - ((Internal*) __Instance)->IsRestrict = value; + ((Internal*) __Instance)->IsRestrict = (byte) (value ? 1 : 0); } } } @@ -522,8 +506,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static QualifiedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -558,16 +543,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public QualifiedType(CppSharp.Parser.AST.QualifiedType _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((QualifiedType.Internal*) __Instance) = *((QualifiedType.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -577,20 +562,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.QualifiedType __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.Type Type @@ -634,7 +610,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -650,8 +626,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TagType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TagType((TagType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -686,8 +660,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TagType(CppSharp.Parser.AST.TagType _0) @@ -695,28 +669,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -747,7 +702,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; @@ -780,8 +735,6 @@ namespace CppSharp Incomplete = 3 } - private bool __ownsNativeInstance; - public static new ArrayType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ArrayType((ArrayType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -816,8 +769,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ArrayType(CppSharp.Parser.AST.ArrayType _0) @@ -825,28 +778,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -911,7 +845,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; @@ -955,8 +889,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionType((FunctionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -991,8 +923,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionType(CppSharp.Parser.AST.FunctionType _0) @@ -1000,28 +932,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -1091,7 +1004,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedPointee; @@ -1118,8 +1031,6 @@ namespace CppSharp RVReference = 3 } - private bool __ownsNativeInstance; - public static new PointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PointerType((PointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1154,8 +1065,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PointerType(CppSharp.Parser.AST.PointerType _0) @@ -1163,28 +1074,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedPointee @@ -1223,7 +1115,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Pointee; @@ -1239,8 +1131,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new MemberPointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MemberPointerType((MemberPointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1275,8 +1165,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MemberPointerType(CppSharp.Parser.AST.MemberPointerType _0) @@ -1284,28 +1174,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Pointee @@ -1331,7 +1202,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -1347,8 +1218,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TypedefType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefType((TypedefType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1383,8 +1252,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefType(CppSharp.Parser.AST.TypedefType _0) @@ -1392,28 +1261,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TypedefDecl Declaration @@ -1444,7 +1294,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Modified; @@ -1463,8 +1313,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new AttributedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AttributedType((AttributedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1499,8 +1347,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AttributedType(CppSharp.Parser.AST.AttributedType _0) @@ -1508,28 +1356,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Modified @@ -1568,7 +1397,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Decayed; @@ -1590,8 +1419,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DecayedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DecayedType((DecayedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1626,8 +1453,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DecayedType(CppSharp.Parser.AST.DecayedType _0) @@ -1635,28 +1462,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Decayed @@ -1741,8 +1549,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateArgument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1777,16 +1586,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateArgument(CppSharp.Parser.AST.TemplateArgument _0) { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TemplateArgument.Internal*) __Instance) = *((TemplateArgument.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1796,20 +1605,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateArgument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument.ArgumentKind Kind @@ -1879,7 +1679,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(20)] public global::System.IntPtr Template; @@ -1923,8 +1723,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateSpecializationType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateSpecializationType((TemplateSpecializationType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1959,8 +1757,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateSpecializationType(CppSharp.Parser.AST.TemplateSpecializationType _0) @@ -1968,28 +1766,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -2062,7 +1841,7 @@ namespace CppSharp public partial struct Internal { [FieldOffset(12)] - public bool IsTypeParameter; + public byte IsTypeParameter; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2083,7 +1862,7 @@ namespace CppSharp [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZNK8CppSharp9CppParser3AST17TemplateParametereqERKS2_")] [return: MarshalAsAttribute(UnmanagedType.I1)] - internal static extern bool OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); + internal static extern byte OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2098,8 +1877,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateParameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2134,17 +1914,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameter(CppSharp.Parser.AST.TemplateParameter _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -2154,22 +1934,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateParameter __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public static bool operator !=(CppSharp.Parser.AST.TemplateParameter __op, CppSharp.Parser.AST.TemplateParameter param) @@ -2186,7 +1956,7 @@ namespace CppSharp var arg0 = __op.__Instance; var arg1 = param.__Instance; var __ret = Internal.OperatorEqualEqual_0(arg0, arg1); - return __ret; + return __ret != 0; } public override bool Equals(object obj) @@ -2214,12 +1984,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsTypeParameter; + return ((Internal*) __Instance)->IsTypeParameter != 0; } set { - ((Internal*) __Instance)->IsTypeParameter = value; + ((Internal*) __Instance)->IsTypeParameter = (byte) (value ? 1 : 0); } } } @@ -2233,7 +2003,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.TemplateParameter.Internal Parameter; @@ -2245,7 +2015,7 @@ namespace CppSharp public uint Index; [FieldOffset(32)] - public bool IsParameterPack; + public byte IsParameterPack; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2263,8 +2033,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateParameterType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterType((TemplateParameterType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2299,8 +2067,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(36); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterType(CppSharp.Parser.AST.TemplateParameterType _0) @@ -2308,28 +2076,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(36); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter Parameter @@ -2375,12 +2124,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsParameterPack; + return ((Internal*) __Instance)->IsParameterPack != 0; } set { - ((Internal*) __Instance)->IsParameterPack = value; + ((Internal*) __Instance)->IsParameterPack = (byte) (value ? 1 : 0); } } } @@ -2394,7 +2143,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Replacement; @@ -2410,8 +2159,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TemplateParameterSubstitutionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterSubstitutionType((TemplateParameterSubstitutionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2446,8 +2193,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterSubstitutionType(CppSharp.Parser.AST.TemplateParameterSubstitutionType _0) @@ -2455,28 +2202,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Replacement @@ -2502,7 +2230,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr TemplateSpecialization; @@ -2521,8 +2249,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InjectedClassNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InjectedClassNameType((InjectedClassNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2557,8 +2283,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InjectedClassNameType(CppSharp.Parser.AST.InjectedClassNameType _0) @@ -2566,31 +2292,12 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization + public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization { get { @@ -2636,7 +2343,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2649,8 +2356,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DependentNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DependentNameType((DependentNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2685,8 +2390,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DependentNameType(CppSharp.Parser.AST.DependentNameType _0) @@ -2694,28 +2399,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2728,7 +2414,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2741,8 +2427,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new PackExpansionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PackExpansionType((PackExpansionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2777,8 +2461,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PackExpansionType(CppSharp.Parser.AST.PackExpansionType _0) @@ -2786,28 +2470,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2820,7 +2485,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.PrimitiveType Type; @@ -2836,8 +2501,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BuiltinType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BuiltinType((BuiltinType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2872,8 +2535,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BuiltinType(CppSharp.Parser.AST.BuiltinType _0) @@ -2881,28 +2544,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.PrimitiveType Type @@ -2946,8 +2590,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableComponent __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2982,16 +2627,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableComponent(CppSharp.Parser.AST.VTableComponent _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((VTableComponent.Internal*) __Instance) = *((VTableComponent.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3001,20 +2646,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableComponent __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponentKind Kind @@ -3105,8 +2741,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3141,17 +2778,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableLayout(CppSharp.Parser.AST.VTableLayout _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3161,22 +2798,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponent getComponents(uint i) @@ -3242,8 +2869,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VFTableInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3278,17 +2906,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VFTableInfo(CppSharp.Parser.AST.VFTableInfo _0) { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3298,22 +2926,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VFTableInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public ulong VBTableIndex @@ -3381,7 +2999,7 @@ namespace CppSharp public CppSharp.Parser.AST.VTableLayout.Internal Layout; [FieldOffset(28)] - public bool HasOwnVFPtr; + public byte HasOwnVFPtr; [FieldOffset(32)] public int VBPtrOffset; @@ -3433,8 +3051,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClassLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3469,17 +3088,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassLayout(CppSharp.Parser.AST.ClassLayout _0) { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3489,22 +3108,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ClassLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VFTableInfo getVFTables(uint i) @@ -3564,12 +3173,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasOwnVFPtr; + return ((Internal*) __Instance)->HasOwnVFPtr != 0; } set { - ((Internal*) __Instance)->HasOwnVFPtr = value; + ((Internal*) __Instance)->HasOwnVFPtr = (byte) (value ? 1 : 0); } } @@ -3653,10 +3262,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -3725,8 +3334,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Declaration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3761,18 +3371,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(92); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Declaration(CppSharp.Parser.AST.Declaration _0) { __Instance = Marshal.AllocHGlobal(92); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3782,22 +3392,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Declaration __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.PreprocessedEntity getPreprocessedEntities(uint i) @@ -3968,12 +3568,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIncomplete; + return ((Internal*) __Instance)->IsIncomplete != 0; } set { - ((Internal*) __Instance)->IsIncomplete = value; + ((Internal*) __Instance)->IsIncomplete = (byte) (value ? 1 : 0); } } @@ -3981,12 +3581,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } @@ -4062,10 +3662,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -4077,7 +3677,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -4255,8 +3855,6 @@ namespace CppSharp internal static extern uint getFriendsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new DeclarationContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DeclarationContext((DeclarationContext.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4291,9 +3889,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(204); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public DeclarationContext(CppSharp.Parser.AST.DeclarationContext _0) @@ -4301,28 +3899,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(204); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Namespace getNamespaces(uint i) @@ -4577,12 +4156,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAnonymous; + return ((Internal*) __Instance)->IsAnonymous != 0; } set { - ((Internal*) __Instance)->IsAnonymous = value; + ((Internal*) __Instance)->IsAnonymous = (byte) (value ? 1 : 0); } } } @@ -4614,10 +4193,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -4647,8 +4226,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TypedefDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefDecl((TypedefDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4683,8 +4260,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(100); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefDecl(CppSharp.Parser.AST.TypedefDecl _0) @@ -4692,28 +4269,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(100); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -4757,10 +4315,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -4790,8 +4348,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Friend __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Friend((Friend.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4826,8 +4382,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(96); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Friend(CppSharp.Parser.AST.Friend _0) @@ -4835,28 +4391,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(96); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -4912,8 +4449,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Statement __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -4948,9 +4486,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -4960,22 +4498,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Statement __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string String @@ -5048,8 +4576,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Expression __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Expression((Expression.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5084,28 +4610,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -5147,8 +4654,6 @@ namespace CppSharp internal static extern void setOpcodeStr_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new BinaryOperator __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BinaryOperator((BinaryOperator.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5183,28 +4688,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string OpcodeStr @@ -5302,8 +4788,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new CXXConstructExpr __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new CXXConstructExpr((CXXConstructExpr.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5338,28 +4822,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Expression getArguments(uint i) @@ -5421,10 +4886,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -5439,10 +4904,10 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; [FieldOffset(100)] - public bool IsIndirect; + public byte IsIndirect; [FieldOffset(101)] - public bool HasDefaultValue; + public byte HasDefaultValue; [FieldOffset(104)] public uint Index; @@ -5466,8 +4931,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Parameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Parameter((Parameter.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5502,8 +4965,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Parameter(CppSharp.Parser.AST.Parameter _0) @@ -5511,28 +4974,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -5552,12 +4996,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIndirect; + return ((Internal*) __Instance)->IsIndirect != 0; } set { - ((Internal*) __Instance)->IsIndirect = value; + ((Internal*) __Instance)->IsIndirect = (byte) (value ? 1 : 0); } } @@ -5565,12 +5009,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasDefaultValue; + return ((Internal*) __Instance)->HasDefaultValue != 0; } set { - ((Internal*) __Instance)->HasDefaultValue = value; + ((Internal*) __Instance)->HasDefaultValue = (byte) (value ? 1 : 0); } } @@ -5633,10 +5077,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -5651,22 +5095,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(100)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(101)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(102)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(103)] - public bool IsInline; + public byte IsInline; [FieldOffset(104)] - public bool IsPure; + public byte IsPure; [FieldOffset(105)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(108)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -5733,8 +5177,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Function __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Function((Function.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5769,8 +5211,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Function(CppSharp.Parser.AST.Function _0) @@ -5778,28 +5220,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -5882,12 +5305,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsReturnIndirect; + return ((Internal*) __Instance)->IsReturnIndirect != 0; } set { - ((Internal*) __Instance)->IsReturnIndirect = value; + ((Internal*) __Instance)->IsReturnIndirect = (byte) (value ? 1 : 0); } } @@ -5895,12 +5318,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasThisReturn; + return ((Internal*) __Instance)->HasThisReturn != 0; } set { - ((Internal*) __Instance)->HasThisReturn = value; + ((Internal*) __Instance)->HasThisReturn = (byte) (value ? 1 : 0); } } @@ -5908,12 +5331,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVariadic; + return ((Internal*) __Instance)->IsVariadic != 0; } set { - ((Internal*) __Instance)->IsVariadic = value; + ((Internal*) __Instance)->IsVariadic = (byte) (value ? 1 : 0); } } @@ -5921,12 +5344,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } @@ -5934,12 +5357,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPure; + return ((Internal*) __Instance)->IsPure != 0; } set { - ((Internal*) __Instance)->IsPure = value; + ((Internal*) __Instance)->IsPure = (byte) (value ? 1 : 0); } } @@ -5947,12 +5370,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDeleted; + return ((Internal*) __Instance)->IsDeleted != 0; } set { - ((Internal*) __Instance)->IsDeleted = value; + ((Internal*) __Instance)->IsDeleted = (byte) (value ? 1 : 0); } } @@ -6028,10 +5451,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -6046,22 +5469,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(100)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(101)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(102)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(103)] - public bool IsInline; + public byte IsInline; [FieldOffset(104)] - public bool IsPure; + public byte IsPure; [FieldOffset(105)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(108)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -6076,34 +5499,34 @@ namespace CppSharp public global::System.IntPtr AccessDecl; [FieldOffset(160)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(161)] - public bool IsStatic; + public byte IsStatic; [FieldOffset(162)] - public bool IsConst; + public byte IsConst; [FieldOffset(163)] - public bool IsImplicit; + public byte IsImplicit; [FieldOffset(164)] - public bool IsExplicit; + public byte IsExplicit; [FieldOffset(165)] - public bool IsOverride; + public byte IsOverride; [FieldOffset(168)] public CppSharp.Parser.AST.CXXMethodKind MethodKind; [FieldOffset(172)] - public bool IsDefaultConstructor; + public byte IsDefaultConstructor; [FieldOffset(173)] - public bool IsCopyConstructor; + public byte IsCopyConstructor; [FieldOffset(174)] - public bool IsMoveConstructor; + public byte IsMoveConstructor; [FieldOffset(176)] public CppSharp.Parser.AST.QualifiedType.Internal ConversionType; @@ -6124,8 +5547,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Method __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Method((Method.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6160,8 +5581,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(184); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Method(CppSharp.Parser.AST.Method _0) @@ -6169,28 +5590,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(184); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.AccessSpecifierDecl AccessDecl @@ -6215,12 +5617,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -6228,12 +5630,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsStatic; + return ((Internal*) __Instance)->IsStatic != 0; } set { - ((Internal*) __Instance)->IsStatic = value; + ((Internal*) __Instance)->IsStatic = (byte) (value ? 1 : 0); } } @@ -6241,12 +5643,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -6254,12 +5656,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsImplicit; + return ((Internal*) __Instance)->IsImplicit != 0; } set { - ((Internal*) __Instance)->IsImplicit = value; + ((Internal*) __Instance)->IsImplicit = (byte) (value ? 1 : 0); } } @@ -6267,12 +5669,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExplicit; + return ((Internal*) __Instance)->IsExplicit != 0; } set { - ((Internal*) __Instance)->IsExplicit = value; + ((Internal*) __Instance)->IsExplicit = (byte) (value ? 1 : 0); } } @@ -6280,12 +5682,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsOverride; + return ((Internal*) __Instance)->IsOverride != 0; } set { - ((Internal*) __Instance)->IsOverride = value; + ((Internal*) __Instance)->IsOverride = (byte) (value ? 1 : 0); } } @@ -6306,12 +5708,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDefaultConstructor; + return ((Internal*) __Instance)->IsDefaultConstructor != 0; } set { - ((Internal*) __Instance)->IsDefaultConstructor = value; + ((Internal*) __Instance)->IsDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -6319,12 +5721,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsCopyConstructor; + return ((Internal*) __Instance)->IsCopyConstructor != 0; } set { - ((Internal*) __Instance)->IsCopyConstructor = value; + ((Internal*) __Instance)->IsCopyConstructor = (byte) (value ? 1 : 0); } } @@ -6332,12 +5734,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsMoveConstructor; + return ((Internal*) __Instance)->IsMoveConstructor != 0; } set { - ((Internal*) __Instance)->IsMoveConstructor = value; + ((Internal*) __Instance)->IsMoveConstructor = (byte) (value ? 1 : 0); } } @@ -6382,10 +5784,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -6397,7 +5799,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(204)] public CppSharp.Parser.AST.Enumeration.EnumModifiers Modifiers; @@ -6479,10 +5881,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -6522,8 +5924,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Item __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Item((Item.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6558,8 +5958,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Item(CppSharp.Parser.AST.Enumeration.Item _0) @@ -6567,28 +5967,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -6621,8 +6002,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new Enumeration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Enumeration((Enumeration.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6657,8 +6036,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(228); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Enumeration(CppSharp.Parser.AST.Enumeration _0) @@ -6666,28 +6045,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(228); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Enumeration.Item getItems(uint i) @@ -6794,10 +6154,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -6837,8 +6197,6 @@ namespace CppSharp internal static extern void setMangled_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Variable __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Variable((Variable.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6873,8 +6231,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Variable(CppSharp.Parser.AST.Variable _0) @@ -6882,28 +6240,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Mangled @@ -6945,7 +6284,7 @@ namespace CppSharp public CppSharp.Parser.AST.AccessSpecifier Access; [FieldOffset(4)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(8)] public global::System.IntPtr Type; @@ -6966,8 +6305,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -7002,16 +6342,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BaseClassSpecifier(CppSharp.Parser.AST.BaseClassSpecifier _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BaseClassSpecifier.Internal*) __Instance) = *((BaseClassSpecifier.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -7021,20 +6361,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BaseClassSpecifier __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.AccessSpecifier Access @@ -7054,12 +6385,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -7122,10 +6453,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -7146,7 +6477,7 @@ namespace CppSharp public global::System.IntPtr Class; [FieldOffset(108)] - public bool IsBitField; + public byte IsBitField; [FieldOffset(112)] public uint BitWidth; @@ -7167,8 +6498,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Field __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Field((Field.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7203,8 +6532,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(116); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Field(CppSharp.Parser.AST.Field _0) @@ -7212,28 +6541,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(116); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -7284,12 +6594,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsBitField; + return ((Internal*) __Instance)->IsBitField != 0; } set { - ((Internal*) __Instance)->IsBitField = value; + ((Internal*) __Instance)->IsBitField = (byte) (value ? 1 : 0); } } @@ -7334,10 +6644,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -7364,8 +6674,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new AccessSpecifierDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AccessSpecifierDecl((AccessSpecifierDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7400,8 +6708,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(92); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AccessSpecifierDecl(CppSharp.Parser.AST.AccessSpecifierDecl _0) @@ -7409,28 +6717,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(92); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -7461,10 +6750,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -7476,34 +6765,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(252)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(253)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(254)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(255)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(256)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(257)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(258)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(259)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(260)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(264)] public global::System.IntPtr Layout; @@ -7604,8 +6893,6 @@ namespace CppSharp internal static extern uint getSpecifiersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Class __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Class((Class.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7640,8 +6927,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(268); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Class(CppSharp.Parser.AST.Class _0) @@ -7649,28 +6936,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(268); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BaseClassSpecifier getBases(uint i) @@ -7801,12 +7069,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPOD; + return ((Internal*) __Instance)->IsPOD != 0; } set { - ((Internal*) __Instance)->IsPOD = value; + ((Internal*) __Instance)->IsPOD = (byte) (value ? 1 : 0); } } @@ -7814,12 +7082,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAbstract; + return ((Internal*) __Instance)->IsAbstract != 0; } set { - ((Internal*) __Instance)->IsAbstract = value; + ((Internal*) __Instance)->IsAbstract = (byte) (value ? 1 : 0); } } @@ -7827,12 +7095,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsUnion; + return ((Internal*) __Instance)->IsUnion != 0; } set { - ((Internal*) __Instance)->IsUnion = value; + ((Internal*) __Instance)->IsUnion = (byte) (value ? 1 : 0); } } @@ -7840,12 +7108,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDynamic; + return ((Internal*) __Instance)->IsDynamic != 0; } set { - ((Internal*) __Instance)->IsDynamic = value; + ((Internal*) __Instance)->IsDynamic = (byte) (value ? 1 : 0); } } @@ -7853,12 +7121,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPolymorphic; + return ((Internal*) __Instance)->IsPolymorphic != 0; } set { - ((Internal*) __Instance)->IsPolymorphic = value; + ((Internal*) __Instance)->IsPolymorphic = (byte) (value ? 1 : 0); } } @@ -7866,12 +7134,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor; + return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = value; + ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -7879,12 +7147,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialCopyConstructor; + return ((Internal*) __Instance)->HasNonTrivialCopyConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialCopyConstructor = value; + ((Internal*) __Instance)->HasNonTrivialCopyConstructor = (byte) (value ? 1 : 0); } } @@ -7892,12 +7160,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDestructor; + return ((Internal*) __Instance)->HasNonTrivialDestructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDestructor = value; + ((Internal*) __Instance)->HasNonTrivialDestructor = (byte) (value ? 1 : 0); } } @@ -7905,12 +7173,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExternCContext; + return ((Internal*) __Instance)->IsExternCContext != 0; } set { - ((Internal*) __Instance)->IsExternCContext = value; + ((Internal*) __Instance)->IsExternCContext = (byte) (value ? 1 : 0); } } @@ -7960,10 +7228,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -8018,8 +7286,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Template __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Template((Template.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8054,9 +7320,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(108); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Template() @@ -8064,8 +7330,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(108); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public Template(CppSharp.Parser.AST.Template _0) @@ -8073,28 +7339,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(108); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter getParameters(uint i) @@ -8170,10 +7417,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -8223,8 +7470,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplate((ClassTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8259,8 +7504,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplate(CppSharp.Parser.AST.ClassTemplate _0) @@ -8268,28 +7513,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ClassTemplateSpecialization getSpecializations(uint i) @@ -8351,10 +7577,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -8366,34 +7592,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(252)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(253)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(254)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(255)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(256)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(257)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(258)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(259)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(260)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(264)] public global::System.IntPtr Layout; @@ -8440,8 +7666,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplateSpecialization((ClassTemplateSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8476,8 +7700,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(288); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplateSpecialization(CppSharp.Parser.AST.ClassTemplateSpecialization _0) @@ -8485,28 +7709,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(288); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -8595,10 +7800,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -8610,34 +7815,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(252)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(253)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(254)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(255)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(256)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(257)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(258)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(259)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(260)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(264)] public global::System.IntPtr Layout; @@ -8664,8 +7869,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplatePartialSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplatePartialSpecialization((ClassTemplatePartialSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8700,8 +7903,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(288); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplatePartialSpecialization(CppSharp.Parser.AST.ClassTemplatePartialSpecialization _0) @@ -8709,28 +7912,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(288); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -8761,10 +7945,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -8814,8 +7998,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionTemplate((FunctionTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8850,8 +8032,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplate(CppSharp.Parser.AST.FunctionTemplate _0) @@ -8859,28 +8041,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.FunctionTemplateSpecialization getSpecializations(uint i) @@ -8967,8 +8130,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -9003,17 +8167,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplateSpecialization(CppSharp.Parser.AST.FunctionTemplateSpecialization _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -9023,22 +8187,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.FunctionTemplateSpecialization __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -9145,10 +8299,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -9160,10 +8314,10 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(201)] - public bool IsInline; + public byte IsInline; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -9181,8 +8335,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Namespace __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Namespace((Namespace.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9217,8 +8369,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(204); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Namespace(CppSharp.Parser.AST.Namespace _0) @@ -9226,40 +8378,21 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(204); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public bool IsInline { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } } @@ -9291,10 +8424,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -9324,8 +8457,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new PreprocessedEntity __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PreprocessedEntity((PreprocessedEntity.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9360,8 +8491,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(96); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PreprocessedEntity(CppSharp.Parser.AST.PreprocessedEntity _0) @@ -9369,36 +8500,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(96); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) + public CppSharp.Parser.AST.MacroLocation MacroLocation { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.MacroLocation MacroLocation - { - get - { - return ((Internal*) __Instance)->MacroLocation; - } + get + { + return ((Internal*) __Instance)->MacroLocation; + } set { @@ -9434,10 +8546,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -9477,8 +8589,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroDefinition __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroDefinition((MacroDefinition.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9513,8 +8623,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(108); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroDefinition(CppSharp.Parser.AST.MacroDefinition _0) @@ -9522,28 +8632,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(108); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -9590,10 +8681,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -9636,8 +8727,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroExpansion __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroExpansion((MacroExpansion.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9672,8 +8761,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroExpansion(CppSharp.Parser.AST.MacroExpansion _0) @@ -9681,28 +8770,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(112); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -9767,10 +8837,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(52)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(53)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(56)] public global::System.IntPtr CompleteDeclaration; @@ -9782,13 +8852,13 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(200)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(201)] - public bool IsInline; + public byte IsInline; [FieldOffset(216)] - public bool IsSystemHeader; + public byte IsSystemHeader; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -9836,8 +8906,6 @@ namespace CppSharp internal static extern uint getMacrosCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TranslationUnit __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TranslationUnit((TranslationUnit.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9872,8 +8940,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(232); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TranslationUnit(CppSharp.Parser.AST.TranslationUnit _0) @@ -9881,28 +8949,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(232); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.MacroDefinition getMacros(uint i) @@ -9956,12 +9005,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsSystemHeader; + return ((Internal*) __Instance)->IsSystemHeader != 0; } set { - ((Internal*) __Instance)->IsSystemHeader = value; + ((Internal*) __Instance)->IsSystemHeader = (byte) (value ? 1 : 0); } } } @@ -10042,8 +9091,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static NativeLibrary __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10078,17 +9128,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public NativeLibrary(CppSharp.Parser.AST.NativeLibrary _0) { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10098,22 +9148,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.NativeLibrary __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string getSymbols(uint i) @@ -10243,8 +9283,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ASTContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10279,17 +9320,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ASTContext(CppSharp.Parser.AST.ASTContext _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10299,22 +9340,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ASTContext __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TranslationUnit getTranslationUnits(uint i) @@ -10370,8 +9401,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Comment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10406,17 +9438,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Comment(CppSharp.Parser.AST.Comment _0) { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((Comment.Internal*) __Instance) = *((Comment.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10426,20 +9458,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Comment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.CommentKind Kind @@ -10480,8 +9503,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BlockContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockContentComment((BlockContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10516,8 +9537,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10525,9 +9546,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.BlockContentComment _0) @@ -10535,27 +9556,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BlockContentComment.Internal*) __Instance) = *((BlockContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -10603,8 +9605,6 @@ namespace CppSharp internal static extern uint getBlocksCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FullComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FullComment((FullComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10639,8 +9639,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FullComment(CppSharp.Parser.AST.FullComment _0) @@ -10648,28 +9648,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockContentComment getBlocks(uint i) @@ -10789,8 +9770,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10825,17 +9807,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.BlockCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10845,22 +9827,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BlockCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -10880,8 +9852,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new BlockCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockCommandComment((BlockCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10916,8 +9886,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10925,9 +9895,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.BlockCommandComment _0) @@ -10935,28 +9905,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockCommandComment.Argument getArguments(uint i) @@ -11040,8 +9991,6 @@ namespace CppSharp InOut = 2 } - private bool __ownsNativeInstance; - public static new ParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParamCommandComment((ParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11076,8 +10025,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParamCommandComment(CppSharp.Parser.AST.ParamCommandComment _0) @@ -11085,28 +10034,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ParamCommandComment.PassDirection Direction @@ -11183,8 +10113,6 @@ namespace CppSharp internal static extern uint getPositionCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TParamCommandComment((TParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11219,8 +10147,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TParamCommandComment(CppSharp.Parser.AST.TParamCommandComment _0) @@ -11228,28 +10156,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public uint getPosition(uint i) @@ -11315,8 +10224,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimBlockLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockLineComment((VerbatimBlockLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11351,8 +10258,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockLineComment(CppSharp.Parser.AST.VerbatimBlockLineComment _0) @@ -11360,28 +10267,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11448,8 +10336,6 @@ namespace CppSharp internal static extern uint getLinesCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new VerbatimBlockComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockComment((VerbatimBlockComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11484,8 +10370,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockComment(CppSharp.Parser.AST.VerbatimBlockComment _0) @@ -11493,28 +10379,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.VerbatimBlockLineComment getLines(uint i) @@ -11586,8 +10453,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimLineComment((VerbatimLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11622,8 +10487,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimLineComment(CppSharp.Parser.AST.VerbatimLineComment _0) @@ -11631,28 +10496,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11696,8 +10542,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InlineContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineContentComment((InlineContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11732,8 +10576,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -11741,9 +10585,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.InlineContentComment _0) @@ -11751,27 +10595,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((InlineContentComment.Internal*) __Instance) = *((InlineContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -11784,7 +10609,7 @@ namespace CppSharp public CppSharp.Parser.AST.CommentKind Kind; [FieldOffset(4)] - public bool IsWhitespace; + public byte IsWhitespace; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -11822,8 +10647,6 @@ namespace CppSharp internal static extern uint getContentCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ParagraphComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParagraphComment((ParagraphComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11858,8 +10681,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParagraphComment(CppSharp.Parser.AST.ParagraphComment _0) @@ -11867,28 +10690,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineContentComment getContent(uint i) @@ -11926,12 +10730,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsWhitespace; + return ((Internal*) __Instance)->IsWhitespace != 0; } set { - ((Internal*) __Instance)->IsWhitespace = value; + ((Internal*) __Instance)->IsWhitespace = (byte) (value ? 1 : 0); } } } @@ -12024,8 +10828,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12060,17 +10865,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.InlineCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12080,22 +10885,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.InlineCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -12115,8 +10910,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new InlineCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineCommandComment((InlineCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12151,8 +10944,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineCommandComment(CppSharp.Parser.AST.InlineCommandComment _0) @@ -12160,28 +10953,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineCommandComment.Argument getArguments(uint i) @@ -12249,8 +11023,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new HTMLTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLTagComment((HTMLTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12285,8 +11057,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.CommentKind Kind) @@ -12294,9 +11066,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.HTMLTagComment _0) @@ -12304,27 +11076,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((HTMLTagComment.Internal*) __Instance) = *((HTMLTagComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -12425,8 +11178,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Attribute __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12461,17 +11215,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Attribute(CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12481,22 +11235,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.HTMLStartTagComment.Attribute __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Name @@ -12532,8 +11276,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new HTMLStartTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLStartTagComment((HTMLStartTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12568,8 +11310,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLStartTagComment(CppSharp.Parser.AST.HTMLStartTagComment _0) @@ -12577,28 +11319,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.HTMLStartTagComment.Attribute getAttributes(uint i) @@ -12679,8 +11402,6 @@ namespace CppSharp internal static extern void setTagName_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new HTMLEndTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLEndTagComment((HTMLEndTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12715,8 +11436,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLEndTagComment(CppSharp.Parser.AST.HTMLEndTagComment _0) @@ -12724,28 +11445,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string TagName @@ -12799,8 +11501,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new TextComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TextComment((TextComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12835,8 +11535,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TextComment(CppSharp.Parser.AST.TextComment _0) @@ -12844,28 +11544,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -12934,8 +11615,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static RawComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12970,17 +11652,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public RawComment(CppSharp.Parser.AST.RawComment _0) { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12990,22 +11672,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.RawComment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs index 5eba5e13..edb958fd 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs @@ -60,16 +60,16 @@ namespace CppSharp public CppSharp.Parser.AST.CppAbi Abi; [FieldOffset(108)] - public bool NoStandardIncludes; + public byte NoStandardIncludes; [FieldOffset(109)] - public bool NoBuiltinIncludes; + public byte NoBuiltinIncludes; [FieldOffset(110)] - public bool MicrosoftMode; + public byte MicrosoftMode; [FieldOffset(111)] - public bool Verbose; + public byte Verbose; [FieldOffset(112)] public CppSharp.Parser.LanguageVersion LanguageVersion; @@ -232,8 +232,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserOptions __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -268,17 +269,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(116); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserOptions(CppSharp.Parser.ParserOptions _0) { __Instance = Marshal.AllocHGlobal(116); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -288,22 +289,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserOptions __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string getArguments(uint i) @@ -548,12 +539,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoStandardIncludes; + return ((Internal*) __Instance)->NoStandardIncludes != 0; } set { - ((Internal*) __Instance)->NoStandardIncludes = value; + ((Internal*) __Instance)->NoStandardIncludes = (byte) (value ? 1 : 0); } } @@ -561,12 +552,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoBuiltinIncludes; + return ((Internal*) __Instance)->NoBuiltinIncludes != 0; } set { - ((Internal*) __Instance)->NoBuiltinIncludes = value; + ((Internal*) __Instance)->NoBuiltinIncludes = (byte) (value ? 1 : 0); } } @@ -574,12 +565,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->MicrosoftMode; + return ((Internal*) __Instance)->MicrosoftMode != 0; } set { - ((Internal*) __Instance)->MicrosoftMode = value; + ((Internal*) __Instance)->MicrosoftMode = (byte) (value ? 1 : 0); } } @@ -587,12 +578,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->Verbose; + return ((Internal*) __Instance)->Verbose != 0; } set { - ((Internal*) __Instance)->Verbose = value; + ((Internal*) __Instance)->Verbose = (byte) (value ? 1 : 0); } } @@ -662,8 +653,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserDiagnostic __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -698,17 +690,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(36); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserDiagnostic(CppSharp.Parser.ParserDiagnostic _0) { __Instance = Marshal.AllocHGlobal(36); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -718,22 +710,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserDiagnostic __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string FileName @@ -863,8 +845,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserResult __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -899,17 +882,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserResult(CppSharp.Parser.ParserResult _0) { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -919,22 +902,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserResult __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i) @@ -1042,8 +1015,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClangParser __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1085,8 +1059,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(0); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((ClangParser.Internal*) __Instance) = *((ClangParser.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1096,20 +1070,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ClangParser __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts) diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs index ad14ef3e..9f41910f 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs @@ -172,8 +172,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserTargetInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -208,17 +209,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(164); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserTargetInfo(CppSharp.Parser.ParserTargetInfo _0) { __Instance = Marshal.AllocHGlobal(164); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -228,22 +229,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserTargetInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string ABI diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs index 4fa21f32..2ac00a4d 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -266,8 +266,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Type __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -302,18 +303,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Type(CppSharp.Parser.AST.Type _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -323,20 +324,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Type __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TypeKind Kind @@ -356,12 +348,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } } @@ -372,13 +364,13 @@ namespace CppSharp public partial struct Internal { [FieldOffset(0)] - public bool IsConst; + public byte IsConst; [FieldOffset(1)] - public bool IsVolatile; + public byte IsVolatile; [FieldOffset(2)] - public bool IsRestrict; + public byte IsRestrict; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -388,8 +380,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TypeQualifiers __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -424,8 +417,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(3); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TypeQualifiers.Internal*) __Instance) = *((TypeQualifiers.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public TypeQualifiers() @@ -442,32 +435,23 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TypeQualifiers __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public bool IsConst { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -475,12 +459,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVolatile; + return ((Internal*) __Instance)->IsVolatile != 0; } set { - ((Internal*) __Instance)->IsVolatile = value; + ((Internal*) __Instance)->IsVolatile = (byte) (value ? 1 : 0); } } @@ -488,12 +472,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsRestrict; + return ((Internal*) __Instance)->IsRestrict != 0; } set { - ((Internal*) __Instance)->IsRestrict = value; + ((Internal*) __Instance)->IsRestrict = (byte) (value ? 1 : 0); } } } @@ -522,8 +506,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static QualifiedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -558,16 +543,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public QualifiedType(CppSharp.Parser.AST.QualifiedType _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((QualifiedType.Internal*) __Instance) = *((QualifiedType.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -577,20 +562,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.QualifiedType __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.Type Type @@ -634,7 +610,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -650,8 +626,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TagType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TagType((TagType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -686,8 +660,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TagType(CppSharp.Parser.AST.TagType _0) @@ -695,28 +669,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -747,7 +702,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; @@ -780,8 +735,6 @@ namespace CppSharp Incomplete = 3 } - private bool __ownsNativeInstance; - public static new ArrayType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ArrayType((ArrayType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -816,8 +769,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ArrayType(CppSharp.Parser.AST.ArrayType _0) @@ -825,28 +778,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -911,7 +845,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; @@ -955,8 +889,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionType((FunctionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -991,8 +923,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionType(CppSharp.Parser.AST.FunctionType _0) @@ -1000,28 +932,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -1091,7 +1004,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedPointee; @@ -1118,8 +1031,6 @@ namespace CppSharp RVReference = 3 } - private bool __ownsNativeInstance; - public static new PointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PointerType((PointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1154,8 +1065,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PointerType(CppSharp.Parser.AST.PointerType _0) @@ -1163,28 +1074,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedPointee @@ -1223,7 +1115,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Pointee; @@ -1239,8 +1131,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new MemberPointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MemberPointerType((MemberPointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1275,8 +1165,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MemberPointerType(CppSharp.Parser.AST.MemberPointerType _0) @@ -1284,28 +1174,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Pointee @@ -1331,7 +1202,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -1347,8 +1218,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TypedefType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefType((TypedefType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1383,8 +1252,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefType(CppSharp.Parser.AST.TypedefType _0) @@ -1392,28 +1261,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TypedefDecl Declaration @@ -1444,7 +1294,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Modified; @@ -1463,8 +1313,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new AttributedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AttributedType((AttributedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1499,8 +1347,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AttributedType(CppSharp.Parser.AST.AttributedType _0) @@ -1508,28 +1356,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Modified @@ -1568,7 +1397,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Decayed; @@ -1590,8 +1419,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DecayedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DecayedType((DecayedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1626,8 +1453,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DecayedType(CppSharp.Parser.AST.DecayedType _0) @@ -1635,28 +1462,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Decayed @@ -1741,8 +1549,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateArgument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1777,16 +1586,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateArgument(CppSharp.Parser.AST.TemplateArgument _0) { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TemplateArgument.Internal*) __Instance) = *((TemplateArgument.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1796,20 +1605,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateArgument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument.ArgumentKind Kind @@ -1879,7 +1679,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(20)] public global::System.IntPtr Template; @@ -1923,8 +1723,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateSpecializationType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateSpecializationType((TemplateSpecializationType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1959,8 +1757,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateSpecializationType(CppSharp.Parser.AST.TemplateSpecializationType _0) @@ -1968,28 +1766,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -2062,7 +1841,7 @@ namespace CppSharp public partial struct Internal { [FieldOffset(24)] - public bool IsTypeParameter; + public byte IsTypeParameter; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -2083,7 +1862,7 @@ namespace CppSharp [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, EntryPoint="??8TemplateParameter@AST@CppParser@CppSharp@@QBE_NABV0123@@Z")] [return: MarshalAsAttribute(UnmanagedType.I1)] - internal static extern bool OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); + internal static extern byte OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -2098,8 +1877,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateParameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2134,17 +1914,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameter(CppSharp.Parser.AST.TemplateParameter _0) { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -2154,22 +1934,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateParameter __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public static bool operator !=(CppSharp.Parser.AST.TemplateParameter __op, CppSharp.Parser.AST.TemplateParameter param) @@ -2186,7 +1956,7 @@ namespace CppSharp var arg0 = __op.__Instance; var arg1 = param.__Instance; var __ret = Internal.OperatorEqualEqual_0(arg0, arg1); - return __ret; + return __ret != 0; } public override bool Equals(object obj) @@ -2214,12 +1984,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsTypeParameter; + return ((Internal*) __Instance)->IsTypeParameter != 0; } set { - ((Internal*) __Instance)->IsTypeParameter = value; + ((Internal*) __Instance)->IsTypeParameter = (byte) (value ? 1 : 0); } } } @@ -2233,7 +2003,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.TemplateParameter.Internal Parameter; @@ -2245,7 +2015,7 @@ namespace CppSharp public uint Index; [FieldOffset(44)] - public bool IsParameterPack; + public byte IsParameterPack; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -2263,8 +2033,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new TemplateParameterType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterType((TemplateParameterType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2299,8 +2067,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterType(CppSharp.Parser.AST.TemplateParameterType _0) @@ -2308,28 +2076,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter Parameter @@ -2375,12 +2124,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsParameterPack; + return ((Internal*) __Instance)->IsParameterPack != 0; } set { - ((Internal*) __Instance)->IsParameterPack = value; + ((Internal*) __Instance)->IsParameterPack = (byte) (value ? 1 : 0); } } } @@ -2394,7 +2143,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Replacement; @@ -2410,8 +2159,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TemplateParameterSubstitutionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterSubstitutionType((TemplateParameterSubstitutionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2446,8 +2193,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterSubstitutionType(CppSharp.Parser.AST.TemplateParameterSubstitutionType _0) @@ -2455,28 +2202,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Replacement @@ -2502,7 +2230,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr TemplateSpecialization; @@ -2521,8 +2249,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InjectedClassNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InjectedClassNameType((InjectedClassNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2557,8 +2283,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InjectedClassNameType(CppSharp.Parser.AST.InjectedClassNameType _0) @@ -2566,31 +2292,12 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization + public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization { get { @@ -2636,7 +2343,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -2649,8 +2356,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DependentNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DependentNameType((DependentNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2685,8 +2390,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DependentNameType(CppSharp.Parser.AST.DependentNameType _0) @@ -2694,28 +2399,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2728,7 +2414,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -2741,8 +2427,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new PackExpansionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PackExpansionType((PackExpansionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2777,8 +2461,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PackExpansionType(CppSharp.Parser.AST.PackExpansionType _0) @@ -2786,28 +2470,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2820,7 +2485,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.PrimitiveType Type; @@ -2836,8 +2501,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BuiltinType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BuiltinType((BuiltinType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2872,8 +2535,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BuiltinType(CppSharp.Parser.AST.BuiltinType _0) @@ -2881,28 +2544,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.PrimitiveType Type @@ -2946,8 +2590,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableComponent __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2982,16 +2627,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableComponent(CppSharp.Parser.AST.VTableComponent _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((VTableComponent.Internal*) __Instance) = *((VTableComponent.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3001,20 +2646,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableComponent __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponentKind Kind @@ -3105,8 +2741,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3141,17 +2778,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableLayout(CppSharp.Parser.AST.VTableLayout _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3161,22 +2798,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponent getComponents(uint i) @@ -3242,8 +2869,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VFTableInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3278,17 +2906,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VFTableInfo(CppSharp.Parser.AST.VFTableInfo _0) { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3298,22 +2926,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VFTableInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public ulong VBTableIndex @@ -3381,7 +2999,7 @@ namespace CppSharp public CppSharp.Parser.AST.VTableLayout.Internal Layout; [FieldOffset(28)] - public bool HasOwnVFPtr; + public byte HasOwnVFPtr; [FieldOffset(32)] public int VBPtrOffset; @@ -3433,8 +3051,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClassLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3469,17 +3088,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassLayout(CppSharp.Parser.AST.ClassLayout _0) { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3489,22 +3108,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ClassLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VFTableInfo getVFTables(uint i) @@ -3564,12 +3173,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasOwnVFPtr; + return ((Internal*) __Instance)->HasOwnVFPtr != 0; } set { - ((Internal*) __Instance)->HasOwnVFPtr = value; + ((Internal*) __Instance)->HasOwnVFPtr = (byte) (value ? 1 : 0); } } @@ -3653,10 +3262,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -3725,8 +3334,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Declaration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3761,18 +3371,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Declaration(CppSharp.Parser.AST.Declaration _0) { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3782,22 +3392,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Declaration __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.PreprocessedEntity getPreprocessedEntities(uint i) @@ -3968,12 +3568,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIncomplete; + return ((Internal*) __Instance)->IsIncomplete != 0; } set { - ((Internal*) __Instance)->IsIncomplete = value; + ((Internal*) __Instance)->IsIncomplete = (byte) (value ? 1 : 0); } } @@ -3981,12 +3581,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } @@ -4062,10 +3662,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -4077,7 +3677,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -4255,8 +3855,6 @@ namespace CppSharp internal static extern uint getFriendsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new DeclarationContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DeclarationContext((DeclarationContext.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4291,9 +3889,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(236); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public DeclarationContext(CppSharp.Parser.AST.DeclarationContext _0) @@ -4301,28 +3899,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(236); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Namespace getNamespaces(uint i) @@ -4577,12 +4156,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAnonymous; + return ((Internal*) __Instance)->IsAnonymous != 0; } set { - ((Internal*) __Instance)->IsAnonymous = value; + ((Internal*) __Instance)->IsAnonymous = (byte) (value ? 1 : 0); } } } @@ -4614,10 +4193,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -4647,8 +4226,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new TypedefDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefDecl((TypedefDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4683,8 +4260,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefDecl(CppSharp.Parser.AST.TypedefDecl _0) @@ -4692,28 +4269,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -4757,10 +4315,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -4790,8 +4348,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new Friend __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Friend((Friend.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4826,8 +4382,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(132); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Friend(CppSharp.Parser.AST.Friend _0) @@ -4835,28 +4391,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(132); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -4912,8 +4449,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Statement __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -4948,9 +4486,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -4960,22 +4498,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Statement __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string String @@ -5048,8 +4576,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new Expression __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Expression((Expression.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5084,28 +4610,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -5147,8 +4654,6 @@ namespace CppSharp internal static extern void setOpcodeStr_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new BinaryOperator __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BinaryOperator((BinaryOperator.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5183,28 +4688,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string OpcodeStr @@ -5302,8 +4788,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new CXXConstructExpr __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new CXXConstructExpr((CXXConstructExpr.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5338,28 +4822,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(44); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Expression getArguments(uint i) @@ -5421,10 +4886,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -5439,10 +4904,10 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; [FieldOffset(136)] - public bool IsIndirect; + public byte IsIndirect; [FieldOffset(137)] - public bool HasDefaultValue; + public byte HasDefaultValue; [FieldOffset(140)] public uint Index; @@ -5466,8 +4931,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new Parameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Parameter((Parameter.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5502,8 +4965,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(148); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Parameter(CppSharp.Parser.AST.Parameter _0) @@ -5511,28 +4974,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(148); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -5552,12 +4996,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIndirect; + return ((Internal*) __Instance)->IsIndirect != 0; } set { - ((Internal*) __Instance)->IsIndirect = value; + ((Internal*) __Instance)->IsIndirect = (byte) (value ? 1 : 0); } } @@ -5565,12 +5009,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasDefaultValue; + return ((Internal*) __Instance)->HasDefaultValue != 0; } set { - ((Internal*) __Instance)->HasDefaultValue = value; + ((Internal*) __Instance)->HasDefaultValue = (byte) (value ? 1 : 0); } } @@ -5633,10 +5077,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -5651,22 +5095,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(136)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(137)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(138)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(139)] - public bool IsInline; + public byte IsInline; [FieldOffset(140)] - public bool IsPure; + public byte IsPure; [FieldOffset(141)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(144)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -5733,8 +5177,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Function __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Function((Function.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5769,8 +5211,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(216); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Function(CppSharp.Parser.AST.Function _0) @@ -5778,28 +5220,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(216); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -5882,12 +5305,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsReturnIndirect; + return ((Internal*) __Instance)->IsReturnIndirect != 0; } set { - ((Internal*) __Instance)->IsReturnIndirect = value; + ((Internal*) __Instance)->IsReturnIndirect = (byte) (value ? 1 : 0); } } @@ -5895,12 +5318,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasThisReturn; + return ((Internal*) __Instance)->HasThisReturn != 0; } set { - ((Internal*) __Instance)->HasThisReturn = value; + ((Internal*) __Instance)->HasThisReturn = (byte) (value ? 1 : 0); } } @@ -5908,12 +5331,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVariadic; + return ((Internal*) __Instance)->IsVariadic != 0; } set { - ((Internal*) __Instance)->IsVariadic = value; + ((Internal*) __Instance)->IsVariadic = (byte) (value ? 1 : 0); } } @@ -5921,12 +5344,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } @@ -5934,12 +5357,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPure; + return ((Internal*) __Instance)->IsPure != 0; } set { - ((Internal*) __Instance)->IsPure = value; + ((Internal*) __Instance)->IsPure = (byte) (value ? 1 : 0); } } @@ -5947,12 +5370,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDeleted; + return ((Internal*) __Instance)->IsDeleted != 0; } set { - ((Internal*) __Instance)->IsDeleted = value; + ((Internal*) __Instance)->IsDeleted = (byte) (value ? 1 : 0); } } @@ -6028,10 +5451,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -6046,22 +5469,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(136)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(137)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(138)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(139)] - public bool IsInline; + public byte IsInline; [FieldOffset(140)] - public bool IsPure; + public byte IsPure; [FieldOffset(141)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(144)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -6076,34 +5499,34 @@ namespace CppSharp public global::System.IntPtr AccessDecl; [FieldOffset(220)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(221)] - public bool IsStatic; + public byte IsStatic; [FieldOffset(222)] - public bool IsConst; + public byte IsConst; [FieldOffset(223)] - public bool IsImplicit; + public byte IsImplicit; [FieldOffset(224)] - public bool IsExplicit; + public byte IsExplicit; [FieldOffset(225)] - public bool IsOverride; + public byte IsOverride; [FieldOffset(228)] public CppSharp.Parser.AST.CXXMethodKind MethodKind; [FieldOffset(232)] - public bool IsDefaultConstructor; + public byte IsDefaultConstructor; [FieldOffset(233)] - public bool IsCopyConstructor; + public byte IsCopyConstructor; [FieldOffset(234)] - public bool IsMoveConstructor; + public byte IsMoveConstructor; [FieldOffset(236)] public CppSharp.Parser.AST.QualifiedType.Internal ConversionType; @@ -6124,8 +5547,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new Method __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Method((Method.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6160,8 +5581,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(244); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Method(CppSharp.Parser.AST.Method _0) @@ -6169,28 +5590,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(244); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.AccessSpecifierDecl AccessDecl @@ -6215,12 +5617,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -6228,12 +5630,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsStatic; + return ((Internal*) __Instance)->IsStatic != 0; } set { - ((Internal*) __Instance)->IsStatic = value; + ((Internal*) __Instance)->IsStatic = (byte) (value ? 1 : 0); } } @@ -6241,12 +5643,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -6254,12 +5656,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsImplicit; + return ((Internal*) __Instance)->IsImplicit != 0; } set { - ((Internal*) __Instance)->IsImplicit = value; + ((Internal*) __Instance)->IsImplicit = (byte) (value ? 1 : 0); } } @@ -6267,12 +5669,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExplicit; + return ((Internal*) __Instance)->IsExplicit != 0; } set { - ((Internal*) __Instance)->IsExplicit = value; + ((Internal*) __Instance)->IsExplicit = (byte) (value ? 1 : 0); } } @@ -6280,12 +5682,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsOverride; + return ((Internal*) __Instance)->IsOverride != 0; } set { - ((Internal*) __Instance)->IsOverride = value; + ((Internal*) __Instance)->IsOverride = (byte) (value ? 1 : 0); } } @@ -6306,12 +5708,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDefaultConstructor; + return ((Internal*) __Instance)->IsDefaultConstructor != 0; } set { - ((Internal*) __Instance)->IsDefaultConstructor = value; + ((Internal*) __Instance)->IsDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -6319,12 +5721,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsCopyConstructor; + return ((Internal*) __Instance)->IsCopyConstructor != 0; } set { - ((Internal*) __Instance)->IsCopyConstructor = value; + ((Internal*) __Instance)->IsCopyConstructor = (byte) (value ? 1 : 0); } } @@ -6332,12 +5734,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsMoveConstructor; + return ((Internal*) __Instance)->IsMoveConstructor != 0; } set { - ((Internal*) __Instance)->IsMoveConstructor = value; + ((Internal*) __Instance)->IsMoveConstructor = (byte) (value ? 1 : 0); } } @@ -6382,10 +5784,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -6397,7 +5799,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(236)] public CppSharp.Parser.AST.Enumeration.EnumModifiers Modifiers; @@ -6479,10 +5881,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -6522,8 +5924,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Item __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Item((Item.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6558,8 +5958,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Item(CppSharp.Parser.AST.Enumeration.Item _0) @@ -6567,28 +5967,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -6621,8 +6002,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new Enumeration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Enumeration((Enumeration.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6657,8 +6036,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(260); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Enumeration(CppSharp.Parser.AST.Enumeration _0) @@ -6666,28 +6045,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(260); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Enumeration.Item getItems(uint i) @@ -6794,10 +6154,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -6837,8 +6197,6 @@ namespace CppSharp internal static extern void setMangled_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Variable __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Variable((Variable.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6873,8 +6231,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Variable(CppSharp.Parser.AST.Variable _0) @@ -6882,28 +6240,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Mangled @@ -6945,7 +6284,7 @@ namespace CppSharp public CppSharp.Parser.AST.AccessSpecifier Access; [FieldOffset(4)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(8)] public global::System.IntPtr Type; @@ -6966,8 +6305,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -7002,16 +6342,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BaseClassSpecifier(CppSharp.Parser.AST.BaseClassSpecifier _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BaseClassSpecifier.Internal*) __Instance) = *((BaseClassSpecifier.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -7021,20 +6361,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BaseClassSpecifier __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.AccessSpecifier Access @@ -7054,12 +6385,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -7122,10 +6453,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -7146,7 +6477,7 @@ namespace CppSharp public global::System.IntPtr Class; [FieldOffset(144)] - public bool IsBitField; + public byte IsBitField; [FieldOffset(148)] public uint BitWidth; @@ -7167,8 +6498,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new Field __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Field((Field.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7203,8 +6532,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Field(CppSharp.Parser.AST.Field _0) @@ -7212,28 +6541,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -7284,12 +6594,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsBitField; + return ((Internal*) __Instance)->IsBitField != 0; } set { - ((Internal*) __Instance)->IsBitField = value; + ((Internal*) __Instance)->IsBitField = (byte) (value ? 1 : 0); } } @@ -7334,10 +6644,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -7364,8 +6674,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new AccessSpecifierDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AccessSpecifierDecl((AccessSpecifierDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7400,8 +6708,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AccessSpecifierDecl(CppSharp.Parser.AST.AccessSpecifierDecl _0) @@ -7409,28 +6717,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -7461,10 +6750,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -7476,34 +6765,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(284)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(285)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(286)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(287)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(288)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(289)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(290)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(291)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(292)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(296)] public global::System.IntPtr Layout; @@ -7604,8 +6893,6 @@ namespace CppSharp internal static extern uint getSpecifiersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Class __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Class((Class.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7640,8 +6927,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(300); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Class(CppSharp.Parser.AST.Class _0) @@ -7649,28 +6936,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(300); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BaseClassSpecifier getBases(uint i) @@ -7801,12 +7069,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPOD; + return ((Internal*) __Instance)->IsPOD != 0; } set { - ((Internal*) __Instance)->IsPOD = value; + ((Internal*) __Instance)->IsPOD = (byte) (value ? 1 : 0); } } @@ -7814,12 +7082,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAbstract; + return ((Internal*) __Instance)->IsAbstract != 0; } set { - ((Internal*) __Instance)->IsAbstract = value; + ((Internal*) __Instance)->IsAbstract = (byte) (value ? 1 : 0); } } @@ -7827,12 +7095,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsUnion; + return ((Internal*) __Instance)->IsUnion != 0; } set { - ((Internal*) __Instance)->IsUnion = value; + ((Internal*) __Instance)->IsUnion = (byte) (value ? 1 : 0); } } @@ -7840,12 +7108,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDynamic; + return ((Internal*) __Instance)->IsDynamic != 0; } set { - ((Internal*) __Instance)->IsDynamic = value; + ((Internal*) __Instance)->IsDynamic = (byte) (value ? 1 : 0); } } @@ -7853,12 +7121,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPolymorphic; + return ((Internal*) __Instance)->IsPolymorphic != 0; } set { - ((Internal*) __Instance)->IsPolymorphic = value; + ((Internal*) __Instance)->IsPolymorphic = (byte) (value ? 1 : 0); } } @@ -7866,12 +7134,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor; + return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = value; + ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -7879,12 +7147,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialCopyConstructor; + return ((Internal*) __Instance)->HasNonTrivialCopyConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialCopyConstructor = value; + ((Internal*) __Instance)->HasNonTrivialCopyConstructor = (byte) (value ? 1 : 0); } } @@ -7892,12 +7160,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDestructor; + return ((Internal*) __Instance)->HasNonTrivialDestructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDestructor = value; + ((Internal*) __Instance)->HasNonTrivialDestructor = (byte) (value ? 1 : 0); } } @@ -7905,12 +7173,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExternCContext; + return ((Internal*) __Instance)->IsExternCContext != 0; } set { - ((Internal*) __Instance)->IsExternCContext = value; + ((Internal*) __Instance)->IsExternCContext = (byte) (value ? 1 : 0); } } @@ -7960,10 +7228,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -8018,8 +7286,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Template __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Template((Template.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8054,9 +7320,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Template() @@ -8064,8 +7330,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public Template(CppSharp.Parser.AST.Template _0) @@ -8073,28 +7339,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter getParameters(uint i) @@ -8170,10 +7417,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -8223,8 +7470,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplate((ClassTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8259,8 +7504,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplate(CppSharp.Parser.AST.ClassTemplate _0) @@ -8268,28 +7513,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ClassTemplateSpecialization getSpecializations(uint i) @@ -8351,10 +7577,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -8366,34 +7592,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(284)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(285)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(286)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(287)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(288)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(289)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(290)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(291)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(292)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(296)] public global::System.IntPtr Layout; @@ -8440,8 +7666,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplateSpecialization((ClassTemplateSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8476,8 +7700,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(320); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplateSpecialization(CppSharp.Parser.AST.ClassTemplateSpecialization _0) @@ -8485,28 +7709,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(320); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -8595,10 +7800,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -8610,34 +7815,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(284)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(285)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(286)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(287)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(288)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(289)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(290)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(291)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(292)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(296)] public global::System.IntPtr Layout; @@ -8664,8 +7869,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new ClassTemplatePartialSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplatePartialSpecialization((ClassTemplatePartialSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8700,8 +7903,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(320); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplatePartialSpecialization(CppSharp.Parser.AST.ClassTemplatePartialSpecialization _0) @@ -8709,28 +7912,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(320); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -8761,10 +7945,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -8814,8 +7998,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionTemplate((FunctionTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8850,8 +8032,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplate(CppSharp.Parser.AST.FunctionTemplate _0) @@ -8859,28 +8041,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.FunctionTemplateSpecialization getSpecializations(uint i) @@ -8967,8 +8130,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -9003,17 +8167,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplateSpecialization(CppSharp.Parser.AST.FunctionTemplateSpecialization _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -9023,22 +8187,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.FunctionTemplateSpecialization __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -9145,10 +8299,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -9160,10 +8314,10 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(236)] - public bool IsInline; + public byte IsInline; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -9181,8 +8335,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new Namespace __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Namespace((Namespace.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9217,8 +8369,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(240); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Namespace(CppSharp.Parser.AST.Namespace _0) @@ -9226,40 +8378,21 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(240); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public bool IsInline { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } } @@ -9291,10 +8424,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -9324,8 +8457,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance, int delete); } - private bool __ownsNativeInstance; - public static new PreprocessedEntity __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PreprocessedEntity((PreprocessedEntity.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9360,8 +8491,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(132); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PreprocessedEntity(CppSharp.Parser.AST.PreprocessedEntity _0) @@ -9369,36 +8500,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(132); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) + public CppSharp.Parser.AST.MacroLocation MacroLocation { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.MacroLocation MacroLocation - { - get - { - return ((Internal*) __Instance)->MacroLocation; - } + get + { + return ((Internal*) __Instance)->MacroLocation; + } set { @@ -9434,10 +8546,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -9477,8 +8589,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroDefinition __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroDefinition((MacroDefinition.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9513,8 +8623,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroDefinition(CppSharp.Parser.AST.MacroDefinition _0) @@ -9522,28 +8632,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(156); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -9590,10 +8681,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -9636,8 +8727,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroExpansion __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroExpansion((MacroExpansion.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9672,8 +8761,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroExpansion(CppSharp.Parser.AST.MacroExpansion _0) @@ -9681,28 +8770,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -9767,10 +8837,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(76)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(77)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(80)] public global::System.IntPtr CompleteDeclaration; @@ -9782,13 +8852,13 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(232)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(236)] - public bool IsInline; + public byte IsInline; [FieldOffset(264)] - public bool IsSystemHeader; + public byte IsSystemHeader; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -9836,8 +8906,6 @@ namespace CppSharp internal static extern uint getMacrosCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TranslationUnit __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TranslationUnit((TranslationUnit.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9872,8 +8940,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(280); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TranslationUnit(CppSharp.Parser.AST.TranslationUnit _0) @@ -9881,28 +8949,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(280); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.MacroDefinition getMacros(uint i) @@ -9956,12 +9005,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsSystemHeader; + return ((Internal*) __Instance)->IsSystemHeader != 0; } set { - ((Internal*) __Instance)->IsSystemHeader = value; + ((Internal*) __Instance)->IsSystemHeader = (byte) (value ? 1 : 0); } } } @@ -10042,8 +9091,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static NativeLibrary __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10078,17 +9128,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(52); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public NativeLibrary(CppSharp.Parser.AST.NativeLibrary _0) { __Instance = Marshal.AllocHGlobal(52); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10098,22 +9148,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.NativeLibrary __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string getSymbols(uint i) @@ -10243,8 +9283,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ASTContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10279,17 +9320,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ASTContext(CppSharp.Parser.AST.ASTContext _0) { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10299,22 +9340,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ASTContext __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TranslationUnit getTranslationUnits(uint i) @@ -10370,8 +9401,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Comment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10406,17 +9438,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Comment(CppSharp.Parser.AST.Comment _0) { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((Comment.Internal*) __Instance) = *((Comment.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10426,20 +9458,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Comment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.CommentKind Kind @@ -10480,8 +9503,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BlockContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockContentComment((BlockContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10516,8 +9537,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10525,9 +9546,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.BlockContentComment _0) @@ -10535,27 +9556,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BlockContentComment.Internal*) __Instance) = *((BlockContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -10603,8 +9605,6 @@ namespace CppSharp internal static extern uint getBlocksCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FullComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FullComment((FullComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10639,8 +9639,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FullComment(CppSharp.Parser.AST.FullComment _0) @@ -10648,28 +9648,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockContentComment getBlocks(uint i) @@ -10789,8 +9770,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10825,17 +9807,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.BlockCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10845,22 +9827,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BlockCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -10880,8 +9852,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new BlockCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockCommandComment((BlockCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10916,8 +9886,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10925,9 +9895,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.BlockCommandComment _0) @@ -10935,28 +9905,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockCommandComment.Argument getArguments(uint i) @@ -11040,8 +9991,6 @@ namespace CppSharp InOut = 2 } - private bool __ownsNativeInstance; - public static new ParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParamCommandComment((ParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11076,8 +10025,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParamCommandComment(CppSharp.Parser.AST.ParamCommandComment _0) @@ -11085,28 +10034,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ParamCommandComment.PassDirection Direction @@ -11183,8 +10113,6 @@ namespace CppSharp internal static extern uint getPositionCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TParamCommandComment((TParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11219,8 +10147,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TParamCommandComment(CppSharp.Parser.AST.TParamCommandComment _0) @@ -11228,28 +10156,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public uint getPosition(uint i) @@ -11315,8 +10224,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimBlockLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockLineComment((VerbatimBlockLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11351,8 +10258,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockLineComment(CppSharp.Parser.AST.VerbatimBlockLineComment _0) @@ -11360,28 +10267,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11448,8 +10336,6 @@ namespace CppSharp internal static extern uint getLinesCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new VerbatimBlockComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockComment((VerbatimBlockComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11484,8 +10370,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockComment(CppSharp.Parser.AST.VerbatimBlockComment _0) @@ -11493,28 +10379,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.VerbatimBlockLineComment getLines(uint i) @@ -11586,8 +10453,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimLineComment((VerbatimLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11622,8 +10487,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(44); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimLineComment(CppSharp.Parser.AST.VerbatimLineComment _0) @@ -11631,28 +10496,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(44); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11696,8 +10542,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InlineContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineContentComment((InlineContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11732,8 +10576,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -11741,9 +10585,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.InlineContentComment _0) @@ -11751,27 +10595,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((InlineContentComment.Internal*) __Instance) = *((InlineContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -11784,7 +10609,7 @@ namespace CppSharp public CppSharp.Parser.AST.CommentKind Kind; [FieldOffset(4)] - public bool IsWhitespace; + public byte IsWhitespace; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, @@ -11822,8 +10647,6 @@ namespace CppSharp internal static extern uint getContentCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ParagraphComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParagraphComment((ParagraphComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11858,8 +10681,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParagraphComment(CppSharp.Parser.AST.ParagraphComment _0) @@ -11867,28 +10690,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineContentComment getContent(uint i) @@ -11926,12 +10730,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsWhitespace; + return ((Internal*) __Instance)->IsWhitespace != 0; } set { - ((Internal*) __Instance)->IsWhitespace = value; + ((Internal*) __Instance)->IsWhitespace = (byte) (value ? 1 : 0); } } } @@ -12024,8 +10828,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12060,17 +10865,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.InlineCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12080,22 +10885,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.InlineCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -12115,8 +10910,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new InlineCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineCommandComment((InlineCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12151,8 +10944,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineCommandComment(CppSharp.Parser.AST.InlineCommandComment _0) @@ -12160,28 +10953,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(20); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineCommandComment.Argument getArguments(uint i) @@ -12249,8 +11023,6 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new HTMLTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLTagComment((HTMLTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12285,8 +11057,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.CommentKind Kind) @@ -12294,9 +11066,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.HTMLTagComment _0) @@ -12304,27 +11076,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((HTMLTagComment.Internal*) __Instance) = *((HTMLTagComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -12425,8 +11178,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Attribute __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12461,17 +11215,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Attribute(CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12481,22 +11235,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.HTMLStartTagComment.Attribute __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string Name @@ -12532,8 +11276,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new HTMLStartTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLStartTagComment((HTMLStartTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12568,8 +11310,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLStartTagComment(CppSharp.Parser.AST.HTMLStartTagComment _0) @@ -12577,28 +11319,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.HTMLStartTagComment.Attribute getAttributes(uint i) @@ -12679,8 +11402,6 @@ namespace CppSharp internal static extern void setTagName_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new HTMLEndTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLEndTagComment((HTMLEndTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12715,8 +11436,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLEndTagComment(CppSharp.Parser.AST.HTMLEndTagComment _0) @@ -12724,28 +11445,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string TagName @@ -12799,8 +11501,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new TextComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TextComment((TextComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12835,8 +11535,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TextComment(CppSharp.Parser.AST.TextComment _0) @@ -12844,28 +11544,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -12934,8 +11615,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static RawComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12970,17 +11652,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public RawComment(CppSharp.Parser.AST.RawComment _0) { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12990,22 +11672,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.RawComment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string Text diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs index 8b7103c1..a56bcd17 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs @@ -60,16 +60,16 @@ namespace CppSharp public CppSharp.Parser.AST.CppAbi Abi; [FieldOffset(132)] - public bool NoStandardIncludes; + public byte NoStandardIncludes; [FieldOffset(133)] - public bool NoBuiltinIncludes; + public byte NoBuiltinIncludes; [FieldOffset(134)] - public bool MicrosoftMode; + public byte MicrosoftMode; [FieldOffset(135)] - public bool Verbose; + public byte Verbose; [FieldOffset(136)] public CppSharp.Parser.LanguageVersion LanguageVersion; @@ -232,8 +232,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserOptions __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -268,17 +269,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(140); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserOptions(CppSharp.Parser.ParserOptions _0) { __Instance = Marshal.AllocHGlobal(140); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -288,22 +289,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserOptions __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string getArguments(uint i) @@ -548,12 +539,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoStandardIncludes; + return ((Internal*) __Instance)->NoStandardIncludes != 0; } set { - ((Internal*) __Instance)->NoStandardIncludes = value; + ((Internal*) __Instance)->NoStandardIncludes = (byte) (value ? 1 : 0); } } @@ -561,12 +552,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoBuiltinIncludes; + return ((Internal*) __Instance)->NoBuiltinIncludes != 0; } set { - ((Internal*) __Instance)->NoBuiltinIncludes = value; + ((Internal*) __Instance)->NoBuiltinIncludes = (byte) (value ? 1 : 0); } } @@ -574,12 +565,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->MicrosoftMode; + return ((Internal*) __Instance)->MicrosoftMode != 0; } set { - ((Internal*) __Instance)->MicrosoftMode = value; + ((Internal*) __Instance)->MicrosoftMode = (byte) (value ? 1 : 0); } } @@ -587,12 +578,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->Verbose; + return ((Internal*) __Instance)->Verbose != 0; } set { - ((Internal*) __Instance)->Verbose = value; + ((Internal*) __Instance)->Verbose = (byte) (value ? 1 : 0); } } @@ -662,8 +653,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserDiagnostic __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -698,17 +690,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(60); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserDiagnostic(CppSharp.Parser.ParserDiagnostic _0) { __Instance = Marshal.AllocHGlobal(60); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -718,22 +710,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserDiagnostic __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string FileName @@ -863,8 +845,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserResult __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -899,17 +882,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserResult(CppSharp.Parser.ParserResult _0) { __Instance = Marshal.AllocHGlobal(28); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -919,22 +902,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserResult __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i) @@ -1042,8 +1015,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClangParser __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1085,8 +1059,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(0); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((ClangParser.Internal*) __Instance) = *((ClangParser.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1096,20 +1070,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ClangParser __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts) diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs index 9eff4688..6f42e493 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs @@ -172,8 +172,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserTargetInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -208,17 +209,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserTargetInfo(CppSharp.Parser.ParserTargetInfo _0) { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -228,22 +229,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserTargetInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance, 0); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance, 0); + Marshal.FreeHGlobal(__Instance); } public string ABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/AST.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/AST.cs index 71e7b35a..454db2db 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/AST.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -266,8 +266,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Type __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -302,18 +303,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Type(CppSharp.Parser.AST.Type _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -323,20 +324,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Type __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TypeKind Kind @@ -356,12 +348,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } } @@ -372,13 +364,13 @@ namespace CppSharp public partial struct Internal { [FieldOffset(0)] - public bool IsConst; + public byte IsConst; [FieldOffset(1)] - public bool IsVolatile; + public byte IsVolatile; [FieldOffset(2)] - public bool IsRestrict; + public byte IsRestrict; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -388,8 +380,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TypeQualifiers __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -424,8 +417,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(3); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TypeQualifiers.Internal*) __Instance) = *((TypeQualifiers.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public TypeQualifiers() @@ -442,32 +435,23 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TypeQualifiers __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public bool IsConst { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -475,12 +459,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVolatile; + return ((Internal*) __Instance)->IsVolatile != 0; } set { - ((Internal*) __Instance)->IsVolatile = value; + ((Internal*) __Instance)->IsVolatile = (byte) (value ? 1 : 0); } } @@ -488,12 +472,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsRestrict; + return ((Internal*) __Instance)->IsRestrict != 0; } set { - ((Internal*) __Instance)->IsRestrict = value; + ((Internal*) __Instance)->IsRestrict = (byte) (value ? 1 : 0); } } } @@ -522,8 +506,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static QualifiedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -558,16 +543,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public QualifiedType(CppSharp.Parser.AST.QualifiedType _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((QualifiedType.Internal*) __Instance) = *((QualifiedType.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -577,20 +562,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.QualifiedType __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.Type Type @@ -634,7 +610,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -650,8 +626,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TagType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TagType((TagType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -686,8 +660,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TagType(CppSharp.Parser.AST.TagType _0) @@ -695,28 +669,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -747,7 +702,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; @@ -780,8 +735,6 @@ namespace CppSharp Incomplete = 3 } - private bool __ownsNativeInstance; - public static new ArrayType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ArrayType((ArrayType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -816,8 +769,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ArrayType(CppSharp.Parser.AST.ArrayType _0) @@ -825,28 +778,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -911,7 +845,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; @@ -955,8 +889,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionType((FunctionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -991,8 +923,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionType(CppSharp.Parser.AST.FunctionType _0) @@ -1000,28 +932,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -1091,7 +1004,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedPointee; @@ -1118,8 +1031,6 @@ namespace CppSharp RVReference = 3 } - private bool __ownsNativeInstance; - public static new PointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PointerType((PointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1154,8 +1065,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PointerType(CppSharp.Parser.AST.PointerType _0) @@ -1163,28 +1074,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedPointee @@ -1223,7 +1115,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Pointee; @@ -1239,8 +1131,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new MemberPointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MemberPointerType((MemberPointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1275,8 +1165,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MemberPointerType(CppSharp.Parser.AST.MemberPointerType _0) @@ -1284,28 +1174,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Pointee @@ -1331,7 +1202,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -1347,8 +1218,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TypedefType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefType((TypedefType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1383,8 +1252,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefType(CppSharp.Parser.AST.TypedefType _0) @@ -1392,28 +1261,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TypedefDecl Declaration @@ -1444,7 +1294,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Modified; @@ -1463,8 +1313,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new AttributedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AttributedType((AttributedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1499,8 +1347,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AttributedType(CppSharp.Parser.AST.AttributedType _0) @@ -1508,28 +1356,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Modified @@ -1568,7 +1397,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Decayed; @@ -1590,8 +1419,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DecayedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DecayedType((DecayedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1626,8 +1453,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DecayedType(CppSharp.Parser.AST.DecayedType _0) @@ -1635,28 +1462,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Decayed @@ -1741,8 +1549,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateArgument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1777,16 +1586,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateArgument(CppSharp.Parser.AST.TemplateArgument _0) { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TemplateArgument.Internal*) __Instance) = *((TemplateArgument.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1796,20 +1605,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateArgument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument.ArgumentKind Kind @@ -1879,7 +1679,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(32)] public global::System.IntPtr Template; @@ -1923,8 +1723,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateSpecializationType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateSpecializationType((TemplateSpecializationType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1959,8 +1757,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateSpecializationType(CppSharp.Parser.AST.TemplateSpecializationType _0) @@ -1968,28 +1766,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -2062,7 +1841,7 @@ namespace CppSharp public partial struct Internal { [FieldOffset(24)] - public bool IsTypeParameter; + public byte IsTypeParameter; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2083,7 +1862,7 @@ namespace CppSharp [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZNK8CppSharp9CppParser3AST17TemplateParametereqERKS2_")] [return: MarshalAsAttribute(UnmanagedType.I1)] - internal static extern bool OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); + internal static extern byte OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2098,8 +1877,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateParameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2134,17 +1914,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameter(CppSharp.Parser.AST.TemplateParameter _0) { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -2154,22 +1934,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateParameter __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public static bool operator !=(CppSharp.Parser.AST.TemplateParameter __op, CppSharp.Parser.AST.TemplateParameter param) @@ -2186,7 +1956,7 @@ namespace CppSharp var arg0 = __op.__Instance; var arg1 = param.__Instance; var __ret = Internal.OperatorEqualEqual_0(arg0, arg1); - return __ret; + return __ret != 0; } public override bool Equals(object obj) @@ -2214,12 +1984,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsTypeParameter; + return ((Internal*) __Instance)->IsTypeParameter != 0; } set { - ((Internal*) __Instance)->IsTypeParameter = value; + ((Internal*) __Instance)->IsTypeParameter = (byte) (value ? 1 : 0); } } } @@ -2233,7 +2003,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.TemplateParameter.Internal Parameter; @@ -2245,7 +2015,7 @@ namespace CppSharp public uint Index; [FieldOffset(48)] - public bool IsParameterPack; + public byte IsParameterPack; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2263,8 +2033,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateParameterType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterType((TemplateParameterType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2299,8 +2067,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterType(CppSharp.Parser.AST.TemplateParameterType _0) @@ -2308,28 +2076,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter Parameter @@ -2375,12 +2124,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsParameterPack; + return ((Internal*) __Instance)->IsParameterPack != 0; } set { - ((Internal*) __Instance)->IsParameterPack = value; + ((Internal*) __Instance)->IsParameterPack = (byte) (value ? 1 : 0); } } } @@ -2394,7 +2143,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Replacement; @@ -2410,8 +2159,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TemplateParameterSubstitutionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterSubstitutionType((TemplateParameterSubstitutionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2446,8 +2193,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterSubstitutionType(CppSharp.Parser.AST.TemplateParameterSubstitutionType _0) @@ -2455,28 +2202,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Replacement @@ -2502,7 +2230,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr TemplateSpecialization; @@ -2521,8 +2249,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InjectedClassNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InjectedClassNameType((InjectedClassNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2557,8 +2283,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InjectedClassNameType(CppSharp.Parser.AST.InjectedClassNameType _0) @@ -2566,31 +2292,12 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization + public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization { get { @@ -2636,7 +2343,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2649,8 +2356,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DependentNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DependentNameType((DependentNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2685,8 +2390,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DependentNameType(CppSharp.Parser.AST.DependentNameType _0) @@ -2694,28 +2399,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2728,7 +2414,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2741,8 +2427,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new PackExpansionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PackExpansionType((PackExpansionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2777,8 +2461,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PackExpansionType(CppSharp.Parser.AST.PackExpansionType _0) @@ -2786,28 +2470,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2820,7 +2485,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.PrimitiveType Type; @@ -2836,8 +2501,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BuiltinType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BuiltinType((BuiltinType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2872,8 +2535,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BuiltinType(CppSharp.Parser.AST.BuiltinType _0) @@ -2881,28 +2544,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.PrimitiveType Type @@ -2946,8 +2590,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableComponent __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2982,16 +2627,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableComponent(CppSharp.Parser.AST.VTableComponent _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((VTableComponent.Internal*) __Instance) = *((VTableComponent.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3001,20 +2646,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableComponent __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponentKind Kind @@ -3105,8 +2741,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3141,17 +2778,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableLayout(CppSharp.Parser.AST.VTableLayout _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3161,22 +2798,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponent getComponents(uint i) @@ -3241,8 +2868,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VFTableInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3277,17 +2905,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VFTableInfo(CppSharp.Parser.AST.VFTableInfo _0) { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3297,22 +2925,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VFTableInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public ulong VBTableIndex @@ -3380,7 +2998,7 @@ namespace CppSharp public CppSharp.Parser.AST.VTableLayout.Internal Layout; [FieldOffset(56)] - public bool HasOwnVFPtr; + public byte HasOwnVFPtr; [FieldOffset(64)] public long VBPtrOffset; @@ -3432,8 +3050,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClassLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3468,17 +3087,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(88); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassLayout(CppSharp.Parser.AST.ClassLayout _0) { __Instance = Marshal.AllocHGlobal(88); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3488,22 +3107,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ClassLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VFTableInfo getVFTables(uint i) @@ -3563,12 +3172,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasOwnVFPtr; + return ((Internal*) __Instance)->HasOwnVFPtr != 0; } set { - ((Internal*) __Instance)->HasOwnVFPtr = value; + ((Internal*) __Instance)->HasOwnVFPtr = (byte) (value ? 1 : 0); } } @@ -3652,10 +3261,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -3724,8 +3333,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Declaration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3760,18 +3370,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(168); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Declaration(CppSharp.Parser.AST.Declaration _0) { __Instance = Marshal.AllocHGlobal(168); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3781,22 +3391,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Declaration __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.PreprocessedEntity getPreprocessedEntities(uint i) @@ -3967,12 +3567,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIncomplete; + return ((Internal*) __Instance)->IsIncomplete != 0; } set { - ((Internal*) __Instance)->IsIncomplete = value; + ((Internal*) __Instance)->IsIncomplete = (byte) (value ? 1 : 0); } } @@ -3980,12 +3580,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } @@ -4061,10 +3661,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -4076,7 +3676,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -4254,8 +3854,6 @@ namespace CppSharp internal static extern uint getFriendsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new DeclarationContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DeclarationContext((DeclarationContext.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4290,9 +3888,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(392); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public DeclarationContext(CppSharp.Parser.AST.DeclarationContext _0) @@ -4300,28 +3898,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(392); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Namespace getNamespaces(uint i) @@ -4576,12 +4155,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAnonymous; + return ((Internal*) __Instance)->IsAnonymous != 0; } set { - ((Internal*) __Instance)->IsAnonymous = value; + ((Internal*) __Instance)->IsAnonymous = (byte) (value ? 1 : 0); } } } @@ -4613,10 +4192,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -4646,8 +4225,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TypedefDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefDecl((TypedefDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4682,8 +4259,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(184); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefDecl(CppSharp.Parser.AST.TypedefDecl _0) @@ -4691,28 +4268,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(184); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -4756,10 +4314,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -4789,8 +4347,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Friend __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Friend((Friend.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4825,8 +4381,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Friend(CppSharp.Parser.AST.Friend _0) @@ -4834,28 +4390,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -4911,8 +4448,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Statement __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -4947,9 +4485,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -4959,22 +4497,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Statement __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string String @@ -5047,8 +4575,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Expression __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Expression((Expression.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5083,28 +4609,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -5146,8 +4653,6 @@ namespace CppSharp internal static extern void setOpcodeStr_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new BinaryOperator __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BinaryOperator((BinaryOperator.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5182,28 +4687,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(80); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string OpcodeStr @@ -5301,8 +4787,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new CXXConstructExpr __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new CXXConstructExpr((CXXConstructExpr.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5337,28 +4821,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Expression getArguments(uint i) @@ -5420,10 +4885,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -5438,10 +4903,10 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; [FieldOffset(184)] - public bool IsIndirect; + public byte IsIndirect; [FieldOffset(185)] - public bool HasDefaultValue; + public byte HasDefaultValue; [FieldOffset(188)] public uint Index; @@ -5465,8 +4930,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Parameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Parameter((Parameter.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5501,8 +4964,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Parameter(CppSharp.Parser.AST.Parameter _0) @@ -5510,28 +4973,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -5551,12 +4995,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIndirect; + return ((Internal*) __Instance)->IsIndirect != 0; } set { - ((Internal*) __Instance)->IsIndirect = value; + ((Internal*) __Instance)->IsIndirect = (byte) (value ? 1 : 0); } } @@ -5564,12 +5008,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasDefaultValue; + return ((Internal*) __Instance)->HasDefaultValue != 0; } set { - ((Internal*) __Instance)->HasDefaultValue = value; + ((Internal*) __Instance)->HasDefaultValue = (byte) (value ? 1 : 0); } } @@ -5632,10 +5076,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -5650,22 +5094,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(184)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(185)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(186)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(187)] - public bool IsInline; + public byte IsInline; [FieldOffset(188)] - public bool IsPure; + public byte IsPure; [FieldOffset(189)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(192)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -5732,8 +5176,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Function __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Function((Function.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5768,8 +5210,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(288); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Function(CppSharp.Parser.AST.Function _0) @@ -5777,28 +5219,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(288); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -5881,12 +5304,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsReturnIndirect; + return ((Internal*) __Instance)->IsReturnIndirect != 0; } set { - ((Internal*) __Instance)->IsReturnIndirect = value; + ((Internal*) __Instance)->IsReturnIndirect = (byte) (value ? 1 : 0); } } @@ -5894,12 +5317,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasThisReturn; + return ((Internal*) __Instance)->HasThisReturn != 0; } set { - ((Internal*) __Instance)->HasThisReturn = value; + ((Internal*) __Instance)->HasThisReturn = (byte) (value ? 1 : 0); } } @@ -5907,12 +5330,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVariadic; + return ((Internal*) __Instance)->IsVariadic != 0; } set { - ((Internal*) __Instance)->IsVariadic = value; + ((Internal*) __Instance)->IsVariadic = (byte) (value ? 1 : 0); } } @@ -5920,12 +5343,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } @@ -5933,12 +5356,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPure; + return ((Internal*) __Instance)->IsPure != 0; } set { - ((Internal*) __Instance)->IsPure = value; + ((Internal*) __Instance)->IsPure = (byte) (value ? 1 : 0); } } @@ -5946,12 +5369,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDeleted; + return ((Internal*) __Instance)->IsDeleted != 0; } set { - ((Internal*) __Instance)->IsDeleted = value; + ((Internal*) __Instance)->IsDeleted = (byte) (value ? 1 : 0); } } @@ -6027,10 +5450,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -6045,22 +5468,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(184)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(185)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(186)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(187)] - public bool IsInline; + public byte IsInline; [FieldOffset(188)] - public bool IsPure; + public byte IsPure; [FieldOffset(189)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(192)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -6075,34 +5498,34 @@ namespace CppSharp public global::System.IntPtr AccessDecl; [FieldOffset(296)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(297)] - public bool IsStatic; + public byte IsStatic; [FieldOffset(298)] - public bool IsConst; + public byte IsConst; [FieldOffset(299)] - public bool IsImplicit; + public byte IsImplicit; [FieldOffset(300)] - public bool IsExplicit; + public byte IsExplicit; [FieldOffset(301)] - public bool IsOverride; + public byte IsOverride; [FieldOffset(304)] public CppSharp.Parser.AST.CXXMethodKind MethodKind; [FieldOffset(308)] - public bool IsDefaultConstructor; + public byte IsDefaultConstructor; [FieldOffset(309)] - public bool IsCopyConstructor; + public byte IsCopyConstructor; [FieldOffset(310)] - public bool IsMoveConstructor; + public byte IsMoveConstructor; [FieldOffset(312)] public CppSharp.Parser.AST.QualifiedType.Internal ConversionType; @@ -6123,8 +5546,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Method __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Method((Method.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6159,8 +5580,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(328); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Method(CppSharp.Parser.AST.Method _0) @@ -6168,28 +5589,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(328); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.AccessSpecifierDecl AccessDecl @@ -6214,12 +5616,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -6227,12 +5629,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsStatic; + return ((Internal*) __Instance)->IsStatic != 0; } set { - ((Internal*) __Instance)->IsStatic = value; + ((Internal*) __Instance)->IsStatic = (byte) (value ? 1 : 0); } } @@ -6240,12 +5642,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -6253,12 +5655,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsImplicit; + return ((Internal*) __Instance)->IsImplicit != 0; } set { - ((Internal*) __Instance)->IsImplicit = value; + ((Internal*) __Instance)->IsImplicit = (byte) (value ? 1 : 0); } } @@ -6266,12 +5668,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExplicit; + return ((Internal*) __Instance)->IsExplicit != 0; } set { - ((Internal*) __Instance)->IsExplicit = value; + ((Internal*) __Instance)->IsExplicit = (byte) (value ? 1 : 0); } } @@ -6279,12 +5681,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsOverride; + return ((Internal*) __Instance)->IsOverride != 0; } set { - ((Internal*) __Instance)->IsOverride = value; + ((Internal*) __Instance)->IsOverride = (byte) (value ? 1 : 0); } } @@ -6305,12 +5707,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDefaultConstructor; + return ((Internal*) __Instance)->IsDefaultConstructor != 0; } set { - ((Internal*) __Instance)->IsDefaultConstructor = value; + ((Internal*) __Instance)->IsDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -6318,12 +5720,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsCopyConstructor; + return ((Internal*) __Instance)->IsCopyConstructor != 0; } set { - ((Internal*) __Instance)->IsCopyConstructor = value; + ((Internal*) __Instance)->IsCopyConstructor = (byte) (value ? 1 : 0); } } @@ -6331,12 +5733,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsMoveConstructor; + return ((Internal*) __Instance)->IsMoveConstructor != 0; } set { - ((Internal*) __Instance)->IsMoveConstructor = value; + ((Internal*) __Instance)->IsMoveConstructor = (byte) (value ? 1 : 0); } } @@ -6381,10 +5783,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -6396,7 +5798,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(388)] public CppSharp.Parser.AST.Enumeration.EnumModifiers Modifiers; @@ -6478,10 +5880,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -6521,8 +5923,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Item __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Item((Item.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6557,8 +5957,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Item(CppSharp.Parser.AST.Enumeration.Item _0) @@ -6566,28 +5966,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -6620,8 +6001,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new Enumeration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Enumeration((Enumeration.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6656,8 +6035,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(432); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Enumeration(CppSharp.Parser.AST.Enumeration _0) @@ -6665,28 +6044,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(432); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Enumeration.Item getItems(uint i) @@ -6793,10 +6153,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -6836,8 +6196,6 @@ namespace CppSharp internal static extern void setMangled_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Variable __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Variable((Variable.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6872,8 +6230,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Variable(CppSharp.Parser.AST.Variable _0) @@ -6881,28 +6239,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Mangled @@ -6944,7 +6283,7 @@ namespace CppSharp public CppSharp.Parser.AST.AccessSpecifier Access; [FieldOffset(4)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(8)] public global::System.IntPtr Type; @@ -6965,8 +6304,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -7001,16 +6341,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BaseClassSpecifier(CppSharp.Parser.AST.BaseClassSpecifier _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BaseClassSpecifier.Internal*) __Instance) = *((BaseClassSpecifier.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -7020,20 +6360,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BaseClassSpecifier __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.AccessSpecifier Access @@ -7053,12 +6384,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -7121,10 +6452,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -7145,7 +6476,7 @@ namespace CppSharp public global::System.IntPtr Class; [FieldOffset(200)] - public bool IsBitField; + public byte IsBitField; [FieldOffset(204)] public uint BitWidth; @@ -7166,8 +6497,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Field __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Field((Field.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7202,8 +6531,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Field(CppSharp.Parser.AST.Field _0) @@ -7211,28 +6540,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -7283,12 +6593,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsBitField; + return ((Internal*) __Instance)->IsBitField != 0; } set { - ((Internal*) __Instance)->IsBitField = value; + ((Internal*) __Instance)->IsBitField = (byte) (value ? 1 : 0); } } @@ -7333,10 +6643,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -7363,8 +6673,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new AccessSpecifierDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AccessSpecifierDecl((AccessSpecifierDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7399,8 +6707,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(168); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AccessSpecifierDecl(CppSharp.Parser.AST.AccessSpecifierDecl _0) @@ -7408,28 +6716,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(168); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -7460,10 +6749,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -7475,34 +6764,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(488)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(489)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(490)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(491)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(492)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(493)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(494)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(495)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(496)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(504)] public global::System.IntPtr Layout; @@ -7603,8 +6892,6 @@ namespace CppSharp internal static extern uint getSpecifiersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Class __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Class((Class.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7639,8 +6926,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(512); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Class(CppSharp.Parser.AST.Class _0) @@ -7648,28 +6935,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(512); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BaseClassSpecifier getBases(uint i) @@ -7800,12 +7068,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPOD; + return ((Internal*) __Instance)->IsPOD != 0; } set { - ((Internal*) __Instance)->IsPOD = value; + ((Internal*) __Instance)->IsPOD = (byte) (value ? 1 : 0); } } @@ -7813,12 +7081,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAbstract; + return ((Internal*) __Instance)->IsAbstract != 0; } set { - ((Internal*) __Instance)->IsAbstract = value; + ((Internal*) __Instance)->IsAbstract = (byte) (value ? 1 : 0); } } @@ -7826,12 +7094,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsUnion; + return ((Internal*) __Instance)->IsUnion != 0; } set { - ((Internal*) __Instance)->IsUnion = value; + ((Internal*) __Instance)->IsUnion = (byte) (value ? 1 : 0); } } @@ -7839,12 +7107,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDynamic; + return ((Internal*) __Instance)->IsDynamic != 0; } set { - ((Internal*) __Instance)->IsDynamic = value; + ((Internal*) __Instance)->IsDynamic = (byte) (value ? 1 : 0); } } @@ -7852,12 +7120,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPolymorphic; + return ((Internal*) __Instance)->IsPolymorphic != 0; } set { - ((Internal*) __Instance)->IsPolymorphic = value; + ((Internal*) __Instance)->IsPolymorphic = (byte) (value ? 1 : 0); } } @@ -7865,12 +7133,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor; + return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = value; + ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -7878,12 +7146,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialCopyConstructor; + return ((Internal*) __Instance)->HasNonTrivialCopyConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialCopyConstructor = value; + ((Internal*) __Instance)->HasNonTrivialCopyConstructor = (byte) (value ? 1 : 0); } } @@ -7891,12 +7159,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDestructor; + return ((Internal*) __Instance)->HasNonTrivialDestructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDestructor = value; + ((Internal*) __Instance)->HasNonTrivialDestructor = (byte) (value ? 1 : 0); } } @@ -7904,12 +7172,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExternCContext; + return ((Internal*) __Instance)->IsExternCContext != 0; } set { - ((Internal*) __Instance)->IsExternCContext = value; + ((Internal*) __Instance)->IsExternCContext = (byte) (value ? 1 : 0); } } @@ -7959,10 +7227,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -8017,8 +7285,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Template __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Template((Template.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8053,9 +7319,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Template() @@ -8063,8 +7329,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public Template(CppSharp.Parser.AST.Template _0) @@ -8072,28 +7338,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter getParameters(uint i) @@ -8169,10 +7416,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -8222,8 +7469,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplate((ClassTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8258,8 +7503,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(224); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplate(CppSharp.Parser.AST.ClassTemplate _0) @@ -8267,28 +7512,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(224); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ClassTemplateSpecialization getSpecializations(uint i) @@ -8350,10 +7576,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -8365,34 +7591,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(488)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(489)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(490)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(491)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(492)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(493)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(494)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(495)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(496)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(504)] public global::System.IntPtr Layout; @@ -8439,8 +7665,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplateSpecialization((ClassTemplateSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8475,8 +7699,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(552); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplateSpecialization(CppSharp.Parser.AST.ClassTemplateSpecialization _0) @@ -8484,28 +7708,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(552); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -8594,10 +7799,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -8609,34 +7814,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(488)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(489)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(490)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(491)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(492)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(493)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(494)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(495)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(496)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(504)] public global::System.IntPtr Layout; @@ -8663,8 +7868,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplatePartialSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplatePartialSpecialization((ClassTemplatePartialSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8699,8 +7902,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(552); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplatePartialSpecialization(CppSharp.Parser.AST.ClassTemplatePartialSpecialization _0) @@ -8708,28 +7911,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(552); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -8760,10 +7944,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -8813,8 +7997,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionTemplate((FunctionTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8849,8 +8031,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(224); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplate(CppSharp.Parser.AST.FunctionTemplate _0) @@ -8858,28 +8040,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(224); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.FunctionTemplateSpecialization getSpecializations(uint i) @@ -8966,8 +8129,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -9002,17 +8166,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplateSpecialization(CppSharp.Parser.AST.FunctionTemplateSpecialization _0) { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -9022,22 +8186,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.FunctionTemplateSpecialization __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -9144,10 +8298,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -9159,10 +8313,10 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(385)] - public bool IsInline; + public byte IsInline; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -9180,8 +8334,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Namespace __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Namespace((Namespace.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9216,8 +8368,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(392); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Namespace(CppSharp.Parser.AST.Namespace _0) @@ -9225,40 +8377,21 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(392); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public bool IsInline { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } } @@ -9290,10 +8423,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -9323,8 +8456,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new PreprocessedEntity __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PreprocessedEntity((PreprocessedEntity.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9359,8 +8490,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PreprocessedEntity(CppSharp.Parser.AST.PreprocessedEntity _0) @@ -9368,36 +8499,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) + public CppSharp.Parser.AST.MacroLocation MacroLocation { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.MacroLocation MacroLocation - { - get - { - return ((Internal*) __Instance)->MacroLocation; - } + get + { + return ((Internal*) __Instance)->MacroLocation; + } set { @@ -9433,10 +8545,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -9476,8 +8588,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroDefinition __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroDefinition((MacroDefinition.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9512,8 +8622,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroDefinition(CppSharp.Parser.AST.MacroDefinition _0) @@ -9521,28 +8631,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(200); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -9589,10 +8680,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -9635,8 +8726,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroExpansion __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroExpansion((MacroExpansion.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9671,8 +8760,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroExpansion(CppSharp.Parser.AST.MacroExpansion _0) @@ -9680,28 +8769,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -9766,10 +8836,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(88)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(89)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(96)] public global::System.IntPtr CompleteDeclaration; @@ -9781,13 +8851,13 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(384)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(385)] - public bool IsInline; + public byte IsInline; [FieldOffset(416)] - public bool IsSystemHeader; + public byte IsSystemHeader; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -9835,8 +8905,6 @@ namespace CppSharp internal static extern uint getMacrosCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TranslationUnit __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TranslationUnit((TranslationUnit.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9871,8 +8939,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(448); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TranslationUnit(CppSharp.Parser.AST.TranslationUnit _0) @@ -9880,28 +8948,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(448); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.MacroDefinition getMacros(uint i) @@ -9955,12 +9004,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsSystemHeader; + return ((Internal*) __Instance)->IsSystemHeader != 0; } set { - ((Internal*) __Instance)->IsSystemHeader = value; + ((Internal*) __Instance)->IsSystemHeader = (byte) (value ? 1 : 0); } } } @@ -10041,8 +9090,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static NativeLibrary __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10077,17 +9127,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(80); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public NativeLibrary(CppSharp.Parser.AST.NativeLibrary _0) { __Instance = Marshal.AllocHGlobal(80); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10097,22 +9147,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.NativeLibrary __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string getSymbols(uint i) @@ -10242,8 +9282,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ASTContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10278,17 +9319,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ASTContext(CppSharp.Parser.AST.ASTContext _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10298,22 +9339,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ASTContext __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TranslationUnit getTranslationUnits(uint i) @@ -10369,8 +9400,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Comment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10405,17 +9437,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Comment(CppSharp.Parser.AST.Comment _0) { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((Comment.Internal*) __Instance) = *((Comment.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10425,20 +9457,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Comment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.CommentKind Kind @@ -10479,8 +9502,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BlockContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockContentComment((BlockContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10515,8 +9536,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10524,9 +9545,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.BlockContentComment _0) @@ -10534,27 +9555,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BlockContentComment.Internal*) __Instance) = *((BlockContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -10602,8 +9604,6 @@ namespace CppSharp internal static extern uint getBlocksCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FullComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FullComment((FullComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10638,8 +9638,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FullComment(CppSharp.Parser.AST.FullComment _0) @@ -10647,28 +9647,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockContentComment getBlocks(uint i) @@ -10788,8 +9769,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10824,17 +9806,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.BlockCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10844,22 +9826,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BlockCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -10879,8 +9851,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new BlockCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockCommandComment((BlockCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10915,8 +9885,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10924,9 +9894,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.BlockCommandComment _0) @@ -10934,28 +9904,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockCommandComment.Argument getArguments(uint i) @@ -11039,8 +9990,6 @@ namespace CppSharp InOut = 2 } - private bool __ownsNativeInstance; - public static new ParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParamCommandComment((ParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11075,8 +10024,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParamCommandComment(CppSharp.Parser.AST.ParamCommandComment _0) @@ -11084,28 +10033,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ParamCommandComment.PassDirection Direction @@ -11182,8 +10112,6 @@ namespace CppSharp internal static extern uint getPositionCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TParamCommandComment((TParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11218,8 +10146,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TParamCommandComment(CppSharp.Parser.AST.TParamCommandComment _0) @@ -11227,28 +10155,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public uint getPosition(uint i) @@ -11314,8 +10223,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimBlockLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockLineComment((VerbatimBlockLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11350,8 +10257,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockLineComment(CppSharp.Parser.AST.VerbatimBlockLineComment _0) @@ -11359,28 +10266,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11447,8 +10335,6 @@ namespace CppSharp internal static extern uint getLinesCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new VerbatimBlockComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockComment((VerbatimBlockComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11483,8 +10369,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockComment(CppSharp.Parser.AST.VerbatimBlockComment _0) @@ -11492,28 +10378,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.VerbatimBlockLineComment getLines(uint i) @@ -11585,8 +10452,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimLineComment((VerbatimLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11621,8 +10486,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimLineComment(CppSharp.Parser.AST.VerbatimLineComment _0) @@ -11630,28 +10495,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11695,8 +10541,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InlineContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineContentComment((InlineContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11731,8 +10575,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -11740,9 +10584,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.InlineContentComment _0) @@ -11750,27 +10594,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((InlineContentComment.Internal*) __Instance) = *((InlineContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -11783,7 +10608,7 @@ namespace CppSharp public CppSharp.Parser.AST.CommentKind Kind; [FieldOffset(4)] - public bool IsWhitespace; + public byte IsWhitespace; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -11821,8 +10646,6 @@ namespace CppSharp internal static extern uint getContentCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ParagraphComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParagraphComment((ParagraphComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11857,8 +10680,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParagraphComment(CppSharp.Parser.AST.ParagraphComment _0) @@ -11866,28 +10689,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineContentComment getContent(uint i) @@ -11925,12 +10729,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsWhitespace; + return ((Internal*) __Instance)->IsWhitespace != 0; } set { - ((Internal*) __Instance)->IsWhitespace = value; + ((Internal*) __Instance)->IsWhitespace = (byte) (value ? 1 : 0); } } } @@ -12023,8 +10827,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12059,17 +10864,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.InlineCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12079,22 +10884,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.InlineCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -12114,8 +10909,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new InlineCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineCommandComment((InlineCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12150,8 +10943,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineCommandComment(CppSharp.Parser.AST.InlineCommandComment _0) @@ -12159,28 +10952,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineCommandComment.Argument getArguments(uint i) @@ -12248,8 +11022,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new HTMLTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLTagComment((HTMLTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12284,8 +11056,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.CommentKind Kind) @@ -12293,9 +11065,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.HTMLTagComment _0) @@ -12303,27 +11075,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((HTMLTagComment.Internal*) __Instance) = *((HTMLTagComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -12424,8 +11177,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Attribute __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12460,17 +11214,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Attribute(CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12480,22 +11234,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.HTMLStartTagComment.Attribute __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Name @@ -12531,8 +11275,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new HTMLStartTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLStartTagComment((HTMLStartTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12567,8 +11309,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLStartTagComment(CppSharp.Parser.AST.HTMLStartTagComment _0) @@ -12576,28 +11318,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.HTMLStartTagComment.Attribute getAttributes(uint i) @@ -12678,8 +11401,6 @@ namespace CppSharp internal static extern void setTagName_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new HTMLEndTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLEndTagComment((HTMLEndTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12714,8 +11435,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLEndTagComment(CppSharp.Parser.AST.HTMLEndTagComment _0) @@ -12723,28 +11444,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string TagName @@ -12798,8 +11500,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new TextComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TextComment((TextComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12834,8 +11534,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TextComment(CppSharp.Parser.AST.TextComment _0) @@ -12843,28 +11543,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -12933,8 +11614,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static RawComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12969,17 +11651,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public RawComment(CppSharp.Parser.AST.RawComment _0) { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12989,22 +11671,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.RawComment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs index df7ded27..9d10c030 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs @@ -60,16 +60,16 @@ namespace CppSharp public CppSharp.Parser.AST.CppAbi Abi; [FieldOffset(212)] - public bool NoStandardIncludes; + public byte NoStandardIncludes; [FieldOffset(213)] - public bool NoBuiltinIncludes; + public byte NoBuiltinIncludes; [FieldOffset(214)] - public bool MicrosoftMode; + public byte MicrosoftMode; [FieldOffset(215)] - public bool Verbose; + public byte Verbose; [FieldOffset(216)] public CppSharp.Parser.LanguageVersion LanguageVersion; @@ -232,8 +232,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserOptions __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -268,17 +269,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(224); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserOptions(CppSharp.Parser.ParserOptions _0) { __Instance = Marshal.AllocHGlobal(224); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -288,22 +289,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserOptions __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string getArguments(uint i) @@ -548,12 +539,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoStandardIncludes; + return ((Internal*) __Instance)->NoStandardIncludes != 0; } set { - ((Internal*) __Instance)->NoStandardIncludes = value; + ((Internal*) __Instance)->NoStandardIncludes = (byte) (value ? 1 : 0); } } @@ -561,12 +552,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoBuiltinIncludes; + return ((Internal*) __Instance)->NoBuiltinIncludes != 0; } set { - ((Internal*) __Instance)->NoBuiltinIncludes = value; + ((Internal*) __Instance)->NoBuiltinIncludes = (byte) (value ? 1 : 0); } } @@ -574,12 +565,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->MicrosoftMode; + return ((Internal*) __Instance)->MicrosoftMode != 0; } set { - ((Internal*) __Instance)->MicrosoftMode = value; + ((Internal*) __Instance)->MicrosoftMode = (byte) (value ? 1 : 0); } } @@ -587,12 +578,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->Verbose; + return ((Internal*) __Instance)->Verbose != 0; } set { - ((Internal*) __Instance)->Verbose = value; + ((Internal*) __Instance)->Verbose = (byte) (value ? 1 : 0); } } @@ -662,8 +653,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserDiagnostic __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -698,17 +690,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserDiagnostic(CppSharp.Parser.ParserDiagnostic _0) { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -718,22 +710,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserDiagnostic __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string FileName @@ -863,8 +845,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserResult __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -899,17 +882,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserResult(CppSharp.Parser.ParserResult _0) { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -919,22 +902,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserResult __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i) @@ -1042,8 +1015,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClangParser __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1085,8 +1059,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(0); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((ClangParser.Internal*) __Instance) = *((ClangParser.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1096,20 +1070,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ClangParser __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts) diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Target.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Target.cs index cc98dd64..aacf412b 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Target.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Target.cs @@ -172,8 +172,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserTargetInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -208,17 +209,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserTargetInfo(CppSharp.Parser.ParserTargetInfo _0) { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -228,22 +229,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserTargetInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string ABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs index 20d5e1e6..2314cc95 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -266,8 +266,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Type __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -302,18 +303,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Type(CppSharp.Parser.AST.Type _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -323,20 +324,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Type __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TypeKind Kind @@ -356,12 +348,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } } @@ -372,13 +364,13 @@ namespace CppSharp public partial struct Internal { [FieldOffset(0)] - public bool IsConst; + public byte IsConst; [FieldOffset(1)] - public bool IsVolatile; + public byte IsVolatile; [FieldOffset(2)] - public bool IsRestrict; + public byte IsRestrict; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -388,8 +380,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TypeQualifiers __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -424,8 +417,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(3); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TypeQualifiers.Internal*) __Instance) = *((TypeQualifiers.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public TypeQualifiers() @@ -442,32 +435,23 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TypeQualifiers __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public bool IsConst { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -475,12 +459,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVolatile; + return ((Internal*) __Instance)->IsVolatile != 0; } set { - ((Internal*) __Instance)->IsVolatile = value; + ((Internal*) __Instance)->IsVolatile = (byte) (value ? 1 : 0); } } @@ -488,12 +472,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsRestrict; + return ((Internal*) __Instance)->IsRestrict != 0; } set { - ((Internal*) __Instance)->IsRestrict = value; + ((Internal*) __Instance)->IsRestrict = (byte) (value ? 1 : 0); } } } @@ -522,8 +506,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static QualifiedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -558,16 +543,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public QualifiedType(CppSharp.Parser.AST.QualifiedType _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((QualifiedType.Internal*) __Instance) = *((QualifiedType.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -577,20 +562,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.QualifiedType __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.Type Type @@ -634,7 +610,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -650,8 +626,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TagType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TagType((TagType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -686,8 +660,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TagType(CppSharp.Parser.AST.TagType _0) @@ -695,28 +669,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -747,7 +702,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; @@ -780,8 +735,6 @@ namespace CppSharp Incomplete = 3 } - private bool __ownsNativeInstance; - public static new ArrayType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ArrayType((ArrayType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -816,8 +769,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ArrayType(CppSharp.Parser.AST.ArrayType _0) @@ -825,28 +778,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -911,7 +845,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; @@ -955,8 +889,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionType((FunctionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -991,8 +923,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionType(CppSharp.Parser.AST.FunctionType _0) @@ -1000,28 +932,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -1091,7 +1004,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal QualifiedPointee; @@ -1118,8 +1031,6 @@ namespace CppSharp RVReference = 3 } - private bool __ownsNativeInstance; - public static new PointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PointerType((PointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1154,8 +1065,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PointerType(CppSharp.Parser.AST.PointerType _0) @@ -1163,28 +1074,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedPointee @@ -1223,7 +1115,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Pointee; @@ -1239,8 +1131,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new MemberPointerType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MemberPointerType((MemberPointerType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1275,8 +1165,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MemberPointerType(CppSharp.Parser.AST.MemberPointerType _0) @@ -1284,28 +1174,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Pointee @@ -1331,7 +1202,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr Declaration; @@ -1347,8 +1218,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TypedefType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefType((TypedefType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1383,8 +1252,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefType(CppSharp.Parser.AST.TypedefType _0) @@ -1392,28 +1261,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TypedefDecl Declaration @@ -1444,7 +1294,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Modified; @@ -1463,8 +1313,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new AttributedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AttributedType((AttributedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1499,8 +1347,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AttributedType(CppSharp.Parser.AST.AttributedType _0) @@ -1508,28 +1356,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Modified @@ -1568,7 +1397,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Decayed; @@ -1590,8 +1419,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DecayedType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DecayedType((DecayedType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1626,8 +1453,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DecayedType(CppSharp.Parser.AST.DecayedType _0) @@ -1635,28 +1462,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Decayed @@ -1741,8 +1549,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateArgument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1777,16 +1586,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateArgument(CppSharp.Parser.AST.TemplateArgument _0) { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((TemplateArgument.Internal*) __Instance) = *((TemplateArgument.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1796,20 +1605,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateArgument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument.ArgumentKind Kind @@ -1879,7 +1679,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(32)] public global::System.IntPtr Template; @@ -1923,8 +1723,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateSpecializationType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateSpecializationType((TemplateSpecializationType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -1959,8 +1757,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateSpecializationType(CppSharp.Parser.AST.TemplateSpecializationType _0) @@ -1968,28 +1766,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -2062,7 +1841,7 @@ namespace CppSharp public partial struct Internal { [FieldOffset(8)] - public bool IsTypeParameter; + public byte IsTypeParameter; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2083,7 +1862,7 @@ namespace CppSharp [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZNK8CppSharp9CppParser3AST17TemplateParametereqERKS2_")] [return: MarshalAsAttribute(UnmanagedType.I1)] - internal static extern bool OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); + internal static extern byte OperatorEqualEqual_0(global::System.IntPtr instance, global::System.IntPtr param); [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2098,8 +1877,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static TemplateParameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2134,17 +1914,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameter(CppSharp.Parser.AST.TemplateParameter _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -2154,22 +1934,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.TemplateParameter __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public static bool operator !=(CppSharp.Parser.AST.TemplateParameter __op, CppSharp.Parser.AST.TemplateParameter param) @@ -2186,7 +1956,7 @@ namespace CppSharp var arg0 = __op.__Instance; var arg1 = param.__Instance; var __ret = Internal.OperatorEqualEqual_0(arg0, arg1); - return __ret; + return __ret != 0; } public override bool Equals(object obj) @@ -2214,12 +1984,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsTypeParameter; + return ((Internal*) __Instance)->IsTypeParameter != 0; } set { - ((Internal*) __Instance)->IsTypeParameter = value; + ((Internal*) __Instance)->IsTypeParameter = (byte) (value ? 1 : 0); } } } @@ -2233,7 +2003,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.TemplateParameter.Internal Parameter; @@ -2245,7 +2015,7 @@ namespace CppSharp public uint Index; [FieldOffset(32)] - public bool IsParameterPack; + public byte IsParameterPack; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2263,8 +2033,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TemplateParameterType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterType((TemplateParameterType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2299,8 +2067,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterType(CppSharp.Parser.AST.TemplateParameterType _0) @@ -2308,28 +2076,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter Parameter @@ -2375,12 +2124,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsParameterPack; + return ((Internal*) __Instance)->IsParameterPack != 0; } set { - ((Internal*) __Instance)->IsParameterPack = value; + ((Internal*) __Instance)->IsParameterPack = (byte) (value ? 1 : 0); } } } @@ -2394,7 +2143,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.QualifiedType.Internal Replacement; @@ -2410,8 +2159,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new TemplateParameterSubstitutionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TemplateParameterSubstitutionType((TemplateParameterSubstitutionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2446,8 +2193,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TemplateParameterSubstitutionType(CppSharp.Parser.AST.TemplateParameterSubstitutionType _0) @@ -2455,28 +2202,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType Replacement @@ -2502,7 +2230,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public global::System.IntPtr TemplateSpecialization; @@ -2521,8 +2249,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InjectedClassNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InjectedClassNameType((InjectedClassNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2557,8 +2283,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InjectedClassNameType(CppSharp.Parser.AST.InjectedClassNameType _0) @@ -2566,31 +2292,12 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization + public CppSharp.Parser.AST.TemplateSpecializationType TemplateSpecialization { get { @@ -2636,7 +2343,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2649,8 +2356,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new DependentNameType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DependentNameType((DependentNameType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2685,8 +2390,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public DependentNameType(CppSharp.Parser.AST.DependentNameType _0) @@ -2694,28 +2399,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2728,7 +2414,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -2741,8 +2427,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new PackExpansionType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PackExpansionType((PackExpansionType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2777,8 +2461,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PackExpansionType(CppSharp.Parser.AST.PackExpansionType _0) @@ -2786,28 +2470,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -2820,7 +2485,7 @@ namespace CppSharp public CppSharp.Parser.AST.TypeKind Kind; [FieldOffset(4)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(8)] public CppSharp.Parser.AST.PrimitiveType Type; @@ -2836,8 +2501,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BuiltinType __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BuiltinType((BuiltinType.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -2872,8 +2535,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BuiltinType(CppSharp.Parser.AST.BuiltinType _0) @@ -2881,28 +2544,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(12); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Type __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.PrimitiveType Type @@ -2946,8 +2590,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableComponent __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -2982,16 +2627,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableComponent(CppSharp.Parser.AST.VTableComponent _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((VTableComponent.Internal*) __Instance) = *((VTableComponent.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3001,20 +2646,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableComponent __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponentKind Kind @@ -3105,8 +2741,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VTableLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3141,17 +2778,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VTableLayout(CppSharp.Parser.AST.VTableLayout _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3161,22 +2798,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VTableLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VTableComponent getComponents(uint i) @@ -3241,8 +2868,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static VFTableInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3277,17 +2905,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VFTableInfo(CppSharp.Parser.AST.VFTableInfo _0) { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3297,22 +2925,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.VFTableInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public ulong VBTableIndex @@ -3380,7 +2998,7 @@ namespace CppSharp public CppSharp.Parser.AST.VTableLayout.Internal Layout; [FieldOffset(56)] - public bool HasOwnVFPtr; + public byte HasOwnVFPtr; [FieldOffset(64)] public long VBPtrOffset; @@ -3432,8 +3050,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClassLayout __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3468,17 +3087,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(88); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassLayout(CppSharp.Parser.AST.ClassLayout _0) { __Instance = Marshal.AllocHGlobal(88); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3488,22 +3107,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ClassLayout __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.VFTableInfo getVFTables(uint i) @@ -3563,12 +3172,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasOwnVFPtr; + return ((Internal*) __Instance)->HasOwnVFPtr != 0; } set { - ((Internal*) __Instance)->HasOwnVFPtr = value; + ((Internal*) __Instance)->HasOwnVFPtr = (byte) (value ? 1 : 0); } } @@ -3652,10 +3261,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -3724,8 +3333,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Declaration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -3760,18 +3370,18 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Declaration(CppSharp.Parser.AST.Declaration _0) { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -3781,22 +3391,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Declaration __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.PreprocessedEntity getPreprocessedEntities(uint i) @@ -3967,12 +3567,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIncomplete; + return ((Internal*) __Instance)->IsIncomplete != 0; } set { - ((Internal*) __Instance)->IsIncomplete = value; + ((Internal*) __Instance)->IsIncomplete = (byte) (value ? 1 : 0); } } @@ -3980,12 +3580,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDependent; + return ((Internal*) __Instance)->IsDependent != 0; } set { - ((Internal*) __Instance)->IsDependent = value; + ((Internal*) __Instance)->IsDependent = (byte) (value ? 1 : 0); } } @@ -4061,10 +3661,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -4076,7 +3676,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -4254,8 +3854,6 @@ namespace CppSharp internal static extern uint getFriendsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new DeclarationContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new DeclarationContext((DeclarationContext.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4290,9 +3888,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(368); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public DeclarationContext(CppSharp.Parser.AST.DeclarationContext _0) @@ -4300,28 +3898,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(368); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Namespace getNamespaces(uint i) @@ -4576,12 +4155,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAnonymous; + return ((Internal*) __Instance)->IsAnonymous != 0; } set { - ((Internal*) __Instance)->IsAnonymous = value; + ((Internal*) __Instance)->IsAnonymous = (byte) (value ? 1 : 0); } } } @@ -4613,10 +4192,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -4646,8 +4225,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TypedefDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TypedefDecl((TypedefDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4682,8 +4259,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TypedefDecl(CppSharp.Parser.AST.TypedefDecl _0) @@ -4691,28 +4268,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -4756,10 +4314,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -4789,8 +4347,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Friend __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Friend((Friend.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -4825,8 +4381,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Friend(CppSharp.Parser.AST.Friend _0) @@ -4834,28 +4390,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Declaration Declaration @@ -4911,8 +4448,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Statement __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -4947,9 +4485,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -4959,22 +4497,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Statement __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string String @@ -5047,8 +4575,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Expression __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Expression((Expression.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5083,28 +4609,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -5146,8 +4653,6 @@ namespace CppSharp internal static extern void setOpcodeStr_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new BinaryOperator __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BinaryOperator((BinaryOperator.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5182,28 +4687,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string OpcodeStr @@ -5301,8 +4787,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new CXXConstructExpr __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new CXXConstructExpr((CXXConstructExpr.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5337,28 +4821,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Statement __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Expression getArguments(uint i) @@ -5420,10 +4885,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -5438,10 +4903,10 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal QualifiedType; [FieldOffset(136)] - public bool IsIndirect; + public byte IsIndirect; [FieldOffset(137)] - public bool HasDefaultValue; + public byte HasDefaultValue; [FieldOffset(140)] public uint Index; @@ -5465,8 +4930,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Parameter __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Parameter((Parameter.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5501,8 +4964,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Parameter(CppSharp.Parser.AST.Parameter _0) @@ -5510,28 +4973,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -5551,12 +4995,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsIndirect; + return ((Internal*) __Instance)->IsIndirect != 0; } set { - ((Internal*) __Instance)->IsIndirect = value; + ((Internal*) __Instance)->IsIndirect = (byte) (value ? 1 : 0); } } @@ -5564,12 +5008,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasDefaultValue; + return ((Internal*) __Instance)->HasDefaultValue != 0; } set { - ((Internal*) __Instance)->HasDefaultValue = value; + ((Internal*) __Instance)->HasDefaultValue = (byte) (value ? 1 : 0); } } @@ -5632,10 +5076,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -5650,22 +5094,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(136)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(137)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(138)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(139)] - public bool IsInline; + public byte IsInline; [FieldOffset(140)] - public bool IsPure; + public byte IsPure; [FieldOffset(141)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(144)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -5732,8 +5176,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Function __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Function((Function.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -5768,8 +5210,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Function(CppSharp.Parser.AST.Function _0) @@ -5777,28 +5219,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(208); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Parameter getParameters(uint i) @@ -5881,12 +5304,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsReturnIndirect; + return ((Internal*) __Instance)->IsReturnIndirect != 0; } set { - ((Internal*) __Instance)->IsReturnIndirect = value; + ((Internal*) __Instance)->IsReturnIndirect = (byte) (value ? 1 : 0); } } @@ -5894,12 +5317,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasThisReturn; + return ((Internal*) __Instance)->HasThisReturn != 0; } set { - ((Internal*) __Instance)->HasThisReturn = value; + ((Internal*) __Instance)->HasThisReturn = (byte) (value ? 1 : 0); } } @@ -5907,12 +5330,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVariadic; + return ((Internal*) __Instance)->IsVariadic != 0; } set { - ((Internal*) __Instance)->IsVariadic = value; + ((Internal*) __Instance)->IsVariadic = (byte) (value ? 1 : 0); } } @@ -5920,12 +5343,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } @@ -5933,12 +5356,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPure; + return ((Internal*) __Instance)->IsPure != 0; } set { - ((Internal*) __Instance)->IsPure = value; + ((Internal*) __Instance)->IsPure = (byte) (value ? 1 : 0); } } @@ -5946,12 +5369,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDeleted; + return ((Internal*) __Instance)->IsDeleted != 0; } set { - ((Internal*) __Instance)->IsDeleted = value; + ((Internal*) __Instance)->IsDeleted = (byte) (value ? 1 : 0); } } @@ -6027,10 +5450,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -6045,22 +5468,22 @@ namespace CppSharp public CppSharp.Parser.AST.QualifiedType.Internal ReturnType; [FieldOffset(136)] - public bool IsReturnIndirect; + public byte IsReturnIndirect; [FieldOffset(137)] - public bool HasThisReturn; + public byte HasThisReturn; [FieldOffset(138)] - public bool IsVariadic; + public byte IsVariadic; [FieldOffset(139)] - public bool IsInline; + public byte IsInline; [FieldOffset(140)] - public bool IsPure; + public byte IsPure; [FieldOffset(141)] - public bool IsDeleted; + public byte IsDeleted; [FieldOffset(144)] public CppSharp.Parser.AST.CXXOperatorKind OperatorKind; @@ -6075,34 +5498,34 @@ namespace CppSharp public global::System.IntPtr AccessDecl; [FieldOffset(216)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(217)] - public bool IsStatic; + public byte IsStatic; [FieldOffset(218)] - public bool IsConst; + public byte IsConst; [FieldOffset(219)] - public bool IsImplicit; + public byte IsImplicit; [FieldOffset(220)] - public bool IsExplicit; + public byte IsExplicit; [FieldOffset(221)] - public bool IsOverride; + public byte IsOverride; [FieldOffset(224)] public CppSharp.Parser.AST.CXXMethodKind MethodKind; [FieldOffset(228)] - public bool IsDefaultConstructor; + public byte IsDefaultConstructor; [FieldOffset(229)] - public bool IsCopyConstructor; + public byte IsCopyConstructor; [FieldOffset(230)] - public bool IsMoveConstructor; + public byte IsMoveConstructor; [FieldOffset(232)] public CppSharp.Parser.AST.QualifiedType.Internal ConversionType; @@ -6123,8 +5546,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Method __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Method((Method.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6159,8 +5580,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(248); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Method(CppSharp.Parser.AST.Method _0) @@ -6168,28 +5589,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(248); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.AccessSpecifierDecl AccessDecl @@ -6214,12 +5616,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -6227,12 +5629,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsStatic; + return ((Internal*) __Instance)->IsStatic != 0; } set { - ((Internal*) __Instance)->IsStatic = value; + ((Internal*) __Instance)->IsStatic = (byte) (value ? 1 : 0); } } @@ -6240,12 +5642,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsConst; + return ((Internal*) __Instance)->IsConst != 0; } set { - ((Internal*) __Instance)->IsConst = value; + ((Internal*) __Instance)->IsConst = (byte) (value ? 1 : 0); } } @@ -6253,12 +5655,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsImplicit; + return ((Internal*) __Instance)->IsImplicit != 0; } set { - ((Internal*) __Instance)->IsImplicit = value; + ((Internal*) __Instance)->IsImplicit = (byte) (value ? 1 : 0); } } @@ -6266,12 +5668,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExplicit; + return ((Internal*) __Instance)->IsExplicit != 0; } set { - ((Internal*) __Instance)->IsExplicit = value; + ((Internal*) __Instance)->IsExplicit = (byte) (value ? 1 : 0); } } @@ -6279,12 +5681,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsOverride; + return ((Internal*) __Instance)->IsOverride != 0; } set { - ((Internal*) __Instance)->IsOverride = value; + ((Internal*) __Instance)->IsOverride = (byte) (value ? 1 : 0); } } @@ -6305,12 +5707,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDefaultConstructor; + return ((Internal*) __Instance)->IsDefaultConstructor != 0; } set { - ((Internal*) __Instance)->IsDefaultConstructor = value; + ((Internal*) __Instance)->IsDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -6318,12 +5720,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsCopyConstructor; + return ((Internal*) __Instance)->IsCopyConstructor != 0; } set { - ((Internal*) __Instance)->IsCopyConstructor = value; + ((Internal*) __Instance)->IsCopyConstructor = (byte) (value ? 1 : 0); } } @@ -6331,12 +5733,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsMoveConstructor; + return ((Internal*) __Instance)->IsMoveConstructor != 0; } set { - ((Internal*) __Instance)->IsMoveConstructor = value; + ((Internal*) __Instance)->IsMoveConstructor = (byte) (value ? 1 : 0); } } @@ -6381,10 +5783,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -6396,7 +5798,7 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(364)] public CppSharp.Parser.AST.Enumeration.EnumModifiers Modifiers; @@ -6478,10 +5880,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -6521,8 +5923,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Item __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Item((Item.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6557,8 +5957,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Item(CppSharp.Parser.AST.Enumeration.Item _0) @@ -6566,28 +5966,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -6620,8 +6001,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new Enumeration __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Enumeration((Enumeration.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6656,8 +6035,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(408); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Enumeration(CppSharp.Parser.AST.Enumeration _0) @@ -6665,28 +6044,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(408); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.Enumeration.Item getItems(uint i) @@ -6793,10 +6153,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -6836,8 +6196,6 @@ namespace CppSharp internal static extern void setMangled_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new Variable __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Variable((Variable.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -6872,8 +6230,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Variable(CppSharp.Parser.AST.Variable _0) @@ -6881,28 +6239,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Mangled @@ -6944,7 +6283,7 @@ namespace CppSharp public CppSharp.Parser.AST.AccessSpecifier Access; [FieldOffset(4)] - public bool IsVirtual; + public byte IsVirtual; [FieldOffset(8)] public global::System.IntPtr Type; @@ -6965,8 +6304,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -7001,16 +6341,16 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BaseClassSpecifier(CppSharp.Parser.AST.BaseClassSpecifier _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BaseClassSpecifier.Internal*) __Instance) = *((BaseClassSpecifier.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -7020,20 +6360,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BaseClassSpecifier __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.AccessSpecifier Access @@ -7053,12 +6384,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsVirtual; + return ((Internal*) __Instance)->IsVirtual != 0; } set { - ((Internal*) __Instance)->IsVirtual = value; + ((Internal*) __Instance)->IsVirtual = (byte) (value ? 1 : 0); } } @@ -7121,10 +6452,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -7145,7 +6476,7 @@ namespace CppSharp public global::System.IntPtr Class; [FieldOffset(152)] - public bool IsBitField; + public byte IsBitField; [FieldOffset(156)] public uint BitWidth; @@ -7166,8 +6497,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Field __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Field((Field.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7202,8 +6531,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Field(CppSharp.Parser.AST.Field _0) @@ -7211,28 +6540,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.QualifiedType QualifiedType @@ -7283,12 +6593,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsBitField; + return ((Internal*) __Instance)->IsBitField != 0; } set { - ((Internal*) __Instance)->IsBitField = value; + ((Internal*) __Instance)->IsBitField = (byte) (value ? 1 : 0); } } @@ -7333,10 +6643,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -7363,8 +6673,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new AccessSpecifierDecl __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new AccessSpecifierDecl((AccessSpecifierDecl.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7399,8 +6707,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public AccessSpecifierDecl(CppSharp.Parser.AST.AccessSpecifierDecl _0) @@ -7408,28 +6716,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(120); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -7460,10 +6749,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -7475,34 +6764,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(464)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(465)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(466)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(467)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(468)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(469)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(470)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(471)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(472)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(480)] public global::System.IntPtr Layout; @@ -7603,8 +6892,6 @@ namespace CppSharp internal static extern uint getSpecifiersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Class __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Class((Class.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -7639,8 +6926,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(488); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Class(CppSharp.Parser.AST.Class _0) @@ -7648,28 +6935,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(488); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BaseClassSpecifier getBases(uint i) @@ -7800,12 +7068,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPOD; + return ((Internal*) __Instance)->IsPOD != 0; } set { - ((Internal*) __Instance)->IsPOD = value; + ((Internal*) __Instance)->IsPOD = (byte) (value ? 1 : 0); } } @@ -7813,12 +7081,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsAbstract; + return ((Internal*) __Instance)->IsAbstract != 0; } set { - ((Internal*) __Instance)->IsAbstract = value; + ((Internal*) __Instance)->IsAbstract = (byte) (value ? 1 : 0); } } @@ -7826,12 +7094,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsUnion; + return ((Internal*) __Instance)->IsUnion != 0; } set { - ((Internal*) __Instance)->IsUnion = value; + ((Internal*) __Instance)->IsUnion = (byte) (value ? 1 : 0); } } @@ -7839,12 +7107,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsDynamic; + return ((Internal*) __Instance)->IsDynamic != 0; } set { - ((Internal*) __Instance)->IsDynamic = value; + ((Internal*) __Instance)->IsDynamic = (byte) (value ? 1 : 0); } } @@ -7852,12 +7120,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsPolymorphic; + return ((Internal*) __Instance)->IsPolymorphic != 0; } set { - ((Internal*) __Instance)->IsPolymorphic = value; + ((Internal*) __Instance)->IsPolymorphic = (byte) (value ? 1 : 0); } } @@ -7865,12 +7133,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor; + return ((Internal*) __Instance)->HasNonTrivialDefaultConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = value; + ((Internal*) __Instance)->HasNonTrivialDefaultConstructor = (byte) (value ? 1 : 0); } } @@ -7878,12 +7146,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialCopyConstructor; + return ((Internal*) __Instance)->HasNonTrivialCopyConstructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialCopyConstructor = value; + ((Internal*) __Instance)->HasNonTrivialCopyConstructor = (byte) (value ? 1 : 0); } } @@ -7891,12 +7159,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->HasNonTrivialDestructor; + return ((Internal*) __Instance)->HasNonTrivialDestructor != 0; } set { - ((Internal*) __Instance)->HasNonTrivialDestructor = value; + ((Internal*) __Instance)->HasNonTrivialDestructor = (byte) (value ? 1 : 0); } } @@ -7904,12 +7172,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsExternCContext; + return ((Internal*) __Instance)->IsExternCContext != 0; } set { - ((Internal*) __Instance)->IsExternCContext = value; + ((Internal*) __Instance)->IsExternCContext = (byte) (value ? 1 : 0); } } @@ -7959,10 +7227,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -8017,8 +7285,6 @@ namespace CppSharp internal static extern uint getParametersCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Template __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Template((Template.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8053,9 +7319,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Template() @@ -8063,8 +7329,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_1(__Instance); + NativeToManagedMap[__Instance] = this; } public Template(CppSharp.Parser.AST.Template _0) @@ -8072,28 +7338,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(152); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateParameter getParameters(uint i) @@ -8169,10 +7416,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -8222,8 +7469,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplate((ClassTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8258,8 +7503,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplate(CppSharp.Parser.AST.ClassTemplate _0) @@ -8267,28 +7512,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ClassTemplateSpecialization getSpecializations(uint i) @@ -8350,10 +7576,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -8365,34 +7591,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(464)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(465)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(466)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(467)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(468)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(469)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(470)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(471)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(472)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(480)] public global::System.IntPtr Layout; @@ -8439,8 +7665,6 @@ namespace CppSharp internal static extern uint getArgumentsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplateSpecialization((ClassTemplateSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8475,8 +7699,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(528); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplateSpecialization(CppSharp.Parser.AST.ClassTemplateSpecialization _0) @@ -8484,28 +7708,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(528); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -8594,10 +7799,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -8609,34 +7814,34 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(464)] - public bool IsPOD; + public byte IsPOD; [FieldOffset(465)] - public bool IsAbstract; + public byte IsAbstract; [FieldOffset(466)] - public bool IsUnion; + public byte IsUnion; [FieldOffset(467)] - public bool IsDynamic; + public byte IsDynamic; [FieldOffset(468)] - public bool IsPolymorphic; + public byte IsPolymorphic; [FieldOffset(469)] - public bool HasNonTrivialDefaultConstructor; + public byte HasNonTrivialDefaultConstructor; [FieldOffset(470)] - public bool HasNonTrivialCopyConstructor; + public byte HasNonTrivialCopyConstructor; [FieldOffset(471)] - public bool HasNonTrivialDestructor; + public byte HasNonTrivialDestructor; [FieldOffset(472)] - public bool IsExternCContext; + public byte IsExternCContext; [FieldOffset(480)] public global::System.IntPtr Layout; @@ -8663,8 +7868,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ClassTemplatePartialSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ClassTemplatePartialSpecialization((ClassTemplatePartialSpecialization.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8699,8 +7902,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(528); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ClassTemplatePartialSpecialization(CppSharp.Parser.AST.ClassTemplatePartialSpecialization _0) @@ -8708,28 +7911,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(528); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -8760,10 +7944,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -8813,8 +7997,6 @@ namespace CppSharp internal static extern uint getSpecializationsCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FunctionTemplate __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FunctionTemplate((FunctionTemplate.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -8849,8 +8031,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplate(CppSharp.Parser.AST.FunctionTemplate _0) @@ -8858,28 +8040,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(176); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.FunctionTemplateSpecialization getSpecializations(uint i) @@ -8966,8 +8129,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -9002,17 +8166,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FunctionTemplateSpecialization(CppSharp.Parser.AST.FunctionTemplateSpecialization _0) { __Instance = Marshal.AllocHGlobal(48); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -9022,22 +8186,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.FunctionTemplateSpecialization __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TemplateArgument getArguments(uint i) @@ -9144,10 +8298,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -9159,10 +8313,10 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(361)] - public bool IsInline; + public byte IsInline; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -9180,8 +8334,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new Namespace __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new Namespace((Namespace.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9216,8 +8368,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(368); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Namespace(CppSharp.Parser.AST.Namespace _0) @@ -9225,40 +8377,21 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(368); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public bool IsInline { get { - return ((Internal*) __Instance)->IsInline; + return ((Internal*) __Instance)->IsInline != 0; } set { - ((Internal*) __Instance)->IsInline = value; + ((Internal*) __Instance)->IsInline = (byte) (value ? 1 : 0); } } } @@ -9290,10 +8423,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -9323,8 +8456,6 @@ namespace CppSharp internal static extern void dtor_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new PreprocessedEntity __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new PreprocessedEntity((PreprocessedEntity.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9359,8 +8490,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public PreprocessedEntity(CppSharp.Parser.AST.PreprocessedEntity _0) @@ -9368,36 +8499,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(128); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } - protected override void Dispose(bool disposing) + public CppSharp.Parser.AST.MacroLocation MacroLocation { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); - } - - public CppSharp.Parser.AST.MacroLocation MacroLocation - { - get - { - return ((Internal*) __Instance)->MacroLocation; - } + get + { + return ((Internal*) __Instance)->MacroLocation; + } set { @@ -9433,10 +8545,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -9476,8 +8588,6 @@ namespace CppSharp internal static extern void setExpression_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroDefinition __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroDefinition((MacroDefinition.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9512,8 +8622,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroDefinition(CppSharp.Parser.AST.MacroDefinition _0) @@ -9521,28 +8631,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(136); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Expression @@ -9589,10 +8680,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -9635,8 +8726,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new MacroExpansion __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new MacroExpansion((MacroExpansion.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9671,8 +8760,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public MacroExpansion(CppSharp.Parser.AST.MacroExpansion _0) @@ -9680,28 +8769,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(144); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -9766,10 +8836,10 @@ namespace CppSharp public global::System.IntPtr Comment; [FieldOffset(56)] - public bool IsIncomplete; + public byte IsIncomplete; [FieldOffset(57)] - public bool IsDependent; + public byte IsDependent; [FieldOffset(64)] public global::System.IntPtr CompleteDeclaration; @@ -9781,13 +8851,13 @@ namespace CppSharp public global::System.IntPtr OriginalPtr; [FieldOffset(360)] - public bool IsAnonymous; + public byte IsAnonymous; [FieldOffset(361)] - public bool IsInline; + public byte IsInline; [FieldOffset(376)] - public bool IsSystemHeader; + public byte IsSystemHeader; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -9835,8 +8905,6 @@ namespace CppSharp internal static extern uint getMacrosCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TranslationUnit __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TranslationUnit((TranslationUnit.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -9871,8 +8939,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(408); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TranslationUnit(CppSharp.Parser.AST.TranslationUnit _0) @@ -9880,28 +8948,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(408); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Declaration __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.MacroDefinition getMacros(uint i) @@ -9955,12 +9004,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsSystemHeader; + return ((Internal*) __Instance)->IsSystemHeader != 0; } set { - ((Internal*) __Instance)->IsSystemHeader = value; + ((Internal*) __Instance)->IsSystemHeader = (byte) (value ? 1 : 0); } } } @@ -10041,8 +9090,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static NativeLibrary __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10077,17 +9127,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public NativeLibrary(CppSharp.Parser.AST.NativeLibrary _0) { __Instance = Marshal.AllocHGlobal(64); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10097,22 +9147,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.NativeLibrary __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string getSymbols(uint i) @@ -10242,8 +9282,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ASTContext __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10278,17 +9319,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ASTContext(CppSharp.Parser.AST.ASTContext _0) { __Instance = Marshal.AllocHGlobal(24); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10298,22 +9339,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.ASTContext __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.TranslationUnit getTranslationUnits(uint i) @@ -10369,8 +9400,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Comment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10405,17 +9437,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = kind; Internal.ctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public Comment(CppSharp.Parser.AST.Comment _0) { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((Comment.Internal*) __Instance) = *((Comment.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10425,20 +9457,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.Comment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.AST.CommentKind Kind @@ -10479,8 +9502,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new BlockContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockContentComment((BlockContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10515,8 +9536,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10524,9 +9545,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockContentComment(CppSharp.Parser.AST.BlockContentComment _0) @@ -10534,27 +9555,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((BlockContentComment.Internal*) __Instance) = *((BlockContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -10602,8 +9604,6 @@ namespace CppSharp internal static extern uint getBlocksCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new FullComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new FullComment((FullComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10638,8 +9638,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public FullComment(CppSharp.Parser.AST.FullComment _0) @@ -10647,28 +9647,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockContentComment getBlocks(uint i) @@ -10788,8 +9769,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -10824,17 +9806,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.BlockCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -10844,22 +9826,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.BlockCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -10879,8 +9851,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new BlockCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new BlockCommandComment((BlockCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -10915,8 +9885,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.CommentKind Kind) @@ -10924,9 +9894,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public BlockCommandComment(CppSharp.Parser.AST.BlockCommandComment _0) @@ -10934,28 +9904,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_3(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.BlockCommandComment.Argument getArguments(uint i) @@ -11039,8 +9990,6 @@ namespace CppSharp InOut = 2 } - private bool __ownsNativeInstance; - public static new ParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParamCommandComment((ParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11075,8 +10024,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParamCommandComment(CppSharp.Parser.AST.ParamCommandComment _0) @@ -11084,28 +10033,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.ParamCommandComment.PassDirection Direction @@ -11182,8 +10112,6 @@ namespace CppSharp internal static extern uint getPositionCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new TParamCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TParamCommandComment((TParamCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11218,8 +10146,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TParamCommandComment(CppSharp.Parser.AST.TParamCommandComment _0) @@ -11227,28 +10155,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public uint getPosition(uint i) @@ -11314,8 +10223,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimBlockLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockLineComment((VerbatimBlockLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11350,8 +10257,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockLineComment(CppSharp.Parser.AST.VerbatimBlockLineComment _0) @@ -11359,28 +10266,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11447,8 +10335,6 @@ namespace CppSharp internal static extern uint getLinesCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new VerbatimBlockComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimBlockComment((VerbatimBlockComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11483,8 +10369,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimBlockComment(CppSharp.Parser.AST.VerbatimBlockComment _0) @@ -11492,28 +10378,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.VerbatimBlockLineComment getLines(uint i) @@ -11585,8 +10452,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new VerbatimLineComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new VerbatimLineComment((VerbatimLineComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11621,8 +10486,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public VerbatimLineComment(CppSharp.Parser.AST.VerbatimLineComment _0) @@ -11630,28 +10495,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -11695,8 +10541,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new InlineContentComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineContentComment((InlineContentComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11731,8 +10575,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.CommentKind Kind) @@ -11740,9 +10584,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public InlineContentComment(CppSharp.Parser.AST.InlineContentComment _0) @@ -11750,27 +10594,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((InlineContentComment.Internal*) __Instance) = *((InlineContentComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -11783,7 +10608,7 @@ namespace CppSharp public CppSharp.Parser.AST.CommentKind Kind; [FieldOffset(4)] - public bool IsWhitespace; + public byte IsWhitespace; [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, @@ -11821,8 +10646,6 @@ namespace CppSharp internal static extern uint getContentCount_0(global::System.IntPtr instance); } - private bool __ownsNativeInstance; - public static new ParagraphComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new ParagraphComment((ParagraphComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -11857,8 +10680,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParagraphComment(CppSharp.Parser.AST.ParagraphComment _0) @@ -11866,28 +10689,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineContentComment getContent(uint i) @@ -11925,12 +10729,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->IsWhitespace; + return ((Internal*) __Instance)->IsWhitespace != 0; } set { - ((Internal*) __Instance)->IsWhitespace = value; + ((Internal*) __Instance)->IsWhitespace = (byte) (value ? 1 : 0); } } } @@ -12023,8 +10827,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Argument __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12059,17 +10864,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Argument(CppSharp.Parser.AST.InlineCommandComment.Argument _0) { __Instance = Marshal.AllocHGlobal(8); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12079,22 +10884,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.InlineCommandComment.Argument __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text @@ -12114,8 +10909,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new InlineCommandComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new InlineCommandComment((InlineCommandComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12150,8 +10943,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public InlineCommandComment(CppSharp.Parser.AST.InlineCommandComment _0) @@ -12159,28 +10952,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_2(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.InlineCommandComment.Argument getArguments(uint i) @@ -12248,8 +11022,6 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - private bool __ownsNativeInstance; - public static new HTMLTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLTagComment((HTMLTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12284,8 +11056,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.CommentKind Kind) @@ -12293,9 +11065,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = Kind; Internal.ctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public HTMLTagComment(CppSharp.Parser.AST.HTMLTagComment _0) @@ -12303,27 +11075,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(4); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((HTMLTagComment.Internal*) __Instance) = *((HTMLTagComment.Internal*) _0.__Instance); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } } @@ -12424,8 +11177,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static Attribute __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12460,17 +11214,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public Attribute(CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12480,22 +11234,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.HTMLStartTagComment.Attribute __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Name @@ -12531,8 +11275,6 @@ namespace CppSharp } } - private bool __ownsNativeInstance; - public static new HTMLStartTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLStartTagComment((HTMLStartTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12567,8 +11309,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLStartTagComment(CppSharp.Parser.AST.HTMLStartTagComment _0) @@ -12576,28 +11318,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(40); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public CppSharp.Parser.AST.HTMLStartTagComment.Attribute getAttributes(uint i) @@ -12678,8 +11401,6 @@ namespace CppSharp internal static extern void setTagName_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new HTMLEndTagComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new HTMLEndTagComment((HTMLEndTagComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12714,8 +11435,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public HTMLEndTagComment(CppSharp.Parser.AST.HTMLEndTagComment _0) @@ -12723,28 +11444,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string TagName @@ -12798,8 +11500,6 @@ namespace CppSharp internal static extern void setText_0(global::System.IntPtr instance, global::System.IntPtr s); } - private bool __ownsNativeInstance; - public static new TextComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { return new TextComment((TextComment.Internal*) native) { __ownsNativeInstance = ownsNativeInstance }; @@ -12834,8 +11534,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public TextComment(CppSharp.Parser.AST.TextComment _0) @@ -12843,28 +11543,9 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(16); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); - } - - protected override void Dispose(bool disposing) - { - DestroyNativeInstance(false); - base.Dispose(disposing); - } - - public override void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { - CppSharp.Parser.AST.Comment __dummy; - NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + NativeToManagedMap[__Instance] = this; } public string Text @@ -12933,8 +11614,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static RawComment __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -12969,17 +11651,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public RawComment(CppSharp.Parser.AST.RawComment _0) { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -12989,22 +11671,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.AST.RawComment __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string Text diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs index d7df8830..a2d47bee 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs @@ -60,16 +60,16 @@ namespace CppSharp public CppSharp.Parser.AST.CppAbi Abi; [FieldOffset(180)] - public bool NoStandardIncludes; + public byte NoStandardIncludes; [FieldOffset(181)] - public bool NoBuiltinIncludes; + public byte NoBuiltinIncludes; [FieldOffset(182)] - public bool MicrosoftMode; + public byte MicrosoftMode; [FieldOffset(183)] - public bool Verbose; + public byte Verbose; [FieldOffset(184)] public CppSharp.Parser.LanguageVersion LanguageVersion; @@ -232,8 +232,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserOptions __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -268,17 +269,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(192); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserOptions(CppSharp.Parser.ParserOptions _0) { __Instance = Marshal.AllocHGlobal(192); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -288,22 +289,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserOptions __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string getArguments(uint i) @@ -548,12 +539,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoStandardIncludes; + return ((Internal*) __Instance)->NoStandardIncludes != 0; } set { - ((Internal*) __Instance)->NoStandardIncludes = value; + ((Internal*) __Instance)->NoStandardIncludes = (byte) (value ? 1 : 0); } } @@ -561,12 +552,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->NoBuiltinIncludes; + return ((Internal*) __Instance)->NoBuiltinIncludes != 0; } set { - ((Internal*) __Instance)->NoBuiltinIncludes = value; + ((Internal*) __Instance)->NoBuiltinIncludes = (byte) (value ? 1 : 0); } } @@ -574,12 +565,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->MicrosoftMode; + return ((Internal*) __Instance)->MicrosoftMode != 0; } set { - ((Internal*) __Instance)->MicrosoftMode = value; + ((Internal*) __Instance)->MicrosoftMode = (byte) (value ? 1 : 0); } } @@ -587,12 +578,12 @@ namespace CppSharp { get { - return ((Internal*) __Instance)->Verbose; + return ((Internal*) __Instance)->Verbose != 0; } set { - ((Internal*) __Instance)->Verbose = value; + ((Internal*) __Instance)->Verbose = (byte) (value ? 1 : 0); } } @@ -662,8 +653,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserDiagnostic __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -698,17 +690,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserDiagnostic(CppSharp.Parser.ParserDiagnostic _0) { __Instance = Marshal.AllocHGlobal(32); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -718,22 +710,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserDiagnostic __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string FileName @@ -863,8 +845,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserResult __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -899,17 +882,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_0(__Instance); + NativeToManagedMap[__Instance] = this; } public ParserResult(CppSharp.Parser.ParserResult _0) { __Instance = Marshal.AllocHGlobal(56); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_1(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -919,22 +902,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserResult __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i) @@ -1042,8 +1015,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ClangParser __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -1085,8 +1059,8 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(0); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; *((ClangParser.Internal*) __Instance) = *((ClangParser.Internal*) _0.__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -1096,20 +1070,11 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ClangParser __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Marshal.FreeHGlobal(__Instance); } public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts) diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs index 87143582..84bdbc1d 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs @@ -172,8 +172,9 @@ namespace CppSharp public global::System.IntPtr __Instance { get; protected set; } public static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; - private bool __ownsNativeInstance; + protected bool __ownsNativeInstance; public static ParserTargetInfo __CreateInstance(global::System.IntPtr native, bool ownsNativeInstance = false) { @@ -208,17 +209,17 @@ namespace CppSharp { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance; Internal.cctor_0(__Instance, arg0); + NativeToManagedMap[__Instance] = this; } public ParserTargetInfo() { __Instance = Marshal.AllocHGlobal(160); __ownsNativeInstance = true; - NativeToManagedMap[__Instance] = this; Internal.ctor_2(__Instance); + NativeToManagedMap[__Instance] = this; } public void Dispose() @@ -228,22 +229,12 @@ namespace CppSharp protected virtual void Dispose(bool disposing) { - DestroyNativeInstance(false); - } - - public virtual void DestroyNativeInstance() - { - DestroyNativeInstance(true); - } - - private void DestroyNativeInstance(bool force) - { + if (!__ownsNativeInstance && disposing) + throw new global::System.InvalidOperationException("Managed instances owned by native code cannot be disposed of."); CppSharp.Parser.ParserTargetInfo __dummy; NativeToManagedMap.TryRemove(__Instance, out __dummy); - if (__ownsNativeInstance || force) - Internal.dtor_0(__Instance); - if (__ownsNativeInstance) - Marshal.FreeHGlobal(__Instance); + Internal.dtor_0(__Instance); + Marshal.FreeHGlobal(__Instance); } public string ABI