|
|
|
@ -447,7 +447,7 @@ namespace CppSharp.Generators.CSharp
@@ -447,7 +447,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
|
|
|
|
|
System.Type typeMap = null; |
|
|
|
|
string key = string.Empty; |
|
|
|
|
var cppTypePrinter = new CppTypePrinter { PrintScopeKind = CppTypePrintScopeKind.Qualified }; |
|
|
|
|
var cppTypePrinter = new CppTypePrinter { PrintScopeKind = TypePrintScopeKind.Qualified }; |
|
|
|
|
foreach (var name in new[] { @class.OriginalName, @class.Visit(cppTypePrinter) }) |
|
|
|
|
{ |
|
|
|
|
if (Context.TypeMaps.TypeMaps.ContainsKey(name)) |
|
|
|
@ -501,8 +501,10 @@ namespace CppSharp.Generators.CSharp
@@ -501,8 +501,10 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
|
|
|
|
|
// use interfaces if any - derived types with a secondary base this class must be compatible with the map
|
|
|
|
|
var @interface = @class.Namespace.Classes.Find(c => c.OriginalClass == @class); |
|
|
|
|
TypePrinter.PushPrintScopeKind(TypePrintScopeKind.Local); |
|
|
|
|
var dict = string.Format("global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, {0}>", |
|
|
|
|
(@interface ?? @class).Visit(TypePrinter)); |
|
|
|
|
TypePrinter.PopPrintScopeKind(); |
|
|
|
|
WriteLine("internal static readonly {0} NativeToManagedMap = new {0}();", dict); |
|
|
|
|
WriteLine("protected void*[] __OriginalVTables;"); |
|
|
|
|
} |
|
|
|
@ -906,6 +908,7 @@ namespace CppSharp.Generators.CSharp
@@ -906,6 +908,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
|
|
|
|
|
var arrayType = field.Type as ArrayType; |
|
|
|
|
|
|
|
|
|
TypePrinter.PushPrintScopeKind(TypePrintScopeKind.Local); |
|
|
|
|
if (arrayType != null && @class.IsValueType) |
|
|
|
|
{ |
|
|
|
|
ctx.ReturnVarName = HandleValueArray(arrayType, field); |
|
|
|
@ -919,6 +922,7 @@ namespace CppSharp.Generators.CSharp
@@ -919,6 +922,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
(@class.IsValueType ? "." : "->")}{Helpers.SafeIdentifier(name)}";
|
|
|
|
|
TypePrinter.PopContext(); |
|
|
|
|
} |
|
|
|
|
TypePrinter.PopPrintScopeKind(); |
|
|
|
|
param.Visit(marshal); |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) |
|
|
|
@ -1113,6 +1117,7 @@ namespace CppSharp.Generators.CSharp
@@ -1113,6 +1117,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
|
|
|
|
|
var name = @class.Layout.Fields.First(f => f.FieldPtr == field.OriginalPtr).Name; |
|
|
|
|
TypePrinter.PushContext(CSharpTypePrinterContextKind.Native); |
|
|
|
|
TypePrinter.PushPrintScopeKind(TypePrintScopeKind.Local); |
|
|
|
|
var ctx = new CSharpMarshalContext(Context) |
|
|
|
|
{ |
|
|
|
|
Kind = CSharpMarshalKind.NativeField, |
|
|
|
@ -1123,6 +1128,7 @@ namespace CppSharp.Generators.CSharp
@@ -1123,6 +1128,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
(@class.IsValueType ? "." : "->")}{Helpers.SafeIdentifier(name)}",
|
|
|
|
|
ReturnType = decl.QualifiedType |
|
|
|
|
}; |
|
|
|
|
TypePrinter.PopPrintScopeKind(); |
|
|
|
|
TypePrinter.PopContext(); |
|
|
|
|
|
|
|
|
|
var arrayType = field.Type as ArrayType; |
|
|
|
@ -2045,6 +2051,7 @@ namespace CppSharp.Generators.CSharp
@@ -2045,6 +2051,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
|
|
|
|
|
var className = @class.IsAbstractImpl ? @class.BaseClass.Name : @class.Name; |
|
|
|
|
|
|
|
|
|
TypePrinter.PushPrintScopeKind(TypePrintScopeKind.Local); |
|
|
|
|
var ctorCall = string.Format("{0}{1}", @class.Name, @class.IsAbstract ? "Internal" : ""); |
|
|
|
|
if (!@class.IsAbstractImpl) |
|
|
|
|
{ |
|
|
|
@ -2110,6 +2117,7 @@ namespace CppSharp.Generators.CSharp
@@ -2110,6 +2117,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
WriteLine($"{Helpers.InstanceField} = *({@class.Visit(TypePrinter)}*) native;"); |
|
|
|
|
TypePrinter.PopContext(); |
|
|
|
|
} |
|
|
|
|
TypePrinter.PopPrintScopeKind(); |
|
|
|
|
|
|
|
|
|
WriteCloseBraceIndent(); |
|
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
@ -2117,6 +2125,7 @@ namespace CppSharp.Generators.CSharp
@@ -2117,6 +2125,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
|
|
|
|
|
private void GenerateNativeConstructorByValue(Class @class, string ctorCall) |
|
|
|
|
{ |
|
|
|
|
TypePrinter.PushPrintScopeKind(TypePrintScopeKind.Local); |
|
|
|
|
TypePrinter.PushContext(CSharpTypePrinterContextKind.Native); |
|
|
|
|
var @internal = (@class.IsAbstractImpl ? @class.BaseClass : @class).Visit(TypePrinter); |
|
|
|
|
TypePrinter.PopContext(); |
|
|
|
@ -2179,6 +2188,7 @@ namespace CppSharp.Generators.CSharp
@@ -2179,6 +2188,7 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
WriteCloseBraceIndent(); |
|
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
|
} |
|
|
|
|
TypePrinter.PopPrintScopeKind(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void GenerateClassConstructorBase(Class @class, Method method) |
|
|
|
@ -2617,8 +2627,10 @@ namespace CppSharp.Generators.CSharp
@@ -2617,8 +2627,10 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
TypePrinter.PushContext(CSharpTypePrinterContextKind.Native); |
|
|
|
|
TypePrinter.PushPrintScopeKind(TypePrintScopeKind.Local); |
|
|
|
|
var classInternal = @class.Visit(TypePrinter); |
|
|
|
|
TypePrinter.PopContext(); |
|
|
|
|
TypePrinter.PopPrintScopeKind(); |
|
|
|
|
WriteLine($@"*(({classInternal}*) {Helpers.InstanceIdentifier}) = *(({
|
|
|
|
|
classInternal}*) {method.Parameters[0].Name}.{Helpers.InstanceIdentifier});");
|
|
|
|
|
} |
|
|
|
|