forked from qt-creator/qt-creator
TextEditor: Split the global QuickFixFactory list
It's only ever used in the filtered Cpp/QmlJs variants. Splitting the class simplifies the code and avoids re-doing filtering over and over again. Also inline QuickFixFactory::matchingOperations() into callers Change-Id: I730756315f2e0321649259ef229631233b12fbdd Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -42,20 +42,34 @@ public:
|
||||
~CppQuickFixOperation();
|
||||
};
|
||||
|
||||
class CPPEDITOR_EXPORT CppQuickFixFactory: public TextEditor::QuickFixFactory
|
||||
/*!
|
||||
The QuickFixFactory is responsible for generating QuickFixOperation s which are
|
||||
applicable to the given QuickFixState.
|
||||
|
||||
A QuickFixFactory should not have any state -- it can be invoked multiple times
|
||||
for different QuickFixState objects to create the matching operations, before any
|
||||
of those operations are applied (or released).
|
||||
|
||||
This way, a single factory can be used by multiple editors, and a single editor
|
||||
can have multiple QuickFixCollector objects for different parts of the code.
|
||||
*/
|
||||
|
||||
class CPPEDITOR_EXPORT CppQuickFixFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void matchingOperations(const TextEditor::QuickFixInterface &interface,
|
||||
TextEditor::QuickFixOperations &result);
|
||||
CppQuickFixFactory();
|
||||
~CppQuickFixFactory();
|
||||
|
||||
/*!
|
||||
Implement this function to match and create the appropriate
|
||||
CppQuickFixOperation objects.
|
||||
*/
|
||||
virtual void match(const Internal::CppQuickFixInterface &interface,
|
||||
TextEditor::QuickFixOperations &result) = 0;
|
||||
TextEditor::QuickFixOperations &result) = 0;
|
||||
|
||||
static const QList<CppQuickFixFactory *> &cppQuickFixFactories();
|
||||
};
|
||||
|
||||
} // namespace CppEditor
|
||||
|
||||
Reference in New Issue
Block a user