This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/doric/engine/v8/JSValueHelper.h

25 lines
647 B
C
Raw Normal View History

2021-03-31 10:36:45 +08:00
#ifndef JSVALUEHELPER_H
#define JSVALUEHELPER_H
2021-04-02 17:23:36 +08:00
#include <QVariant>
2021-03-31 10:36:45 +08:00
#include <string>
2021-04-07 09:43:35 +08:00
#include "v8.h"
2021-03-31 10:36:45 +08:00
#define NewV8String(name) \
v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), name, \
v8::NewStringType::kNormal) \
.ToLocalChecked()
2021-04-02 15:16:18 +08:00
std::string JS2String(v8::Local<v8::Value> object);
2021-03-31 10:36:45 +08:00
2021-04-02 15:16:18 +08:00
double JS2Number(v8::Local<v8::Value> value);
bool JS2Bool(v8::Local<v8::Value> value);
v8::Local<v8::Value> String2JS(std::string string);
2021-03-31 10:36:45 +08:00
2021-04-02 17:23:36 +08:00
v8::Local<v8::Value> Variant2JS(QVariant variant);
2021-03-31 10:36:45 +08:00
#endif // JSVALUEHELPER_H