JSONDefs.h   JSONDefs.h 
skipping to change at line 83 skipping to change at line 83
typedef void (*json_error_callback_t)(const json_string &); typedef void (*json_error_callback_t)(const json_string &);
#endif #endif
#endif #endif
#ifdef JSON_INDEX_TYPE #ifdef JSON_INDEX_TYPE
typedef JSON_INDEX_TYPE json_index_t; typedef JSON_INDEX_TYPE json_index_t;
#else #else
typedef unsigned int json_index_t; typedef unsigned int json_index_t;
#endif #endif
#ifdef JSON_BOOL_TYPE
typedef JSON_BOOL_TYPE json_bool_t;
#else
typedef int json_bool_t;
#endif
typedef void (*json_mutex_callback_t)(void *); typedef void (*json_mutex_callback_t)(void *);
typedef void (*json_free_t)(void *); typedef void (*json_free_t)(void *);
#ifndef JSON_LIBRARY #ifndef JSON_LIBRARY
typedef void * (*json_malloc_t)(size_t); typedef void * (*json_malloc_t)(size_t);
typedef void * (*json_realloc_t)(void *, size_t); typedef void * (*json_realloc_t)(void *, size_t);
#else #else
#define JSONNODE void //so that JSONNODE* is void* #define JSONNODE void //so that JSONNODE* is void*
typedef JSONNODE** JSONNODE_ITERATOR; typedef JSONNODE** JSONNODE_ITERATOR;
typedef void * (*json_malloc_t)(unsigned long); typedef void * (*json_malloc_t)(unsigned long);
typedef void * (*json_realloc_t)(void *, unsigned long); typedef void * (*json_realloc_t)(void *, unsigned long);
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 JSONOptions.h   JSONOptions.h 
skipping to change at line 194 skipping to change at line 194
//#define JSON_CASE_INSENSITIVE_FUNCTIONS //#define JSON_CASE_INSENSITIVE_FUNCTIONS
/* /*
* JSON_INDEX_TYPE allows you th change the size type for the children fun ctions. If this * JSON_INDEX_TYPE allows you th change the size type for the children fun ctions. If this
* option is not used then unsigned int is used. This option is useful fo r cutting down * option is not used then unsigned int is used. This option is useful fo r cutting down
* on memory, or using huge numbers of child nodes (over 4 billion) * on memory, or using huge numbers of child nodes (over 4 billion)
*/ */
//#define JSON_INDEX_TYPE unsigned int //#define JSON_INDEX_TYPE unsigned int
/* /*
* JSON_BOOL_TYPE lets you change the bool type for the C interface. Beca
use before C99 there
* was no bool, and even then it's just a typedef, you may want to use som
ething else. If this
* is not defined, it will revert to int
*/
//#define JSON_BOOL_TYPE char
/*
* JSON_STRING_HEADER allows you to change the type of string that libjson uses both for the * JSON_STRING_HEADER allows you to change the type of string that libjson uses both for the
* interface and internally. It must implement most of the STL string int erface, but not all * interface and internally. It must implement most of the STL string int erface, but not all
* of it. Things like wxString or QString should wourk without much troub le * of it. Things like wxString or QString should wourk without much troub le
*/ */
//#define JSON_STRING_HEADER "../TestSuite/StringTest.h" //#define JSON_STRING_HEADER "../TestSuite/StringTest.h"
/* /*
* JSON_UNIT_TEST is used to maintain and debug the libjson. It makes all private * JSON_UNIT_TEST is used to maintain and debug the libjson. It makes all private
* members and functions public so that tests can do checks of the inner w orkings * members and functions public so that tests can do checks of the inner w orkings
* of libjson. This should not be turned on by end users. * of libjson. This should not be turned on by end users.
 End of changes. 1 change blocks. 
0 lines changed or deleted 9 lines changed or added


 internalJSONNode.h   internalJSONNode.h 
skipping to change at line 296 skipping to change at line 296
return _string; return _string;
} }
inline long internalJSONNode::as_int(void) const { inline long internalJSONNode::as_int(void) const {
Fetch(); Fetch();
switch(type()){ switch(type()){
case JSON_NULL: case JSON_NULL:
return 0; return 0;
case JSON_BOOL: case JSON_BOOL:
return _value._bool ? 1 : 0; return _value._bool ? 1 : 0;
case JSON_STRING:
FetchNumber();
} }
JSON_ASSERT(type() == JSON_NUMBER, JSON_TEXT("as_int returning undefine d results")); JSON_ASSERT(type() == JSON_NUMBER, JSON_TEXT("as_int returning undefine d results"));
JSON_ASSERT(_value._number > LONG_MIN, _string + JSON_TEXT(" is outside the lower range of long")); JSON_ASSERT(_value._number > LONG_MIN, _string + JSON_TEXT(" is outside the lower range of long"));
JSON_ASSERT(_value._number < LONG_MAX, _string + JSON_TEXT(" is outside the upper range of long")); JSON_ASSERT(_value._number < LONG_MAX, _string + JSON_TEXT(" is outside the upper range of long"));
JSON_ASSERT(_value._number == (json_number)((int)_value._number), json_ string(JSON_TEXT("as_int will truncate ")) + _string); JSON_ASSERT(_value._number == (json_number)((int)_value._number), json_ string(JSON_TEXT("as_int will truncate ")) + _string);
return (int)_value._number; return (int)_value._number;
} }
inline json_number internalJSONNode::as_float(void) const { inline json_number internalJSONNode::as_float(void) const {
Fetch(); Fetch();
switch(type()){ switch(type()){
case JSON_NULL: case JSON_NULL:
return (json_number)0.0; return (json_number)0.0;
case JSON_BOOL: case JSON_BOOL:
return (json_number)(_value._bool ? 1.0 : 0.0); return (json_number)(_value._bool ? 1.0 : 0.0);
case JSON_STRING:
FetchNumber();
} }
JSON_ASSERT(type() == JSON_NUMBER, JSON_TEXT("as_float returning undefi ned results")); JSON_ASSERT(type() == JSON_NUMBER, JSON_TEXT("as_float returning undefi ned results"));
return _value._number; return _value._number;
} }
inline bool internalJSONNode::as_bool(void) const { inline bool internalJSONNode::as_bool(void) const {
Fetch(); Fetch();
switch(type()){ switch(type()){
case JSON_NUMBER: case JSON_NUMBER:
return _value._number != 0.0f; return _value._number != 0.0f;
skipping to change at line 401 skipping to change at line 405
Fetch(); Fetch();
return Children.end(); return Children.end();
} }
inline JSONNode * internalJSONNode::at(json_index_t pos){ inline JSONNode * internalJSONNode::at(json_index_t pos){
Fetch(); Fetch();
return Children[pos]; return Children[pos];
} }
inline void internalJSONNode::reserve(json_index_t siz){ inline void internalJSONNode::reserve(json_index_t siz){
Fetch(); #ifndef JSON_LESS_MEMORY
Children.reserve2(siz); Fetch();
Children.reserve2(siz);
#endif
} }
/* /*
These functions are to allow allocation to be completely controlled by the callbacks These functions are to allow allocation to be completely controlled by the callbacks
*/ */
inline void internalJSONNode::deleteInternal(internalJSONNode * ptr){ inline void internalJSONNode::deleteInternal(internalJSONNode * ptr){
#ifdef JSON_MEMORY_CALLBACKS #ifdef JSON_MEMORY_CALLBACKS
ptr -> ~internalJSONNode(); ptr -> ~internalJSONNode();
libjson_free<internalJSONNode>(ptr); libjson_free<internalJSONNode>(ptr);
 End of changes. 3 change blocks. 
2 lines changed or deleted 8 lines changed or added


 libjson.h   libjson.h 
skipping to change at line 70 skipping to change at line 70
void json_register_memory_callbacks(json_malloc_t m al, json_realloc_t real, json_free_t fre); void json_register_memory_callbacks(json_malloc_t m al, json_realloc_t real, json_free_t fre);
#endif #endif
/* /*
stuff that's in class JSONNode stuff that's in class JSONNode
*/ */
//ctors //ctors
JSONNODE * json_new_a(json_const json_char * name, json_co nst json_char * value); JSONNODE * json_new_a(json_const json_char * name, json_co nst json_char * value);
JSONNODE * json_new_i(json_const json_char * name, long va lue); JSONNODE * json_new_i(json_const json_char * name, long va lue);
JSONNODE * json_new_f(json_const json_char * name, json_nu mber value); JSONNODE * json_new_f(json_const json_char * name, json_nu mber value);
JSONNODE * json_new_b(json_const json_char * name, int val ue); //because C bools are ints and C++ will implicitly cast it JSONNODE * json_new_b(json_const json_char * name, json_bo ol_t value);
JSONNODE * json_new(char type); JSONNODE * json_new(char type);
JSONNODE * json_copy(json_const JSONNODE * orig); JSONNODE * json_copy(json_const JSONNODE * orig);
JSONNODE * json_duplicate(json_const JSONNODE * orig); JSONNODE * json_duplicate(json_const JSONNODE * orig);
//assignment //assignment
void json_set_a(JSONNODE * node, json_const json_char * va lue); void json_set_a(JSONNODE * node, json_const json_char * va lue);
void json_set_i(JSONNODE * node, long value); void json_set_i(JSONNODE * node, long value);
void json_set_f(JSONNODE * node, json_number value); void json_set_f(JSONNODE * node, json_number value);
void json_set_b(JSONNODE * node, int value); //because C bools are ints ane C++ will implicit void json_set_b(JSONNODE * node, json_bool_t value);
void json_set_n(JSONNODE * node, json_const JSONNODE * ori g); void json_set_n(JSONNODE * node, json_const JSONNODE * ori g);
//inspectors //inspectors
char json_type(json_const JSONNODE * node); char json_type(json_const JSONNODE * node);
json_index_t json_size(json_const JSONNODE * node); json_index_t json_size(json_const JSONNODE * node);
int json_empty(json_const JSONNODE * node); json_bool_t json_empty(json_const JSONNODE * node);
json_char * json_name(json_const JSONNODE * node); json_char * json_name(json_const JSONNODE * node);
#ifdef JSON_COMMENTS #ifdef JSON_COMMENTS
json_char * json_get_comment(json_const JSONNODE * node); json_char * json_get_comment(json_const JSONNODE * node);
#endif #endif
json_char * json_as_string(json_const JSONNODE * node); json_char * json_as_string(json_const JSONNODE * node);
long json_as_int(json_const JSONNODE * node); long json_as_int(json_const JSONNODE * node);
json_number json_as_float(json_const JSONNODE * node); json_number json_as_float(json_const JSONNODE * node);
int json_as_bool(json_const JSONNODE * node); json_bool_t json_as_bool(json_const JSONNODE * node);
JSONNODE * json_as_node(json_const JSONNODE * node); JSONNODE * json_as_node(json_const JSONNODE * node);
JSONNODE * json_as_array(json_const JSONNODE * node); JSONNODE * json_as_array(json_const JSONNODE * node);
#ifdef JSON_BINARY #ifdef JSON_BINARY
void * json_as_binary(json_const JSONNODE * node, u nsigned long * size); void * json_as_binary(json_const JSONNODE * node, u nsigned long * size);
#endif #endif
#ifdef JSON_WRITER #ifdef JSON_WRITER
json_char * json_write(json_const JSONNODE * node); json_char * json_write(json_const JSONNODE * node);
json_char * json_write_formatted(json_const JSONNOD E * node); json_char * json_write_formatted(json_const JSONNOD E * node);
#endif #endif
skipping to change at line 148 skipping to change at line 148
JSONNODE_ITERATOR json_erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); JSONNODE_ITERATOR json_erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end);
JSONNODE_ITERATOR json_insert(JSONNODE * node, JSON NODE_ITERATOR it, JSONNODE * node2); JSONNODE_ITERATOR json_insert(JSONNODE * node, JSON NODE_ITERATOR it, JSONNODE * node2);
JSONNODE_ITERATOR json_insert_multi(JSONNODE * node , JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); JSONNODE_ITERATOR json_insert_multi(JSONNODE * node , JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end);
//iterator functions //iterator functions
JSONNODE_ITERATOR json_begin(JSONNODE * node); JSONNODE_ITERATOR json_begin(JSONNODE * node);
JSONNODE_ITERATOR json_end(JSONNODE * node); JSONNODE_ITERATOR json_end(JSONNODE * node);
#endif #endif
//comparison //comparison
int json_equal(JSONNODE * node, JSONNODE * node2); json_bool_t json_equal(JSONNODE * node, JSONNODE * node2);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#else #else
#ifndef __cplusplus #ifndef __cplusplus
#error Using the non-library requires C++ #error Using the non-library requires C++
#endif #endif
#include "Source/JSONNode.h" //not used in this file, but libjson.h sh ould be the only file required to use it embedded #include "Source/JSONNode.h" //not used in this file, but libjson.h sh ould be the only file required to use it embedded
#include "Source/JSONWorker.h" #include "Source/JSONWorker.h"
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/