Browse Source

Moved the getting of the access of a class as a string to a separate function.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/53/head
Dimitar Dobrev 13 years ago
parent
commit
dfff92bb9f
  1. 26
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

26
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -57,6 +57,19 @@ namespace CppSharp.Generators.CSharp
{ {
get { return Generator.GeneratedIdentifier("Instance"); } 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 public class CSharpBlockKind
@ -609,18 +622,7 @@ namespace CppSharp.Generators.CSharp
if (@class.IsUnion) if (@class.IsUnion)
WriteLine("[StructLayout(LayoutKind.Explicit)]"); WriteLine("[StructLayout(LayoutKind.Explicit)]");
switch (@class.Access) Write(Helpers.GetAccess(@class));
{
case AccessSpecifier.Private:
Write("internal ");
break;
case AccessSpecifier.Protected:
Write("protected ");
break;
case AccessSpecifier.Public:
Write("public ");
break;
}
Write("unsafe "); Write("unsafe ");
if (@class.IsAbstract) if (@class.IsAbstract)

Loading…
Cancel
Save