diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2023-11-17 12:56:27 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-11-20 14:37:37 +0000 |
commit | cf74409bac2dbc58204ef85d1ba13916f76a7093 (patch) | |
tree | 16b0f4f1aaf690138c9cf919b63c08a056a0a26c /src/plugins/texteditor/refactoringchanges.h | |
parent | 78b9edd2510cd54c50d7fa2dc7274c5134b85225 (diff) |
TextEditor: Introduce PlainRefactoringFileFactory
This makes it immediately clear that there are more specialized variants
available, which helps users make a conscious decision.
Change-Id: I35feb4bed2d91fb4f83ede6e731d9ce89fd4af3f
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/refactoringchanges.h')
-rw-r--r-- | src/plugins/texteditor/refactoringchanges.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/plugins/texteditor/refactoringchanges.h b/src/plugins/texteditor/refactoringchanges.h index 43e3524a2d..5d270b2f65 100644 --- a/src/plugins/texteditor/refactoringchanges.h +++ b/src/plugins/texteditor/refactoringchanges.h @@ -20,12 +20,12 @@ class QTextDocument; QT_END_NAMESPACE namespace TextEditor { -class TextDocument; -class TextEditorWidget; +class PlainRefactoringFileFactory; class RefactoringFile; using RefactoringFilePtr = QSharedPointer<RefactoringFile>; -class RefactoringFileFactory; using RefactoringSelections = QVector<QPair<QTextCursor, QTextCursor>>; +class TextDocument; +class TextEditorWidget; // ### listen to the m_editor::destroyed signal? class TEXTEDITOR_EXPORT RefactoringFile @@ -103,17 +103,20 @@ protected: bool m_appliedOnce = false; bool m_formattingEnabled = false; - friend class RefactoringFileFactory; // access to constructor + friend class PlainRefactoringFileFactory; // access to constructor }; class TEXTEDITOR_EXPORT RefactoringFileFactory { public: virtual ~RefactoringFileFactory(); + virtual RefactoringFilePtr file(const Utils::FilePath &filePath) const = 0; +}; - // TODO: Make pure virtual and introduce dedicated subclass for generic refactoring, - // so no one instantiates this one by mistake. - virtual RefactoringFilePtr file(const Utils::FilePath &filePath) const; +class TEXTEDITOR_EXPORT PlainRefactoringFileFactory final : public RefactoringFileFactory +{ +public: + RefactoringFilePtr file(const Utils::FilePath &filePath) const override; }; } // namespace TextEditor |