-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobserver.hpp
More file actions
77 lines (64 loc) · 2.37 KB
/
Copy pathobserver.hpp
File metadata and controls
77 lines (64 loc) · 2.37 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include <vector>
#include <variant>
#include <qregexp.h>
#define cast_int(a) static_cast<int>(a)
#define cast_enum(e, a) static_cast<e>(a)
#define DEFINE_ENUM_FLAGS(ENUMTYPE) \
inline ENUMTYPE operator |(ENUMTYPE a, ENUMTYPE b) { \
return cast_enum(ENUMTYPE, cast_int(a) | cast_int(b)); \
} \
inline ENUMTYPE operator &(ENUMTYPE a, ENUMTYPE b) { \
return cast_enum(ENUMTYPE, cast_int(a) & cast_int(b)); \
} \
inline ENUMTYPE operator ^(ENUMTYPE a, ENUMTYPE b) { \
return cast_enum(ENUMTYPE, cast_int(a) ^ cast_int(b)); \
} \
inline ENUMTYPE operator ~(ENUMTYPE a) { \
return cast_enum(ENUMTYPE, ~cast_int(a)); \
} \
inline ENUMTYPE &operator |=(ENUMTYPE &a, ENUMTYPE b) { a = a | b; return a; } \
inline ENUMTYPE &operator &=(ENUMTYPE &a, ENUMTYPE b) { a = a & b; return a; } \
inline ENUMTYPE &operator ^=(ENUMTYPE &a, ENUMTYPE b) { a = a ^ b; return a; }
enum UserType {
None = 0,
Mod = 1 << 0,
Sub = 1 << 1,
Vip = 1 << 2,
Staff = 1 << 3,
};
DEFINE_ENUM_FLAGS(UserType)
QT_FORWARD_DECLARE_CLASS(ActionHandler)
enum ActionType {
Toggle = 1 << 0,
Hide = 1 << 1,
Show = 1 << 2,
SwitchScene = 1 << 3,
};
struct sceneitems_context_data {
std::vector<std::string> sceneitems;
int rollback_timeout = 0;
};
struct scene_context_data {
std::string scene;
int rollback_timeout = 0;
};
typedef std::variant<
sceneitems_context_data,
scene_context_data
> context_data_t;
struct action_descriptor {
ActionType type;
context_data_t context_data;
std::vector<std::string> users;
std::string expression;
bool ignore_case = true;
bool active = true;
int timeout = 0;
ActionHandler *handler = nullptr;
~action_descriptor();
};
struct observer_settings {
std::string channel;
std::vector<action_descriptor> actions = std::vector<action_descriptor>();
};