C++: Add support of ref-qualifier for functions.

Now the ref-qualifier (& or &&) of the function declaration
is propagated to GUI. For example,  'Refactor' -> 'Add Definition'
preserves the ref-qualifier.

Change-Id: I8ac4e1cad4e44985e94230aabbd9858a7e929fee
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Dmitry Ashkadov
2014-11-13 22:18:53 +03:00
committed by Orgad Shaneh
parent c0f3094866
commit 43075f5fb1
7 changed files with 176 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ public:
funTy->copy(type);
funTy->setConst(type->isConst());
funTy->setVolatile(type->isVolatile());
funTy->setRefQualifier(type->refQualifier());
funTy->setName(rewrite->rewriteName(type->name()));

View File

@@ -454,6 +454,17 @@ void TypePrettyPrinter::visit(Function *type)
appendSpace();
_text += QLatin1String("volatile");
}
// add ref-qualifier
if (type->refQualifier() != Function::NoRefQualifier) {
if (!_overview->starBindFlags.testFlag(Overview::BindToLeftSpecifier)
|| (!type->isConst() && !type->isVolatile())) {
appendSpace();
}
_text += type->refQualifier() == Function::LvalueRefQualifier
? QLatin1String("&")
: QLatin1String("&&");
}
}
}