aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/TypePrettyPrinter.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-08-11 14:35:58 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-08-11 15:25:20 +0200
commitbe1cde6ed5dcd6876eef078101699410667de2c1 (patch)
tree108c48873ff80998efe9c8c2b84953af3a8b5e4a /src/libs/cplusplus/TypePrettyPrinter.cpp
parenta14016bfe644cc901032e360806017dbbb101a0f (diff)
Pretty print templates.
Diffstat (limited to 'src/libs/cplusplus/TypePrettyPrinter.cpp')
-rw-r--r--src/libs/cplusplus/TypePrettyPrinter.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index 30b9e040cb..30dc3ecaf8 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -142,23 +142,23 @@ void TypePrettyPrinter::visit(Namespace *type)
void TypePrettyPrinter::visit(Template *type)
{
- const unsigned argc = type->templateParameterCount();
- QString decl;
- decl += QLatin1String("template <");
- for (unsigned i = 0; i < argc; ++i) {
- if (i != 0)
- decl += QLatin1String(", ");
-
- decl += QLatin1String("T");
- decl += QString::number(i + 1);
- }
- decl += QLatin1Char('<');
if (Symbol *d = type->declaration()) {
- decl += QLatin1Char(' ');
- decl += overview()->prettyType(d->type(), d->name());
+ if (overview()->showTemplateParameters() && ! _name.isEmpty()) {
+ _name += QLatin1Char('<');
+ for (unsigned index = 0; index < type->templateParameterCount(); ++index) {
+ if (index)
+ _name += QLatin1String(", ");
+ QString arg = overview()->prettyName(type->templateParameterAt(index)->name());
+ if (arg.isEmpty()) {
+ arg += QLatin1Char('T');
+ arg += QString::number(index + 1);
+ }
+ _name += arg;
+ }
+ _name += QLatin1Char('>');
+ }
+ acceptType(d->type());
}
- _text.prepend(decl);
- qWarning() << "here:" << decl;
prependCv(_fullySpecifiedType);
}