diff --git a/src/Generator/Types/CppTypePrinter.cs b/src/Generator/Types/CppTypePrinter.cs index 8b699fcd..67c76fd9 100644 --- a/src/Generator/Types/CppTypePrinter.cs +++ b/src/Generator/Types/CppTypePrinter.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using CppSharp.AST; using Type = CppSharp.AST.Type; @@ -11,6 +12,8 @@ namespace CppSharp.Types { } + public bool PrintLocalName { get; set; } + public string VisitTagType(TagType tag, TypeQualifiers quals) { return tag.Declaration.Visit(this); @@ -106,6 +109,8 @@ namespace CppSharp.Types public string VisitTypedefType(TypedefType typedef, TypeQualifiers quals) { + if (PrintLocalName) + return typedef.Declaration.OriginalName; return "::" + typedef.Declaration.QualifiedOriginalName; } @@ -116,8 +121,12 @@ namespace CppSharp.Types public string VisitTemplateSpecializationType(TemplateSpecializationType template, TypeQualifiers quals) { - var decl = template.Template.TemplatedDecl; - return decl.Visit(this); + string prefix = PrintLocalName ? string.Empty : "::"; + return string.Format("{0}{1}<{2}>", prefix, template.Template.TemplatedDecl.Visit(this), + string.Join(", ", + template.Arguments.Where( + a => a.Type.Type != null && + !(a.Type.Type is DependentNameType)).Select(a => a.Type.Visit(this)))); } public string VisitTemplateParameterType(TemplateParameterType param, TypeQualifiers quals) @@ -205,6 +214,8 @@ namespace CppSharp.Types public string VisitClassDecl(Class @class) { + if (PrintLocalName) + return @class.OriginalName; return string.Format("::{0}", @class.QualifiedOriginalName); } @@ -235,6 +246,8 @@ namespace CppSharp.Types public string VisitEnumDecl(Enumeration @enum) { + if (PrintLocalName) + return @enum.OriginalName; return string.Format("::{0}", @enum.QualifiedOriginalName); }