Browse Source

Generate helper constructors that take the native version of the class/struct.

pull/1/head
triton 12 years ago
parent
commit
ef5dcc505f
  1. 14
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

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

@ -993,6 +993,20 @@ namespace CppSharp.Generators.CSharp @@ -993,6 +993,20 @@ namespace CppSharp.Generators.CSharp
private void GenerateNativeConstructor(Class @class)
{
WriteLine("internal {0}({1}.Internal* native)", SafeIdentifier(@class.Name),
@class.Name);
WriteLineIndent(": this(new System.IntPtr(native))");
WriteStartBraceIndent();
WriteCloseBraceIndent();
NewLine();
WriteLine("internal {0}({1}.Internal native)", SafeIdentifier(@class.Name),
@class.Name);
WriteLineIndent(": this(&native)");
WriteStartBraceIndent();
WriteCloseBraceIndent();
NewLine();
WriteLine("internal {0}(System.IntPtr native)", SafeIdentifier(@class.Name));
var hasBaseClass = @class.HasBaseClass && @class.BaseClass.IsRefType;

Loading…
Cancel
Save