diff --git a/src/libs/utils/textwriter.cpp b/src/libs/utils/changeset.cpp similarity index 91% rename from src/libs/utils/textwriter.cpp rename to src/libs/utils/changeset.cpp index 6753acfda44752d73afd6e9fc7737c686f0c4e60..32be3cf15bc7bdbc774b11892d2d2ccd8d923121 100644 --- a/src/libs/utils/textwriter.cpp +++ b/src/libs/utils/changeset.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "textwriter.h" +#include "changeset.h" namespace Utils { -TextWriter::TextWriter() +ChangeSet::ChangeSet() :string(0), cursor(0) { } @@ -53,7 +53,7 @@ static bool overlaps(int posA, int lengthA, int posB, int lengthB) { || (posA < posB && posA + lengthA > posB); } -bool TextWriter::hasOverlap(int pos, int length) +bool ChangeSet::hasOverlap(int pos, int length) { { QListIterator<Replace> i(replaceList); @@ -74,7 +74,7 @@ bool TextWriter::hasOverlap(int pos, int length) } } -bool TextWriter::hasMoveInto(int pos, int length) +bool ChangeSet::hasMoveInto(int pos, int length) { QListIterator<Move> i(moveList); while (i.hasNext()) { @@ -85,7 +85,7 @@ bool TextWriter::hasMoveInto(int pos, int length) return false; } -void TextWriter::replace(int pos, int length, const QString &replacement) +void ChangeSet::replace(int pos, int length, const QString &replacement) { Q_ASSERT(!hasOverlap(pos, length)); Q_ASSERT(!hasMoveInto(pos, length)); @@ -97,7 +97,7 @@ void TextWriter::replace(int pos, int length, const QString &replacement) replaceList += cmd; } -void TextWriter::move(int pos, int length, int to) +void ChangeSet::move(int pos, int length, int to) { Q_ASSERT(!hasOverlap(pos, length)); @@ -108,7 +108,7 @@ void TextWriter::move(int pos, int length, int to) moveList += cmd; } -void TextWriter::doReplace(const Replace &replace) +void ChangeSet::doReplace(const Replace &replace) { int diff = replace.replacement.size() - replace.length; { @@ -144,7 +144,7 @@ void TextWriter::doReplace(const Replace &replace) } } -void TextWriter::doMove(const Move &move) +void ChangeSet::doMove(const Move &move) { QString text; if (string) { @@ -174,21 +174,21 @@ void TextWriter::doMove(const Move &move) } } -void TextWriter::write(QString *s) +void ChangeSet::write(QString *s) { string = s; write_helper(); string = 0; } -void TextWriter::write(QTextCursor *textCursor) +void ChangeSet::write(QTextCursor *textCursor) { cursor = textCursor; write_helper(); cursor = 0; } -void TextWriter::write_helper() +void ChangeSet::write_helper() { if (cursor) cursor->beginEditBlock(); diff --git a/src/libs/utils/textwriter.h b/src/libs/utils/changeset.h similarity index 89% rename from src/libs/utils/textwriter.h rename to src/libs/utils/changeset.h index 4b3df22ad603e9ca36ffc712e60e185562d9202a..ba86cf2253c60ddde91b1c343209e5ed569f7285 100644 --- a/src/libs/utils/textwriter.h +++ b/src/libs/utils/changeset.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef TEXTWRITER_H -#define TEXTWRITER_H +#ifndef CHANGESET_H +#define CHANGESET_H #include "utils_global.h" @@ -50,23 +50,23 @@ namespace Utils { -class QTCREATOR_UTILS_EXPORT TextWriter +class QTCREATOR_UTILS_EXPORT ChangeSet { QString *string; QTextCursor *cursor; struct Replace { - int pos; - int length; - QString replacement; + int pos; + int length; + QString replacement; }; QList<Replace> replaceList; struct Move { - int pos; - int length; - int to; + int pos; + int length; + int to; }; QList<Move> moveList; @@ -80,7 +80,7 @@ class QTCREATOR_UTILS_EXPORT TextWriter void write_helper(); public: - TextWriter(); + ChangeSet(); void replace(int pos, int length, const QString &replacement); void move(int pos, int length, int to); @@ -91,4 +91,4 @@ public: } // namespace Utils -#endif // TEXTWRITER_H +#endif // CHANGESET_H diff --git a/src/libs/utils/utils.pro b/src/libs/utils/utils.pro index b5d797c8e336e2442a7900d9366b43deaa6b241d..e48e240b5d7302d4482666ad393b09f8571fb045 100644 --- a/src/libs/utils/utils.pro +++ b/src/libs/utils/utils.pro @@ -37,7 +37,7 @@ SOURCES += reloadpromptutils.cpp \ fancymainwindow.cpp \ detailsbutton.cpp \ detailswidget.cpp \ - textwriter.cpp + changeset.cpp win32 { SOURCES += abstractprocess_win.cpp \ consoleprocess_win.cpp \ @@ -82,7 +82,7 @@ HEADERS += utils_global.h \ fancymainwindow.h \ detailsbutton.h \ detailswidget.h \ - textwriter.h + changeset.h FORMS += filewizardpage.ui \ projectintropage.ui \ newclasswidget.ui \ diff --git a/src/plugins/cppeditor/cppquickfix.h b/src/plugins/cppeditor/cppquickfix.h index 41377fae511ccea138e25aa89332b62fb4424223..66e43254f14e1c34ba19c3e3af4a6acbfc3a5c93 100644 --- a/src/plugins/cppeditor/cppquickfix.h +++ b/src/plugins/cppeditor/cppquickfix.h @@ -35,7 +35,7 @@ #include <cplusplus/CppDocument.h> #include <ASTfwd.h> -#include <utils/textwriter.h> +#include <utils/changeset.h> #include <QtCore/QSharedPointer> #include <QtGui/QTextCursor> @@ -114,7 +114,7 @@ private: CPlusPlus::Document::Ptr _doc; CPlusPlus::Snapshot _snapshot; QTextCursor _textCursor; - Utils::TextWriter _textWriter; + Utils::ChangeSet _textWriter; CPPEditor *_editor; };