-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpropmacros.hpp
49 lines (48 loc) · 1.18 KB
/
propmacros.hpp
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
/*
* propmacros.h
*
* Define macros for setting or getting TJS property or object
* Copyright (C) 2018-2019 khjxiaogu
*
* Author: khjxiaogu
* Web: http://www.khjxiaogu.com
*/
#pragma once
#include <windows.h>
#include "tp_stub.h"
#ifndef MACROS
#define MACROS
#define GETSTR(a) tTJSVariant(a).GetString()
#define CONSTRUCTOR Factory(&Class::Factory)
#define NATIVECLASS(a) NCB_REGISTER_CLASS(a)
#define FUNCTION(a) RawCallback(#a, &Class::##a, 0)
template<class T>
T* alloc(int count = 1);
//put object to object
void PutToObject(const wchar_t* name, iTJSDispatch2* data, iTJSDispatch2* inst);
//put object to object by num
void PutToObject(int name, iTJSDispatch2* data, iTJSDispatch2* inst);
template<class T>
void PutToObject(int name, T data, iTJSDispatch2* inst) {
tTJSVariant i(data);
inst->PropSetByNum(
TJS_MEMBERENSURE,
(tjs_int)name,
&i,
inst
);
}
template<class T>
void PutToObject(const wchar_t* name, T data, iTJSDispatch2* inst) {
tTJSVariant i(data);
inst->PropSet(
TJS_MEMBERENSURE,
name,
NULL,
&i,
inst
);
}
tTJSVariant getMember(iTJSDispatch2* dic, const tjs_char* key);
tTJSVariant getMember(iTJSDispatch2* dic, tjs_int key);
#endif