Browse Source

Added better support for injected class name types.

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

5
src/Bridge/ASTVisitor.cs

@ -130,6 +130,11 @@ namespace CppSharp @@ -130,6 +130,11 @@ namespace CppSharp
return true;
}
public bool VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)
{
return true;
}
public virtual bool VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals)
{
return true;

23
src/Bridge/Type.cs

@ -389,6 +389,27 @@ namespace CppSharp @@ -389,6 +389,27 @@ namespace CppSharp
}
}
/// <summary>
/// The injected class name of a C++ class template or class template partial
/// specialization.
/// </summary>
public class InjectedClassNameType : Type
{
public InjectedClassNameType()
{
}
public TemplateSpecializationType TemplateSpecialization;
public Class Class;
public override T Visit<T>(ITypeVisitor<T> visitor,
TypeQualifiers quals = new TypeQualifiers())
{
return visitor.VisitInjectedClassNameType(this, quals);
}
}
#region Primitives
/// <summary>
@ -455,5 +476,7 @@ namespace CppSharp @@ -455,5 +476,7 @@ namespace CppSharp
T VisitDeclaration(Declaration decl, TypeQualifiers quals);
T VisitTemplateParameterType(TemplateParameterType param,
TypeQualifiers quals);
T VisitInjectedClassNameType(InjectedClassNameType injected,
TypeQualifiers quals);
}
}

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

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

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

@ -241,6 +241,11 @@ namespace CppSharp.Generators.CSharp @@ -241,6 +241,11 @@ namespace CppSharp.Generators.CSharp
throw new NotImplementedException();
}
public CSharpTypePrinterResult VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals)
{
throw new NotImplementedException();
}
public CSharpTypePrinterResult VisitPrimitiveType(PrimitiveType primitive,
TypeQualifiers quals)
{

5
src/Generator/Types/CppTypePrinter.cs

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

7
src/Parser/Parser.cpp

@ -956,8 +956,11 @@ CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -956,8 +956,11 @@ CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
}
case Type::InjectedClassName:
{
auto MYIN = Type->getAs<InjectedClassNameType>();
return nullptr;
auto ICN = Type->getAs<InjectedClassNameType>();
auto ICNT = gcnew CppSharp::InjectedClassNameType();
ICNT->Class = safe_cast<CppSharp::Class^>(WalkDeclaration(
ICN->getDecl(), 0, /*IgnoreSystemDecls=*/false));
return ICNT;
}
case Type::DependentName:
{

Loading…
Cancel
Save