10 #include "../../JSONOptions.h"
11 #include "JSONDefs/Unknown_C.h"
12 #include "JSONDefs/GNU_C.h"
13 #include "JSONDefs/Visual_C.h"
14 #include "JSONDefs/Strings_Defs.h"
16 #define __LIBJSON_MAJOR__ 7
17 #define __LIBJSON_MINOR__ 6
18 #define __LIBJSON_PATCH__ 1
19 #define __LIBJSON_VERSION__ (__LIBJSON_MAJOR__ * 10000 + __LIBJSON_MINOR__ * 100 + __LIBJSON_PATCH__)
21 #define JSON_NULL '\0'
22 #define JSON_STRING '\1'
23 #define JSON_NUMBER '\2'
24 #define JSON_BOOL '\3'
25 #define JSON_ARRAY '\4'
26 #define JSON_NODE '\5'
29 #if defined(JSON_MEMORY_CALLBACKS) || defined(JSON_MEMORY_POOL)
30 #include "JSONAllocator.h"
32 #define json_allocator std::allocator
35 #ifdef JSON_STRING_HEADER
36 #include JSON_STRING_HEADER
38 typedef std::basic_string<json_char, std::char_traits<json_char>, json_allocator<json_char> > json_string;
41 #define JSON_MAP(x, y) std::map<x, y, std::less<x>, json_allocator<std::pair<const x, y> > >
43 #ifdef JSON_NO_EXCEPTIONS
46 #define json_catch(exception, code)
48 #define json_throw(x) throw(x)
50 #define json_catch(exception, code) catch(exception){ code }
55 #error, JSON_UNICODE is required for JSON_STRICT
58 #error, JSON_COMMENTS is required to be off for JSON_STRICT
62 #ifdef JSON_ISO_STRICT
64 #error, You can not use unicode under ANSI Strict C++
68 #ifdef __STRICT_ANSI__
69 #warning, Using -ansi GCC option, but JSON_ISO_STRICT not on, turning it on for you
70 #define JSON_ISO_STRICT
76 #ifdef JSON_NUMBER_TYPE
77 typedef JSON_NUMBER_TYPE json_number;
78 #define JSON_FLOAT_THRESHHOLD 0.00001
80 #ifdef JSON_LESS_MEMORY
81 typedef float json_number;
82 #define JSON_FLOAT_THRESHHOLD 0.00001f
84 typedef double json_number;
85 #define JSON_FLOAT_THRESHHOLD 0.00001
90 #ifdef JSON_LESS_MEMORY
92 #define START_MEM_SCOPE {
93 #define END_MEM_SCOPE }
97 #define START_MEM_SCOPE
101 #if defined JSON_DEBUG || defined JSON_SAFE
103 typedef void (*json_error_callback_t)(
const json_char *);
105 typedef void (*json_error_callback_t)(
const json_string &);
109 #ifdef JSON_INDEX_TYPE
110 typedef JSON_INDEX_TYPE json_index_t;
112 typedef unsigned int json_index_t;
115 #ifdef JSON_BOOL_TYPE
116 typedef JSON_BOOL_TYPE json_bool_t;
118 typedef int json_bool_t;
122 typedef JSON_INT_TYPE json_int_t;
124 typedef long json_int_t;
127 #define JSONSTREAM_SELF (void*)-1
128 typedef void (*json_stream_e_callback_t)(
void * identifier);
130 typedef void (*json_mutex_callback_t)(
void *);
131 typedef void (*json_free_t)(
void *);
133 typedef void * (*json_malloc_t)(size_t);
134 typedef void * (*json_realloc_t)(
void *, size_t);
136 #define JSONNODE void
137 typedef JSONNODE** JSONNODE_ITERATOR;
139 #define JSONSTREAM void
140 typedef void (*json_stream_callback_t)(JSONNODE *,
void * identifier);
142 typedef void * (*json_malloc_t)(
unsigned long);
143 typedef void * (*json_realloc_t)(
void *,
unsigned long);
149 #warning, Have JSON_DEBUG on in a release build
151 #error, Have JSON_DEBUG on in a release build
157 #warning, Release build of libjson, but NDEBUG is not on
159 #error, Release build of libjson, but NDEBUG is not on
164 #ifdef JSON_UNIT_TEST
165 #define JSON_PRIVATE public:
166 #define JSON_PROTECTED public:
168 #define JSON_PRIVATE private:
169 #define JSON_PROTECTED protected:
172 #ifndef JSON_READ_PRIORITY
173 #error, JSON_STREAM also requires JSON_READ_PRIORITY
177 #ifndef JSON_READ_PRIORITY
178 #error, JSON_VALIDATE also requires JSON_READ_PRIORITY
182 #define JSON_TEMP_COMMENT_IDENTIFIER JSON_TEXT('#')