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
27f6b2ce
Commit
27f6b2ce
authored
Jun 22, 2010
by
Roberto Raggi
Browse files
Renamed CppRefactoringChanges::parsedDocumentForFile().
parent
eb749ec3
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppquickfix.cpp
View file @
27f6b2ce
...
...
@@ -933,8 +933,7 @@ int CppQuickFixOperation::match(TextEditor::QuickFixState *state)
_document
=
s
->
info
.
doc
;
if
(
_refactoringChanges
)
delete
_refactoringChanges
;
CPPEditor
*
cppEditor
=
qobject_cast
<
CPPEditor
*>
(
editor
());
_refactoringChanges
=
new
CppRefactoringChanges
(
s
->
info
.
snapshot
,
cppEditor
->
modelManager
());
_refactoringChanges
=
new
CppRefactoringChanges
(
s
->
info
.
snapshot
);
return
match
(
s
->
path
);
}
...
...
src/plugins/cppeditor/cpprefactoringchanges.cpp
View file @
27f6b2ce
...
...
@@ -34,13 +34,12 @@ using namespace CppTools;
using
namespace
TextEditor
;
using
namespace
CppEditor
;
CppRefactoringChanges
::
CppRefactoringChanges
(
const
Snapshot
&
snapshot
,
CppModelManagerInterface
*
modelManager
)
CppRefactoringChanges
::
CppRefactoringChanges
(
const
Snapshot
&
snapshot
)
:
m_snapshot
(
snapshot
)
,
m_modelManager
(
modelManager
)
,
m_workingCopy
(
modelManager
->
workingCopy
())
,
m_modelManager
(
CppTools
::
CppModelManagerInterface
::
instance
())
{
Q_ASSERT
(
modelManager
);
Q_ASSERT
(
m_modelManager
);
m_workingCopy
=
m_modelManager
->
workingCopy
();
}
QStringList
CppRefactoringChanges
::
apply
()
...
...
@@ -50,17 +49,14 @@ QStringList CppRefactoringChanges::apply()
return
changedFiles
;
}
Document
::
Ptr
CppRefactoringChanges
::
parsedDocumentForFile
(
const
QString
&
fileName
)
const
Document
::
Ptr
CppRefactoringChanges
::
document
(
const
QString
&
fileName
)
const
{
Document
::
Ptr
doc
=
m_snapshot
.
document
(
fileName
);
QString
source
;
unsigned
editorRevision
=
0
;
if
(
m_workingCopy
.
contains
(
fileName
))
{
QPair
<
QString
,
unsigned
>
workingCopy
=
m_workingCopy
.
get
(
fileName
);
if
(
doc
&&
doc
->
editorRevision
()
==
workingCopy
.
second
)
return
doc
;
else
source
=
workingCopy
.
first
;
const
QPair
<
QString
,
unsigned
>
workingCopy
=
m_workingCopy
.
get
(
fileName
);
source
=
workingCopy
.
first
;
editorRevision
=
workingCopy
.
second
;
}
else
{
QFile
file
(
fileName
);
if
(
!
file
.
open
(
QFile
::
ReadOnly
))
...
...
@@ -71,7 +67,8 @@ Document::Ptr CppRefactoringChanges::parsedDocumentForFile(const QString &fileNa
}
const
QByteArray
contents
=
m_snapshot
.
preprocessedCode
(
source
,
fileName
);
doc
=
m_snapshot
.
documentFromSource
(
contents
,
fileName
);
Document
::
Ptr
doc
=
m_snapshot
.
documentFromSource
(
contents
,
fileName
);
doc
->
setEditorRevision
(
editorRevision
);
doc
->
check
();
return
doc
;
}
src/plugins/cppeditor/cpprefactoringchanges.h
View file @
27f6b2ce
...
...
@@ -42,14 +42,14 @@ namespace CppEditor {
class
CPPEDITOR_EXPORT
CppRefactoringChanges
:
public
TextEditor
::
RefactoringChanges
{
public:
CppRefactoringChanges
(
const
CPlusPlus
::
Snapshot
&
snapshot
,
CppTools
::
CppModelManagerInterface
*
modelManager
);
CppRefactoringChanges
(
const
CPlusPlus
::
Snapshot
&
snapshot
);
virtual
QStringList
apply
();
const
CPlusPlus
::
Snapshot
&
snapshot
()
const
{
return
m_snapshot
;
}
CPlusPlus
::
Document
::
Ptr
parsedDocumentForFile
(
const
QString
&
fileName
)
const
;
CPlusPlus
::
Document
::
Ptr
document
(
const
QString
&
fileName
)
const
;
private:
CPlusPlus
::
Snapshot
m_snapshot
;
...
...
src/plugins/texteditor/refactoringchanges.cpp
View file @
27f6b2ce
...
...
@@ -103,7 +103,7 @@ QStringList RefactoringChanges::apply()
}
QTextCursor
changeSetCursor
=
editor
->
textCursor
();
Utils
::
ChangeSet
changeSet
=
m_changesByFile
[
fileName
]
;
Utils
::
ChangeSet
changeSet
=
m_changesByFile
.
value
(
fileName
)
;
changeSet
.
apply
(
&
changeSetCursor
);
foreach
(
const
CursorPair
&
cursorPair
,
cursorPairs
)
{
...
...
src/plugins/texteditor/refactoringchanges.h
View file @
27f6b2ce
...
...
@@ -57,7 +57,7 @@ public:
virtual
QStringList
apply
();
int
positionInFile
(
const
QString
&
fileName
,
int
line
,
int
column
=
0
)
const
;
Q_DECL_DEPRECATED
int
positionInFile
(
const
QString
&
fileName
,
int
line
,
int
column
=
0
)
const
;
static
BaseTextEditor
*
editorForFile
(
const
QString
&
fileName
,
bool
openIfClosed
=
false
);
...
...
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