diff options
-rw-r--r-- | bin10/lib/mir_core.lib | bin | 44528 -> 53216 bytes | |||
-rw-r--r-- | bin10/lib/mir_core64.lib | bin | 40498 -> 48684 bytes | |||
-rw-r--r-- | bin11/lib/mir_core.lib | bin | 44528 -> 53216 bytes | |||
-rw-r--r-- | bin11/lib/mir_core64.lib | bin | 40498 -> 48684 bytes | |||
-rw-r--r-- | include/m_json.h | 356 | ||||
-rw-r--r-- | protocols/WhatsApp/src/main.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/json/JSONChildren.cpp (renamed from src/modules/json/JSONChildren.cpp) | 2 | ||||
-rw-r--r-- | src/mir_core/json/JSONChildren.h (renamed from src/modules/json/JSONChildren.h) | 0 | ||||
-rw-r--r-- | src/mir_core/json/JSONDebug.cpp (renamed from src/modules/json/JSONDebug.cpp) | 5 | ||||
-rw-r--r-- | src/mir_core/json/JSONDebug.h (renamed from src/modules/json/JSONDebug.h) | 0 | ||||
-rw-r--r-- | src/mir_core/json/JSONDefs.h (renamed from src/modules/json/JSONDefs.h) | 6 | ||||
-rw-r--r-- | src/mir_core/json/JSONIterators.cpp (renamed from src/modules/json/JSONIterators.cpp) | 2 | ||||
-rw-r--r-- | src/mir_core/json/JSONMemory.cpp (renamed from src/modules/json/JSONMemory.cpp) | 2 | ||||
-rw-r--r-- | src/mir_core/json/JSONMemory.h (renamed from src/modules/json/JSONMemory.h) | 0 | ||||
-rw-r--r-- | src/mir_core/json/JSONNode.cpp (renamed from src/modules/json/JSONNode.cpp) | 2 | ||||
-rw-r--r-- | src/mir_core/json/JSONNode.h (renamed from src/modules/json/JSONNode.h) | 12 | ||||
-rw-r--r-- | src/mir_core/json/JSONNode_Mutex.cpp (renamed from src/modules/json/JSONNode_Mutex.cpp) | 4 | ||||
-rw-r--r-- | src/mir_core/json/JSONOptions.h (renamed from src/modules/json/JSONOptions.h) | 0 | ||||
-rw-r--r-- | src/mir_core/json/JSONWorker.cpp (renamed from src/modules/json/JSONWorker.cpp) | 2 | ||||
-rw-r--r-- | src/mir_core/json/JSONWorker.h (renamed from src/modules/json/JSONWorker.h) | 0 | ||||
-rw-r--r-- | src/mir_core/json/JSONWriter.cpp (renamed from src/modules/json/JSONWriter.cpp) | 2 | ||||
-rw-r--r-- | src/mir_core/json/NumberToString.h (renamed from src/modules/json/NumberToString.h) | 4 | ||||
-rw-r--r-- | src/mir_core/json/internalJSONNode.cpp (renamed from src/modules/json/internalJSONNode.cpp) | 3 | ||||
-rw-r--r-- | src/mir_core/json/internalJSONNode.h (renamed from src/modules/json/internalJSONNode.h) | 0 | ||||
-rw-r--r-- | src/mir_core/json/libJSON.cpp | 462 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj | 74 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj.filters | 63 | ||||
-rw-r--r-- | src/mir_core/mir_core_11.vcxproj | 68 | ||||
-rw-r--r-- | src/mir_core/mir_core_11.vcxproj.filters | 60 | ||||
-rw-r--r-- | src/mir_core/miranda.h | 3 | ||||
-rw-r--r-- | src/miranda32_10.vcxproj | 47 | ||||
-rw-r--r-- | src/miranda32_10.vcxproj.filters | 72 | ||||
-rw-r--r-- | src/miranda32_11.vcxproj | 47 | ||||
-rw-r--r-- | src/miranda32_11.vcxproj.filters | 72 | ||||
-rw-r--r-- | src/modules/json/JSON_Base64.cpp | 136 | ||||
-rw-r--r-- | src/modules/json/JSON_Base64.h | 14 | ||||
-rw-r--r-- | src/modules/json/json.cpp | 134 | ||||
-rw-r--r-- | src/modules/json/libJSON.cpp | 505 | ||||
-rw-r--r-- | src/modules/json/libJSON.h | 211 | ||||
-rw-r--r-- | src/modules/utils/utils.cpp | 2 |
40 files changed, 862 insertions, 1512 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 6f0a88799a..77af7e4592 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex 243e6c01ff..c94c1c6f1c 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib Binary files differindex f4719e3372..4c06ddef13 100644 --- a/bin11/lib/mir_core.lib +++ b/bin11/lib/mir_core.lib diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib Binary files differindex 243e6c01ff..8f2f3a7065 100644 --- a/bin11/lib/mir_core64.lib +++ b/bin11/lib/mir_core64.lib diff --git a/include/m_json.h b/include/m_json.h index 38c3a5e44e..8c4b25c6aa 100644 --- a/include/m_json.h +++ b/include/m_json.h @@ -1,234 +1,122 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef MIM_LIBJSON_H -#define MIM_LIBJSON_H - -#define IsJSONServiceAvailable() (ServiceExists(MS_JSON_FREE)) -#define json_getJSI(a) CallService(MS_JSON_GETINTERFACE,(WPARAM)a,0) - -#ifndef LIBJSON_H -#define JSONNODE void //so that JSONNODE* is void* -typedef JSONNODE** JSONNODE_ITERATOR; -#endif - -// This function get the service interface for direct calling -// wParam = (WPARAM)(LPJSONSERVICEINTERFACE) -// lParam = 0 -// Return value ALWAYS 0 - -typedef struct { - /* - stuff that's in namespace libJSON - */ - void (*free)(void * str); - void (*delete_)(JSONNODE * node); - // #ifdef JSON_MEMORY_MANAGE - void (*free_all)(void); - void (*delete_all)(void); - // #endif - JSONNODE * (*parse)(const char * json); - char * (*strip_white_space)(const char * json); - // #ifdef JSON_VALIDATE - JSONNODE * (*validate)(const char * json); - // #endif - - /* - stuff that's in class JSONNode - */ - //ctors - JSONNODE * (*new_a)(const char * name, const char * value); - JSONNODE * (*new_i)(const char * name, long value); - JSONNODE * (*new_f)(const char * name, double value); - JSONNODE * (*new_b)(const char * name, int value); //because C bools are ints and C++ will implicitly cast it - JSONNODE * (*new_)(char type); - JSONNODE * (*copy)(const JSONNODE * orig); - JSONNODE * (*duplicate)(const JSONNODE * orig); - - //assignment - void (*set_a)(JSONNODE * node, const char * value); - void (*set_i)(JSONNODE * node, long value); - void (*set_f)(JSONNODE * node, double value); - void (*set_b)(JSONNODE * node, int value); //because C bools are ints ane C++ will implicit - void (*set_n)(JSONNODE * node, const JSONNODE * orig); - - //inspectors - char (*type)(const JSONNODE * node); - unsigned int (*size)(const JSONNODE * node); - int (*empty)(const JSONNODE * node); - char * (*name)(const JSONNODE * node); - // #ifdef JSON_COMMENTS - char * (*get_comment)(const JSONNODE * node); - // #endif - char * (*as_string)(const JSONNODE * node); - long (*as_int)(const JSONNODE * node); - double (*as_float)(const JSONNODE * node); - int (*as_bool)(const JSONNODE * node); - JSONNODE * (*as_node)(const JSONNODE * node); - JSONNODE * (*as_array)(const JSONNODE * node); - // #ifdef JSON_BINARY - void * (*as_binary)(const JSONNODE * node, unsigned long * size); - // #endif - // #ifdef JSON_WRITER - char * (*write)(const JSONNODE * node); - char * (*write_formatted)(const JSONNODE * node); - // #endif - - //modifiers - void (*set_name)(JSONNODE * node, const char * name); - // #ifdef JSON_COMMENTS - void (*set_comment)(JSONNODE * node, const char * comment); - // #endif - void (*clear)(JSONNODE * node); - void (*nullify)(JSONNODE * node); - void (*swap)(JSONNODE * node, JSONNODE * node2); - void (*merge)(JSONNODE * node, JSONNODE * node2); - // #ifndef JSON_PREPARSE - void (*preparse)(JSONNODE * node); - // #endif - // #ifdef JSON_BINARY - void (*set_binary)(JSONNODE * node, const void * data, unsigned long length); - // #endif - void (*cast)(JSONNODE * node, char type); - - //children access - void (*reserve)(JSONNODE * node, unsigned int siz); - JSONNODE * (*at)(JSONNODE * node, unsigned int pos); - JSONNODE * (*get)(JSONNODE * node, const char * name); - // #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS - JSONNODE * (*get_nocase)(JSONNODE * node, const char * name); - JSONNODE * (*pop_back_nocase)(JSONNODE * node, const char * name); - // #endif - void (*push_back)(JSONNODE * node, JSONNODE * node2); - JSONNODE * (*pop_back_at)(JSONNODE * node, unsigned int pos); - JSONNODE * (*pop_back)(JSONNODE * node, const char * name); - // #ifdef JSON_ITERATORS - JSONNODE_ITERATOR (*find)(JSONNODE * node, const char * name); - // #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS - JSONNODE_ITERATOR (*find_nocase)(JSONNODE * node, const char * name); - // #endif - JSONNODE_ITERATOR (*erase)(JSONNODE * node, JSONNODE_ITERATOR it); - JSONNODE_ITERATOR (*erase_multi)(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); - JSONNODE_ITERATOR (*insert)(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2); - JSONNODE_ITERATOR (*insert_multi)(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); - - //iterator functions - JSONNODE_ITERATOR (*begin)(JSONNODE * node); - JSONNODE_ITERATOR (*end)(JSONNODE * node); - // #endif - - //comparison - int (*equal)(JSONNODE * node, JSONNODE * node2); -} JSONSERVICEINTERFACE, *PJSONSERVICEINTERFACE, *LPJSONSERVICEINTERFACE; - - -#ifndef _STATIC -extern JSONSERVICEINTERFACE jsi; - -#ifndef LIBJSON_H -#define json_free(a) jsi.free(a) -#define json_delete(a) jsi.delete_(a) -// #ifdef JSON_MEMORY_MANAGE -#define json_free_all() jsi.free_all() -#define json_delete_all() jsi.delete_all() -// #endif -#define json_parse(a) jsi.parse(a) -#define json_strip_white_space(a) jsi.strip_white_space(a) -// #ifdef JSON_VALIDATE -#define json_validate(a) jsi.validate(a) -// #endif -#define json_new_a(a,b) jsi.new_a(a,b) -#define json_new_i(a,b) jsi.new_i(a,b) -#define json_new_f(a,b) jsi.new_f(a,b) -#define json_new_b(a,b) jsi.new_b(a,b) -#define json_new(a) jsi.new_(a) -#define json_copy(a) jsi.copy(a) -#define json_duplicate(a) jsi.duplicate(a) -#define json_set_a(a,b) jsi.set_a(a,b) -#define json_set_i(a,b) jsi.set_i(a,b) -#define json_set_f(a,b) jsi.set_f(a,b) -#define json_set_b(a,b) jsi.set_b(a,b) -#define json_set_n(a,b) jsi.set_n(a,b) -#define json_type(a) jsi.type(a) -#define json_size(a) jsi.size(a) -#define json_empty(a) jsi.empty(a) -#define json_name(a) jsi.name(a) -// #ifdef JSON_COMMENTS -#define json_get_comment(a) jsi.get_comment(a) -// #endif -#define json_as_string(a) jsi.as_string(a) -#define json_as_int(a) jsi.as_int(a) -#define json_as_float(a) jsi.as_float(a) -#define json_as_bool(a) jsi.as_bool(a) -#define json_as_node(a) jsi.as_node(a) -#define json_as_array(a) jsi.as_array(a) -// #ifdef JSON_BINARY -#define json_as_binary(a,b) jsi.as_binary(a,b) -// #endif -// #ifdef JSON_WRITER -#define json_write(a) jsi.write(a) -#define json_write_formatted(a) jsi.write_formatted(a) -// #endif -#define json_set_name(a,b) jsi.set_name(a,b) -// #ifdef JSON_COMMENTS -#define json_set_comment(a,b) jsi.set_comment(a,b) -// #endif -#define json_clear(a) jsi.clear(a) -#define json_nullify(a) jsi.nullify(a) -#define json_swap(a,b) jsi.swap(a,b) -#define json_merge(a,b) jsi.merge(a,b) -// #ifndef JSON_PREPARSE -#define json_preparse(a) jsi.preparse(a) -// #endif -// #ifdef JSON_BINARY -#define json_set_binary(a,b,c) jsi.set_binary(a,b,c) -// #endif -#define json_cast(a,b) jsi.cast(a,b) -#define json_reserve(a,b) jsi.reserve(a,b) -#define json_at(a,b) jsi.at(a,b) -#define json_get(a,b) jsi.get(a,b) -// #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS -#define json_get_nocase(a,b) jsi.get_nocase(a,b) -#define json_pop_back_nocase(a,b) jsi.pop_back_nocase(a,b) -// #endif -#define json_push_back(a,b) jsi.push_back(a,b) -#define json_pop_back_at(a,b) jsi.pop_back_at(a,b) -#define json_pop_back(a,b) jsi.pop_back(a,b) -// #ifdef JSON_ITERATORS -#define json_find(a,b) jsi.find(a,b) -// #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS -#define json_find_nocase(a,b) jsi.find_nocase(a,b) -// #endif -#define json_erase(a,b) jsi.erase(a,b) -#define json_erase_multi(a,b,c) jsi.erase_multi(a,b,c) -#define json_insert(a,b,c) jsi.insert(a,b,c) -#define json_insert_multi(a,b,c,d) jsi.insert_multi(a,b,c,d) -#define json_begin(a) jsi.begin(a) -#define json_end(a) jsi.end(a) -#define json_equal(a,b) jsi.equal(a,b) -#endif -#endif // _STATIC - -#define MS_JSON_GETINTERFACE "JSON/GetInterface" - -#endif // MIM_LIBJSON_H +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef MIM_LIBJSON_H
+#define MIM_LIBJSON_H
+
+#include <m_core.h>
+
+#ifdef __cplusplus
+
+typedef void JSONNODE;
+
+extern "C"
+{
+#else
+typedef void JSONNODE;
+#endif
+
+MIR_CORE_DLL(void) json_free(void * str);
+MIR_CORE_DLL(void) json_delete(JSONNODE * node);
+
+MIR_CORE_DLL(JSONNODE*) json_parse(const char * json);
+MIR_CORE_DLL(char*) json_strip_white_space(const char * json);
+
+#ifdef JSON_VALIDATE
+ MIR_CORE_DLL(JSONNODE*) json_validate(const char * json);
+#endif
+
+/*
+ stuff that's in class JSONNode
+*/
+//ctors
+MIR_CORE_DLL(JSONNODE*) json_new_a(const char * name, const char * value);
+MIR_CORE_DLL(JSONNODE*) json_new_i(const char * name, long value);
+MIR_CORE_DLL(JSONNODE*) json_new_f(const char * name, double value);
+MIR_CORE_DLL(JSONNODE*) json_new_b(const char * name, int value); //because C bools are ints and C++ will implicitly cast it
+MIR_CORE_DLL(JSONNODE*) json_new(char type);
+MIR_CORE_DLL(JSONNODE*) json_copy(const JSONNODE * orig);
+MIR_CORE_DLL(JSONNODE*) json_duplicate(const JSONNODE * orig);
+
+//assignment
+MIR_CORE_DLL(void) json_set_a(JSONNODE * node, const char * value);
+MIR_CORE_DLL(void) json_set_i(JSONNODE * node, long value);
+MIR_CORE_DLL(void) json_set_f(JSONNODE * node, double value);
+MIR_CORE_DLL(void) json_set_b(JSONNODE * node, int value); //because C bools are ints ane C++ will implicit
+MIR_CORE_DLL(void) json_set_n(JSONNODE * node, const JSONNODE * orig);
+
+//inspectors
+MIR_CORE_DLL(char) json_type(const JSONNODE * node);
+MIR_CORE_DLL(size_t) json_size(const JSONNODE * node);
+MIR_CORE_DLL(int) json_empty(const JSONNODE * node);
+MIR_CORE_DLL(char*) json_name(const JSONNODE * node);
+#ifdef JSON_COMMENTS
+ MIR_CORE_DLL(char * json_get_comment(const JSONNODE * node);
+#endif
+MIR_CORE_DLL(char*) json_as_string(const JSONNODE * node);
+MIR_CORE_DLL(long) json_as_int(const JSONNODE * node);
+MIR_CORE_DLL(double) json_as_float(const JSONNODE * node);
+MIR_CORE_DLL(int) json_as_bool(const JSONNODE * node);
+MIR_CORE_DLL(JSONNODE*) json_as_node(const JSONNODE * node);
+MIR_CORE_DLL(JSONNODE*) json_as_array(const JSONNODE * node);
+
+MIR_CORE_DLL(char*) json_write(const JSONNODE * node);
+MIR_CORE_DLL(char*) json_write_formatted(const JSONNODE * node);
+
+//modifiers
+MIR_CORE_DLL(void) json_set_name(JSONNODE * node, const char * name);
+#ifdef JSON_COMMENTS
+ MIR_CORE_DLL(void) json_set_comment(JSONNODE * node, const char * comment);
+#endif
+MIR_CORE_DLL(void) json_clear(JSONNODE * node);
+MIR_CORE_DLL(void) json_nullify(JSONNODE * node);
+MIR_CORE_DLL(void) json_swap(JSONNODE * node, JSONNODE * node2);
+MIR_CORE_DLL(void) json_merge(JSONNODE * node, JSONNODE * node2);
+#ifndef JSON_PREPARSE
+ MIR_CORE_DLL(void) json_preparse(JSONNODE * node);
+#endif
+#ifdef JSON_BINARY
+ MIR_CORE_DLL(void) json_set_binary(JSONNODE * node, const void * data, unsigned long length);
+#endif
+MIR_CORE_DLL(void) json_cast(JSONNODE * node, char type);
+
+//children access
+MIR_CORE_DLL(void) json_reserve(JSONNODE * node, size_t siz);
+MIR_CORE_DLL(JSONNODE*) json_at(JSONNODE * node, size_t pos);
+MIR_CORE_DLL(JSONNODE*) json_get(JSONNODE * node, const char * name);
+#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
+ MIR_CORE_DLL(JSONNODE*) json_get_nocase(JSONNODE * node, const char * name);
+ MIR_CORE_DLL(JSONNODE*) json_pop_back_nocase(JSONNODE * node, const char * name);
+#endif
+MIR_CORE_DLL(void) json_push_back(JSONNODE * node, JSONNODE * node2);
+MIR_CORE_DLL(JSONNODE*) json_pop_back_at(JSONNODE * node, size_t pos);
+MIR_CORE_DLL(JSONNODE*) json_pop_back(JSONNODE * node, const char * name);
+
+//comparison
+MIR_CORE_DLL(int) json_equal(JSONNODE * node, JSONNODE * node2);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MIM_LIBJSON_H
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index 13f128bcef..d2f45c7fdf 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -1,6 +1,5 @@ #include "common.h"
-JSONSERVICEINTERFACE jsi;
CLIST_INTERFACE* pcli;
int hLangpack;
@@ -72,7 +71,6 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP(&pluginInfo);
mir_getCLI();
- json_getJSI(&jsi);
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "WhatsApp";
diff --git a/src/modules/json/JSONChildren.cpp b/src/mir_core/json/JSONChildren.cpp index 9a99ef1680..a5e85b69d5 100644 --- a/src/modules/json/JSONChildren.cpp +++ b/src/mir_core/json/JSONChildren.cpp @@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include "JSONChildren.h"
#include "JSONNode.h"
diff --git a/src/modules/json/JSONChildren.h b/src/mir_core/json/JSONChildren.h index ce697ffd77..ce697ffd77 100644 --- a/src/modules/json/JSONChildren.h +++ b/src/mir_core/json/JSONChildren.h diff --git a/src/modules/json/JSONDebug.cpp b/src/mir_core/json/JSONDebug.cpp index 82ec80d5a5..084b6dbb28 100644 --- a/src/modules/json/JSONDebug.cpp +++ b/src/mir_core/json/JSONDebug.cpp @@ -21,10 +21,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
-#include "libJSON.h"
-#include "m_json.h"
+#include <m_json.h>
#ifdef JSON_DEBUG
diff --git a/src/modules/json/JSONDebug.h b/src/mir_core/json/JSONDebug.h index ff1cedf8fc..ff1cedf8fc 100644 --- a/src/modules/json/JSONDebug.h +++ b/src/mir_core/json/JSONDebug.h diff --git a/src/modules/json/JSONDefs.h b/src/mir_core/json/JSONDefs.h index 5f66efcd33..9bcaa55b64 100644 --- a/src/modules/json/JSONDefs.h +++ b/src/mir_core/json/JSONDefs.h @@ -65,7 +65,7 @@ #ifdef JSON_INDEX_TYPE
typedef JSON_INDEX_TYPE json_index_t;
#else
- typedef unsigned int json_index_t;
+ typedef size_t json_index_t;
#endif
typedef void (*json_mutex_callback_t)(void *);
@@ -76,8 +76,8 @@ typedef void (*json_free_t)(void *); #else
#define JSONNODE void //so that JSONNODE* is void*
typedef JSONNODE** JSONNODE_ITERATOR;
- typedef void * (*json_malloc_t)(unsigned long);
- typedef void * (*json_realloc_t)(void *, unsigned long);
+ typedef void * (*json_malloc_t)(size_t);
+ typedef void * (*json_realloc_t)(void *, size_t);
#endif
#endif //JSONDEFS_H
diff --git a/src/modules/json/JSONIterators.cpp b/src/mir_core/json/JSONIterators.cpp index 5de4ffb9e0..5da3c76a72 100644 --- a/src/modules/json/JSONIterators.cpp +++ b/src/mir_core/json/JSONIterators.cpp @@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include "JSONNode.h"
diff --git a/src/modules/json/JSONMemory.cpp b/src/mir_core/json/JSONMemory.cpp index 0fc6d28cde..91744dc3ab 100644 --- a/src/modules/json/JSONMemory.cpp +++ b/src/mir_core/json/JSONMemory.cpp @@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include "JSONMemory.h"
#include "JSONNode.h"
diff --git a/src/modules/json/JSONMemory.h b/src/mir_core/json/JSONMemory.h index 32e8c3f4ef..32e8c3f4ef 100644 --- a/src/modules/json/JSONMemory.h +++ b/src/mir_core/json/JSONMemory.h diff --git a/src/modules/json/JSONNode.cpp b/src/mir_core/json/JSONNode.cpp index b2364f31aa..9816010089 100644 --- a/src/modules/json/JSONNode.cpp +++ b/src/mir_core/json/JSONNode.cpp @@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include "JSONNode.h"
diff --git a/src/modules/json/JSONNode.h b/src/mir_core/json/JSONNode.h index 2d36c5232b..487925b04f 100644 --- a/src/modules/json/JSONNode.h +++ b/src/mir_core/json/JSONNode.h @@ -3,8 +3,6 @@ #include "JSONDefs.h" //for string type
#include "internalJSONNode.h" //internal structure for json value
-#include <stdexcept>
-#include <cstdarg> //for the ... parameter
#ifdef JSON_BINARY
#include "JSON_Base64.h"
@@ -29,18 +27,18 @@ #define JSON_NEW(x) JSONNode::newJSONNode_Shallow(x)
#define DECLARE_FOR_ALL_TYPES(foo)\
foo(long);\
- foo(json_number);\
+ foo(double);\
foo(bool);\
foo(const json_string &);
#define DECLARE_FOR_ALL_TYPES_CONST(foo)\
foo(long) const;\
- foo(json_number) const;\
+ foo(double) const;\
foo(bool) const;\
foo(const json_string &) const;\
foo(const JSONNode &) const;
#define IMPLEMENT_FOR_ALL_NUMBERS(foo)\
foo(long)\
- foo(json_number)
+ foo(double)
#else
#define JSON_PTR_LIB
@@ -113,7 +111,7 @@ public: json_string as_string(void) const;
long as_int(void) const;
- json_number as_float(void) const;
+ double as_float(void) const;
bool as_bool(void) const;
JSONNode as_node(void) const;
JSONNode as_array(void) const;
@@ -535,7 +533,7 @@ inline long JSONNode::as_int(void) const { JSON_CHECK_INTERNAL();
return internal -> as_int();
}
-inline json_number JSONNode::as_float(void) const {
+inline double JSONNode::as_float(void) const {
JSON_CHECK_INTERNAL();
return internal -> as_float();
}
diff --git a/src/modules/json/JSONNode_Mutex.cpp b/src/mir_core/json/JSONNode_Mutex.cpp index 2c52366320..6aa480d193 100644 --- a/src/modules/json/JSONNode_Mutex.cpp +++ b/src/mir_core/json/JSONNode_Mutex.cpp @@ -21,11 +21,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include <m_json.h>
-#include "libJSON.h"
-
#ifdef JSON_MUTEX_CALLBACKS
json_mutex_callback_t json_lock_callback = 0;
diff --git a/src/modules/json/JSONOptions.h b/src/mir_core/json/JSONOptions.h index 29d588113a..29d588113a 100644 --- a/src/modules/json/JSONOptions.h +++ b/src/mir_core/json/JSONOptions.h diff --git a/src/modules/json/JSONWorker.cpp b/src/mir_core/json/JSONWorker.cpp index 92d0772e52..a52b85b3f8 100644 --- a/src/modules/json/JSONWorker.cpp +++ b/src/mir_core/json/JSONWorker.cpp @@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include "JSONWorker.h"
diff --git a/src/modules/json/JSONWorker.h b/src/mir_core/json/JSONWorker.h index f425e12e86..f425e12e86 100644 --- a/src/modules/json/JSONWorker.h +++ b/src/mir_core/json/JSONWorker.h diff --git a/src/modules/json/JSONWriter.cpp b/src/mir_core/json/JSONWriter.cpp index b94a0ffb44..579f08093d 100644 --- a/src/modules/json/JSONWriter.cpp +++ b/src/mir_core/json/JSONWriter.cpp @@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include "JSONNode.h"
#ifdef JSON_WRITER
diff --git a/src/modules/json/NumberToString.h b/src/mir_core/json/NumberToString.h index 177837e50e..a260f1cb5c 100644 --- a/src/modules/json/NumberToString.h +++ b/src/mir_core/json/NumberToString.h @@ -95,8 +95,8 @@ public: return result;
}
- static inline bool areEqual(const json_number & one, const json_number & two){
- const json_number temp = one - two;
+ static inline bool areEqual(const double & one, const double & two){
+ const double temp = one - two;
return (temp > 0.0) ? temp < 0.00001 : temp > -0.00001;
}
};
diff --git a/src/modules/json/internalJSONNode.cpp b/src/mir_core/json/internalJSONNode.cpp index 4dca707526..bc9408d60c 100644 --- a/src/modules/json/internalJSONNode.cpp +++ b/src/mir_core/json/internalJSONNode.cpp @@ -21,10 +21,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "..\..\core\commonheaders.h"
+#include "..\commonheaders.h"
#include <m_json.h>
-#include "libJSON.h"
#include "internalJSONNode.h"
#include "NumberToString.h" //So that I can convert numbers into strings
#include "JSONNode.h" //To fill in the foreward declaration
diff --git a/src/modules/json/internalJSONNode.h b/src/mir_core/json/internalJSONNode.h index 8832bbd828..8832bbd828 100644 --- a/src/modules/json/internalJSONNode.h +++ b/src/mir_core/json/internalJSONNode.h diff --git a/src/mir_core/json/libJSON.cpp b/src/mir_core/json/libJSON.cpp new file mode 100644 index 0000000000..077af1b961 --- /dev/null +++ b/src/mir_core/json/libJSON.cpp @@ -0,0 +1,462 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "..\commonheaders.h"
+
+#include <m_json.h>
+
+/*
+ This is the implementation of the C interface to libJSON
+ This file may be included in any C++ application, but it will
+ be completely ignored if JSON_LIBRARY isn't defined. The
+ only reason JSON_LIBRARY should be defined is when compiling libJSON
+ as a library
+*/
+
+#include "JSONNode.h"
+#include "JSONWorker.h"
+#include <stdexcept> //some methods throw exceptions
+#ifdef JSON_MEMORY_MANAGE
+ auto_expand StringHandler;
+ auto_expand_node NodeHandler;
+ #define MANAGER_INSERT(x) NodeHandler.insert(x)
+#else
+ #define MANAGER_INSERT(x) x
+#endif
+
+#ifdef JSON_SAFE
+ static const json_char * EMPTY_CSTRING = JSON_TEXT("");
+#endif
+
+inline json_char * toCString(const json_string & str){
+ const size_t len((str.length() + 1) * sizeof(json_char));
+ #ifdef JSON_MEMORY_MANAGE
+ return (json_char *)StringHandler.insert(memcpy(json_malloc<json_char>(len), str.c_str(), len));
+ #else
+ return (json_char *)memcpy(json_malloc<json_char>(len), str.c_str(), len);
+ #endif
+}
+
+/*
+ stuff that's in namespace libJSON
+*/
+
+MIR_CORE_DLL(void) json_free(void * str){
+ JSON_ASSERT_SAFE(str, JSON_TEXT("freeing null ptr"), return;);
+ #ifdef JSON_MEMORY_MANAGE
+ StringHandler.remove(str);
+ #endif
+ libjson_free<void>(str);
+}
+
+MIR_CORE_DLL(void) json_delete(JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("deleting null ptr"), return;);
+ #ifdef JSON_MEMORY_MANAGE
+ NodeHandler.remove(node);
+ #endif
+ JSONNode::deleteJSONNode((JSONNode *)node);
+}
+
+#ifdef JSON_MEMORY_MANAGE
+ MIR_CORE_DLL(void) json_free_all(void){
+ StringHandler.clear();
+ }
+
+ MIR_CORE_DLL(void) json_delete_all(void){
+ NodeHandler.clear();
+ }
+#endif
+
+MIR_CORE_DLL(JSONNODE*) json_parse(const json_char * json){
+ JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_parse"), return 0;);
+ try {
+ //use this constructor to simply copy reference instead of copying the temp
+ return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(JSONWorker::parse(json)));
+ } catch (std::invalid_argument){}
+ return 0;
+}
+
+MIR_CORE_DLL(json_char*) json_strip_white_space(const json_char * json){
+ JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_strip_white_space"), return 0;);
+ return toCString(JSONWorker::RemoveWhiteSpaceAndComments(json));
+}
+
+#ifdef JSON_VALIDATE
+ MIR_CORE_DLL(JSONNODE*) json_validate(const json_char * json){
+ JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_validate"), return 0;);
+ try {
+ //use this constructor to simply copy reference instead of copying the temp
+ return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(JSONWorker::validate(json)));
+ } catch (std::invalid_argument){}
+ return 0;
+ }
+#endif
+
+#if defined JSON_DEBUG && !defined JSON_STDERROR
+ //When libjson errors, a callback allows the user to know what went wrong
+ MIR_CORE_DLL(void) json_register_debug_callback(json_error_callback_t callback){
+ JSONDebug::register_callback(callback);
+ }
+#endif
+
+#ifdef JSON_MUTEX_CALLBACKS
+ #ifdef JSON_MUTEX_MANAGE
+ MIR_CORE_DLL(void) json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock){
+ JSONNode::register_mutex_callbacks(lock, unlock, manager_lock);
+ JSONNode::register_mutex_destructor(destroy);
+ }
+
+ #else
+ MIR_CORE_DLL(void) json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock){
+ JSONNode::register_mutex_callbacks(lock, unlock, manager_lock);
+ }
+ #endif
+
+ MIR_CORE_DLL(void) json_set_global_mutex(void * mutex){
+ JSONNode::set_global_mutex(mutex);
+ }
+
+ MIR_CORE_DLL(void) json_set_mutex(JSONNODE * node, void * mutex){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_mutex"), return;);
+ ((JSONNode*)node) -> set_mutex(mutex);
+ }
+
+ MIR_CORE_DLL(void) json_lock(JSONNODE * node, int threadid){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_lock"), return;);
+ ((JSONNode*)node) -> lock(threadid);
+ }
+
+ MIR_CORE_DLL(void) json_unlock(JSONNODE * node, int threadid){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_unlock"), return;);
+ ((JSONNode*)node) -> unlock(threadid);
+ }
+#endif
+
+#ifdef JSON_MEMORY_CALLBACKS
+ MIR_CORE_DLL(void) json_register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre){
+ JSONMemory::registerMemoryCallbacks(mal, real, fre);
+ }
+#endif
+
+
+/*
+stuff that's in class JSONNode
+*/
+//ctors
+MIR_CORE_DLL(JSONNODE*) json_new_a(const json_char * name, const json_char * value){
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_a"), name = EMPTY_CSTRING;);
+ JSON_ASSERT_SAFE(value, JSON_TEXT("null value to json_new_a"), value = EMPTY_CSTRING;);
+ #ifdef JSON_MEMORY_CALLBACKS
+ return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, json_string(value)));
+ #else
+ return MANAGER_INSERT(new JSONNode(name, json_string(value)));
+ #endif
+}
+
+MIR_CORE_DLL(JSONNODE*) json_new_i(const json_char * name, long value){
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_i"), name = EMPTY_CSTRING;);
+ #ifdef JSON_MEMORY_CALLBACKS
+ return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value));
+ #else
+ return MANAGER_INSERT(new JSONNode(name, value));
+ #endif
+}
+
+MIR_CORE_DLL(JSONNODE*) json_new_f(const json_char * name, double value){
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_f"), name = EMPTY_CSTRING;);
+ #ifdef JSON_MEMORY_CALLBACKS
+ return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value));
+ #else
+ return MANAGER_INSERT(new JSONNode(name, value));
+ #endif
+}
+
+MIR_CORE_DLL(JSONNODE*) json_new_b(const json_char * name, int value){
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_b"), name = EMPTY_CSTRING;);
+ #ifdef JSON_MEMORY_CALLBACKS
+ return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value != 0 ));
+ #else
+ return MANAGER_INSERT(new JSONNode(name, value != 0));
+ #endif
+}
+
+MIR_CORE_DLL(JSONNODE*) json_new(char type){
+ #ifdef JSON_MEMORY_CALLBACKS
+ return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(type));
+ #else
+ return MANAGER_INSERT(new JSONNode(type));
+ #endif
+}
+
+MIR_CORE_DLL(JSONNODE*) json_copy(const JSONNODE * orig){
+ JSON_ASSERT_SAFE(orig, JSON_TEXT("null orig to json_copy"), return 0;);
+ #ifdef JSON_MEMORY_CALLBACKS
+ return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(*((JSONNode*)orig)));
+ #else
+ return MANAGER_INSERT(new JSONNode(*((JSONNode*)orig)));
+ #endif
+}
+
+MIR_CORE_DLL(JSONNODE*) json_duplicate(const JSONNODE * orig){
+ JSON_ASSERT_SAFE(orig, JSON_TEXT("null orig to json_duplicate"), return 0;);
+ return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)orig) -> duplicate()));
+}
+
+//assignment
+MIR_CORE_DLL(void) json_set_a(JSONNODE * node, const json_char * value){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_a"), return;);
+ JSON_ASSERT_SAFE(value, JSON_TEXT("null value to json_set_a"), value = EMPTY_CSTRING;);
+ *((JSONNode*)node) = json_string(value);
+}
+
+MIR_CORE_DLL(void) json_set_i(JSONNODE * node, long value){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_i"), return;);
+ *((JSONNode*)node) = value;
+}
+
+MIR_CORE_DLL(void) json_set_f(JSONNODE * node, double value){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_f"), return;);
+ *((JSONNode*)node) = value;
+}
+
+MIR_CORE_DLL(void) json_set_b(JSONNODE * node, int value){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_b"), return;);
+ *((JSONNode*)node) = value != 0;
+}
+
+MIR_CORE_DLL(void) json_set_n(JSONNODE * node, const JSONNODE * orig){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_n"), return;);
+ JSON_ASSERT_SAFE(orig, JSON_TEXT("null node to json_set_n"), return;);
+ *((JSONNode*)node) = *((JSONNode*)orig);
+}
+
+//inspectors
+MIR_CORE_DLL(char) json_type(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_type"), return JSON_NULL;);
+ return ((JSONNode*)node) -> type();
+}
+
+MIR_CORE_DLL(json_index_t) json_size(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_size"), return 0;);
+ return ((JSONNode*)node) -> size();
+}
+
+MIR_CORE_DLL(int) json_empty(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_empty"), return true;);
+ return (int)(((JSONNode*)node) -> empty());
+}
+
+MIR_CORE_DLL(json_char*) json_name(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_name"), return toCString(EMPTY_CSTRING););
+ return toCString(((JSONNode*)node) -> name());
+}
+
+#ifdef JSON_COMMENTS
+ MIR_CORE_DLL(json_char*) json_get_comment(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_get_comment"), return toCString(EMPTY_CSTRING););
+ return toCString(((JSONNode*)node) -> get_comment());
+ }
+#endif
+
+MIR_CORE_DLL(json_char*) json_as_string(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_string"), return toCString(EMPTY_CSTRING););
+ return toCString(((JSONNode*)node) -> as_string());
+}
+
+MIR_CORE_DLL(long) json_as_int(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_int"), return 0;);
+ return ((JSONNode*)node) -> as_int();
+}
+
+MIR_CORE_DLL(double) json_as_float(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_float"), return 0.0;);
+ return ((JSONNode*)node) -> as_float();
+}
+
+MIR_CORE_DLL(int) json_as_bool(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_bool"), return false;);
+ return (int)(((JSONNode*)node) -> as_bool());
+}
+
+MIR_CORE_DLL(JSONNODE*) json_as_node(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_node"), return 0;);
+ return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)node) -> as_node()));
+}
+
+MIR_CORE_DLL(JSONNODE*) json_as_array(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_array"), return 0;);
+ return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)node) -> as_array()));
+}
+
+#ifdef JSON_BINARY
+ void * json_as_binary(const JSONNODE * node, unsigned long * size){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_binary"), if (size){*size = 0;} return 0;);
+ const std::string result = ((JSONNode*)node) -> as_binary();
+ const size_t len = result.length();
+ if (size) *size = len;
+ #ifdef JSON_SAFE
+ if (result.empty()) return 0;
+ #endif
+ #ifdef JSON_MEMORY_MANAGE
+ return StringHandler.insert(memcpy(json_malloc<char>(len), result.data(), len));
+ #else
+ return memcpy(json_malloc<char>(len), result.data(), len);
+ #endif
+ }
+#endif
+
+#ifdef JSON_WRITER
+ MIR_CORE_DLL(json_char*) json_write(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write"), return toCString(EMPTY_CSTRING););
+ return toCString(((JSONNode*)node) -> write());
+ }
+
+ MIR_CORE_DLL(json_char*) json_write_formatted(const JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write_formatted"), return toCString(EMPTY_CSTRING););
+ return toCString(((JSONNode*)node) -> write_formatted());
+ }
+#endif
+
+//modifiers
+MIR_CORE_DLL(void) json_set_name(JSONNODE * node, const json_char * name){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_name"), return;);
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_set_name"), name = EMPTY_CSTRING;);
+ ((JSONNode*)node) -> set_name(name);
+}
+
+#ifdef JSON_COMMENTS
+ MIR_CORE_DLL(void) json_set_comment(JSONNODE * node, const json_char * comment){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_comment"), return;);
+ JSON_ASSERT_SAFE(comment, JSON_TEXT("null name to json_set_comment"), comment = EMPTY_CSTRING;);
+ ((JSONNode*)node) -> set_comment(comment);
+ }
+#endif
+
+MIR_CORE_DLL(void) json_clear(JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_clear"), return;);
+ ((JSONNode*)node) -> clear();
+}
+
+MIR_CORE_DLL(void) json_nullify(JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_nullify"), return;);
+ ((JSONNode*)node) -> nullify();
+}
+
+MIR_CORE_DLL(void) json_swap(JSONNODE * node, JSONNODE * node2){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_swap"), return;);
+ JSON_ASSERT_SAFE(node2, JSON_TEXT("null node to json_swap"), return;);
+ ((JSONNode*)node) -> swap(*(JSONNode*)node2);
+}
+
+MIR_CORE_DLL(void) json_merge(JSONNODE * node, JSONNODE * node2){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_merge"), return;);
+ JSON_ASSERT_SAFE(node2, JSON_TEXT("null node to json_merge"), return;);
+ ((JSONNode*)node) -> merge(*(JSONNode*)node2);
+}
+
+#ifndef JSON_PREPARSE
+ MIR_CORE_DLL(void) json_preparse(JSONNODE * node){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_preparse"), return;);
+ ((JSONNode*)node) -> preparse();
+ }
+#endif
+
+#ifdef JSON_BINARY
+ MIR_CORE_DLL(void) json_set_binary(JSONNODE * node, const void * data, unsigned long length){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_swap"), return;);
+ JSON_ASSERT_SAFE(data, JSON_TEXT("null data to json_set_binary"), *((JSONNode*)node) = EMPTY_CSTRING; return;);
+ ((JSONNode*)node) -> set_binary((unsigned char *)data, length);
+ }
+#endif
+
+MIR_CORE_DLL(void) json_cast(JSONNODE * node, char type){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_cast"), return;);
+ ((JSONNode*)node) -> cast(type);
+}
+
+//children access
+MIR_CORE_DLL(void) json_reserve(JSONNODE * node, json_index_t siz){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_reserve"), return;);
+ ((JSONNode*)node) -> reserve(siz);
+}
+
+MIR_CORE_DLL(JSONNODE*) json_at(JSONNODE * node, json_index_t pos){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_at"), return 0;);
+ try {
+ return &((JSONNode*)node) -> at(pos);
+ } catch (std::out_of_range){}
+ return 0;
+}
+
+MIR_CORE_DLL(JSONNODE*) json_get(JSONNODE * node, const json_char * name){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_get"), return 0;);
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null node to json_get. Did you mean to use json_at?"), return 0;);
+ try {
+ return &((JSONNode*)node) -> at(name);
+ } catch (std::out_of_range){}
+ return 0;
+}
+
+#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
+ MIR_CORE_DLL(JSONNODE*) json_get_nocase(JSONNODE * node, const json_char * name){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_at_nocase"), return 0;);
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_at_nocase"), return 0;);
+ try {
+ return &((JSONNode*)node) -> at_nocase(name);
+ } catch (std::out_of_range){}
+ return 0;
+ }
+
+ MIR_CORE_DLL(JSONNODE*) json_pop_back_nocase(JSONNODE * node, const json_char * name){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_nocase"), return 0;);
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back_nocase"), return 0;);
+ return MANAGER_INSERT(((JSONNode*)node) -> pop_back_nocase(name));
+ }
+#endif
+
+MIR_CORE_DLL(void) json_push_back(JSONNODE * node, JSONNODE * node2){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_push_back"), return;);
+ JSON_ASSERT_SAFE(node2, JSON_TEXT("null node2 to json_push_back"), return;);
+ #ifdef JSON_MEMORY_MANAGE
+ NodeHandler.remove(node2);
+ #endif
+ ((JSONNode*)node) -> push_back((JSONNode*)node2);
+}
+
+MIR_CORE_DLL(JSONNODE*) json_pop_back_at(JSONNODE * node, json_index_t pos){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_i"), return 0;);
+ return MANAGER_INSERT(((JSONNode*)node) -> pop_back(pos));
+}
+
+MIR_CORE_DLL(JSONNODE*) json_pop_back(JSONNODE * node, const json_char * name){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back"), return 0;);
+ JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back. Did you mean to use json_pop_back_at?"), return 0;);
+ return MANAGER_INSERT(((JSONNode*)node) -> pop_back(name));
+}
+
+//comparison
+MIR_CORE_DLL(int) json_equal(JSONNODE * node, JSONNODE * node2){
+ JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_equal"), return false;);
+ JSON_ASSERT_SAFE(node2, JSON_TEXT("null node2 to json_equal"), return false;);
+ return (int)(*((JSONNode*)node) == *((JSONNode*)node2));
+}
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index 7473772083..cf9dff3054 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -23,12 +23,82 @@ <ClInclude Include="..\..\include\m_database.h" />
<ClInclude Include="..\..\include\m_system.h" />
<ClInclude Include="commonheaders.h" />
+ <ClInclude Include="json\internalJSONNode.h" />
+ <ClInclude Include="json\JSONChildren.h" />
+ <ClInclude Include="json\JSONDebug.h" />
+ <ClInclude Include="json\JSONDefs.h" />
+ <ClInclude Include="json\JSONMemory.h" />
+ <ClInclude Include="json\JSONNode.h" />
+ <ClInclude Include="json\JSONOptions.h" />
+ <ClInclude Include="json\JSONWorker.h" />
+ <ClInclude Include="json\libJSON.h" />
+ <ClInclude Include="json\NumberToString.h" />
<ClInclude Include="miranda.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cmdline.cpp" />
<ClCompile Include="http.cpp" />
<ClCompile Include="icons.cpp" />
+ <ClCompile Include="json\internalJSONNode.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONChildren.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONDebug.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONIterators.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONMemory.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode_Mutex.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONWorker.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONWriter.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\libJSON.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="protos.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
@@ -110,7 +180,6 @@ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;MIR_CORE_EXPORTS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
- <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -150,7 +219,6 @@ <PreprocessorDefinitions>_DEBUG;_WINDOWS;MIR_CORE_EXPORTS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
- <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -178,7 +246,6 @@ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
@@ -222,7 +289,6 @@ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index a558c5a592..ff586c343d 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -8,6 +8,9 @@ <Filter Include="Header Files">
<UniqueIdentifier>{a578a180-0eb9-4c3e-b4ae-0eaefa01d207}</UniqueIdentifier>
</Filter>
+ <Filter Include="Source Files\json">
+ <UniqueIdentifier>{fd36323a-6636-4faa-90b0-e2980235fe19}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="memory.cpp">
@@ -64,6 +67,36 @@ <ClCompile Include="protos.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="json\internalJSONNode.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONChildren.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONDebug.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONIterators.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONMemory.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode_Mutex.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONWorker.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONWriter.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\libJSON.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
@@ -81,5 +114,35 @@ <ClInclude Include="..\..\include\m_database.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="json\internalJSONNode.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONChildren.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONDebug.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONDefs.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONMemory.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONNode.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONOptions.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONWorker.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\libJSON.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\NumberToString.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/mir_core/mir_core_11.vcxproj b/src/mir_core/mir_core_11.vcxproj index c328a5a34b..f65e731e1d 100644 --- a/src/mir_core/mir_core_11.vcxproj +++ b/src/mir_core/mir_core_11.vcxproj @@ -21,14 +21,78 @@ <ItemGroup>
<ClInclude Include="..\..\include\m_core.h" />
<ClInclude Include="..\..\include\m_database.h" />
+ <ClInclude Include="..\..\include\m_json.h" />
<ClInclude Include="..\..\include\m_system.h" />
<ClInclude Include="commonheaders.h" />
+ <ClInclude Include="json\internalJSONNode.h" />
+ <ClInclude Include="json\JSONChildren.h" />
+ <ClInclude Include="json\JSONDebug.h" />
+ <ClInclude Include="json\JSONDefs.h" />
+ <ClInclude Include="json\JSONMemory.h" />
+ <ClInclude Include="json\JSONNode.h" />
+ <ClInclude Include="json\JSONOptions.h" />
+ <ClInclude Include="json\JSONWorker.h" />
+ <ClInclude Include="json\NumberToString.h" />
<ClInclude Include="miranda.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cmdline.cpp" />
<ClCompile Include="http.cpp" />
<ClCompile Include="icons.cpp" />
+ <ClCompile Include="json\internalJSONNode.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONChildren.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONDebug.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONMemory.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode_Mutex.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONWorker.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\JSONWriter.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="json\libJSON.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="protos.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
@@ -114,7 +178,6 @@ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;MIR_CORE_EXPORTS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
- <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -155,7 +218,6 @@ <PreprocessorDefinitions>_DEBUG;_WINDOWS;MIR_CORE_EXPORTS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
- <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -183,7 +245,6 @@ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
@@ -226,7 +287,6 @@ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
diff --git a/src/mir_core/mir_core_11.vcxproj.filters b/src/mir_core/mir_core_11.vcxproj.filters index a558c5a592..5603f49551 100644 --- a/src/mir_core/mir_core_11.vcxproj.filters +++ b/src/mir_core/mir_core_11.vcxproj.filters @@ -8,6 +8,9 @@ <Filter Include="Header Files">
<UniqueIdentifier>{a578a180-0eb9-4c3e-b4ae-0eaefa01d207}</UniqueIdentifier>
</Filter>
+ <Filter Include="Source Files\json">
+ <UniqueIdentifier>{78a0dcef-2ff4-4e4f-b787-092afab60e64}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="memory.cpp">
@@ -64,6 +67,33 @@ <ClCompile Include="protos.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="json\internalJSONNode.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONChildren.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONDebug.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONMemory.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONNode_Mutex.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONWorker.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\JSONWriter.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
+ <ClCompile Include="json\libJSON.cpp">
+ <Filter>Source Files\json</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
@@ -81,5 +111,35 @@ <ClInclude Include="..\..\include\m_database.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="json\internalJSONNode.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONChildren.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONDebug.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONDefs.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONMemory.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONNode.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONOptions.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\JSONWorker.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="json\NumberToString.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\m_json.h">
+ <Filter>Source Files\json</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/mir_core/miranda.h b/src/mir_core/miranda.h index 608b16fe78..93c7201e6a 100644 --- a/src/mir_core/miranda.h +++ b/src/mir_core/miranda.h @@ -24,10 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern "C"
{
MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo);
+ MIR_CORE_DLL(MUUID*) Langpack_LookupUuid(WPARAM wParam);
};
-MIR_CORE_DLL(MUUID*) Langpack_LookupUuid(WPARAM wParam);
-
void UnloadLangPackModule(void);
int InitialiseModularEngine(void);
diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj index 5eb1245bf7..e9850e16b8 100644 --- a/src/miranda32_10.vcxproj +++ b/src/miranda32_10.vcxproj @@ -249,17 +249,6 @@ <ClInclude Include="modules\extraicons\extraicons.h" />
<ClInclude Include="modules\extraicons\usedIcons.h" />
<ClInclude Include="modules\findadd\findadd.h" />
- <ClInclude Include="modules\json\internalJSONNode.h" />
- <ClInclude Include="modules\json\JSONChildren.h" />
- <ClInclude Include="modules\json\JSONDebug.h" />
- <ClInclude Include="modules\json\JSONDefs.h" />
- <ClInclude Include="modules\json\JSONMemory.h" />
- <ClInclude Include="modules\json\JSONNode.h" />
- <ClInclude Include="modules\json\JSONOptions.h" />
- <ClInclude Include="modules\json\JSONWorker.h" />
- <ClInclude Include="modules\json\JSON_Base64.h" />
- <ClInclude Include="modules\json\libJSON.h" />
- <ClInclude Include="modules\json\NumberToString.h" />
<ClInclude Include="modules\netlib\netlib.h" />
<ClInclude Include="modules\options\filter.h" />
<ClInclude Include="..\include\m_protoint.h" />
@@ -348,42 +337,6 @@ <ClCompile Include="modules\ignore\ignore.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
- <ClCompile Include="modules\json\internalJSONNode.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONChildren.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONDebug.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONIterators.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONMemory.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode_Mutex.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWorker.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWriter.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSON_Base64.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\libJSON.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\json.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="modules\langpack\lpservices.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters index dc7c13a2f5..7ad69a897d 100644 --- a/src/miranda32_10.vcxproj.filters +++ b/src/miranda32_10.vcxproj.filters @@ -64,9 +64,6 @@ <Filter Include="Resources">
<UniqueIdentifier>{dcc9b0d7-b335-458b-ac09-6cc6cf55e397}</UniqueIdentifier>
</Filter>
- <Filter Include="Modules\json">
- <UniqueIdentifier>{8aad13dd-0e8d-4154-ad6f-913724b5a499}</UniqueIdentifier>
- </Filter>
<Filter Include="Modules\crypt">
<UniqueIdentifier>{15d84b6a-4aa3-4cd5-93b3-2559709224ea}</UniqueIdentifier>
</Filter>
@@ -219,39 +216,6 @@ <ClInclude Include="modules\skin\skin.h">
<Filter>Modules\skin</Filter>
</ClInclude>
- <ClInclude Include="modules\json\internalJSONNode.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSON_Base64.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONChildren.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONDebug.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONDefs.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONMemory.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONNode.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONOptions.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONWorker.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\libJSON.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\NumberToString.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
<ClInclude Include="..\include\m_json.h">
<Filter>SDK</Filter>
</ClInclude>
@@ -536,42 +500,6 @@ <ClCompile Include="modules\icolib\skin2opts.cpp">
<Filter>Modules\icolib</Filter>
</ClCompile>
- <ClCompile Include="modules\json\internalJSONNode.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSON_Base64.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONChildren.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONDebug.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONIterators.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONMemory.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode_Mutex.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWorker.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWriter.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\libJSON.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\json.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
<ClCompile Include="modules\utils\utils.cpp">
<Filter>Modules\utils</Filter>
</ClCompile>
diff --git a/src/miranda32_11.vcxproj b/src/miranda32_11.vcxproj index 193a311044..973d7d78e5 100644 --- a/src/miranda32_11.vcxproj +++ b/src/miranda32_11.vcxproj @@ -252,17 +252,6 @@ <ClInclude Include="modules\extraicons\extraicons.h" />
<ClInclude Include="modules\extraicons\usedIcons.h" />
<ClInclude Include="modules\findadd\findadd.h" />
- <ClInclude Include="modules\json\internalJSONNode.h" />
- <ClInclude Include="modules\json\JSONChildren.h" />
- <ClInclude Include="modules\json\JSONDebug.h" />
- <ClInclude Include="modules\json\JSONDefs.h" />
- <ClInclude Include="modules\json\JSONMemory.h" />
- <ClInclude Include="modules\json\JSONNode.h" />
- <ClInclude Include="modules\json\JSONOptions.h" />
- <ClInclude Include="modules\json\JSONWorker.h" />
- <ClInclude Include="modules\json\JSON_Base64.h" />
- <ClInclude Include="modules\json\libJSON.h" />
- <ClInclude Include="modules\json\NumberToString.h" />
<ClInclude Include="modules\netlib\netlib.h" />
<ClInclude Include="modules\options\filter.h" />
<ClInclude Include="..\include\m_protoint.h" />
@@ -351,42 +340,6 @@ <ClCompile Include="modules\ignore\ignore.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
- <ClCompile Include="modules\json\internalJSONNode.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONChildren.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONDebug.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONIterators.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONMemory.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode_Mutex.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWorker.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWriter.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\JSON_Base64.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\libJSON.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClCompile Include="modules\json\json.cpp">
- <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="modules\langpack\lpservices.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_11.vcxproj.filters b/src/miranda32_11.vcxproj.filters index 3c18a8dbd9..6c47635b13 100644 --- a/src/miranda32_11.vcxproj.filters +++ b/src/miranda32_11.vcxproj.filters @@ -64,9 +64,6 @@ <Filter Include="Resources">
<UniqueIdentifier>{dcc9b0d7-b335-458b-ac09-6cc6cf55e397}</UniqueIdentifier>
</Filter>
- <Filter Include="Modules\json">
- <UniqueIdentifier>{8aad13dd-0e8d-4154-ad6f-913724b5a499}</UniqueIdentifier>
- </Filter>
<Filter Include="Modules\crypt">
<UniqueIdentifier>{15d84b6a-4aa3-4cd5-93b3-2559709224ea}</UniqueIdentifier>
</Filter>
@@ -219,39 +216,6 @@ <ClInclude Include="modules\skin\skin.h">
<Filter>Modules\skin</Filter>
</ClInclude>
- <ClInclude Include="modules\json\internalJSONNode.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSON_Base64.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONChildren.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONDebug.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONDefs.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONMemory.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONNode.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONOptions.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\JSONWorker.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\libJSON.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
- <ClInclude Include="modules\json\NumberToString.h">
- <Filter>Modules\json</Filter>
- </ClInclude>
<ClInclude Include="..\include\m_json.h">
<Filter>SDK</Filter>
</ClInclude>
@@ -536,42 +500,6 @@ <ClCompile Include="modules\icolib\skin2opts.cpp">
<Filter>Modules\icolib</Filter>
</ClCompile>
- <ClCompile Include="modules\json\internalJSONNode.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSON_Base64.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONChildren.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONDebug.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONIterators.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONMemory.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONNode_Mutex.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWorker.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\JSONWriter.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\libJSON.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
- <ClCompile Include="modules\json\json.cpp">
- <Filter>Modules\json</Filter>
- </ClCompile>
<ClCompile Include="modules\utils\utils.cpp">
<Filter>Modules\utils</Filter>
</ClCompile>
diff --git a/src/modules/json/JSON_Base64.cpp b/src/modules/json/JSON_Base64.cpp deleted file mode 100644 index 49b24a8a28..0000000000 --- a/src/modules/json/JSON_Base64.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/*
-
-Miranda IM: the free IM client for Microsoft* Windows*
-
-Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "..\..\core\commonheaders.h"
-
-#include "JSON_Base64.h"
-#include "JSONDefs.h"
-
-#ifdef JSON_BINARY //if this is not needed, don't waste space compiling it
-
-static const json_char * chars64 = JSON_TEXT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
-#ifdef JSON_UNICODE
- static std::string BASE64_EMPTY_STRING;
-#else
- #define BASE64_EMPTY_STRING EMPTY_STRING
-#endif
-
-json_string JSONBase64::json_encode64(const unsigned char * binary, size_t bytes){
- size_t misaligned = bytes % 3;
- size_t aligned = (bytes - misaligned) / 3; //divide by three once and inc is faster than add 3 each time
- json_string result;
- result.reserve((size_t)(((float)bytes) * 1.37f) + 4);
-
- //do all of the ones that are 3 byte aligned
- for (size_t i=0; i < aligned; ++i){
- result += chars64[(binary[0] & 0xFC) >> 2];
- result += chars64[((binary[0] & 0x03) << 4) + ((binary[1] & 0xF0) >> 4)];
- result += chars64[((binary[1] & 0x0F) << 2) + ((binary[2] & 0xC0) >> 6)];
- result += chars64[binary[2] & 0x3F];
- binary += 3;
- }
-
- if (misaligned){
- //copy the rest into a temporary buffer
- unsigned char temp[3];
- for (unsigned int i=0; i < misaligned; ++i){
- temp[i] = *binary++;
- }
- for (unsigned int i = (unsigned int)misaligned; i < 3; ++i){
- temp[i] = '\0';
- }
-
- //now do the final three bytes
- result += chars64[(temp[0] & 0xFC) >> 2];
- result += chars64[((temp[0] & 0x03) << 4) + ((temp[1] & 0xF0) >> 4)];
- if (misaligned == 2){
- result += chars64[((temp[1] & 0x0F) << 2) + ((temp[2] & 0xC0) >> 6)];
- result += JSON_TEXT('=');
- } else {
- result += JSON_TEXT(" = = ");
- }
- }
- JSON_ASSERT((size_t)(((float)bytes) * 1.37f) + 4 >= result.length(), JSON_TEXT("Didn't reserve enough space for a one-time go"));
- return result;
-}
-
-inline json_char toBinary(json_char c){
- if (c == JSON_TEXT('+')) {
- return JSON_TEXT('>');
- } else if (c == JSON_TEXT('/')) {
- return JSON_TEXT('?');
- } else if (c < JSON_TEXT(':')) {
- return c + JSON_TEXT('\x04');
- } else if (c < JSON_TEXT('[')) {
- return c - JSON_TEXT('\x41');
- }
- return c - 71;
-}
-
-/*
- Must be a std::string because it's binary, and chars must be 1 byte
- */
-std::string JSONBase64::json_decode64(const json_string & encoded){
- const size_t length = encoded.length();
- #if defined JSON_DEBUG || defined JSON_SAFE
- size_t pos = encoded.find_first_not_of(chars64);
- if (pos != json_string::npos){
- JSON_ASSERT_SAFE(encoded[pos] == JSON_TEXT('='), JSON_TEXT("Not Base64"), return BASE64_EMPTY_STRING;);
- if (pos != length - 1){
- JSON_ASSERT_SAFE(pos == length - 2, JSON_TEXT("Not Base64"), return BASE64_EMPTY_STRING;);
- JSON_ASSERT_SAFE(encoded[pos + 1] == JSON_TEXT('='), JSON_TEXT("Not Base64"), return BASE64_EMPTY_STRING;);
- }
- }
- #endif
- const json_char * runner = encoded.c_str();
- size_t aligned = length / 4; //don't do the last ones as they might be = padding
- std::string result;
- if (aligned){
- --aligned;
- result.reserve((size_t)((float)length / 1.37) + 1);
-
- //first do the ones that can not have any padding
- for (unsigned int i=0; i < aligned; ++i){
- const json_char second = toBinary(runner[1]);
- const json_char third = toBinary(runner[2]);
- result += (toBinary(runner[0]) << 2) + ((second & 0x30) >> 4);
- result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2);
- result += ((third & 0x3) << 6) + toBinary(runner[3]);
- runner += 4;
- }
-
- //now do the ones that might have padding, the first two characters can not be padding, so do them quickly
- const char second = toBinary(runner[1]);
- result += (toBinary(runner[0]) << 2) + ((second & 0x30) >> 4);
- if (runner[2] != '=') { //not two = pads
- const char third = toBinary(runner[2]);
- result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2);
- if (runner[3] != '=') { //no padding
- result += ((third & 0x3) << 6) + toBinary(runner[3]);
- }
- }
- }
- return result;
-}
-
-#endif
diff --git a/src/modules/json/JSON_Base64.h b/src/modules/json/JSON_Base64.h deleted file mode 100644 index 6c14aeb866..0000000000 --- a/src/modules/json/JSON_Base64.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef JSON_BASE64_H
-#define JSON_BASE64_H
-
-#include "JSONDebug.h"
-#ifdef JSON_BINARY //if this is not needed, don't waste space compiling it
-
-class JSONBase64 {
-public:
- static json_string json_encode64(const unsigned char * binary, size_t bytes);
- static std::string json_decode64(const json_string & encoded);
-};
-
-#endif
-#endif
diff --git a/src/modules/json/json.cpp b/src/modules/json/json.cpp deleted file mode 100644 index 267775e4eb..0000000000 --- a/src/modules/json/json.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/*
-
-Miranda IM: the free IM client for Microsoft* Windows*
-
-Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "..\..\core\commonheaders.h"
-#include <m_json.h>
-
-#include "libJSON.h"
-
-///////////////////////////////////////////////////////////////////////////////
-// Interface function
-
-INT_PTR GetInterface(WPARAM wParam, LPARAM lParam)
-{
- LPJSONSERVICEINTERFACE lpJSI = (LPJSONSERVICEINTERFACE)wParam;
- memset(lpJSI,0,sizeof(JSONSERVICEINTERFACE));
-
-#define SETJSI(x) lpJSI->##x = json_##x
- SETJSI(free);
- lpJSI->delete_ = json_delete;
-#ifdef JSON_MEMORY_MANAGE
- SETJSI(free_all);
- SETJSI(delete_all);
-#endif
- SETJSI(parse);
- SETJSI(strip_white_space);
-#ifdef JSON_VALIDATE
- SETJSI(validate);
-#endif
- SETJSI(new_a);
- SETJSI(new_i);
- SETJSI(new_f);
- SETJSI(new_b);
- lpJSI->new_ = json_new;
- SETJSI(copy);
- SETJSI(duplicate);
- SETJSI(set_a);
- SETJSI(set_i);
- SETJSI(set_f);
- SETJSI(set_b);
- SETJSI(set_n);
- SETJSI(type);
- SETJSI(size);
- SETJSI(empty);
- SETJSI(name);
-#ifdef JSON_COMMENTS
- SETJSI(get_comment);
-#endif
- SETJSI(as_string);
- SETJSI(as_int);
- SETJSI(as_float);
- SETJSI(as_bool);
- SETJSI(as_node);
- SETJSI(as_array);
- #ifdef JSON_BINARY
- SETJSI(as_binary);
- #endif
- #ifdef JSON_WRITER
- SETJSI(write);
- SETJSI(write_formatted);
- #endif
- SETJSI(set_name);
- #ifdef JSON_COMMENTS
- SETJSI(set_comment);
- #endif
- SETJSI(clear);
- SETJSI(nullify);
- SETJSI(swap);
- SETJSI(merge);
- #ifndef JSON_PREPARSE
- SETJSI(preparse);
- #endif
- #ifdef JSON_BINARY
- SETJSI(set_binary);
- #endif
- SETJSI(cast);
-
- //children access
- SETJSI(reserve);
- SETJSI(at);
- SETJSI(get);
- #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
- SETJSI(get_nocase);
- SETJSI(pop_back_nocase);
- #endif
- SETJSI(push_back);
- SETJSI(pop_back_at);
- SETJSI(pop_back);
- #ifdef JSON_ITERATORS
- SETJSI(find);
- #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
- SETJSI(find_nocase);
- #endif
- SETJSI(erase);
- SETJSI(erase_multi);
- SETJSI(insert);
- SETJSI(insert_multi);
-
- //iterator functions
- SETJSI(begin);
- SETJSI(end);
- #endif
-
- SETJSI(equal);
-
- return 0;
-}
-
-int InitJson()
-{
- CreateServiceFunction(MS_JSON_GETINTERFACE,GetInterface);
-
- json_register_memory_callbacks((json_malloc_t)mir_alloc,(json_realloc_t)mir_realloc,(json_free_t)mir_free);
- return 0;
-}
diff --git a/src/modules/json/libJSON.cpp b/src/modules/json/libJSON.cpp deleted file mode 100644 index 44ccefa616..0000000000 --- a/src/modules/json/libJSON.cpp +++ /dev/null @@ -1,505 +0,0 @@ -/*
-
-Miranda IM: the free IM client for Microsoft* Windows*
-
-Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "..\..\core\commonheaders.h"
-
-#include "libJSON.h"
-
-/*
- This is the implementation of the C interface to libJSON
- This file may be included in any C++ application, but it will
- be completely ignored if JSON_LIBRARY isn't defined. The
- only reason JSON_LIBRARY should be defined is when compiling libJSON
- as a library
-*/
-
-#ifdef JSON_LIBRARY
-
- #include "JSONNode.h"
- #include "JSONWorker.h"
- #include <stdexcept> //some methods throw exceptions
- #ifdef JSON_MEMORY_MANAGE
- auto_expand StringHandler;
- auto_expand_node NodeHandler;
- #define MANAGER_INSERT(x) NodeHandler.insert(x)
- #else
- #define MANAGER_INSERT(x) x
- #endif
-
- #ifdef JSON_SAFE
- static const json_char * EMPTY_CSTRING = JSON_TEXT("");
- #endif
-
- inline json_char * toCString(const json_string & str){
- const size_t len((str.length() + 1) * sizeof(json_char));
- #ifdef JSON_MEMORY_MANAGE
- return (json_char *)StringHandler.insert(memcpy(json_malloc<json_char>(len), str.c_str(), len));
- #else
- return (json_char *)memcpy(json_malloc<json_char>(len), str.c_str(), len);
- #endif
- }
-
- /*
- stuff that's in namespace libJSON
- */
- void json_free(void * str){
- JSON_ASSERT_SAFE(str, JSON_TEXT("freeing null ptr"), return;);
- #ifdef JSON_MEMORY_MANAGE
- StringHandler.remove(str);
- #endif
- libjson_free<void>(str);
- }
-
- void json_delete(JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("deleting null ptr"), return;);
- #ifdef JSON_MEMORY_MANAGE
- NodeHandler.remove(node);
- #endif
- JSONNode::deleteJSONNode((JSONNode *)node);
- }
-
- #ifdef JSON_MEMORY_MANAGE
- void json_free_all(void){
- StringHandler.clear();
- }
-
- void json_delete_all(void){
- NodeHandler.clear();
- }
- #endif
-
- JSONNODE * json_parse(const json_char * json){
- JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_parse"), return 0;);
- try {
- //use this constructor to simply copy reference instead of copying the temp
- return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(JSONWorker::parse(json)));
- } catch (std::invalid_argument){}
- return 0;
- }
-
- json_char * json_strip_white_space(const json_char * json){
- JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_strip_white_space"), return 0;);
- return toCString(JSONWorker::RemoveWhiteSpaceAndComments(json));
- }
-
- #ifdef JSON_VALIDATE
- JSONNODE * json_validate(const json_char * json){
- JSON_ASSERT_SAFE(json, JSON_TEXT("null ptr to json_validate"), return 0;);
- try {
- //use this constructor to simply copy reference instead of copying the temp
- return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(JSONWorker::validate(json)));
- } catch (std::invalid_argument){}
- return 0;
- }
- #endif
-
- #if defined JSON_DEBUG && !defined JSON_STDERROR
- //When libjson errors, a callback allows the user to know what went wrong
- void json_register_debug_callback(json_error_callback_t callback){
- JSONDebug::register_callback(callback);
- }
- #endif
-
- #ifdef JSON_MUTEX_CALLBACKS
- #ifdef JSON_MUTEX_MANAGE
- void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock){
- JSONNode::register_mutex_callbacks(lock, unlock, manager_lock);
- JSONNode::register_mutex_destructor(destroy);
- }
-
- #else
- void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock){
- JSONNode::register_mutex_callbacks(lock, unlock, manager_lock);
- }
- #endif
-
- void json_set_global_mutex(void * mutex){
- JSONNode::set_global_mutex(mutex);
- }
-
- void json_set_mutex(JSONNODE * node, void * mutex){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_mutex"), return;);
- ((JSONNode*)node) -> set_mutex(mutex);
- }
-
- void json_lock(JSONNODE * node, int threadid){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_lock"), return;);
- ((JSONNode*)node) -> lock(threadid);
- }
-
- void json_unlock(JSONNODE * node, int threadid){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_unlock"), return;);
- ((JSONNode*)node) -> unlock(threadid);
- }
- #endif
-
- #ifdef JSON_MEMORY_CALLBACKS
- void json_register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre){
- JSONMemory::registerMemoryCallbacks(mal, real, fre);
- }
- #endif
-
-
- /*
- stuff that's in class JSONNode
- */
- //ctors
- JSONNODE * json_new_a(const json_char * name, const json_char * value){
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_a"), name = EMPTY_CSTRING;);
- JSON_ASSERT_SAFE(value, JSON_TEXT("null value to json_new_a"), value = EMPTY_CSTRING;);
- #ifdef JSON_MEMORY_CALLBACKS
- return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, json_string(value)));
- #else
- return MANAGER_INSERT(new JSONNode(name, json_string(value)));
- #endif
- }
-
- JSONNODE * json_new_i(const json_char * name, long value){
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_i"), name = EMPTY_CSTRING;);
- #ifdef JSON_MEMORY_CALLBACKS
- return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value));
- #else
- return MANAGER_INSERT(new JSONNode(name, value));
- #endif
- }
-
- JSONNODE * json_new_f(const json_char * name, json_number value){
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_f"), name = EMPTY_CSTRING;);
- #ifdef JSON_MEMORY_CALLBACKS
- return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value));
- #else
- return MANAGER_INSERT(new JSONNode(name, value));
- #endif
- }
-
- JSONNODE * json_new_b(const json_char * name, int value){
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_new_b"), name = EMPTY_CSTRING;);
- #ifdef JSON_MEMORY_CALLBACKS
- return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(name, value != 0 ));
- #else
- return MANAGER_INSERT(new JSONNode(name, (bool)value)) != 0;
- #endif
- }
-
- JSONNODE * json_new(char type){
- #ifdef JSON_MEMORY_CALLBACKS
- return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(type));
- #else
- return MANAGER_INSERT(new JSONNode(type));
- #endif
- }
-
- JSONNODE * json_copy(const JSONNODE * orig){
- JSON_ASSERT_SAFE(orig, JSON_TEXT("null orig to json_copy"), return 0;);
- #ifdef JSON_MEMORY_CALLBACKS
- return MANAGER_INSERT(new(json_malloc<JSONNode>(1)) JSONNode(*((JSONNode*)orig)));
- #else
- return MANAGER_INSERT(new JSONNode(*((JSONNode*)orig)));
- #endif
- }
-
- JSONNODE * json_duplicate(const JSONNODE * orig){
- JSON_ASSERT_SAFE(orig, JSON_TEXT("null orig to json_duplicate"), return 0;);
- return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)orig) -> duplicate()));
- }
-
- //assignment
- void json_set_a(JSONNODE * node, const json_char * value){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_a"), return;);
- JSON_ASSERT_SAFE(value, JSON_TEXT("null value to json_set_a"), value = EMPTY_CSTRING;);
- *((JSONNode*)node) = json_string(value);
- }
-
- void json_set_i(JSONNODE * node, long value){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_i"), return;);
- *((JSONNode*)node) = value;
- }
-
- void json_set_f(JSONNODE * node, json_number value){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_f"), return;);
- *((JSONNode*)node) = value;
- }
-
- void json_set_b(JSONNODE * node, int value){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_b"), return;);
- *((JSONNode*)node) = value != 0;
- }
-
- void json_set_n(JSONNODE * node, const JSONNODE * orig){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_n"), return;);
- JSON_ASSERT_SAFE(orig, JSON_TEXT("null node to json_set_n"), return;);
- *((JSONNode*)node) = *((JSONNode*)orig);
- }
-
- //inspectors
- char json_type(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_type"), return JSON_NULL;);
- return ((JSONNode*)node) -> type();
- }
-
- json_index_t json_size(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_size"), return 0;);
- return ((JSONNode*)node) -> size();
- }
-
- int json_empty(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_empty"), return true;);
- return (int)(((JSONNode*)node) -> empty());
- }
-
- json_char * json_name(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_name"), return toCString(EMPTY_CSTRING););
- return toCString(((JSONNode*)node) -> name());
- }
-
- #ifdef JSON_COMMENTS
- json_char * json_get_comment(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_get_comment"), return toCString(EMPTY_CSTRING););
- return toCString(((JSONNode*)node) -> get_comment());
- }
- #endif
-
- json_char * json_as_string(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_string"), return toCString(EMPTY_CSTRING););
- return toCString(((JSONNode*)node) -> as_string());
- }
-
- long json_as_int(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_int"), return 0;);
- return ((JSONNode*)node) -> as_int();
- }
-
- json_number json_as_float(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_float"), return 0.0;);
- return ((JSONNode*)node) -> as_float();
- }
-
- int json_as_bool(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_bool"), return false;);
- return (int)(((JSONNode*)node) -> as_bool());
- }
-
- JSONNODE * json_as_node(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_node"), return 0;);
- return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)node) -> as_node()));
- }
-
- JSONNODE * json_as_array(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_array"), return 0;);
- return MANAGER_INSERT(JSONNode::newJSONNode_Shallow(((JSONNode*)node) -> as_array()));
- }
-
- #ifdef JSON_BINARY
- void * json_as_binary(const JSONNODE * node, unsigned long * size){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_as_binary"), if (size){*size = 0;} return 0;);
- const std::string result = ((JSONNode*)node) -> as_binary();
- const size_t len = result.length();
- if (size) *size = len;
- #ifdef JSON_SAFE
- if (result.empty()) return 0;
- #endif
- #ifdef JSON_MEMORY_MANAGE
- return StringHandler.insert(memcpy(json_malloc<char>(len), result.data(), len));
- #else
- return memcpy(json_malloc<char>(len), result.data(), len);
- #endif
- }
- #endif
-
- #ifdef JSON_WRITER
- json_char * json_write(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write"), return toCString(EMPTY_CSTRING););
- return toCString(((JSONNode*)node) -> write());
- }
-
- json_char * json_write_formatted(const JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write_formatted"), return toCString(EMPTY_CSTRING););
- return toCString(((JSONNode*)node) -> write_formatted());
- }
- #endif
-
- //modifiers
- void json_set_name(JSONNODE * node, const json_char * name){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_name"), return;);
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_set_name"), name = EMPTY_CSTRING;);
- ((JSONNode*)node) -> set_name(name);
- }
-
- #ifdef JSON_COMMENTS
- void json_set_comment(JSONNODE * node, const json_char * comment){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_set_comment"), return;);
- JSON_ASSERT_SAFE(comment, JSON_TEXT("null name to json_set_comment"), comment = EMPTY_CSTRING;);
- ((JSONNode*)node) -> set_comment(comment);
- }
- #endif
-
- void json_clear(JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_clear"), return;);
- ((JSONNode*)node) -> clear();
- }
-
- void json_nullify(JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_nullify"), return;);
- ((JSONNode*)node) -> nullify();
- }
-
- void json_swap(JSONNODE * node, JSONNODE * node2){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_swap"), return;);
- JSON_ASSERT_SAFE(node2, JSON_TEXT("null node to json_swap"), return;);
- ((JSONNode*)node) -> swap(*(JSONNode*)node2);
- }
-
- void json_merge(JSONNODE * node, JSONNODE * node2){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_merge"), return;);
- JSON_ASSERT_SAFE(node2, JSON_TEXT("null node to json_merge"), return;);
- ((JSONNode*)node) -> merge(*(JSONNode*)node2);
- }
-
- #ifndef JSON_PREPARSE
- void json_preparse(JSONNODE * node){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_preparse"), return;);
- ((JSONNode*)node) -> preparse();
- }
- #endif
-
- #ifdef JSON_BINARY
- void json_set_binary(JSONNODE * node, const void * data, unsigned long length){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_swap"), return;);
- JSON_ASSERT_SAFE(data, JSON_TEXT("null data to json_set_binary"), *((JSONNode*)node) = EMPTY_CSTRING; return;);
- ((JSONNode*)node) -> set_binary((unsigned char *)data, length);
- }
- #endif
-
- void json_cast(JSONNODE * node, char type){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_cast"), return;);
- ((JSONNode*)node) -> cast(type);
- }
-
- //children access
- void json_reserve(JSONNODE * node, json_index_t siz){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_reserve"), return;);
- ((JSONNode*)node) -> reserve(siz);
- }
-
- JSONNODE * json_at(JSONNODE * node, unsigned int pos){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_at"), return 0;);
- try {
- return &((JSONNode*)node) -> at(pos);
- } catch (std::out_of_range){}
- return 0;
- }
-
- JSONNODE * json_get(JSONNODE * node, const json_char * name){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_get"), return 0;);
- JSON_ASSERT_SAFE(name, JSON_TEXT("null node to json_get. Did you mean to use json_at?"), return 0;);
- try {
- return &((JSONNode*)node) -> at(name);
- } catch (std::out_of_range){}
- return 0;
- }
-
- #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
- JSONNODE * json_get_nocase(JSONNODE * node, const json_char * name){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_at_nocase"), return 0;);
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_at_nocase"), return 0;);
- try {
- return &((JSONNode*)node) -> at_nocase(name);
- } catch (std::out_of_range){}
- return 0;
- }
-
- JSONNODE * json_pop_back_nocase(JSONNODE * node, const json_char * name){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_nocase"), return 0;);
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back_nocase"), return 0;);
- return MANAGER_INSERT(((JSONNode*)node) -> pop_back_nocase(name));
- }
- #endif
-
- void json_push_back(JSONNODE * node, JSONNODE * node2){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_push_back"), return;);
- JSON_ASSERT_SAFE(node2, JSON_TEXT("null node2 to json_push_back"), return;);
- #ifdef JSON_MEMORY_MANAGE
- NodeHandler.remove(node2);
- #endif
- ((JSONNode*)node) -> push_back((JSONNode*)node2);
- }
-
- JSONNODE * json_pop_back_at(JSONNODE * node, unsigned int pos){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_i"), return 0;);
- return MANAGER_INSERT(((JSONNode*)node) -> pop_back(pos));
- }
-
- JSONNODE * json_pop_back(JSONNODE * node, const json_char * name){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back"), return 0;);
- JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back. Did you mean to use json_pop_back_at?"), return 0;);
- return MANAGER_INSERT(((JSONNode*)node) -> pop_back(name));
- }
-
- #ifdef JSON_ITERATORS
- JSONNODE_ITERATOR json_find(JSONNODE * node, const json_char * name){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> find(name));
- }
-
- #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
- JSONNODE_ITERATOR json_find_nocase(JSONNODE * node, const json_char * name){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> find_nocase(name));
- }
- #endif
-
- JSONNODE_ITERATOR json_erase(JSONNODE * node, JSONNODE_ITERATOR it){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> erase((JSONNode**)it));
- }
-
- JSONNODE_ITERATOR json_erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> erase((JSONNode**)start, (JSONNode**)end));
- }
-
- JSONNODE_ITERATOR json_insert(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2){
- #ifdef JSON_MEMORY_MANAGE
- NodeHandler.remove(node2);
- #endif
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> insert((JSONNode**)it, (JSONNode*)node2));
- }
-
- JSONNODE_ITERATOR json_insert_multi(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> insert((JSONNode**)it, (JSONNode**)start, (JSONNode**)end));
- }
-
- //iterator functions
- JSONNODE_ITERATOR json_begin(JSONNODE * node){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> begin());
- }
-
- JSONNODE_ITERATOR json_end(JSONNODE * node){
- return (JSONNODE_ITERATOR)(((JSONNode*)node) -> end());
- }
- #endif
-
- //comparison
- int json_equal(JSONNODE * node, JSONNODE * node2){
- JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_equal"), return false;);
- JSON_ASSERT_SAFE(node2, JSON_TEXT("null node2 to json_equal"), return false;);
- return (int)(*((JSONNode*)node) == *((JSONNode*)node2));
- }
-
-#endif //JSON_LIBRARY
diff --git a/src/modules/json/libJSON.h b/src/modules/json/libJSON.h deleted file mode 100644 index d552e71720..0000000000 --- a/src/modules/json/libJSON.h +++ /dev/null @@ -1,211 +0,0 @@ -#ifndef LIBJSON_H
-#define LIBJSON_H
-
-#include "JSONDefs.h" //for typedefs of functions, strings, and nodes
-
-#ifdef _STATIC
-#define LIBJSON_DLL
-#elif LIBJSON_EXPORTS
-#define LIBJSON_DLL _declspec(dllexport)
-#else
-#define LIBJSON_DLL _declspec(dllimport)
-#endif
-
-/*
- This is the C interface to libJSON.
-
- This file also declares various things that are needed for
- C++ programming
-*/
-
-#ifdef JSON_LIBRARY //compiling the library, hide the interface
- #ifdef __cplusplus
- #ifdef JSON_UNIT_TEST
- #include "JSONNode.h"
- #endif
- extern "C" {
- #endif
-
- /*
- stuff that's in namespace libJSON
- */
- LIBJSON_DLL void json_free(void * str);
- LIBJSON_DLL void json_delete(JSONNODE * node);
- #ifdef JSON_MEMORY_MANAGE
- LIBJSON_DLL void json_free_all(void);
- LIBJSON_DLL void json_delete_all(void);
- #endif
- LIBJSON_DLL JSONNODE * json_parse(const json_char * json);
- LIBJSON_DLL json_char * json_strip_white_space(const json_char * json);
- #ifdef JSON_VALIDATE
- LIBJSON_DLL JSONNODE * json_validate(const json_char * json);
- #endif
- #if defined JSON_DEBUG && !defined JSON_STDERROR
- //When libjson errors, a callback allows the user to know what went wrong
- LIBJSON_DLL void json_register_debug_callback(json_error_callback_t callback);
- #endif
- #ifdef JSON_MUTEX_CALLBACKS
- #ifdef JSON_MUTEX_MANAGE
- LIBJSON_DLL void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock);
- #else
- LIBJSON_DLL void json_register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock);
- #endif
- LIBJSON_DLL void json_set_global_mutex(void * mutex);
- LIBJSON_DLL void json_set_mutex(JSONNODE * node, void * mutex);
- LIBJSON_DLL void json_lock(JSONNODE * node, int threadid);
- LIBJSON_DLL void json_unlock(JSONNODE * node, int threadid);
- #endif
- #ifdef JSON_MEMORY_CALLBACKS
- LIBJSON_DLL void json_register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre);
- #endif
-
- /*
- stuff that's in class JSONNode
- */
- //ctors
- LIBJSON_DLL JSONNODE * json_new_a(const json_char * name, const json_char * value);
- LIBJSON_DLL JSONNODE * json_new_i(const json_char * name, long value);
- LIBJSON_DLL JSONNODE * json_new_f(const json_char * name, json_number value);
- LIBJSON_DLL JSONNODE * json_new_b(const json_char * name, int value); //because C bools are ints and C++ will implicitly cast it
- LIBJSON_DLL JSONNODE * json_new(char type);
- LIBJSON_DLL JSONNODE * json_copy(const JSONNODE * orig);
- LIBJSON_DLL JSONNODE * json_duplicate(const JSONNODE * orig);
-
- //assignment
- LIBJSON_DLL void json_set_a(JSONNODE * node, const json_char * value);
- LIBJSON_DLL void json_set_i(JSONNODE * node, long value);
- LIBJSON_DLL void json_set_f(JSONNODE * node, json_number value);
- LIBJSON_DLL void json_set_b(JSONNODE * node, int value); //because C bools are ints ane C++ will implicit
- LIBJSON_DLL void json_set_n(JSONNODE * node, const JSONNODE * orig);
-
- //inspectors
- LIBJSON_DLL char json_type(const JSONNODE * node);
- LIBJSON_DLL json_index_t json_size(const JSONNODE * node);
- LIBJSON_DLL int json_empty(const JSONNODE * node);
- LIBJSON_DLL json_char * json_name(const JSONNODE * node);
- #ifdef JSON_COMMENTS
- LIBJSON_DLL json_char * json_get_comment(const JSONNODE * node);
- #endif
- LIBJSON_DLL json_char * json_as_string(const JSONNODE * node);
- LIBJSON_DLL long json_as_int(const JSONNODE * node);
- LIBJSON_DLL json_number json_as_float(const JSONNODE * node);
- LIBJSON_DLL int json_as_bool(const JSONNODE * node);
- LIBJSON_DLL JSONNODE * json_as_node(const JSONNODE * node);
- LIBJSON_DLL JSONNODE * json_as_array(const JSONNODE * node);
- #ifdef JSON_BINARY
- LIBJSON_DLL void * json_as_binary(const JSONNODE * node, unsigned long * size);
- #endif
- #ifdef JSON_WRITER
- LIBJSON_DLL json_char * json_write(const JSONNODE * node);
- LIBJSON_DLL json_char * json_write_formatted(const JSONNODE * node);
- #endif
-
- //modifiers
- LIBJSON_DLL void json_set_name(JSONNODE * node, const json_char * name);
- #ifdef JSON_COMMENTS
- LIBJSON_DLL void json_set_comment(JSONNODE * node, const json_char * comment);
- #endif
- LIBJSON_DLL void json_clear(JSONNODE * node);
- LIBJSON_DLL void json_nullify(JSONNODE * node);
- LIBJSON_DLL void json_swap(JSONNODE * node, JSONNODE * node2);
- LIBJSON_DLL void json_merge(JSONNODE * node, JSONNODE * node2);
- #ifndef JSON_PREPARSE
- LIBJSON_DLL void json_preparse(JSONNODE * node);
- #endif
- #ifdef JSON_BINARY
- LIBJSON_DLL void json_set_binary(JSONNODE * node, const void * data, unsigned long length);
- #endif
- LIBJSON_DLL void json_cast(JSONNODE * node, char type);
-
- //children access
- LIBJSON_DLL void json_reserve(JSONNODE * node, json_index_t siz);
- LIBJSON_DLL JSONNODE * json_at(JSONNODE * node, json_index_t pos);
- LIBJSON_DLL JSONNODE * json_get(JSONNODE * node, const json_char * name);
- #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
- LIBJSON_DLL JSONNODE * json_get_nocase(JSONNODE * node, const json_char * name);
- LIBJSON_DLL JSONNODE * json_pop_back_nocase(JSONNODE * node, const json_char * name);
- #endif
- LIBJSON_DLL void json_push_back(JSONNODE * node, JSONNODE * node2);
- LIBJSON_DLL JSONNODE * json_pop_back_at(JSONNODE * node, json_index_t pos);
- LIBJSON_DLL JSONNODE * json_pop_back(JSONNODE * node, const json_char * name);
- #ifdef JSON_ITERATORS
- LIBJSON_DLL JSONNODE_ITERATOR json_find(JSONNODE * node, const json_char * name);
- #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
- LIBJSON_DLL JSONNODE_ITERATOR json_find_nocase(JSONNODE * node, const json_char * name);
- #endif
- LIBJSON_DLL JSONNODE_ITERATOR json_erase(JSONNODE * node, JSONNODE_ITERATOR it);
- LIBJSON_DLL JSONNODE_ITERATOR json_erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end);
- LIBJSON_DLL JSONNODE_ITERATOR json_insert(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2);
- LIBJSON_DLL JSONNODE_ITERATOR json_insert_multi(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end);
-
- //iterator functions
- LIBJSON_DLL JSONNODE_ITERATOR json_begin(JSONNODE * node);
- LIBJSON_DLL JSONNODE_ITERATOR json_end(JSONNODE * node);
- #endif
-
- //comparison
- LIBJSON_DLL int json_equal(JSONNODE * node, JSONNODE * node2);
-
- #ifdef __cplusplus
- }
- #endif
-#else
- #ifndef __cplusplus
- #error Using the non-library requires C++
- #endif
- #include "JSONNode.h" //not used in this file, but libJSON.h should be the only file required to use it embedded
- #include "JSONWorker.h"
- #include <stdexcept> //some methods throw exceptions
-
- namespace libJSON {
- //if json is invalid, it throws a std::invalid_argument exception
- inline static JSONNode parse(const json_string & json){
- return JSONWorker::parse(json);
- }
-
- //useful if you have json that you don't want to parse, just want to strip to cut down on space
- inline static json_string strip_white_space(const json_string & json){
- return JSONWorker::RemoveWhiteSpaceAndComments(json);
- }
-
- //if json is invalid, it throws a std::invalid_argument exception (differs from parse because this checks the entire tree)
- #ifdef JSON_VALIDATE
- inline static JSONNode validate(const json_string & json){
- return JSONWorker::validate(json);
- }
- #endif
-
- //When libjson errors, a callback allows the user to know what went wrong
- #if defined JSON_DEBUG && !defined JSON_STDERROR
- inline static void register_debug_callback(json_error_callback_t callback){
- JSONDebug::register_callback(callback);
- }
- #endif
-
- #ifdef JSON_MUTEX_CALLBACKS
- #ifdef JSON_MUTEX_MANAGE
- inline static void register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, json_mutex_callback_t destroy, void * manager_lock){
- JSONNode::register_mutex_callbacks(lock, unlock, manager_lock);
- JSONNode::register_mutex_destructor(destroy);
- }
- #else
- inline static void register_mutex_callbacks(json_mutex_callback_t lock, json_mutex_callback_t unlock, void * manager_lock){
- SONNode::register_mutex_callbacks(lock, unlock, manager_lock);
- }
- #endif
-
- inline static void set_global_mutex(void * mutex){
- JSONNode::set_global_mutex(mutex);
- }
- #endif
-
- #ifdef JSON_MEMORY_CALLBACKS
- inline static void register_memory_callbacks(json_malloc_t mal, json_realloc_t real, json_free_t fre){
- JSONMemory::registerMemoryCallbacks(mal, real, fre);
- }
- #endif
-
- }
-#endif //JSON_LIBRARY
-
-#endif //LIBJSON_H
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 5d0813c483..9807d18278 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -32,7 +32,6 @@ int InitPathUtils(void); void FreeWindowList(void);
int InitHyperlink(void);
int InitColourPicker(void);
-int InitJson(void);
int InitBitmapFilter(void);
void InitXmlApi(void);
void InitTimeZones(void);
@@ -493,7 +492,6 @@ int LoadUtilsModule(void) InitColourPicker();
InitBitmapFilter();
InitXmlApi();
- InitJson();
InitTimeZones();
InitCrypt();
return 0;
|