Browse Source

Added declarations of class properties to CLI.

pull/16/merge
triton 12 years ago
parent
commit
1887f80dfd
  1. 21
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs
  2. 2
      src/Generator/Generators/CLI/CLITextTemplate.cs

21
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -484,22 +484,35 @@ namespace CppSharp.Generators.CLI @@ -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>(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)

2
src/Generator/Generators/CLI/CLITextTemplate.cs

@ -1,6 +1,5 @@ @@ -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 @@ -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;
}
/// <summary>

Loading…
Cancel
Save