-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.h
42 lines (24 loc) · 864 Bytes
/
utils.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
#ifndef UTILS_H
#define UTILS_H
#include <ruby.h>
#include "qtobjectmanager.h"
#define SAVE_CI0(value) Qom::inst()->objs[self] = (QObject*)value
#define SAVE_CI2(type, value) Qom::inst()->objs[self] = (QObject*)value
// ci == cpp instance
#define GET_CI2(type) type *ci = (type*)Qom::inst()->objs[self]
#define GET_CI3(type) y##type *ci = (y##type*)Qom::inst()->objs[self]
#define GET_CI0() QObject *ci = (QObject*)Qom::inst()->objs[self]
#define FUNVAL (VALUE (*) (...))
// from src/corelib/kernel/qobjectdefs.h
// # define METHOD(a) "0"#a
// # define SLOT(a) "1"#a
// # define SIGNAL(a) "2"#a
// # define emit // empty
// TODO use
template<typename QtObjectType>
void save_ci(VALUE self) {
QtObjectType *io = new QtObjectType();
Qom::inst()->objs[self] = (QObject*)io;
QMetaObject *mo = io->metaObject();
}
#endif /* UTILS_H */