This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnums.h
70 lines (59 loc) · 1.48 KB
/
Enums.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
63
64
65
66
67
68
69
70
#ifndef ENUMS_H
#define ENUMS_H
#include <QMetaType>
#include <QString>
enum class MemberType {
Data,
Function
};
enum class Accessibility {
Public,
Private,
Protected
};
enum class DataType {
Int,
Float,
Double,
Char,
String,
Custom // 用于表示自定义的数据类型
};
enum class UserType {
Admin,
User,
Invalid
};
Q_DECLARE_METATYPE(MemberType)
Q_DECLARE_METATYPE(Accessibility)
Q_DECLARE_METATYPE(DataType)
// 返回MemberType的字符串表示
inline QString memberTypeToString(MemberType type) {
switch (type) {
case MemberType::Data: return "Data";
case MemberType::Function: return "Function";
default: return "Unknown";
}
}
// 返回Accessibility的字符串表示
inline QString accessibilityToString(Accessibility access) {
switch (access) {
case Accessibility::Public: return "Public";
case Accessibility::Private: return "Private";
case Accessibility::Protected: return "Protected";
default: return "Unknown";
}
}
// 返回DataType的字符串表示
inline QString dataTypeToString(DataType type) {
switch (type) {
case DataType::Int: return "Int";
case DataType::Float: return "Float";
case DataType::Double: return "Double";
case DataType::Char: return "Char";
case DataType::String: return "String";
case DataType::Custom: return "Custom";
default: return "Unknown";
}
}
#endif // ENUMS_H