Browse Source

Added better support for substituted template parameter types.

pull/1/head
triton 13 years ago
parent
commit
6d2c342eed
  1. 6
      src/Bridge/ASTVisitor.cs
  2. 21
      src/Bridge/Type.cs
  3. 6
      src/Generator/Generators/CLI/CLITypePrinter.cs
  4. 5
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  5. 6
      src/Generator/Types/CppTypePrinter.cs
  6. 8
      src/Parser/Parser.cpp

6
src/Bridge/ASTVisitor.cs

@ -130,6 +130,12 @@ namespace CppSharp @@ -130,6 +130,12 @@ namespace CppSharp
return true;
}
public bool VisitTemplateParameterSubstitutionType(TemplateParameterSubstitutionType param,
TypeQualifiers quals)
{
return param.Replacement.Type.Visit(this, quals);
}
public bool VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)
{
return true;

21
src/Bridge/Type.cs

@ -390,6 +390,25 @@ namespace CppSharp @@ -390,6 +390,25 @@ namespace CppSharp
}
}
/// <summary>
/// Represents the result of substituting a type for a template type parameter.
/// </summary>
public class TemplateParameterSubstitutionType : Type
{
public TemplateParameterSubstitutionType()
{
}
public QualifiedType Replacement;
public override T Visit<T>(ITypeVisitor<T> visitor,
TypeQualifiers quals = new TypeQualifiers())
{
return visitor.VisitTemplateParameterSubstitutionType(this, quals);
}
}
/// <summary>
/// The injected class name of a C++ class template or class template partial
/// specialization.
@ -494,6 +513,8 @@ namespace CppSharp @@ -494,6 +513,8 @@ namespace CppSharp
T VisitDeclaration(Declaration decl, TypeQualifiers quals);
T VisitTemplateParameterType(TemplateParameterType param,
TypeQualifiers quals);
T VisitTemplateParameterSubstitutionType(
TemplateParameterSubstitutionType param, TypeQualifiers quals);
T VisitInjectedClassNameType(InjectedClassNameType injected,
TypeQualifiers quals);
T VisitDependentNameType(DependentNameType dependent,

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

@ -217,6 +217,12 @@ namespace CppSharp.Generators.CLI @@ -217,6 +217,12 @@ namespace CppSharp.Generators.CLI
return param.Parameter.Name;
}
public string VisitTemplateParameterSubstitutionType(
TemplateParameterSubstitutionType param, TypeQualifiers quals)
{
throw new NotImplementedException();
}
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)
{
throw new NotImplementedException();

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

@ -237,6 +237,11 @@ namespace CppSharp.Generators.CSharp @@ -237,6 +237,11 @@ namespace CppSharp.Generators.CSharp
public CSharpTypePrinterResult VisitTemplateParameterType(
TemplateParameterType param, TypeQualifiers quals)
{
}
public CSharpTypePrinterResult VisitTemplateParameterSubstitutionType(TemplateParameterSubstitutionType param,
TypeQualifiers quals)
{
throw new NotImplementedException();
}

6
src/Generator/Types/CppTypePrinter.cs

@ -107,6 +107,12 @@ namespace CppSharp.Types @@ -107,6 +107,12 @@ namespace CppSharp.Types
return param.Parameter.Name;
}
public string VisitTemplateParameterSubstitutionType(
TemplateParameterSubstitutionType param, TypeQualifiers quals)
{
throw new System.NotImplementedException();
}
public string VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)
{
throw new System.NotImplementedException();

8
src/Parser/Parser.cpp

@ -962,7 +962,13 @@ CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -962,7 +962,13 @@ CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
}
case Type::SubstTemplateTypeParm:
{
auto TPT = gcnew CppSharp::TemplateParameterType();
auto TP = Type->getAs<SubstTemplateTypeParmType>();
auto Ty = TP->getReplacementType();
auto TPT = gcnew CppSharp::TemplateParameterSubstitutionType();
auto Next = TL->getNextTypeLoc();
TPT->Replacement = GetQualifiedType(Ty, WalkType(Ty, &Next));
return TPT;
}
case Type::InjectedClassName:

Loading…
Cancel
Save