diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2019-01-14 01:40:53 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2019-01-21 09:00:18 +0000 |
commit | 1d3d18a96988eb091b207103f18c9fbba505013a (patch) | |
tree | ea96a5524d5dbda96447455a9152484e54ea6e3b /src/plugins/cpptools/cppselectionchanger.cpp | |
parent | 845af928896ba1ef1bb7259766913ea7f4c35cd9 (diff) | |
download | qt-creator-1d3d18a96988eb091b207103f18c9fbba505013a.tar.gz |
CppTools: modernize
Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/cpptools/cppselectionchanger.cpp')
-rw-r--r-- | src/plugins/cpptools/cppselectionchanger.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/plugins/cpptools/cppselectionchanger.cpp b/src/plugins/cpptools/cppselectionchanger.cpp index 59ac0a1634..e19c1711a6 100644 --- a/src/plugins/cpptools/cppselectionchanger.cpp +++ b/src/plugins/cpptools/cppselectionchanger.cpp @@ -51,14 +51,8 @@ using namespace CppTools::Internal; CppSelectionChanger::CppSelectionChanger(QObject *parent) : QObject(parent) - , m_initialChangeSelectionCursor() - , m_workingCursor() - , m_doc(0) - , m_unit(0) - , m_direction(ExpandSelection) , m_changeSelectionNodeIndex(kChangeSelectionNodeIndexNotSet) , m_nodeCurrentStep(kChangeSelectionNodeIndexNotSet) - , m_inChangeSelection(false) { } @@ -337,7 +331,7 @@ ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursor( } ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorWhenNodeIndexNotSet( - const QList<AST *> astPath, + const QList<AST *> &astPath, const QTextCursor &cursor) { // Find relevant AST node from cursor, when the user expands for the first time. @@ -345,19 +339,18 @@ ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorWhenNode } ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorWhenWholeDocumentSelected( - const QList<AST *> astPath, + const QList<AST *> &astPath, const QTextCursor &cursor) { // Can't expand more, because whole document is selected. if (m_direction == ExpandSelection) - return 0; + return {}; // In case of shrink, select the next smaller selection. return findRelevantASTPositionsFromCursor(astPath, cursor); } -ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorFromPreviousNodeIndex( - const QList<AST *> astPath, +ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorFromPreviousNodeIndex(const QList<AST *> &astPath, const QTextCursor &cursor) { ASTNodePositions nodePositions; @@ -377,13 +370,13 @@ ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorFromPrev if (newAstIndex < 0 || newAstIndex >= astPath.count()) { if (debug) qDebug() << "Skipping expansion because there is no available next AST node."; - return 0; + return {}; } // Switch to next AST and set the first step. nodePositions = findRelevantASTPositionsFromCursor(astPath, cursor, newAstIndex); if (!nodePositions) - return 0; + return {}; if (debug) qDebug() << "Moved to next AST node."; @@ -419,7 +412,7 @@ ASTNodePositions CppSelectionChanger::findNextASTStepPositions(const QTextCursor #endif if (astPath.size() == 0) - return 0; + return {}; ASTNodePositions currentNodePositions; if (m_changeSelectionNodeIndex == kChangeSelectionNodeIndexNotSet) { @@ -439,7 +432,7 @@ ASTNodePositions CppSelectionChanger::findNextASTStepPositions(const QTextCursor << "current step:" << m_nodeCurrentStep; } - QTC_ASSERT(m_nodeCurrentStep >= 1, return 0); + QTC_ASSERT(m_nodeCurrentStep >= 1, return {}); return currentNodePositions; } |