summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/codeassist/asyncprocessor.h
blob: 9894239af1d96b56fe860b70122152df35d119c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "iassistprocessor.h"

#include <QFutureWatcher>

namespace TextEditor {

class TEXTEDITOR_EXPORT AsyncProcessor : public TextEditor::IAssistProcessor
{
public:
    AsyncProcessor();

    IAssistProposal *perform() final;
    bool running() override;
    void cancel() override;

    virtual IAssistProposal *performAsync() = 0;
    virtual IAssistProposal *immediateProposal();

protected:
    bool isCanceled() const;

private:
    QFutureWatcher<IAssistProposal *> m_watcher;
};

} // namespace TextEditor