-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.h
62 lines (54 loc) · 1.27 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef COMMAND_H
#define COMMAND_H
#include <QString>
#include <QtNetwork/QTcpSocket>
class AbstractCommand
{
QString message;
public:
AbstractCommand(QString message = "");
virtual ~AbstractCommand();
virtual void run(QTcpSocket*) = 0;
void setMessage(QString);
QString getMessage() const;
};
class SendMessageCommand : public AbstractCommand {
public:
SendMessageCommand(QString message = "");
virtual ~SendMessageCommand();
void run(QTcpSocket*);
};
class LoginCommand : public AbstractCommand {
QString message;
public:
LoginCommand(QString message = "");
virtual ~LoginCommand();
void run(QTcpSocket*);
};
class DrawCommand : public AbstractCommand {
int xRect;
int yRect;
int color;
public:
enum DrawType {
POINT,
LINE
} type;
DrawCommand(DrawCommand::DrawType, int x = 0, int y = 0, int color = 0);
virtual ~DrawCommand();
void run(QTcpSocket*);
};
class ClearCommand : public AbstractCommand {
public:
ClearCommand();
virtual ~ClearCommand();
void run(QTcpSocket *);
};
class WantDrawCommand : public AbstractCommand {
bool wantDraw;
public:
WantDrawCommand(bool want = true);
virtual ~WantDrawCommand();
void run(QTcpSocket *);
};
#endif // COMMAND_H