From 440ed5b92f50fcb058affeadaa633f10e4d40c34 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 7 May 2013 19:58:25 +0100 Subject: [PATCH] Added better support for dependent name types. --- src/Bridge/ASTVisitor.cs | 5 +++++ src/Bridge/Type.cs | 19 +++++++++++++++++++ .../Generators/CLI/CLITypePrinter.cs | 5 +++++ .../Generators/CSharp/CSharpTypePrinter.cs | 4 ++++ src/Generator/Types/CppTypePrinter.cs | 5 +++++ src/Parser/Parser.cpp | 3 ++- 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Bridge/ASTVisitor.cs b/src/Bridge/ASTVisitor.cs index 44862d33..dafddc75 100644 --- a/src/Bridge/ASTVisitor.cs +++ b/src/Bridge/ASTVisitor.cs @@ -135,6 +135,11 @@ namespace CppSharp return true; } + public bool VisitDependentNameType(DependentNameType dependent, 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 352065d4..3412aa9b 100644 --- a/src/Bridge/Type.cs +++ b/src/Bridge/Type.cs @@ -411,6 +411,23 @@ namespace CppSharp } } + /// + /// Represents a qualified type name for which the type name is dependent. + /// + public class DependentNameType : Type + { + public DependentNameType() + { + + } + + public override T Visit(ITypeVisitor visitor, + TypeQualifiers quals = new TypeQualifiers()) + { + return visitor.VisitDependentNameType(this, quals); + } + } + #region Primitives /// @@ -479,5 +496,7 @@ namespace CppSharp TypeQualifiers quals); T VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals); + T VisitDependentNameType(DependentNameType dependent, + 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 2eedf337..3ef59ef8 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -222,6 +222,11 @@ namespace CppSharp.Generators.CLI throw new NotImplementedException(); } + public string VisitDependentNameType(DependentNameType dependent, 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 bea913c9..02c15cdb 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -242,6 +242,10 @@ namespace CppSharp.Generators.CSharp } public CSharpTypePrinterResult VisitInjectedClassNameType(InjectedClassNameType injected, TypeQualifiers quals) + { + } + + public CSharpTypePrinterResult VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals) { throw new NotImplementedException(); } diff --git a/src/Generator/Types/CppTypePrinter.cs b/src/Generator/Types/CppTypePrinter.cs index 5a1860d5..6a37f93d 100644 --- a/src/Generator/Types/CppTypePrinter.cs +++ b/src/Generator/Types/CppTypePrinter.cs @@ -112,6 +112,11 @@ namespace CppSharp.Types throw new System.NotImplementedException(); } + public string VisitDependentNameType(DependentNameType dependent, 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 8a280eb4..48803720 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -976,7 +976,8 @@ CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, case Type::DependentName: { auto DN = Type->getAs(); - return nullptr; + auto DNT = gcnew CppSharp::DependentNameType(); + return DNT; } case Type::LValueReference: {