Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
e43bd82a
Commit
e43bd82a
authored
Nov 24, 2009
by
Roberto Raggi
Browse files
Renamed TextWriter to ChangeSet
parent
735f307c
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/
textwriter
.cpp
→
src/libs/utils/
changeset
.cpp
View file @
e43bd82a
...
...
@@ -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
();
...
...
src/libs/utils/
textwriter
.h
→
src/libs/utils/
changeset
.h
View file @
e43bd82a
...
...
@@ -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
src/libs/utils/utils.pro
View file @
e43bd82a
...
...
@@ -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
\
...
...
src/plugins/cppeditor/cppquickfix.h
View file @
e43bd82a
...
...
@@ -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
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment