From fb127211ecdf8736dd48de38bf68fe9f9a0fced7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Krog?= Date: Sat, 15 Mar 2014 18:05:00 +0100 Subject: [PATCH] Move helper methods in Property out from class and into extension class PropertyExtensions --- src/AST/Property.cs | 13 ------------- src/AST/PropertyExtensions.cs | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 src/AST/PropertyExtensions.cs diff --git a/src/AST/Property.cs b/src/AST/Property.cs index 0d045578..0c477c26 100644 --- a/src/AST/Property.cs +++ b/src/AST/Property.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using CppSharp.AST.Extensions; namespace CppSharp.AST { @@ -106,17 +105,5 @@ namespace CppSharp.AST return visitor.VisitProperty(this); } - public bool IsInRefTypeAndBackedByValueClassField() - { - if (Field == null || ((Class) Namespace).IsRefType) - return false; - - Type type; - Field.Type.IsPointerTo(out type); - type = type ?? Field.Type; - - Class decl; - return type.IsTagDecl(out decl) && decl.IsValueType; - } } } \ No newline at end of file diff --git a/src/AST/PropertyExtensions.cs b/src/AST/PropertyExtensions.cs new file mode 100644 index 00000000..2d1a9a66 --- /dev/null +++ b/src/AST/PropertyExtensions.cs @@ -0,0 +1,20 @@ +using CppSharp.AST.Extensions; + +namespace CppSharp.AST +{ + public static class PropertyExtensions + { + public static bool IsInRefTypeAndBackedByValueClassField(this Property p) + { + if (p.Field == null || ((Class) p.Namespace).IsRefType) + return false; + + Type type; + p.Field.Type.IsPointerTo(out type); + type = type ?? p.Field.Type; + + Class decl; + return type.IsTagDecl(out decl) && decl.IsValueType; + } + } +} \ No newline at end of file