summaryrefslogtreecommitdiff
path: root/plugins/MirLua/Modules/JSON/src/stdafx.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-02-03 12:03:36 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-02-03 12:03:36 +0000
commitac0ca480f5a8598648004b9bd0205a3d7c12e48a (patch)
tree11dd8eae469d874ded966426cf668b7a6e174e7f /plugins/MirLua/Modules/JSON/src/stdafx.h
parenteb552097af8e812ff119b92770bd9d7c30a0a696 (diff)
MirLua: json encoding support
git-svn-id: http://svn.miranda-ng.org/main/trunk@16218 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/Modules/JSON/src/stdafx.h')
-rw-r--r--plugins/MirLua/Modules/JSON/src/stdafx.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/MirLua/Modules/JSON/src/stdafx.h b/plugins/MirLua/Modules/JSON/src/stdafx.h
index 104b898845..333a821a62 100644
--- a/plugins/MirLua/Modules/JSON/src/stdafx.h
+++ b/plugins/MirLua/Modules/JSON/src/stdafx.h
@@ -10,11 +10,24 @@
#include <m_core.h>
#include <m_json.h>
+#include <m_string.h>
struct MT
{
JSONNode *node;
bool bDelete;
+
+ MT(JSONNode &refNode, bool bCopy = false) : node(bCopy ? json_copy(&refNode) : &refNode), bDelete(!bCopy) {}
+ MT(JSONNode *n, bool bD = true) : node(n), bDelete(bD) {}
+ ~MT()
+ {
+ if (bDelete) json_delete(node);
+ }
+
+ __inline void* operator new(size_t size, lua_State *L)
+ {
+ return lua_newuserdata(L, size);
+ }
};
extern const luaL_Reg jsonApi[];