-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathcommand.h
41 lines (32 loc) · 873 Bytes
/
command.h
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
32
33
34
35
36
37
38
39
40
41
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef COMMAND
#define COMMAND
#include <QRunnable>
class CommandService;
class CommandMessage;
class Extractor;
class Command : public QRunnable
{
public:
enum State {
Preparing,
Running
};
Command(CommandService *service = nullptr);
virtual QList<CommandMessage *> doExecute(CommandMessage *) = 0;
virtual QString name() const = 0;
void exit();
State state() const;
CommandService *service() const;
void installMessageExtractor(Extractor *extractor);
private:
void run() override;
Extractor * m_inEx = nullptr;
Extractor * m_outEx = nullptr;
bool m_isExit = false;
State m_state = Preparing;
CommandService *m_service = nullptr;
};
#endif // COMMANDMESSAGE