Browse Source

Added string as a primitive type to the type system.

This will make it less hacky to represent proper strings in our AST model.
pull/778/head
Joao Matos 9 years ago
parent
commit
4a653b00bd
  1. 14
      src/AST/CppTypePrinter.cs
  2. 3
      src/AST/Type.cs
  3. 1
      src/Generator/Generators/CLI/CLITypePrinter.cs
  4. 1
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs

14
src/AST/CppTypePrinter.cs

@ -142,6 +142,20 @@ namespace CppSharp.AST @@ -142,6 +142,20 @@ namespace CppSharp.AST
case PrimitiveType.IntPtr: return "void*";
case PrimitiveType.UIntPtr: return "uintptr_t";
case PrimitiveType.Null: return PrintFlavorKind == CppTypePrintFlavorKind.Cpp ? "std::nullptr_t" : "NULL";
case PrimitiveType.String:
{
switch (PrintFlavorKind)
{
case CppTypePrintFlavorKind.C:
return "const char*";
case CppTypePrintFlavorKind.Cpp:
return "std::string";
case CppTypePrintFlavorKind.ObjC:
return "NSString";;
default:
throw new ArgumentOutOfRangeException();
}
}
}
throw new NotSupportedException();

3
src/AST/Type.cs

@ -1132,7 +1132,8 @@ namespace CppSharp.AST @@ -1132,7 +1132,8 @@ namespace CppSharp.AST
LongDouble,
Float128,
IntPtr,
UIntPtr
UIntPtr,
String
}
/// <summary>

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

@ -232,6 +232,7 @@ namespace CppSharp.Generators.CLI @@ -232,6 +232,7 @@ namespace CppSharp.Generators.CLI
case PrimitiveType.IntPtr: return "IntPtr";
case PrimitiveType.UIntPtr: return "UIntPtr";
case PrimitiveType.Null: return "void*";
case PrimitiveType.String: return "System::String";
}
throw new NotSupportedException();

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

@ -558,6 +558,7 @@ namespace CppSharp.Generators.CSharp @@ -558,6 +558,7 @@ namespace CppSharp.Generators.CSharp
case PrimitiveType.IntPtr: return IntPtrType;
case PrimitiveType.UIntPtr: return "global::System.UIntPtr";
case PrimitiveType.Null: return "void*";
case PrimitiveType.String: return "string";
}
throw new NotSupportedException();

Loading…
Cancel
Save