TextEditor: Move more code into RefactoringFile

We want to get rid of RefactoringChangesData.

Change-Id: Ia428563a0ff70ec9660761beac3eb7168b8e9eca
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-16 16:09:26 +01:00
parent 4c0abb6d2c
commit 6f3bc431fc
11 changed files with 97 additions and 127 deletions

View File

@@ -51,13 +51,19 @@ public:
using TextEditor::RefactoringFile::textOf;
QString textOf(const CPlusPlus::AST *ast) const;
protected:
private:
CppRefactoringFile(const Utils::FilePath &filePath, const QSharedPointer<TextEditor::RefactoringChangesData> &data);
CppRefactoringFile(QTextDocument *document, const Utils::FilePath &filePath);
explicit CppRefactoringFile(TextEditor::TextEditorWidget *editor);
CppRefactoringChangesData *data() const;
void fileChanged() override;
void indentSelection(const QTextCursor &selection,
const TextEditor::TextDocument *textDocument) const override;
virtual void reindentSelection(const QTextCursor &selection,
const TextEditor::TextDocument *textDocument) const override;
int tokenIndexForPosition(const std::vector<CPlusPlus::Token> &tokens, int pos,
int startIndex) const;
@@ -72,16 +78,6 @@ class CPPEDITOR_EXPORT CppRefactoringChangesData : public TextEditor::Refactorin
public:
explicit CppRefactoringChangesData(const CPlusPlus::Snapshot &snapshot);
void indentSelection(const QTextCursor &selection,
const Utils::FilePath &filePath,
const TextEditor::TextDocument *textDocument) const override;
void reindentSelection(const QTextCursor &selection,
const Utils::FilePath &filePath,
const TextEditor::TextDocument *textDocument) const override;
void fileChanged(const Utils::FilePath &filePath) override;
CPlusPlus::Snapshot m_snapshot;
WorkingCopy m_workingCopy;
};