-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathqvariant.i
146 lines (115 loc) · 3.58 KB
/
qvariant.i
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
class QVariant {
public:
QVariant();
QVariant(int);
QVariant(const char *);
QVariant(bool);
int toInt() const;
QString toString() const;
QStringList toStringList() const;
bool toBool() const;
};
%extend QVariant {
void setValue(int value) {
$self->setValue(QVariant::fromValue(value));
}
void setValue(DamageStruct *damage) {
$self->setValue(QVariant::fromValue(*damage));
}
DamageStruct toDamage() const{
return $self->value<DamageStruct>();
}
void setValue(CardEffectStruct *effect) {
$self->setValue(QVariant::fromValue(*effect));
}
CardEffectStruct toCardEffect() const{
return $self->value<CardEffectStruct>();
}
void setValue(SlashEffectStruct *effect) {
$self->setValue(QVariant::fromValue(*effect));
}
SlashEffectStruct toSlashEffect() const{
return $self->value<SlashEffectStruct>();
}
void setValue(CardUseStruct *use) {
$self->setValue(QVariant::fromValue(*use));
}
CardUseStruct toCardUse() const{
return $self->value<CardUseStruct>();
}
void setValue(const Card *card) {
$self->setValue(QVariant::fromValue(card));
}
const Card *toCard() const{
return $self->value<const Card *>();
}
void setValue(ServerPlayer *player) {
$self->setValue(QVariant::fromValue(player));
}
ServerPlayer *toPlayer() const{
return $self->value<ServerPlayer *>();
}
void setValue(DyingStruct *dying) {
$self->setValue(QVariant::fromValue(*dying));
}
DyingStruct toDying() const{
return $self->value<DyingStruct>();
}
void setValue(DeathStruct *death) {
$self->setValue(QVariant::fromValue(*death));
}
DeathStruct toDeath() const{
return $self->value<DeathStruct>();
}
void setValue(RecoverStruct *recover) {
$self->setValue(QVariant::fromValue(*recover));
}
RecoverStruct toRecover() const{
return $self->value<RecoverStruct>();
}
void setValue(JudgeStruct *judge) {
$self->setValue(QVariant::fromValue(judge));
}
JudgeStruct *toJudge() const{
return $self->value<JudgeStruct *>();
}
void setValue(PindianStruct *pindian) {
$self->setValue(QVariant::fromValue(pindian));
}
PindianStruct *toPindian() const{
return $self->value<PindianStruct *>();
}
void setValue(PhaseChangeStruct *phase) {
$self->setValue(QVariant::fromValue(*phase));
}
PhaseChangeStruct toPhaseChange() const{
return $self->value<PhaseChangeStruct>();
}
void setValue(CardsMoveOneTimeStruct *move) {
$self->setValue(QVariant::fromValue(*move));
}
CardsMoveOneTimeStruct toMoveOneTime() const{
return $self->value<CardsMoveOneTimeStruct>();
}
void setValue(CardResponseStruct *resp) {
$self->setValue(QVariant::fromValue(*resp));
}
CardResponseStruct toCardResponse() const{
return $self->value<CardResponseStruct>();
}
void setValue(QList<int> intlist) {
QVariantList varlist;
for (int i = 0; i < intlist.length(); i++)
varlist.append(QVariant::fromValue(intlist.at(i)));
$self->setValue(QVariant::fromValue(varlist));
}
QList<int> toIntList() const{
QList<int> result;
if ($self->canConvert<QVariantList>()) {
QVariantList res_var = $self->toList();
for (int i = 0; i < res_var.length(); i++)
result.append(res_var.at(i).toInt());
}
return result;
}
};