Browse Source

Added 3 hacks so that QtCore reaches the end of code generation:

1. If an expression of an enum item is null, count it as non-hex;
2. Do not throw a NotSupported exception when a fixed array of an non-primitive type is encountered;
3. Provide some seemingly correct implementation for CppTypePrinter.VisitTemplateParameterSubstitutionType.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/23/head
Dimitar Dobrev 12 years ago
parent
commit
31fe7760ad
  1. 4
      src/AST/Enumeration.cs
  2. 6
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  3. 2
      src/Generator/Types/CppTypePrinter.cs

4
src/AST/Enumeration.cs

@ -31,6 +31,10 @@ namespace CppSharp.AST
{ {
get get
{ {
if (Expression == null)
{
return false;
}
return Expression.Contains("0x") || Expression.Contains("0X"); return Expression.Contains("0x") || Expression.Contains("0X");
} }
} }

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

@ -96,9 +96,9 @@ namespace CppSharp.Generators.CSharp
if (ContextKind == CSharpTypePrinterContextKind.Native && if (ContextKind == CSharpTypePrinterContextKind.Native &&
array.SizeType == ArrayType.ArraySize.Constant) array.SizeType == ArrayType.ArraySize.Constant)
{ {
PrimitiveType primitive; //PrimitiveType primitive;
if (!array.Type.Desugar().IsPrimitiveType(out primitive)) //if (!array.Type.Desugar().IsPrimitiveType(out primitive))
throw new NotSupportedException(); // throw new NotSupportedException();
return new CSharpTypePrinterResult() return new CSharpTypePrinterResult()
{ {

2
src/Generator/Types/CppTypePrinter.cs

@ -118,7 +118,7 @@ namespace CppSharp.Types
public string VisitTemplateParameterSubstitutionType( public string VisitTemplateParameterSubstitutionType(
TemplateParameterSubstitutionType param, TypeQualifiers quals) TemplateParameterSubstitutionType param, TypeQualifiers quals)
{ {
throw new System.NotImplementedException(); return param.Replacement.Visit(this);
} }
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals) public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)

Loading…
Cancel
Save