aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2014-05-29 23:12:04 +0300
committerOrgad Shaneh <orgads@gmail.com>2014-06-02 23:48:14 +0200
commit04e8b332bb4a478b5d9ab83b70c3982af3b85be3 (patch)
tree39fbaecc88b913a182f76bbf72e6fb14f95278df /src/plugins
parentc5012f258c87a66207b50c683a3a8dc13e199bd3 (diff)
Unify Utils::ChangeSet usages
* Remove using Utils::ChangeSet from header files * Remove unused typedef for Range * Add it only in source files that contain many occurrences Change-Id: I60a8b77e2d5a46431507f53b6d60186d511ccf30 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/cppeditor/cppfunctiondecldeflink.cpp2
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp7
-rw-r--r--src/plugins/cpptools/cpppointerdeclarationformatter.cpp6
-rw-r--r--src/plugins/cpptools/cpppointerdeclarationformatter.h7
-rw-r--r--src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp6
-rw-r--r--src/plugins/cpptools/cpprefactoringchanges.cpp9
-rw-r--r--src/plugins/texteditor/basetexteditor.h1
7 files changed, 15 insertions, 23 deletions
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
index e70cec8213..9fa4bc030a 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
@@ -298,7 +298,7 @@ void FunctionDeclDefLink::apply(CPPEditorWidget *editor, bool jumpToMatch)
const int targetStart = newTargetFile->position(targetLine, targetColumn);
const int targetEnd = targetStart + targetInitial.size();
if (targetInitial == newTargetFile->textOf(targetStart, targetEnd)) {
- const ChangeSet changeset = changes(snapshot, targetStart);
+ const Utils::ChangeSet changeset = changes(snapshot, targetStart);
newTargetFile->setChangeSet(changeset);
if (jumpToMatch) {
const int jumpTarget = newTargetFile->position(targetFunction->line(), targetFunction->column());
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index 0cc5aefda7..f7dc95f81c 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -71,6 +71,7 @@ using namespace CppEditor;
using namespace CppEditor::Internal;
using namespace CppTools;
using namespace TextEditor;
+using Utils::ChangeSet;
void CppEditor::Internal::registerQuickFixes(ExtensionSystem::IPlugin *plugIn)
{
@@ -4216,7 +4217,7 @@ public:
toFile->apply();
// remove definition from fromFile
- Utils::ChangeSet headerTarget;
+ ChangeSet headerTarget;
if (m_type == MoveOutsideMemberToCppFile) {
headerTarget.remove(fromFile->range(m_funcDef));
} else {
@@ -4330,7 +4331,7 @@ public:
fromFile->endOf(m_funcAST->function_body));
// Replace declaration with function and delete old definition
- Utils::ChangeSet toTarget;
+ ChangeSet toTarget;
toTarget.replace(m_toRange, wholeFunctionText);
if (m_toFileName == m_fromFileName)
toTarget.remove(fromRange);
@@ -4339,7 +4340,7 @@ public:
toFile->setOpenEditor(true, m_toRange.start);
toFile->apply();
if (m_toFileName != m_fromFileName) {
- Utils::ChangeSet fromTarget;
+ ChangeSet fromTarget;
fromTarget.remove(fromRange);
fromFile->setChangeSet(fromTarget);
fromFile->apply();
diff --git a/src/plugins/cpptools/cpppointerdeclarationformatter.cpp b/src/plugins/cpptools/cpppointerdeclarationformatter.cpp
index ed5dd40266..2c2aae2380 100644
--- a/src/plugins/cpptools/cpppointerdeclarationformatter.cpp
+++ b/src/plugins/cpptools/cpppointerdeclarationformatter.cpp
@@ -382,8 +382,8 @@ void PointerDeclarationFormatter::checkAndRewrite(DeclaratorAST *declarator,
for (unsigned token = tokenRange.start; token <= tokenRange.end; ++token)
CHECK_R(!tokenAt(token).expanded(), "Token is expanded");
- Range range(m_cppRefactoringFile->startOf(tokenRange.start),
- m_cppRefactoringFile->endOf(tokenRange.end));
+ Utils::ChangeSet::Range range(m_cppRefactoringFile->startOf(tokenRange.start),
+ m_cppRefactoringFile->endOf(tokenRange.end));
CHECK_R(range.start >= 0 && range.end > 0, "ChangeRange invalid1");
CHECK_R(range.start < range.end, "ChangeRange invalid2");
@@ -446,7 +446,7 @@ void PointerDeclarationFormatter::checkAndRewrite(DeclaratorAST *declarator,
// original source. It tries to create an replacement operation
// at this position and fails due to overlapping ranges (the
// simple declaration range includes parameter declaration range).
- ChangeSet change(m_changeSet);
+ Utils::ChangeSet change(m_changeSet);
if (change.replace(range, rewrittenDeclaration))
m_changeSet = change;
else if (DEBUG_OUTPUT)
diff --git a/src/plugins/cpptools/cpppointerdeclarationformatter.h b/src/plugins/cpptools/cpppointerdeclarationformatter.h
index 4fc15b659c..02b5d5c83c 100644
--- a/src/plugins/cpptools/cpppointerdeclarationformatter.h
+++ b/src/plugins/cpptools/cpppointerdeclarationformatter.h
@@ -39,9 +39,6 @@ namespace CppTools {
using namespace CPlusPlus;
using namespace CppTools;
-using Utils::ChangeSet;
-
-typedef Utils::ChangeSet::Range Range;
/*!
\class CppTools::PointerDeclarationFormatter
@@ -85,7 +82,7 @@ public:
Returns a ChangeSet for applying the formatting changes.
The ChangeSet is empty if it was not possible to rewrite anything.
*/
- ChangeSet format(AST *ast)
+ Utils::ChangeSet format(AST *ast)
{
if (ast)
accept(ast);
@@ -119,7 +116,7 @@ private:
Overview &m_overview;
const CursorHandling m_cursorHandling;
- ChangeSet m_changeSet;
+ Utils::ChangeSet m_changeSet;
};
} // namespace CppTools
diff --git a/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp b/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
index 469173a27a..65f2c8468a 100644
--- a/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
+++ b/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
@@ -48,14 +48,10 @@ using namespace CPlusPlus;
using namespace CppTools;
using namespace CppTools::Internal;
-using Utils::ChangeSet;
-
Q_DECLARE_METATYPE(Overview)
namespace {
-typedef Utils::ChangeSet::Range Range;
-
QString stripCursor(const QString &source)
{
QString copy(source);
@@ -127,7 +123,7 @@ public:
// Run the formatter
PointerDeclarationFormatter formatter(cppRefactoringFile, overview, cursorHandling);
- ChangeSet change = formatter.format(ast); // ChangeSet may be empty.
+ Utils::ChangeSet change = formatter.format(ast); // ChangeSet may be empty.
// Apply change
QTextCursor changeCursor(textDocument);
diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp
index a44bdadb2e..a07d7a404c 100644
--- a/src/plugins/cpptools/cpprefactoringchanges.cpp
+++ b/src/plugins/cpptools/cpprefactoringchanges.cpp
@@ -38,7 +38,6 @@
using namespace CPlusPlus;
using namespace CppTools;
-using namespace Utils;
class CppTools::CppRefactoringChangesData : public TextEditor::RefactoringChangesData
{
@@ -195,18 +194,18 @@ bool CppRefactoringFile::isCursorOn(const AST *ast) const
return false;
}
-ChangeSet::Range CppRefactoringFile::range(unsigned tokenIndex) const
+Utils::ChangeSet::Range CppRefactoringFile::range(unsigned tokenIndex) const
{
const Token &token = tokenAt(tokenIndex);
unsigned line, column;
cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column);
const int start = document()->findBlockByNumber(line - 1).position() + column - 1;
- return ChangeSet::Range(start, start + token.utf16chars());
+ return Utils::ChangeSet::Range(start, start + token.utf16chars());
}
-ChangeSet::Range CppRefactoringFile::range(AST *ast) const
+Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const
{
- return ChangeSet::Range(startOf(ast), endOf(ast));
+ return Utils::ChangeSet::Range(startOf(ast), endOf(ast));
}
int CppRefactoringFile::startOf(unsigned index) const
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 09838f7d38..5d37e0c3b8 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -48,7 +48,6 @@ QT_END_NAMESPACE
namespace Utils {
class LineColumnLabel;
- class ChangeSet;
}
namespace TextEditor {