summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2012-10-16 12:53:21 +0200
committerhjk <qthjk@ovi.com>2012-10-17 11:20:10 +0200
commit6fb3328dbe4833544cb1bfbe9406f89d624936ce (patch)
tree0ed31bd2bff52d9e23aba6534f46f1fe5d520261 /src
parent2b3058238a6798e5786f8e753c62e63bded0c424 (diff)
downloadqt-creator-6fb3328dbe4833544cb1bfbe9406f89d624936ce.tar.gz
CppEditor: remove operator() overloads from OverView
Feels less obfuscated. Change-Id: Ide0ec1f38762038ddbb1eddb4f70f7d6acdf1ff7 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp8
-rw-r--r--src/libs/cplusplus/Dumpers.cpp4
-rw-r--r--src/libs/cplusplus/LookupContext.cpp12
-rw-r--r--src/libs/cplusplus/TypePrettyPrinter.cpp2
-rw-r--r--src/plugins/cppeditor/cppcompleteswitch.cpp4
-rw-r--r--src/plugins/cppeditor/cppfunctiondecldeflink.cpp18
-rw-r--r--src/plugins/cppeditor/cppinsertdecldef.cpp4
-rw-r--r--src/plugins/cppeditor/cppinsertqtpropertymembers.cpp4
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp4
-rw-r--r--src/plugins/cpptools/cppcompletionassist.cpp6
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp2
-rw-r--r--src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp18
12 files changed, 43 insertions, 43 deletions
diff --git a/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp b/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
index 4c8c752fab..eb27a6bf55 100644
--- a/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
+++ b/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
@@ -304,25 +304,25 @@ private:
virtual void visit(const DestructorNameId *name)
{
Overview oo;
- qWarning() << "ignored name:" << oo(name);
+ qWarning() << "ignored name:" << oo.prettyName(name);
}
virtual void visit(const OperatorNameId *name)
{
Overview oo;
- qWarning() << "ignored name:" << oo(name);
+ qWarning() << "ignored name:" << oo.prettyName(name);
}
virtual void visit(const ConversionNameId *name)
{
Overview oo;
- qWarning() << "ignored name:" << oo(name);
+ qWarning() << "ignored name:" << oo.prettyName(name);
}
virtual void visit(const SelectorNameId *name)
{
Overview oo;
- qWarning() << "ignored name:" << oo(name);
+ qWarning() << "ignored name:" << oo.prettyName(name);
}
private:
diff --git a/src/libs/cplusplus/Dumpers.cpp b/src/libs/cplusplus/Dumpers.cpp
index be6dcaa265..2a20ea72f4 100644
--- a/src/libs/cplusplus/Dumpers.cpp
+++ b/src/libs/cplusplus/Dumpers.cpp
@@ -55,13 +55,13 @@ static QString indent(QString s, int level = 2)
QString CPlusPlus::toString(const Name *name, QString id)
{
Overview oo;
- return QString("%0: %1").arg(id, name ? oo(name) : QLatin1String("(null)"));
+ return QString("%0: %1").arg(id, name ? oo.prettyName(name) : QLatin1String("(null)"));
}
QString CPlusPlus::toString(FullySpecifiedType ty, QString id)
{
Overview oo;
- return QString("%0: %1 (a %2)").arg(id, oo(ty), ty.type() ? typeid(*ty.type()).name() : "(null)");
+ return QString("%0: %1 (a %2)").arg(id, oo.prettyType(ty), ty.type() ? typeid(*ty.type()).name() : "(null)");
}
QString CPlusPlus::toString(const Symbol *s, QString id)
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 1fbe5c5e60..a9ea1f33da 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -1106,7 +1106,7 @@ bool CreateBindings::visit(Declaration *decl)
_currentClassOrNamespace->addNestedType(decl->name(), e);
} else if (false) {
Overview oo;
- qDebug() << "found entity not found for" << oo(namedTy->name());
+ qDebug() << "found entity not found for" << oo.prettyName(namedTy->name());
}
} else if (Class *klass = ty->asClassType()) {
if (const Identifier *nameId = decl->name()->asNameId()) {
@@ -1131,7 +1131,7 @@ bool CreateBindings::visit(BaseClass *b)
_currentClassOrNamespace->addUsing(base);
} else if (false) {
Overview oo;
- qDebug() << "no entity for:" << oo(b->name());
+ qDebug() << "no entity for:" << oo.prettyName(b->name());
}
return false;
}
@@ -1157,7 +1157,7 @@ bool CreateBindings::visit(UsingNamespaceDirective *u)
_currentClassOrNamespace->addUsing(e);
} else if (false) {
Overview oo;
- qDebug() << "no entity for namespace:" << oo(u->name());
+ qDebug() << "no entity for namespace:" << oo.prettyName(u->name());
}
return false;
}
@@ -1173,7 +1173,7 @@ bool CreateBindings::visit(NamespaceAlias *a)
} else if (false) {
Overview oo;
- qDebug() << "no entity for namespace:" << oo(a->namespaceName());
+ qDebug() << "no entity for namespace:" << oo.prettyName(a->namespaceName());
}
return false;
@@ -1201,7 +1201,7 @@ bool CreateBindings::visit(ObjCBaseClass *b)
_currentClassOrNamespace->addUsing(base);
} else if (false) {
Overview oo;
- qDebug() << "no entity for:" << oo(b->name());
+ qDebug() << "no entity for:" << oo.prettyName(b->name());
}
return false;
}
@@ -1233,7 +1233,7 @@ bool CreateBindings::visit(ObjCBaseProtocol *b)
_currentClassOrNamespace->addUsing(base);
} else if (false) {
Overview oo;
- qDebug() << "no entity for:" << oo(b->name());
+ qDebug() << "no entity for:" << oo.prettyName(b->name());
}
return false;
}
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index dc3e0108f9..035a6f6be6 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -345,7 +345,7 @@ void TypePrettyPrinter::visit(Function *type)
if (_overview->showArgumentNames)
name = arg->name();
- _text += argumentText(arg->type(), name);
+ _text += argumentText.prettyType(arg->type(), name);
if (_overview->showDefaultArguments) {
if (const StringLiteral *initializer = arg->initializer()) {
diff --git a/src/plugins/cppeditor/cppcompleteswitch.cpp b/src/plugins/cppeditor/cppcompleteswitch.cpp
index 554e3faba7..76833afbc8 100644
--- a/src/plugins/cppeditor/cppcompleteswitch.cpp
+++ b/src/plugins/cppeditor/cppcompleteswitch.cpp
@@ -79,7 +79,7 @@ public:
scope);
if (!candidates .isEmpty() && candidates.first().declaration()) {
Symbol *decl = candidates.first().declaration();
- values << prettyPrint(LookupContext::fullyQualifiedName(decl));
+ values << prettyPrint.prettyName(LookupContext::fullyQualifiedName(decl));
}
}
return true;
@@ -194,7 +194,7 @@ QList<CppQuickFixOperation::Ptr> CompleteSwitchCaseStatement::match(
Overview prettyPrint;
for (unsigned i = 0; i < e->memberCount(); ++i) {
if (Declaration *decl = e->memberAt(i)->asDeclaration()) {
- values << prettyPrint(LookupContext::fullyQualifiedName(decl));
+ values << prettyPrint.prettyName(LookupContext::fullyQualifiedName(decl));
}
}
// Get the used values
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
index d33a6b1a7a..9148d1a586 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
@@ -604,7 +604,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
// abort if the name of the newly parsed function is not the expected one
DeclaratorIdAST *newDeclId = getDeclaratorId(newDef->declarator);
if (!newDeclId || !newDeclId->name || !newDeclId->name->name
- || overview(newDeclId->name->name) != nameInitial) {
+ || overview.prettyName(newDeclId->name->name) != nameInitial) {
return changes;
}
@@ -650,7 +650,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
if (!newFunction->returnType().isEqualTo(sourceFunction->returnType())
&& !newFunction->returnType().isEqualTo(targetFunction->returnType())) {
FullySpecifiedType type = rewriteType(newFunction->returnType(), &env, control);
- const QString replacement = overview(type, targetFunction->name());
+ const QString replacement = overview.prettyType(type, targetFunction->name());
changes.replace(returnTypeStart,
targetFile->startOf(targetFunctionDeclarator->lparen_token),
replacement);
@@ -706,19 +706,19 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
QMultiHash<QString, int> sourceParamNameToIndex;
for (int i = 0; i < existingParamCount; ++i) {
Symbol *sourceParam = sourceFunction->argumentAt(i);
- sourceParamNameToIndex.insert(overview(sourceParam->name()), i);
+ sourceParamNameToIndex.insert(overview.prettyName(sourceParam->name()), i);
}
QMultiHash<QString, int> newParamNameToIndex;
for (int i = 0; i < newParamCount; ++i) {
Symbol *newParam = newFunction->argumentAt(i);
- newParamNameToIndex.insert(overview(newParam->name()), i);
+ newParamNameToIndex.insert(overview.prettyName(newParam->name()), i);
}
// name-based binds (possibly disambiguated by type)
for (int sourceParamIndex = 0; sourceParamIndex < existingParamCount; ++sourceParamIndex) {
Symbol *sourceParam = sourceFunction->argumentAt(sourceParamIndex);
- const QString &name = overview(sourceParam->name());
+ const QString &name = overview.prettyName(sourceParam->name());
QList<int> newParams = newParamNameToIndex.values(name);
QList<int> sourceParams = sourceParamNameToIndex.values(name);
@@ -783,7 +783,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
// if it's genuinely new, add it
if (existingParamIndex == -1) {
FullySpecifiedType type = rewriteType(newParam->type(), &env, control);
- newTargetParam = overview(type, newParam->name());
+ newTargetParam = overview.prettyType(type, newParam->name());
hadChanges = true;
}
// otherwise preserve as much as possible from the existing parameter
@@ -821,7 +821,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
// track renames
if (replacementName != targetParam->name() && replacementName)
- renamedTargetParameters[targetParam] = overview(replacementName);
+ renamedTargetParameters[targetParam] = overview.prettyName(replacementName);
// need to change the type (and name)?
if (!newParam->type().isEqualTo(sourceParam->type())
@@ -837,14 +837,14 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
FullySpecifiedType replacementType = rewriteType(newParam->type(), &env, control);
newTargetParam = targetFile->textOf(parameterStart, parameterTypeStart);
- newTargetParam += overview(replacementType, replacementName);
+ newTargetParam += overview.prettyType(replacementType, replacementName);
newTargetParam += targetFile->textOf(parameterTypeEnd, parameterEnd);
hadChanges = true;
}
// change the name only?
else if (!namesEqual(targetParam->name(), replacementName)) {
DeclaratorIdAST *id = getDeclaratorId(targetParamAst->declarator);
- const QString &replacementNameStr = overview(replacementName);
+ const QString &replacementNameStr = overview.prettyName(replacementName);
if (id) {
newTargetParam += targetFile->textOf(parameterStart, targetFile->startOf(id));
QString rest = targetFile->textOf(targetFile->endOf(id), parameterEnd);
diff --git a/src/plugins/cppeditor/cppinsertdecldef.cpp b/src/plugins/cppeditor/cppinsertdecldef.cpp
index 1410520e74..16a0bd13dc 100644
--- a/src/plugins/cppeditor/cppinsertdecldef.cpp
+++ b/src/plugins/cppeditor/cppinsertdecldef.cpp
@@ -212,7 +212,7 @@ QString InsertDeclOperation::generateDeclaration(Function *function)
oo.showArgumentNames = true;
QString decl;
- decl += oo(function->type(), function->unqualifiedName());
+ decl += oo.prettyType(function->type(), function->unqualifiedName());
decl += QLatin1String(";\n");
return decl;
@@ -271,7 +271,7 @@ public:
FullySpecifiedType tn = rewriteType(m_decl->type(), &env, control);
// rewrite the function name
- QString name = oo(LookupContext::minimalName(m_decl, targetCoN, control));
+ QString name = oo.prettyName(LookupContext::minimalName(m_decl, targetCoN, control));
QString defText = oo.prettyType(tn, name) + QLatin1String("\n{\n}");
diff --git a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp
index 6d22946e5c..3e43271589 100644
--- a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp
+++ b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp
@@ -102,7 +102,7 @@ QList<CppQuickFixOperation::Ptr> InsertQtPropertyMembers::match(
Symbol *member = c->memberAt(i);
FullySpecifiedType type = member->type();
if (member->asFunction() || (type.isValid() && type->asFunctionType())) {
- const QString name = overview(member->name());
+ const QString name = overview.prettyName(member->name());
if (name == getterName) {
generateFlags &= ~GenerateGetter;
} else if (name == setterName) {
@@ -111,7 +111,7 @@ QList<CppQuickFixOperation::Ptr> InsertQtPropertyMembers::match(
generateFlags &= ~GenerateSignal;
}
} else if (member->asDeclaration()) {
- const QString name = overview(member->name());
+ const QString name = overview.prettyName(member->name());
if (name == storageName)
generateFlags &= ~GenerateStorage;
}
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index 3a49abd733..ce981e3a54 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -1702,7 +1702,7 @@ private:
FullySpecifiedType tn = rewriteType(result.first().type(), &env, control);
Overview oo;
- QString ty = oo(tn);
+ QString ty = oo.prettyType(tn);
if (! ty.isEmpty()) {
const QChar ch = ty.at(ty.size() - 1);
@@ -1848,7 +1848,7 @@ public:
if (!existingResults.isEmpty())
return noResult();
- const QString &className = Overview()(innermostName->name);
+ const QString &className = Overview().prettyName(innermostName->name);
if (className.isEmpty())
return noResult();
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index 49ec6b0b50..321d05c98f 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -1134,9 +1134,9 @@ void CppCompletionAssistProcessor::completeObjCMsgSend(CPlusPlus::ClassOrNamespa
text += QLatin1Char(':');
text += TextEditor::Snippet::kVariableDelimiter;
text += QLatin1Char('(');
- text += oo(arg->type());
+ text += oo.prettyType(arg->type());
text += QLatin1Char(')');
- text += oo(arg->name());
+ text += oo.prettyName(arg->name());
text += TextEditor::Snippet::kVariableDelimiter;
}
} else {
@@ -1907,7 +1907,7 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl
const FullySpecifiedType localTy = rewriteType(f->type(), &env, control);
// gets: "parameter list) cv-spec",
- QString completion = overview(localTy).mid(1);
+ QString completion = overview.prettyType(localTy).mid(1);
addCompletionItem(completion, QIcon(), 0,
QVariant::fromValue(CompleteFunctionDeclaration(f)));
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index 6779fe2c9d..63e3edabdb 100644
--- a/src/plugins/cpptools/cppfindreferences.cpp
+++ b/src/plugins/cpptools/cppfindreferences.cpp
@@ -250,7 +250,7 @@ void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol,
Overview overview;
Find::SearchResult *search = Find::SearchResultWindow::instance()->startNewSearch(tr("C++ Usages:"),
QString(),
- overview(context.fullyQualifiedName(symbol)),
+ overview.prettyName(context.fullyQualifiedName(symbol)),
replace ? Find::SearchResultWindow::SearchAndReplace
: Find::SearchResultWindow::SearchOnly,
QLatin1String("CppEditor"));
diff --git a/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp b/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp
index c358b219a0..5b261fd416 100644
--- a/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp
+++ b/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp
@@ -516,7 +516,7 @@ static FullySpecifiedType stripPointerAndReference(const FullySpecifiedType &typ
static QString toQmlType(const FullySpecifiedType &type)
{
Overview overview;
- QString result = overview(stripPointerAndReference(type));
+ QString result = overview.prettyType(stripPointerAndReference(type));
if (result == QLatin1String("QString"))
result = QLatin1String("string");
return result;
@@ -553,7 +553,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
Overview namePrinter;
- fmo->setClassName(namePrinter(klass->name()));
+ fmo->setClassName(namePrinter.prettyName(klass->name()));
// add the no-package export, so the cpp name can be used in properties
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
@@ -564,7 +564,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
if (Function *func = member->type()->asFunctionType()) {
if (!func->isSlot() && !func->isInvokable() && !func->isSignal())
continue;
- FakeMetaMethod method(namePrinter(func->name()), toQmlType(func->returnType()));
+ FakeMetaMethod method(namePrinter.prettyName(func->name()), toQmlType(func->returnType()));
if (func->isSignal())
method.setMethodType(FakeMetaMethod::Signal);
else
@@ -573,7 +573,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
Symbol *arg = func->argumentAt(a);
QString name;
if (arg->name())
- name = namePrinter(arg->name());
+ name = namePrinter.prettyName(arg->name());
method.addParameter(name, toQmlType(arg->type()));
}
fmo->addMethod(method);
@@ -585,7 +585,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
const bool isPointer = type.type() && type.type()->isPointerType();
const int revision = 0; // ### fixme
FakeMetaProperty property(
- namePrinter(propDecl->name()),
+ namePrinter.prettyName(propDecl->name()),
toQmlType(type),
isList, isWritable, isPointer,
revision);
@@ -594,7 +594,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
if (QtEnum *qtEnum = member->asQtEnum()) {
// find the matching enum
Enum *e = 0;
- QList<LookupItem> result = typeOf(namePrinter(qtEnum->name()).toUtf8(), klass);
+ QList<LookupItem> result = typeOf(namePrinter.prettyName(qtEnum->name()).toUtf8(), klass);
foreach (const LookupItem &item, result) {
if (item.declaration()) {
e = item.declaration()->asEnum();
@@ -605,12 +605,12 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
if (!e)
continue;
- FakeMetaEnum metaEnum(namePrinter(e->name()));
+ FakeMetaEnum metaEnum(namePrinter.prettyName(e->name()));
for (unsigned j = 0; j < e->memberCount(); ++j) {
Symbol *enumMember = e->memberAt(j);
if (!enumMember->name())
continue;
- metaEnum.addKey(namePrinter(enumMember->name()), 0);
+ metaEnum.addKey(namePrinter.prettyName(enumMember->name()), 0);
}
fmo->addEnum(metaEnum);
}
@@ -622,7 +622,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
if (!base->name())
return fmo;
- const QString baseClassName = namePrinter(base->name());
+ const QString baseClassName = namePrinter.prettyName(base->name());
fmo->setSuperclassName(baseClassName);
Class *baseClass = lookupClass(baseClassName, klass, typeOf);