-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCEFTypes.xsi
61 lines (51 loc) · 2.03 KB
/
CEFTypes.xsi
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
namespace xs {
// automatic default typemap for <CefRefPtr<TYPE>> if typemap for <TYPE> defined
template <class TYPEMAP, class TYPE> struct Typemap<CefRefPtr<TYPEMAP>, CefRefPtr<TYPE>> : Typemap<TYPE*> {
using Super = Typemap<TYPE*>;
static CefRefPtr<TYPE> in (SV* arg) { return CefRefPtr<TYPE>(xs::Typemap<TYPE*>::in(arg)); }
//static CefRefPtr<TYPE> in (SV* arg) { return CefRefPtr<TYPE>(Super::in(arg)); }
static Sv out (const CefRefPtr<TYPE>& var, const Sv& proto = {}) {
return Super::out(var.get(), proto);
}
};
}
namespace xs {
template <class D> struct CefTypemap : TypemapObject<D, D, ObjectTypeRefcntPtr, ObjectStorageMG, StaticCast> {
};
template <class D> struct CefStructTypemap : TypemapObject<D, D, ObjectTypePtr, ObjectStorageMG, StaticCast> {
};
}
void refcnt_inc(CefBaseRefCounted* param) { param->AddRef(); }
void refcnt_dec(CefBaseRefCounted* param) { param->Release(); }
std::uint32_t refcnt_get(CefBaseRefCounted* param) {
if( ! param->HasAtLeastOneRef() ) {
return 0;
}
return param->HasOneRef() ? 1 : 2;
}
//struct Typemap< _TYPE *, _TYPE *> : CefTypemap< _TYPE *> { \
//struct Typemap< _TYPE *, _TYPE *> : TypemapObject<D, D, ObjectTypeRefcntPtr, ObjectStorageMG, StaticCast> { \
#define CEF_XS_TYPEMAP(_TYPE, _PACKAGE) \
namespace xs { \
template <> \
struct Typemap< _TYPE *> : TypemapObject<_TYPE*, _TYPE*, ObjectTypeRefcntPtr, ObjectStorageMG, StaticCast> { \
static std::string package () { return _PACKAGE; } \
}; \
}
#define CEF_XS_STRUCT_TYPEMAP(_TYPE, _PACKAGE) \
namespace xs { \
template <> \
struct Typemap< _TYPE *> : TypemapObject<_TYPE*, _TYPE*, ObjectTypePtr, ObjectStorageMG, StaticCast> { \
static std::string package () { return _PACKAGE; } \
}; \
}
#if defined(OS_WIN)
typedef long long int window_id_t;
typedef HWND window_id_internal_t;
#elif defined(OS_MACOSX)
typedef long unsigned int window_id_t;
typedef void* window_id_internal_t; // NSView*
#elif defined(OS_LINUX)
typedef long unsigned int window_id_t;
typedef long unsigned int window_id_internal_t;
#endif