diff --git a/src/libs/cplusplus/Overview.cpp b/src/libs/cplusplus/Overview.cpp index 0a7d2628dc8..748033d8599 100644 --- a/src/libs/cplusplus/Overview.cpp +++ b/src/libs/cplusplus/Overview.cpp @@ -38,99 +38,16 @@ using namespace CPlusPlus; Overview::Overview() - : _markedArgument(0), - _markedArgumentBegin(0), - _markedArgumentEnd(0), - _showArgumentNames(false), - _showReturnTypes(false), - _showFunctionSignatures(true), - _showDefaultArguments(true), - _showTemplateParameters(false) + : markedArgument(0), + markedArgumentBegin(0), + markedArgumentEnd(0), + showArgumentNames(false), + showReturnTypes(false), + showFunctionSignatures(true), + showDefaultArguments(true), + showTemplateParameters(false) { } -Overview::~Overview() -{ } - -bool Overview::showArgumentNames() const -{ - return _showArgumentNames; -} - -void Overview::setShowArgumentNames(bool showArgumentNames) -{ - _showArgumentNames = showArgumentNames; -} - -void Overview::setShowReturnTypes(bool showReturnTypes) -{ - _showReturnTypes = showReturnTypes; -} - -bool Overview::showReturnTypes() const -{ - return _showReturnTypes; -} - -unsigned Overview::markedArgument() const -{ - return _markedArgument; -} - -void Overview::setMarkedArgument(unsigned position) -{ - _markedArgument = position; -} - -int Overview::markedArgumentBegin() const -{ - return _markedArgumentBegin; -} - -void Overview::setMarkedArgumentBegin(int begin) -{ - _markedArgumentBegin = begin; -} - -int Overview::markedArgumentEnd() const -{ - return _markedArgumentEnd; -} - -void Overview::setMarkedArgumentEnd(int end) -{ - _markedArgumentEnd = end; -} - -bool Overview::showFunctionSignatures() const -{ - return _showFunctionSignatures; -} - -void Overview::setShowFunctionSignatures(bool showFunctionSignatures) -{ - _showFunctionSignatures = showFunctionSignatures; -} - -bool Overview::showDefaultArguments() const -{ - return _showDefaultArguments; -} - -void Overview::setShowDefaultArguments(bool showDefaultArguments) -{ - _showDefaultArguments = showDefaultArguments; -} - -bool Overview::showTemplateParameters() const -{ - return _showTemplateParameters; -} - -void Overview::setShowTemplateParameters(bool showTemplateParameters) -{ - _showTemplateParameters = showTemplateParameters; -} - QString Overview::prettyName(const Name *name) const { NamePrettyPrinter pp(this); diff --git a/src/libs/cplusplus/Overview.h b/src/libs/cplusplus/Overview.h index 8a7635cdd87..344c976f998 100644 --- a/src/libs/cplusplus/Overview.h +++ b/src/libs/cplusplus/Overview.h @@ -44,32 +44,6 @@ class CPLUSPLUS_EXPORT Overview public: Overview(); - ~Overview(); - - bool showArgumentNames() const; - void setShowArgumentNames(bool showArgumentNames); - - bool showReturnTypes() const; - void setShowReturnTypes(bool showReturnTypes); - - bool showFunctionSignatures() const; - void setShowFunctionSignatures(bool showFunctionSignatures); - - bool showDefaultArguments() const; - void setShowDefaultArguments(bool showDefaultArguments); - - bool showTemplateParameters() const; - void setShowTemplateParameters(bool showTemplateParameters); - - // argument index that you want to mark - unsigned markedArgument() const; - void setMarkedArgument(unsigned position); - - int markedArgumentBegin() const; - void setMarkedArgumentBegin(int begin); - - int markedArgumentEnd() const; - void setMarkedArgumentEnd(int end); QString operator()(const Name *name) const { return prettyName(name); } @@ -85,15 +59,15 @@ public: QString prettyType(const FullySpecifiedType &type, const Name *name = 0) const; QString prettyType(const FullySpecifiedType &type, const QString &name) const; -private: - unsigned _markedArgument; - int _markedArgumentBegin; - int _markedArgumentEnd; - bool _showArgumentNames: 1; - bool _showReturnTypes: 1; - bool _showFunctionSignatures: 1; - bool _showDefaultArguments: 1; - bool _showTemplateParameters: 1; +public: + unsigned markedArgument; + int markedArgumentBegin; + int markedArgumentEnd; + bool showArgumentNames: 1; + bool showReturnTypes: 1; + bool showFunctionSignatures: 1; + bool showDefaultArguments: 1; + bool showTemplateParameters: 1; }; } // namespace CPlusPlus diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index 7031c7c7776..dc3e0108f97 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -143,7 +143,7 @@ void TypePrettyPrinter::visit(Namespace *type) void TypePrettyPrinter::visit(Template *type) { if (Symbol *d = type->declaration()) { - if (overview()->showTemplateParameters() && ! _name.isEmpty()) { + if (overview()->showTemplateParameters && ! _name.isEmpty()) { _name += QLatin1Char('<'); for (unsigned index = 0; index < type->templateParameterCount(); ++index) { if (index) @@ -309,13 +309,13 @@ void TypePrettyPrinter::visit(Function *type) } _text.append(QLatin1Char(')')); _needsParens = false; - } else if (! _name.isEmpty() && _overview->showFunctionSignatures()) { + } else if (! _name.isEmpty() && _overview->showFunctionSignatures) { appendSpace(); _text.append(_name); _name.clear(); } - if (_overview->showReturnTypes()) { + if (_overview->showReturnTypes) { const QString returnType = _overview->prettyType(type->returnType()); if (!returnType.isEmpty()) { if (!endsWithPtrOrRef(returnType)) @@ -324,11 +324,11 @@ void TypePrettyPrinter::visit(Function *type) } } - if (_overview->showFunctionSignatures()) { + if (_overview->showFunctionSignatures) { Overview argumentText; - argumentText.setShowReturnTypes(true); - argumentText.setShowArgumentNames(false); - argumentText.setShowFunctionSignatures(true); + argumentText.showReturnTypes = true; + argumentText.showArgumentNames = false; + argumentText.showFunctionSignatures = true; _text += QLatin1Char('('); @@ -337,25 +337,25 @@ void TypePrettyPrinter::visit(Function *type) _text += QLatin1String(", "); if (Argument *arg = type->argumentAt(index)->asArgument()) { - if (index + 1 == _overview->markedArgument()) - const_cast(_overview)->setMarkedArgumentBegin(_text.length()); + if (index + 1 == _overview->markedArgument) + const_cast(_overview)->markedArgumentBegin = _text.length(); const Name *name = 0; - if (_overview->showArgumentNames()) + if (_overview->showArgumentNames) name = arg->name(); _text += argumentText(arg->type(), name); - if (_overview->showDefaultArguments()) { + if (_overview->showDefaultArguments) { if (const StringLiteral *initializer = arg->initializer()) { _text += QLatin1String(" ="); _text += QString::fromUtf8(initializer->chars(), initializer->size()); } } - if (index + 1 == _overview->markedArgument()) - const_cast(_overview)->setMarkedArgumentEnd(_text.length()); + if (index + 1 == _overview->markedArgument) + const_cast(_overview)->markedArgumentEnd = _text.length(); } } diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index d24d4a15e98..3f135251fef 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -334,8 +334,8 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement() m_icon = Icons().iconForSymbol(declaration); Overview overview; - overview.setShowArgumentNames(true); - overview.setShowReturnTypes(true); + overview.showArgumentNames = true; + overview.showReturnTypes = true; m_name = overview.prettyName(declaration->name()); if (declaration->enclosingScope()->isClass() || declaration->enclosingScope()->isNamespace() || @@ -469,10 +469,10 @@ CppFunction::CppFunction(Symbol *declaration) : CppDeclarableElement(declaration // Functions marks can be found either by the main overload or signature based // (with no argument names and no return). Help ids have no signature at all. Overview overview; - overview.setShowDefaultArguments(false); + overview.showDefaultArguments = false; setHelpMark(overview.prettyType(type, name())); - overview.setShowFunctionSignatures(false); + overview.showFunctionSignatures = false; addHelpIdCandidate(overview.prettyName(declaration->name())); } diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index 979706d6f53..d33a6b1a7a7 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -596,10 +596,10 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ return changes; Overview overview; - overview.setShowReturnTypes(true); - overview.setShowTemplateParameters(true); - overview.setShowArgumentNames(true); - overview.setShowFunctionSignatures(true); + overview.showReturnTypes = true; + overview.showTemplateParameters = true; + overview.showArgumentNames = true; + overview.showFunctionSignatures = true; // abort if the name of the newly parsed function is not the expected one DeclaratorIdAST *newDeclId = getDeclaratorId(newDef->declarator); diff --git a/src/plugins/cppeditor/cppinsertdecldef.cpp b/src/plugins/cppeditor/cppinsertdecldef.cpp index 8bcebbbf434..1410520e74e 100644 --- a/src/plugins/cppeditor/cppinsertdecldef.cpp +++ b/src/plugins/cppeditor/cppinsertdecldef.cpp @@ -207,9 +207,9 @@ QList DeclFromDef::match( QString InsertDeclOperation::generateDeclaration(Function *function) { Overview oo; - oo.setShowFunctionSignatures(true); - oo.setShowReturnTypes(true); - oo.setShowArgumentNames(true); + oo.showFunctionSignatures = true; + oo.showReturnTypes = true; + oo.showArgumentNames = true; QString decl; decl += oo(function->type(), function->unqualifiedName()); @@ -247,9 +247,9 @@ public: CppRefactoringFilePtr targetFile = refactoring.file(m_loc.fileName()); Overview oo; - oo.setShowFunctionSignatures(true); - oo.setShowReturnTypes(true); - oo.setShowArgumentNames(true); + oo.showFunctionSignatures = true; + oo.showReturnTypes = true; + oo.showArgumentNames = true; // make target lookup context Document::Ptr targetDoc = targetFile->cppDocument(); diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index 8dd911aac85..78fd3ad9e5f 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -401,14 +401,14 @@ private: QString CppFunctionHintModel::text(int index) const { Overview overview; - overview.setShowReturnTypes(true); - overview.setShowArgumentNames(true); - overview.setMarkedArgument(m_currentArg + 1); + overview.showReturnTypes = true; + overview.showArgumentNames = true; + overview.markedArgument = m_currentArg + 1; Function *f = m_functionSymbols.at(index); - const QString prettyMethod = overview(f->type(), f->name()); - const int begin = overview.markedArgumentBegin(); - const int end = overview.markedArgumentEnd(); + const QString prettyMethod = overview.prettyType(f->type(), f->name()); + const int begin = overview.markedArgumentBegin; + const int end = overview.markedArgumentEnd; QString hintText; hintText += Qt::escape(prettyMethod.left(begin)); @@ -536,8 +536,8 @@ public: : _item(0) , _symbol(0) { - overview.setShowReturnTypes(true); - overview.setShowArgumentNames(true); + overview.showReturnTypes = true; + overview.showArgumentNames = true; } BasicProposalItem *operator()(Symbol *symbol) @@ -1574,9 +1574,9 @@ bool CppCompletionAssistProcessor::completeQtMethod(const QList signatures; foreach (const LookupItem &p, results) { @@ -1882,8 +1882,8 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QListtype(), &env, control);