summaryrefslogtreecommitdiff
path: root/include/m_json.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-16 08:07:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-16 08:07:27 +0000
commit0757c5684dc44f76308199954eca7ced4e9189b3 (patch)
tree237432394d4c057b217b083248572feadc9d336a /include/m_json.h
parentb4683d6856632c4fac0ad54b0b1e692661a41bca (diff)
libson separated from mir_core and moved to libs\
git-svn-id: http://svn.miranda-ng.org/main/trunk@14187 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_json.h')
-rw-r--r--include/m_json.h125
1 files changed, 68 insertions, 57 deletions
diff --git a/include/m_json.h b/include/m_json.h
index 63980ab4e0..c0116d3957 100644
--- a/include/m_json.h
+++ b/include/m_json.h
@@ -29,118 +29,129 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma warning(disable:4190)
+#ifdef LIBJSON_EXPORTS
+#define LIBJSON_EXPORT __declspec(dllexport)
+#else
+#define LIBJSON_EXPORT __declspec(dllimport)
+#endif
+
+#define LIBJSON_DLL(T) LIBJSON_EXPORT T __stdcall
+
#ifdef __cplusplus
-#include "../src/mir_core/src/json/JSONNode.h"
-typedef JSONNode JSONNODE;
+#include "../libs/libjson/src/JSONNode.h"
extern "C"
{
#else
-typedef void JSONNODE;
+typedef void JSONNode;
#endif
-MIR_CORE_DLL(void) json_free(void *str);
-MIR_CORE_DLL(void) json_delete(JSONNODE *node);
+LIBJSON_DLL(void) json_free(void *str);
+LIBJSON_DLL(void) json_delete(JSONNode *node);
-MIR_CORE_DLL(JSONNODE*) json_parse(const char *json);
-MIR_CORE_DLL(TCHAR*) json_strip_white_space(const char *json);
+LIBJSON_DLL(JSONNode*) json_parse(const char *json);
+LIBJSON_DLL(TCHAR*) json_strip_white_space(const char *json);
#ifdef JSON_VALIDATE
- MIR_CORE_DLL(JSONNODE*) json_validate(const char *json);
+ LIBJSON_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);
+LIBJSON_DLL(JSONNode*) json_new_a(const char *name, const char *value);
+LIBJSON_DLL(JSONNode*) json_new_i(const char *name, long value);
+LIBJSON_DLL(JSONNode*) json_new_f(const char *name, double value);
+LIBJSON_DLL(JSONNode*) json_new_b(const 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
-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);
+LIBJSON_DLL(void) json_set_a(JSONNode *node, const char *value);
+LIBJSON_DLL(void) json_set_i(JSONNode *node, long value);
+LIBJSON_DLL(void) json_set_f(JSONNode *node, double 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
-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(const char*) json_name(const JSONNODE *node);
+LIBJSON_DLL(char) json_type(const JSONNode *node);
+LIBJSON_DLL(size_t) json_size(const JSONNode *node);
+LIBJSON_DLL(int) json_empty(const JSONNode *node);
+LIBJSON_DLL(const char*) json_name(const JSONNode *node);
#ifdef JSON_COMMENTS
- MIR_CORE_DLL(char * json_get_comment(const JSONNODE *node);
+ LIBJSON_DLL(char * json_get_comment(const JSONNode *node);
#endif
-MIR_CORE_DLL(TCHAR*) 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);
+LIBJSON_DLL(TCHAR*) json_as_string(const JSONNode *node);
+LIBJSON_DLL(long) json_as_int(const JSONNode *node);
+LIBJSON_DLL(double) 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);
-MIR_CORE_DLL(TCHAR*) json_write(const JSONNODE *node);
-MIR_CORE_DLL(TCHAR*) json_write_formatted(const JSONNODE *node);
+LIBJSON_DLL(TCHAR*) json_write(const JSONNode *node);
+LIBJSON_DLL(TCHAR*) json_write_formatted(const JSONNode *node);
//modifiers
-MIR_CORE_DLL(void) json_set_name(JSONNODE *node, const char *name);
+LIBJSON_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);
+ LIBJSON_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);
+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
- MIR_CORE_DLL(void) json_preparse(JSONNODE *node);
+ LIBJSON_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);
+ LIBJSON_DLL(void) json_set_binary(JSONNode *node, const void * data, unsigned long length);
#endif
-MIR_CORE_DLL(void) json_cast(JSONNODE *node, char type);
+LIBJSON_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);
+LIBJSON_DLL(void) json_reserve(JSONNode *node, size_t siz);
+LIBJSON_DLL(JSONNode*) json_at(JSONNode *node, size_t pos);
+LIBJSON_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);
+ LIBJSON_DLL(JSONNode*) json_get_nocase(JSONNode *node, const char *name);
+ LIBJSON_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);
+LIBJSON_DLL(void) json_push_back(JSONNode *node, JSONNode *node2);
+LIBJSON_DLL(JSONNode*) json_pop_back_at(JSONNode *node, size_t pos);
+LIBJSON_DLL(JSONNode*) json_pop_back(JSONNode *node, const char *name);
//comparison
-MIR_CORE_DLL(int) json_equal(JSONNODE *node, JSONNODE *node2);
+LIBJSON_DLL(int) json_equal(JSONNode *node, JSONNode *node2);
#ifdef __cplusplus
class JSONROOT
{
- JSONNODE *m_node;
+ JSONNode *m_node;
public:
__forceinline JSONROOT() { m_node = NULL; }
__forceinline JSONROOT(LPCSTR text) { Parse(text); }
__forceinline ~JSONROOT() { json_delete(m_node); }
- __forceinline operator JSONNODE*() const { return m_node; }
+ __forceinline operator JSONNode*() const { return m_node; }
- __forceinline JSONNODE* Parse(LPCSTR text) { return (m_node = json_parse(text)); }
+ __forceinline JSONNode* Parse(LPCSTR text) { return (m_node = json_parse(text)); }
};
}
-#ifdef _XSTRING_
-MIR_C_CORE_DLL(std::string) json_as_pstring(const JSONNODE *node);
-#endif
+#endif // __cplusplus
+#ifndef LIBJSON_EXPORTS
+ #if !defined(_WIN64)
+ #pragma comment(lib, "libjson.lib")
+ #else
+ #pragma comment(lib, "libjson64.lib")
+ #endif
#endif
#endif // MIM_LIBJSON_H