00001 00002 // Name: json_defs.h 00003 // Purpose: shared build defines 00004 // Author: Luciano Cattani 00005 // Created: 2007/10/20 00006 // RCS-ID: $Id: json_defs.h,v 1.6 2008/03/12 10:48:19 luccat Exp $ 00007 // Copyright: (c) 2007 Luciano Cattani 00008 // Licence: wxWidgets licence 00010 00011 00012 #ifndef _WX_JSON_DEFS_H_ 00013 #define _WX_JSON_DEFS_H_ 00014 00015 // Defines for component version. 00016 // The following symbols should be updated for each new component release 00017 // since some kind of tests, like those of AM_WXCODE_CHECKFOR_COMPONENT_VERSION() 00018 // for "configure" scripts under unix, use them. 00019 #define wxJSON_MAJOR 1 00020 #define wxJSON_MINOR 1 00021 #define wxJSON_RELEASE 0 00022 00023 // For non-Unix systems (i.e. when building without a configure script), 00024 // users of this component can use the following macro to check if the 00025 // current version is at least major.minor.release 00026 #define wxCHECK_JSON_VERSION(major,minor,release) \ 00027 (wxJSON_MAJOR > (major) || \ 00028 (wxJSON_MAJOR == (major) && wxJSON_MINOR > (minor)) || \ 00029 (wxJSON_MAJOR == (major) && wxJSON_MINOR == (minor) && wxJSON_RELEASE >= (release))) 00030 00031 00032 // Defines for shared builds. 00033 // Simple reference for using these macros and for writin components 00034 // which support shared builds: 00035 // 00036 // 1) use the WXDLLIMPEXP_MYCOMP in each class declaration: 00037 // class WXDLLIMPEXP_MYCOMP myCompClass { [...] }; 00038 // 00039 // 2) use the WXDLLIMPEXP_MYCOMP in the declaration of each global function: 00040 // WXDLLIMPEXP_MYCOMP int myGlobalFunc(); 00041 // 00042 // 3) use the WXDLLIMPEXP_DATA_MYCOMP() in the declaration of each global 00043 // variable: 00044 // WXDLLIMPEXP_DATA_MYCOMP(int) myGlobalIntVar; 00045 // 00046 #ifdef WXMAKINGDLL_JSON 00047 #define WXDLLIMPEXP_JSON WXEXPORT 00048 #define WXDLLIMPEXP_DATA_JSON(type) WXEXPORT type 00049 #elif defined(WXUSINGDLL) 00050 #define WXDLLIMPEXP_JSON WXIMPORT 00051 #define WXDLLIMPEXP_DATA_JSON(type) WXIMPORT type 00052 #else // not making nor using DLL 00053 #define WXDLLIMPEXP_JSON 00054 #define WXDLLIMPEXP_DATA_JSON(type) type 00055 #endif 00056 00057 // the __PRETTY_FUNCTION__ macro expands to the full class's 00058 // member name in the GNU GCC. 00059 // For other compilers we use the standard __wxFUNCTION__ macro 00060 #if !defined( __GNUC__ ) 00061 #define __PRETTY_FUNCTION__ __WXFUNCTION__ 00062 #endif 00063 00064 00065 00066 // define wxJSON_USE_UNICODE if wxWidgets was built with 00067 // unicode support 00068 #if defined( wxJSON_USE_UNICODE ) 00069 #undef wxJSON_USE_UNICODE 00070 #endif 00071 // do not modify the following lines 00072 #if wxUSE_UNICODE == 1 00073 #define wxJSON_USE_UNICODE 00074 #endif 00075 00076 // the following macro, if defined, cause the wxJSONValue to store 00077 // pointers to C-strings as pointers to statically allocated 00078 // C-strings. By default this macro is not defined 00079 // #define wxJSON_USE_CSTRING 00080 00081 00082 // the following macro, if defined, cause the wxJSONvalue and its 00083 // referenced data structure to store and increment a static 00084 // progressive counter in the ctor. 00085 // this is only usefull for debugging purposes 00086 // #define WXJSON_USE_VALUE_COUNTER 00087 00088 00089 // the following macro is used by wxJSON internally and you should not 00090 // modify it. If the platform seems to support 64-bits integers, 00091 // the following lines define the 'wxJSON_64BIT_INT' macro 00092 #if defined( wxLongLong_t ) 00093 #define wxJSON_64BIT_INT 00094 #endif 00095 00096 00097 // 00098 // the following macro, if defined, cause the wxJSON library to 00099 // always use 32-bits integers also when the platform seems to 00100 // have native 64-bits support: by default the macro if not defined 00101 // 00102 // #define wxJSON_NO_64BIT_INT 00103 // 00104 #if defined( wxJSON_NO_64BIT_INT ) && defined( wxJSON_64BIT_INT ) 00105 #undef wxJSON_64BIT_INT 00106 #endif 00107 00108 // 00109 // it seems that some compilers do not define 'long long int' limits 00110 // constants. For example, this is the output of the Borland BCC 5.5 00111 // compiler when I tried to compile wxJSON with 64-bits integer support: 00112 // Error E2451 ..\src\jsonreader.cpp 1737: Undefined symbol 'LLONG_MAX' 00113 // in function wxJSONReader::Strtoll(const wxString &,__int64 *) 00114 // *** 1 errors in Compile *** 00115 // so, if the constants are not defined, I define them by myself 00116 #if !defined( LLONG_MAX ) 00117 #define LLONG_MAX 9223372036854775807 00118 #endif 00119 00120 #if !defined( ULLONG_MAX ) 00121 #define ULLONG_MAX 18446744073709551615 00122 #endif 00123 00124 #if !defined( LLONG_MIN ) 00125 #define LLONG_MIN -9223372036854775808 00126 #endif 00127 00128 00129 00130 // the same applies for all other integer constants 00131 #if !defined( INT_MIN ) 00132 #define INT_MIN -32768 00133 #endif 00134 #if !defined( INT_MAX ) 00135 #define INT_MAX 32767 00136 #endif 00137 #if !defined( UINT_MAX ) 00138 #define UINT_MAX 65535 00139 #endif 00140 #if !defined( LONG_MIN ) 00141 #define LONG_MIN -2147483648 00142 #endif 00143 #if !defined( LONG_MAX ) 00144 #define LONG_MAX 2147483647 00145 #endif 00146 #if !defined( ULONG_MAX ) 00147 #define ULONG_MAX 4294967295 00148 #endif 00149 #if !defined( SHORT_MAX ) 00150 #define SHORT_MAX 32767 00151 #endif 00152 #if !defined( SHORT_MIN ) 00153 #define SHORT_MIN -32768 00154 #endif 00155 #if !defined( USHORT_MAX ) 00156 #define USHORT_MAX 65535 00157 #endif 00158 00159 00160 00161 // 00162 // define the wxJSON_ASSERT() macro to expand to wxASSERT() 00163 // unless the wxJSON_NOABORT_ASSERT is defined 00164 #define wxJSON_NOABORT_ASSERT 00165 #if defined( wxJSON_NOABORT_ASSERT ) 00166 #define wxJSON_ASSERT( cond ) 00167 #else 00168 #define wxJSON_ASSERT( cond ) wxASSERT( cond ); 00169 #endif 00170 00171 00172 // 00173 // the following macros are used by the wxJSONWriter::WriteStringValues() 00174 // when the wxJSONWRITER_SPLIT_STRING flag is set 00175 #define wxJSONWRITER_LAST_COL 50 00176 #define wxJSONWRITER_SPLIT_COL 75 00177 #define wxJSONWRITER_MIN_LENGTH 15 00178 #define wxJSONWRITER_TAB_LENGTH 4 00179 00180 // 00181 // in version 2.9 and above, we use the wxW 2.8 compatibility 00182 // note that the library has to be built with 2.8 compatibility 00183 // enabled in order to use it 00184 #if wxCHECK_VERSION(2, 9, 0 ) 00185 #define WXWIN_COMPATIBILITY_2_8 1 00186 #endif 00187 00188 00189 // 00190 // some compilers (i.e. MSVC++) defines their own 'snprintf' function 00191 // so if it is not defined, define it in the following lines 00192 // please note that we cannot use the wxWidget's counterpart 'wxSnprintf' 00193 // because the latter uses 'wxChar' but wxJSON only use 'char' 00194 #if !defined(snprintf) && defined(_MSC_VER) 00195 #define snprintf _snprintf 00196 #endif 00197 00198 00199 // 00200 // force use of STL-style implementation of wxHashMap container 00201 // this is needed for compiling on MinGW 00202 // wxJSON_USE_MINGW 00203 00204 00205 00206 00207 00208 00209 00210 #endif // _WX_JSON_DEFS_H_ 00211 00212