From d09d2e9cf6ac3a3c8c050fdadebe10c83699ab44 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 24 Dec 2013 16:57:53 +0000 Subject: [PATCH] Simplified the property generation code. --- .../Generators/CLI/CLIHeadersTemplate.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index 28d19470..028fcd59 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -566,25 +566,27 @@ namespace CppSharp.Generators.CLI if (prop.Ignore) continue; GenerateDeclarationCommon(prop); - GenerateProperty(prop, prop.HasGetter, prop.HasSetter); + GenerateProperty(prop); } PopIndent(); } - public void GenerateProperty(T decl, bool isGetter = true, bool isSetter = true) - where T : Declaration, ITypedDecl + public void GenerateProperty(Property property) { - if (!(isGetter || isSetter)) + if (!(property.HasGetter || property.HasSetter)) return; - PushBlock(CLIBlockKind.Property, decl); - var type = decl.Type.Visit(TypePrinter, decl.QualifiedType.Qualifiers); + PushBlock(CLIBlockKind.Property, property); + var type = property.QualifiedType.Visit(TypePrinter); - WriteLine("property {0} {1}", type, decl.Name); + WriteLine("property {0} {1}", type, property.Name); WriteStartBraceIndent(); - if(isGetter) WriteLine("{0} get();", type); - if(isSetter) WriteLine("void set({0});", type); + if(property.HasGetter) + WriteLine("{0} get();", type); + + if(property.HasSetter) + WriteLine("void set({0});", type); WriteCloseBraceIndent(); PopBlock(NewLineKind.BeforeNextBlock);