Permalink
Browse files

Added to a method a list of its overridden methods.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Jul 27, 2017
1 parent cf98ecd commit e2e41096313a6eb1882109c23e18b2929926e2ce
@@ -1,3 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using CppSharp.AST.Extensions;
namespace CppSharp.AST
@@ -103,6 +105,7 @@ public Method(Method method)
Conversion = method.Conversion;
SynthKind = method.SynthKind;
AdjustedOffset = method.AdjustedOffset;
OverriddenMethods.AddRange(method.OverriddenMethods);
}
public Method(Function function)
@@ -115,9 +118,13 @@ public Method(Function function)
public bool IsStatic { get; set; }
public bool IsConst { get; set; }
public bool IsExplicit { get; set; }
public bool IsOverride { get; set; }
public bool IsOverride
{
get { return isOverride ?? OverriddenMethods.Any(); }
set { isOverride = value; }
}
// True if the method is final / sealed.
// True if the method is final / sealed.
public bool IsFinal { get; set; }
public bool IsProxy { get; set; }
@@ -161,9 +168,13 @@ public bool IsDestructor
public int AdjustedOffset { get; set; }
public List<Method> OverriddenMethods { get; } = new List<Method>();
public override T Visit<T>(IDeclVisitor<T> visitor)
{
return visitor.VisitMethodDecl(this);
}
private bool? isOverride;
}
}
@@ -650,7 +650,6 @@ Method::Method()
, isStatic(false)
, isConst(false)
, isExplicit(false)
, isOverride(false)
, isDefaultConstructor(false)
, isCopyConstructor(false)
, isMoveConstructor(false)
@@ -661,6 +660,8 @@ Method::Method()
Method::~Method() {}
DEF_VECTOR(Method, Method*, OverriddenMethods)
// Enumeration
Enumeration::Enumeration() : DeclarationContext(DeclarationKind::Enumeration),
@@ -762,7 +762,6 @@ class CS_API Method : public Function
bool isStatic;
bool isConst;
bool isExplicit;
bool isOverride;
CXXMethodKind methodKind;
@@ -772,6 +771,7 @@ class CS_API Method : public Function
QualifiedType conversionType;
RefQualifierKind refQualifier;
VECTOR(Method*, OverriddenMethods)
};
class CS_API Enumeration : public DeclarationContext
@@ -3739,6 +3739,26 @@ CppSharp::Parser::AST::Method::Method()
NativePtr = new ::CppSharp::CppParser::AST::Method();
}
CppSharp::Parser::AST::Method^ CppSharp::Parser::AST::Method::GetOverriddenMethods(unsigned int i)
{
auto __ret = ((::CppSharp::CppParser::AST::Method*)NativePtr)->getOverriddenMethods(i);
if (__ret == nullptr) return nullptr;
return (__ret == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::Method((::CppSharp::CppParser::AST::Method*)__ret);
}
void CppSharp::Parser::AST::Method::AddOverriddenMethods(CppSharp::Parser::AST::Method^ s)
{
if (ReferenceEquals(s, nullptr))
throw gcnew ::System::ArgumentNullException("s", "Cannot be null because it is a C++ reference (&).");
auto __arg0 = (::CppSharp::CppParser::AST::Method*)s->NativePtr;
((::CppSharp::CppParser::AST::Method*)NativePtr)->addOverriddenMethods(__arg0);
}
void CppSharp::Parser::AST::Method::ClearOverriddenMethods()
{
((::CppSharp::CppParser::AST::Method*)NativePtr)->clearOverriddenMethods();
}
CppSharp::Parser::AST::Method::Method(CppSharp::Parser::AST::Method^ _0)
: CppSharp::Parser::AST::Function((::CppSharp::CppParser::AST::Function*)nullptr)
{
@@ -3789,16 +3809,6 @@ void CppSharp::Parser::AST::Method::IsExplicit::set(bool value)
((::CppSharp::CppParser::AST::Method*)NativePtr)->isExplicit = value;
}
bool CppSharp::Parser::AST::Method::IsOverride::get()
{
return ((::CppSharp::CppParser::AST::Method*)NativePtr)->isOverride;
}
void CppSharp::Parser::AST::Method::IsOverride::set(bool value)
{
((::CppSharp::CppParser::AST::Method*)NativePtr)->isOverride = value;
}
CppSharp::Parser::AST::CXXMethodKind CppSharp::Parser::AST::Method::MethodKind::get()
{
return (CppSharp::Parser::AST::CXXMethodKind)((::CppSharp::CppParser::AST::Method*)NativePtr)->methodKind;
@@ -3859,6 +3869,34 @@ void CppSharp::Parser::AST::Method::RefQualifier::set(CppSharp::Parser::AST::Ref
((::CppSharp::CppParser::AST::Method*)NativePtr)->refQualifier = (::CppSharp::CppParser::AST::RefQualifierKind)value;
}
System::Collections::Generic::List<CppSharp::Parser::AST::Method^>^ CppSharp::Parser::AST::Method::OverriddenMethods::get()
{
auto _tmp__OverriddenMethods = gcnew System::Collections::Generic::List<CppSharp::Parser::AST::Method^>();
for(auto _element : ((::CppSharp::CppParser::AST::Method*)NativePtr)->OverriddenMethods)
{
auto _marshalElement = (_element == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::Method((::CppSharp::CppParser::AST::Method*)_element);
_tmp__OverriddenMethods->Add(_marshalElement);
}
return _tmp__OverriddenMethods;
}
void CppSharp::Parser::AST::Method::OverriddenMethods::set(System::Collections::Generic::List<CppSharp::Parser::AST::Method^>^ value)
{
auto _tmpvalue = std::vector<::CppSharp::CppParser::AST::Method*>();
for each(CppSharp::Parser::AST::Method^ _element in value)
{
auto _marshalElement = (::CppSharp::CppParser::AST::Method*)_element->NativePtr;
_tmpvalue.push_back(_marshalElement);
}
((::CppSharp::CppParser::AST::Method*)NativePtr)->OverriddenMethods = _tmpvalue;
}
unsigned int CppSharp::Parser::AST::Method::OverriddenMethodsCount::get()
{
auto __ret = ((::CppSharp::CppParser::AST::Method*)NativePtr)->getOverriddenMethodsCount();
return __ret;
}
CppSharp::Parser::AST::Enumeration::Item::Item(::CppSharp::CppParser::AST::Enumeration::Item* native)
: CppSharp::Parser::AST::Declaration((::CppSharp::CppParser::AST::Declaration*)native)
{
@@ -2180,12 +2180,6 @@ namespace CppSharp
void set(bool);
}
property bool IsOverride
{
bool get();
void set(bool);
}
property CppSharp::Parser::AST::CXXMethodKind MethodKind
{
CppSharp::Parser::AST::CXXMethodKind get();
@@ -2221,6 +2215,23 @@ namespace CppSharp
CppSharp::Parser::AST::RefQualifierKind get();
void set(CppSharp::Parser::AST::RefQualifierKind);
}
property System::Collections::Generic::List<CppSharp::Parser::AST::Method^>^ OverriddenMethods
{
System::Collections::Generic::List<CppSharp::Parser::AST::Method^>^ get();
void set(System::Collections::Generic::List<CppSharp::Parser::AST::Method^>^);
}
property unsigned int OverriddenMethodsCount
{
unsigned int get();
}
CppSharp::Parser::AST::Method^ GetOverriddenMethods(unsigned int i);
void AddOverriddenMethods(CppSharp::Parser::AST::Method^ s);
void ClearOverriddenMethods();
};
public ref class Enumeration : CppSharp::Parser::AST::DeclarationContext
@@ -7583,7 +7583,7 @@ public uint ParametersCount
public unsafe partial class Method : global::CppSharp.Parser.AST.Function, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 352)]
[StructLayout(LayoutKind.Explicit, Size = 360)]
public new partial struct __Internal
{
[FieldOffset(0)]
@@ -7743,26 +7743,26 @@ public new partial struct __Internal
internal byte isExplicit;
[FieldOffset(328)]
internal byte isOverride;
[FieldOffset(332)]
internal global::CppSharp.Parser.AST.CXXMethodKind methodKind;
[FieldOffset(336)]
[FieldOffset(332)]
internal byte isDefaultConstructor;
[FieldOffset(337)]
[FieldOffset(333)]
internal byte isCopyConstructor;
[FieldOffset(338)]
[FieldOffset(334)]
internal byte isMoveConstructor;
[FieldOffset(340)]
[FieldOffset(336)]
internal global::CppSharp.Parser.AST.QualifiedType.__Internal conversionType;
[FieldOffset(348)]
[FieldOffset(344)]
internal global::CppSharp.Parser.AST.RefQualifierKind refQualifier;
[FieldOffset(348)]
internal global::Std.__1.Vector.__Internal OverriddenMethods;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST6MethodC2Ev")]
@@ -7777,6 +7777,26 @@ public new partial struct __Internal
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST6MethodD2Ev")]
internal static extern void dtor(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST6Method20getOverriddenMethodsEj")]
internal static extern global::System.IntPtr GetOverriddenMethods(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST6Method20addOverriddenMethodsERPS2_")]
internal static extern void AddOverriddenMethods(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST6Method22clearOverriddenMethodsEv")]
internal static extern void ClearOverriddenMethods(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST6Method25getOverriddenMethodsCountEv")]
internal static extern uint GetOverriddenMethodsCount(global::System.IntPtr instance);
}
internal static new global::CppSharp.Parser.AST.Method __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
@@ -7846,6 +7866,30 @@ public override void Dispose(bool disposing)
__Instance = IntPtr.Zero;
}
public global::CppSharp.Parser.AST.Method GetOverriddenMethods(uint i)
{
var __ret = __Internal.GetOverriddenMethods((__Instance + __PointerAdjustment), i);
global::CppSharp.Parser.AST.Method __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.Method.NativeToManagedMap.ContainsKey(__ret))
__result0 = (global::CppSharp.Parser.AST.Method) global::CppSharp.Parser.AST.Method.NativeToManagedMap[__ret];
else __result0 = global::CppSharp.Parser.AST.Method.__CreateInstance(__ret);
return __result0;
}
public void AddOverriddenMethods(global::CppSharp.Parser.AST.Method s)
{
if (ReferenceEquals(s, null))
throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&).");
var __arg0 = s.__Instance;
__Internal.AddOverriddenMethods((__Instance + __PointerAdjustment), __arg0);
}
public void ClearOverriddenMethods()
{
__Internal.ClearOverriddenMethods((__Instance + __PointerAdjustment));
}
public bool IsVirtual
{
get
@@ -7898,19 +7942,6 @@ public bool IsExplicit
}
}
public bool IsOverride
{
get
{
return ((global::CppSharp.Parser.AST.Method.__Internal*) __Instance)->isOverride != 0;
}
set
{
((global::CppSharp.Parser.AST.Method.__Internal*) __Instance)->isOverride = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.CXXMethodKind MethodKind
{
get
@@ -7988,6 +8019,15 @@ public bool IsMoveConstructor
((global::CppSharp.Parser.AST.Method.__Internal*) __Instance)->refQualifier = value;
}
}
public uint OverriddenMethodsCount
{
get
{
var __ret = __Internal.GetOverriddenMethodsCount((__Instance + __PointerAdjustment));
return __ret;
}
}
}
public unsafe partial class Enumeration : global::CppSharp.Parser.AST.DeclarationContext, IDisposable
Oops, something went wrong.

0 comments on commit e2e4109

Please sign in to comment.