-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.h
50 lines (40 loc) · 1.58 KB
/
cmd.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
// ----------------CLASS DEFINATION OF COMMANDS WE SAVE-----------------------
#ifndef CMD_H
#define CMD_H
#include <QString>
#include <QDataStream>
class cmd
{
public:
int num;
int type;
bool fields;
QString name;
QString cmdstr;
cmd(int n=0, QString nam="", QString postcm="",int type2 = 0)
{
num = n;
name = nam;
cmdstr = postcm;
type = type2;
fields = true;
}
friend QDataStream &operator<<(QDataStream &out, const cmd &command)
{
out << int(command.num) << command.name
<< command.cmdstr << int(command.type) << bool(command.fields);
return out;
}
friend QDataStream &operator>>(QDataStream &in, cmd &command)
{
QString name;
QString postcmd;
int type;
int num;
bool fields;
in >> num >> name >> postcmd >> type >> fields;
command = cmd(num,name,postcmd,type);
return in;
}
};
#endif // CMD_H