diff --git a/src/Bridge/ASTVisitor.cs b/src/Bridge/ASTVisitor.cs index 24690e52..44862d33 100644 --- a/src/Bridge/ASTVisitor.cs +++ b/src/Bridge/ASTVisitor.cs @@ -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; diff --git a/src/Bridge/Type.cs b/src/Bridge/Type.cs index 54f1ae96..4860ef8e 100644 --- a/src/Bridge/Type.cs +++ b/src/Bridge/Type.cs @@ -389,6 +389,27 @@ namespace CppSharp } } + /// + /// The injected class name of a C++ class template or class template partial + /// specialization. + /// + public class InjectedClassNameType : Type + { + public InjectedClassNameType() + { + + } + + public TemplateSpecializationType TemplateSpecialization; + public Class Class; + + public override T Visit(ITypeVisitor visitor, + TypeQualifiers quals = new TypeQualifiers()) + { + return visitor.VisitInjectedClassNameType(this, quals); + } + } + #region Primitives /// @@ -455,5 +476,7 @@ namespace CppSharp T VisitDeclaration(Declaration decl, TypeQualifiers quals); T VisitTemplateParameterType(TemplateParameterType param, TypeQualifiers quals); + T VisitInjectedClassNameType(InjectedClassNameType injected, + TypeQualifiers quals); } } \ No newline at end of file diff --git a/src/Generator/Generators/CLI/CLITypePrinter.cs b/src/Generator/Generators/CLI/CLITypePrinter.cs index 01b11d0f..2eedf337 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -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); diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 72babaee..bea913c9 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -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) { diff --git a/src/Generator/Types/CppTypePrinter.cs b/src/Generator/Types/CppTypePrinter.cs index b5fdf2d4..5a1860d5 100644 --- a/src/Generator/Types/CppTypePrinter.cs +++ b/src/Generator/Types/CppTypePrinter.cs @@ -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(); diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index 4f35a273..553a02f0 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -956,8 +956,11 @@ CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, } case Type::InjectedClassName: { - auto MYIN = Type->getAs(); - return nullptr; + auto ICN = Type->getAs(); + auto ICNT = gcnew CppSharp::InjectedClassNameType(); + ICNT->Class = safe_cast(WalkDeclaration( + ICN->getDecl(), 0, /*IgnoreSystemDecls=*/false)); + return ICNT; } case Type::DependentName: {