diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index 6edc0f41..49bf6f25 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -484,22 +484,35 @@ namespace CppSharp.Generators.CLI continue; GenerateDeclarationCommon(field); - GenerateFieldProperty(field); + GenerateProperty(field); + } + PopIndent(); + + PushIndent(); + foreach (var prop in @class.Properties) + { + if (prop.Ignore) continue; + + GenerateDeclarationCommon(prop); + GenerateProperty(prop); } PopIndent(); } - public void GenerateFieldProperty(Field field) + public void GenerateProperty(T decl) + where T : Declaration, ITypedDecl { - var type = field.Type.Visit(TypePrinter, field.QualifiedType.Qualifiers); + PushBlock(CLIBlockKind.Property, decl); + var type = decl.Type.Visit(TypePrinter, decl.QualifiedType.Qualifiers); - WriteLine("property {0} {1}", type, field.Name); + WriteLine("property {0} {1}", type, decl.Name); WriteStartBraceIndent(); WriteLine("{0} get();", type); WriteLine("void set({0});", type); WriteCloseBraceIndent(); + PopBlock(); } public void GenerateMethod(Method method) diff --git a/src/Generator/Generators/CLI/CLITextTemplate.cs b/src/Generator/Generators/CLI/CLITextTemplate.cs index 591aa598..965d231b 100644 --- a/src/Generator/Generators/CLI/CLITextTemplate.cs +++ b/src/Generator/Generators/CLI/CLITextTemplate.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using CppSharp.AST; namespace CppSharp.Generators.CLI @@ -38,6 +37,7 @@ namespace CppSharp.Generators.CLI public const int Usings = BlockKind.LAST + 10; public const int FunctionsClass = BlockKind.LAST + 11; public const int Function = BlockKind.LAST + 12; + public const int Property = BlockKind.LAST + 13; } ///