Browse Source

Improved the handling of char arrays by using desugaring.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/256/merge
Dimitar Dobrev 10 years ago
parent
commit
e36d6f0aae
  1. 2
      src/Generator/Generators/CLI/CLIMarshal.cs
  2. 2
      src/Generator/Generators/CLI/CLITypePrinter.cs
  3. 2
      src/Generator/Generators/CSharp/CSharpMarshal.cs
  4. 2
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs

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

@ -61,7 +61,7 @@ namespace CppSharp.Generators.CLI
break; break;
case ArrayType.ArraySize.Incomplete: case ArrayType.ArraySize.Incomplete:
// const char* and const char[] are the same so we can use a string // const char* and const char[] are the same so we can use a string
if (array.Type.IsPrimitiveType(PrimitiveType.Char) && if (array.Type.Desugar().IsPrimitiveType(PrimitiveType.Char) &&
array.QualifiedType.Qualifiers.IsConst) array.QualifiedType.Qualifiers.IsConst)
return VisitPointerType(new PointerType return VisitPointerType(new PointerType
{ {

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

@ -65,7 +65,7 @@ namespace CppSharp.Generators.CLI
{ {
// const char* and const char[] are the same so we can use a string // const char* and const char[] are the same so we can use a string
if (array.SizeType == ArrayType.ArraySize.Incomplete && if (array.SizeType == ArrayType.ArraySize.Incomplete &&
array.Type.IsPrimitiveType(PrimitiveType.Char) && array.Type.Desugar().IsPrimitiveType(PrimitiveType.Char) &&
array.QualifiedType.Qualifiers.IsConst) array.QualifiedType.Qualifiers.IsConst)
return "System::String^"; return "System::String^";

2
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -118,7 +118,7 @@ namespace CppSharp.Generators.CSharp
break; break;
case ArrayType.ArraySize.Incomplete: case ArrayType.ArraySize.Incomplete:
// const char* and const char[] are the same so we can use a string // const char* and const char[] are the same so we can use a string
if (array.Type.IsPrimitiveType(PrimitiveType.Char) && if (array.Type.Desugar().IsPrimitiveType(PrimitiveType.Char) &&
array.QualifiedType.Qualifiers.IsConst) array.QualifiedType.Qualifiers.IsConst)
return VisitPointerType(new PointerType return VisitPointerType(new PointerType
{ {

2
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -155,7 +155,7 @@ namespace CppSharp.Generators.CSharp
// const char* and const char[] are the same so we can use a string // const char* and const char[] are the same so we can use a string
if (array.SizeType == ArrayType.ArraySize.Incomplete && if (array.SizeType == ArrayType.ArraySize.Incomplete &&
array.Type.IsPrimitiveType(PrimitiveType.Char) && array.Type.Desugar().IsPrimitiveType(PrimitiveType.Char) &&
array.QualifiedType.Qualifiers.IsConst) array.QualifiedType.Qualifiers.IsConst)
return "string"; return "string";

Loading…
Cancel
Save