Plasma Engine  2.0
Loading...
Searching...
No Matches
DuktapeContext.h
1#pragma once
2
3#include <Core/Scripting/DuktapeFunction.h>
4#include <Foundation/Memory/CommonAllocators.h>
5
6#ifdef BUILDSYSTEM_ENABLE_DUKTAPE_SUPPORT
7
8struct duk_hthread;
9using duk_context = duk_hthread;
10using duk_c_function = int (*)(duk_context*);
11
12
13class PL_CORE_DLL plDuktapeContext : public plDuktapeHelper
14{
15 PL_DISALLOW_COPY_AND_ASSIGN(plDuktapeContext);
16
17public:
18 plDuktapeContext(plStringView sWrapperName);
19 ~plDuktapeContext();
20
23
25 void EnableModuleSupport(duk_c_function moduleSearchFunction);
26
28
29private:
30 void InitializeContext();
31 void DestroyContext();
32
33 static void FatalErrorHandler(void* pUserData, const char* szMsg);
34 static void* DukAlloc(void* pUserData, size_t size);
35 static void* DukRealloc(void* pUserData, void* pPointer, size_t size);
36 static void DukFree(void* pUserData, void* pPointer);
37
38protected:
39 bool m_bInitializedModuleSupport = false;
40
41private:
42# if PL_ENABLED(PL_COMPILE_FOR_DEBUG)
44# else
46# endif
47};
48
49#endif // BUILDSYSTEM_ENABLE_DUKTAPE_SUPPORT
Policy based allocator implementation of the plAllocator interface.
Definition AllocatorWithPolicy.h:19
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34