Browse Source

Handled more possible names for type maps when generating the mapped class itself.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/719/head
Dimitar Dobrev 9 years ago
parent
commit
5b6a19a0c4
  1. 16
      src/Generator/Generators/CSharp/CSharpSources.cs

16
src/Generator/Generators/CSharp/CSharpSources.cs

@ -434,11 +434,17 @@ namespace CppSharp.Generators.CSharp
GenerateClassTemplateSpecializationInternal(nestedTemplate); GenerateClassTemplateSpecializationInternal(nestedTemplate);
System.Type typeMap = null; System.Type typeMap = null;
if (Context.TypeMaps.TypeMaps.ContainsKey(@class.Name)) string key = string.Empty;
foreach (var name in new[] { @class.OriginalName, @class.QualifiedOriginalName })
{ {
typeMap = Context.TypeMaps.TypeMaps[@class.Name]; if (Context.TypeMaps.TypeMaps.ContainsKey(name))
// disable the type map for the mapped class itself so that operator params are not mapped {
Context.TypeMaps.TypeMaps.Remove(@class.Name); key = name;
typeMap = Context.TypeMaps.TypeMaps[key];
// disable the type map for the mapped class itself so that operator params are not mapped
Context.TypeMaps.TypeMaps.Remove(key);
break;
}
} }
PushBlock(CSharpBlockKind.Class); PushBlock(CSharpBlockKind.Class);
@ -503,7 +509,7 @@ namespace CppSharp.Generators.CSharp
PopBlock(NewLineKind.BeforeNextBlock); PopBlock(NewLineKind.BeforeNextBlock);
if (typeMap != null) if (typeMap != null)
Context.TypeMaps.TypeMaps.Add(@class.Name, typeMap); Context.TypeMaps.TypeMaps.Add(key, typeMap);
} }
private void GenerateInterface(Class @class) private void GenerateInterface(Class @class)

Loading…
Cancel
Save