-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathqtimer_implement.h
More file actions
43 lines (42 loc) · 1.34 KB
/
Copy pathqtimer_implement.h
File metadata and controls
43 lines (42 loc) · 1.34 KB
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
#pragma once
#include "framework.h"
#include <qtimer.h>
#include "qtimer_p.h"
#include "qtimer_wrapper.h"
namespace shelllet {
namespace core {
class Timer : public QTimerWrapper<QTimer, Timer, true>
{
public:
using ReturnType = QTimerPrivate<QTimer, true>;
using ReturnType2 = QTimerPrivate<QTimer, false>;
ReturnType* Private(const v8::FunctionCallbackInfo<v8::Value>& args) {
return new ReturnType(args.GetIsolate(), args.This());
}
Timer(const v8::FunctionCallbackInfo<v8::Value>& args) :QTimerWrapper(*Private(args), args)
{
}
Timer(QTimer* p, const v8::FunctionCallbackInfo<v8::Value>& args) :QTimerWrapper(*new ReturnType2(args.GetIsolate(), args.This(), p), args)
{
}
Timer(v8::Isolate* isolate, const v8::Local<v8::FunctionTemplate>& tpl) : QTimerWrapper(isolate, tpl) {
tpl->Set(isolate, "singleShot", v8::FunctionTemplate::New(isolate, SingleShot));
}
Timer(v8::Isolate* isolate, const v8::Local<v8::ObjectTemplate>& proto) : QTimerWrapper(isolate, proto)
{
}
public:
static const char* Name() { return "Timer"; }
protected:
void toString(std::stringstream& ss) const {}
protected:
static void SingleShot(const v8::FunctionCallbackInfo<v8::Value>& args)
{
V8_CREATE_LOCAL_CONTEXT_WITHOUT_LOCKER_BY_CALLBACK_INFO(args)
{
}
V8_CREATE_LOCAL_CONTEXT_END
}
};
}
}