Browse Source

Remove PrimitiveTypeExtensions.ConvertToType

C++ types cannot be converted to C# types without knowing details of the
target (e.g. what is the size of "long") and
PrimitiveTypeExtensions.ConvertToType does not handle that correctly.

However, ConvertToType is not used anywhere, so let's just remove it so
that no one will use the method.

We could also fix the method, but it's an extension method for
PrimitiveType, and I don't think such an extension method should be used
for the task, as you would also need to pass it information about the
target system.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
pull/252/head
Tomi Valkeinen 11 years ago committed by triton
parent
commit
765bc4219d
  1. 26
      src/Generator/Utils/Utils.cs

26
src/Generator/Utils/Utils.cs

@ -15,32 +15,6 @@ namespace CppSharp @@ -15,32 +15,6 @@ namespace CppSharp
}
}
public static class PrimitiveTypeExtensions
{
public static System.Type ConvertToType(this PrimitiveType primitive)
{
switch (primitive)
{
case PrimitiveType.Bool: return typeof(bool);
case PrimitiveType.Void: return typeof(void);
case PrimitiveType.Char16:
case PrimitiveType.WideChar: return typeof(char);
case PrimitiveType.Int8: return typeof(sbyte);
case PrimitiveType.UInt8: return typeof(byte);
case PrimitiveType.Int16: return typeof(short);
case PrimitiveType.UInt16: return typeof(ushort);
case PrimitiveType.Int32: return typeof(int);
case PrimitiveType.UInt32: return typeof(uint);
case PrimitiveType.Int64: return typeof(long);
case PrimitiveType.UInt64: return typeof(ulong);
case PrimitiveType.Float: return typeof(float);
case PrimitiveType.Double: return typeof(double);
}
return typeof(int);
}
}
public static class StringHelpers
{
public static string CommonPrefix(this string[] ss)

Loading…
Cancel
Save