From 5a8400ed22a54eab1e2531dce114006d3ec80a0f Mon Sep 17 00:00:00 2001 From: triton Date: Fri, 18 Jan 2013 16:54:25 +0000 Subject: [PATCH] Added generation of properties for fields of non value-type classes. --- .../Generators/CLI/CLIHeadersTemplate.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index 7553672e..7ab31338 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -228,6 +228,21 @@ namespace Cxxi.Generators.CLI PopIndent(); } + // Generate a property for each field if class is not value type + if (@class.IsRefType) + { + PushIndent(); + foreach (var field in @class.Fields) + { + if (CheckIgnoreField(@class, field)) + continue; + + GenerateDeclarationCommon(field); + GenerateFieldProperty(field); + } + PopIndent(); + } + PushIndent(); foreach (var method in @class.Methods) { @@ -242,6 +257,16 @@ namespace Cxxi.Generators.CLI WriteLine("};"); } + public void GenerateFieldProperty(Field field) + { + field.Type.Visit(Type.TypePrinter); + + var type = field.Type.Visit(Type.TypePrinter); + + WriteLine("property {0} {1};", type, field.Name); + NewLine(); + } + public void GenerateMethod(Method method) { if (method.Ignore) return;