-
-
Notifications
You must be signed in to change notification settings - Fork 311
Expand file tree
/
Copy pathnutils.h
More file actions
38 lines (31 loc) · 1.2 KB
/
nutils.h
File metadata and controls
38 lines (31 loc) · 1.2 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
#pragma once
#include <napi.h>
#include <QPointer>
#include <QVariant>
#include "Extras/Export/export.h"
#include "core/FlexLayout/flexutils.h"
#include "deps/yoga/YGNode.h"
namespace extrautils {
DLL_EXPORT QVariant* convertToQVariant(Napi::Env& env, Napi::Value& value);
DLL_EXPORT bool isNapiValueInt(Napi::Env& env, Napi::Value& num);
DLL_EXPORT std::string getNapiObjectClassName(Napi::Object& object);
DLL_EXPORT void* configureQWidget(QWidget* widget, bool isLeafNode = false);
DLL_EXPORT void* configureQObject(QObject* object);
DLL_EXPORT void* configureComponent(void* component);
DLL_EXPORT uint64_t hashPointerTo53bit(const void* input);
template <typename T>
void safeDelete(QPointer<T>& component) {
if (!component.isNull() && component->QObject::parent() == nullptr) {
delete component;
}
}
} // namespace extrautils
class DLL_EXPORT NUtilsWrap : public Napi::ObjectWrap<NUtilsWrap> {
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
NUtilsWrap(const Napi::CallbackInfo& info);
static Napi::FunctionReference constructor;
};
namespace StaticNUtilsWrapMethods {
DLL_EXPORT Napi::Value isNapiExternal(const Napi::CallbackInfo& info);
} // namespace StaticNUtilsWrapMethods