From dfff92bb9ffb6d2cb77471c7395e411f5a0c7449 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 9 Sep 2013 18:24:42 +0300 Subject: [PATCH] Moved the getting of the access of a class as a string to a separate function. Signed-off-by: Dimitar Dobrev --- .../Generators/CSharp/CSharpTextTemplate.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index d63d77cf..0076458c 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -57,6 +57,19 @@ namespace CppSharp.Generators.CSharp { get { return Generator.GeneratedIdentifier("Instance"); } } + + public static string GetAccess(Class @class) + { + switch (@class.Access) + { + case AccessSpecifier.Private: + return "internal "; + case AccessSpecifier.Protected: + return "protected "; + default: + return "public "; + } + } } public class CSharpBlockKind @@ -609,18 +622,7 @@ namespace CppSharp.Generators.CSharp if (@class.IsUnion) WriteLine("[StructLayout(LayoutKind.Explicit)]"); - switch (@class.Access) - { - case AccessSpecifier.Private: - Write("internal "); - break; - case AccessSpecifier.Protected: - Write("protected "); - break; - case AccessSpecifier.Public: - Write("public "); - break; - } + Write(Helpers.GetAccess(@class)); Write("unsafe "); if (@class.IsAbstract)