00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00037 #ifndef _OSRTJSON_H_
00038 #define _OSRTJSON_H_
00039
00040 #include "rtxsrc/osMacros.h"
00041 #include "rtxsrc/osSysTypes.h"
00042 #include "rtxsrc/rtxCommon.h"
00043 #include "rtxsrc/rtxError.h"
00044 #include "rtxsrc/rtxBuffer.h"
00045 #include "rtxsrc/rtxMemory.h"
00046
00047 #include "rtjsonsrc/rtJsonExternDefs.h"
00048
00049 #ifndef EXTERNJSON
00050 #ifdef BUILDJSONDLL
00051 #define EXTERNJSON __declspec(dllexport)
00052 #elif defined (USEJSONLDLL)
00053 #define EXTERNJSON __declspec(dllimport)
00054 #else
00055 #define EXTERNJSON
00056 #endif
00057 #endif
00058
00059 #ifdef __cplusplus
00060 extern "C" {
00061 #endif
00062
00063 struct OSXMLElemIDRec;
00064
00065
00066
00067 #define OSJSONATTR 0x00008000
00068
00069
00070
00071 #define OSJSONPUTCOMMA(pctxt) \
00072 if ((pctxt)->lastChar != '{' && (pctxt)->lastChar != ',' \
00073 && (pctxt)->lastChar != '\0') OSRTSAFEPUTCHAR (pctxt, ',');
00074
00075 extern const signed char decodeTable[];
00076 #define BASE64TOINT(c) ((((unsigned)(c)) < 128) ? decodeTable [(c) - 40] : -1)
00077
00078
00079
00080 #ifndef DEFAULT_DOUBLE_PRECISION
00081 #define DEFAULT_DOUBLE_PRECISION 11
00082 #endif
00083
00084 #ifndef DEFAULT_FLOAT_PRECISION
00085 #define DEFAULT_FLOAT_PRECISION 6
00086 #endif
00087
00088 #ifndef OSUPCASE
00089
00090 #define OSUPCASE 0x00008000
00091 #endif
00092
00093
00094
00095
00111 EXTERNJSON int rtJsonEncAnyAttr (OSCTXT* pctxt, const OSRTDList* pvalue);
00112
00122 EXTERNJSON int rtJsonEncIntValue (OSCTXT* pctxt, OSINT32 value);
00123
00134 EXTERNJSON int rtJsonEncInt64Value (OSCTXT* pctxt, OSINT64 value);
00135
00146 EXTERNJSON int rtJsonEncBase64StrValue (OSCTXT* pctxt, OSUINT32 nocts,
00147 const OSOCTET* value);
00148
00158 EXTERNJSON int rtJsonEncBoolValue (OSCTXT* pctxt, OSBOOL value);
00159
00170 EXTERNJSON int rtJsonEncGYear (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00171
00182 EXTERNJSON int rtJsonEncGYearMonth (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00183
00194 EXTERNJSON int rtJsonEncGMonth (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00195
00206 EXTERNJSON int rtJsonEncGMonthDay (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00207
00218 EXTERNJSON int rtJsonEncGDay (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00219
00232 EXTERNJSON int rtJsonEncDate (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00233
00245 EXTERNJSON int rtJsonEncTime (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00246
00257 EXTERNJSON int rtJsonEncDateTime (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00258
00269 EXTERNJSON int rtJsonEncDecimalValue (OSCTXT* pctxt, OSREAL value,
00270 const OSDecimalFmt* pFmtSpec);
00271
00282 EXTERNJSON int rtJsonEncDoubleValue (OSCTXT* pctxt, OSREAL value,
00283 const OSDoubleFmt* pFmtSpec);
00284
00295 EXTERNJSON int rtJsonEncFloatValue (OSCTXT* pctxt, OSREAL value,
00296 const OSDoubleFmt* pFmtSpec);
00297
00308 EXTERNJSON int rtJsonEncHexStr (OSCTXT* pctxt, OSUINT32 nocts,
00309 const OSOCTET* data);
00310
00321 EXTERNJSON int rtJsonEncBitStrValue (OSCTXT* pctxt, OSUINT32 nbits,
00322 const OSOCTET* data);
00333 EXTERNJSON int rtJsonEncIndent (OSCTXT* pctxt);
00334
00345 EXTERNJSON int rtJsonEncStringObject (OSCTXT* pctxt,
00346 const OSUTF8CHAR* name, const OSUTF8CHAR* value);
00347
00360 EXTERNJSON int rtJsonEncStringObject2 (OSCTXT* pctxt,
00361 const OSUTF8CHAR* name, size_t nameLen,
00362 const OSUTF8CHAR* value, size_t valueLen);
00363
00374 EXTERNJSON int rtJsonEncStringPair (OSCTXT* pctxt,
00375 const OSUTF8CHAR* name, const OSUTF8CHAR* value);
00376
00389 EXTERNJSON int rtJsonEncStringPair2 (OSCTXT* pctxt,
00390 const OSUTF8CHAR* name, size_t nameLen,
00391 const OSUTF8CHAR* value, size_t valueLen);
00392
00402 EXTERNJSON int rtJsonEncStringValue (OSCTXT* pctxt, const OSUTF8CHAR* value);
00403
00414 EXTERNJSON int rtJsonEncStringValue2 (OSCTXT* pctxt,
00415 const OSUTF8CHAR* value, size_t valueLen);
00416
00427 EXTERNJSON int rtJsonEncUnicodeData (OSCTXT* pctxt,
00428 const OSUNICHAR* value, OSUINT32 nchars);
00429
00440 EXTERNJSON int rtJsonEncUCS4Data (OSCTXT* pctxt,
00441 const OS32BITCHAR* value, OSUINT32 nchars);
00442
00443
00453 EXTERNJSON int rtJsonEncUIntValue (OSCTXT* pctxt, OSUINT32 value);
00454
00466 EXTERNJSON int rtJsonEncUInt64Value (OSCTXT* pctxt, OSUINT64 value);
00467
00492 EXTERNJSON int rtJsonDecAnyElem (OSCTXT* pctxt, OSUTF8CHAR** ppvalue);
00493
00509 EXTERNJSON int rtJsonDecAnyType (OSCTXT* pctxt, OSUTF8CHAR** ppvalue);
00510
00534 EXTERNJSON int rtJsonDecBase64Str (OSCTXT* pctxt,
00535 OSOCTET* pvalue, OSUINT32* pnocts,
00536 size_t bufsize);
00537
00554 EXTERNJSON int rtJsonDecDynBase64Str (OSCTXT* pctxt, OSDynOctStr* pvalue);
00555
00566 EXTERNJSON int rtJsonDecBool (OSCTXT* pctxt, OSBOOL* pvalue);
00567
00580 EXTERNJSON int rtJsonDecDate (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00581
00600 EXTERNJSON int rtJsonDecTime (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00601
00614 EXTERNJSON int rtJsonDecDateTime (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00615
00628 EXTERNJSON int rtJsonDecGYear (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00629
00642 EXTERNJSON int rtJsonDecGYearMonth (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00643
00656 EXTERNJSON int rtJsonDecGMonth (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00657
00670 EXTERNJSON int rtJsonDecGMonthDay (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00671
00684 EXTERNJSON int rtJsonDecGDay (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00685
00700 EXTERNJSON int rtJsonDecDecimal (OSCTXT* pctxt, OSREAL* pvalue,
00701 int totalDigits, int fractionDigits);
00702
00715 EXTERNJSON int rtJsonDecDouble (OSCTXT* pctxt, OSREAL* pvalue);
00716
00741 EXTERNJSON int rtJsonDecHexStr (OSCTXT* pctxt, OSOCTET* pvalue,
00742 OSUINT32* pnocts, size_t bufsize);
00743
00761 EXTERNJSON int rtJsonDecDynHexStr (OSCTXT* pctxt, OSDynOctStr* pvalue);
00762
00776 EXTERNJSON int rtJsonDecDynBitStr
00777 (OSCTXT* pctxt, OSUINT32 *nbits, OSOCTET **data);
00778
00791 EXTERNJSON int rtJsonDecBitStrValue
00792 (OSCTXT* pctxt, OSUINT32 *nbits, OSOCTET *data);
00793
00807 EXTERNJSON int rtJsonDecInt8Value (OSCTXT* pctxt, OSINT8* pvalue);
00808
00821 EXTERNJSON int rtJsonDecInt16Value (OSCTXT* pctxt, OSINT16* pvalue);
00822
00835 EXTERNJSON int rtJsonDecInt32Value (OSCTXT* pctxt, OSINT32* pvalue);
00836 #define rtJsonDecIntValue rtJsonDecInt32Value
00837
00850 EXTERNJSON int rtJsonDecInt64Value (OSCTXT* pctxt, OSINT64* pvalue);
00851
00865 EXTERNJSON int rtJsonDecUInt8Value (OSCTXT* pctxt, OSUINT8* pvalue);
00866
00879 EXTERNJSON int rtJsonDecUInt16Value (OSCTXT* pctxt, OSUINT16* pvalue);
00880
00893 EXTERNJSON int rtJsonDecUInt32Value (OSCTXT* pctxt, OSUINT32* pvalue);
00894 #define rtJsonDecUIntValue rtJsonDecUInt32Value
00895
00908 EXTERNJSON int rtJsonDecUInt64Value (OSCTXT* pctxt, OSUINT64* pvalue);
00909
00919 EXTERNJSON int rtJsonDecMatchChar (OSCTXT* pctxt, OSUTF8CHAR ch);
00920
00933 EXTERNJSON int rtJsonDecMatchObjectStart
00934 (OSCTXT* pctxt, const OSUTF8NameAndLen* nameArray, size_t numNames);
00935
00948 EXTERNJSON int rtJsonDecMatchToken (OSCTXT* pctxt, const OSUTF8CHAR* token);
00949
00963 EXTERNJSON int rtJsonDecMatchToken2
00964 (OSCTXT* pctxt, const OSUTF8CHAR* token, size_t tokenLen);
00965
00976 EXTERNJSON int rtJsonDecNameValuePair (OSCTXT* pctxt, OSUTF8NVP* pvalue);
00977
00988 EXTERNJSON int rtJsonDecPeekChar (OSCTXT* pctxt, OSUTF8CHAR* pch);
00989
00997 EXTERNJSON char rtJsonDecPeekChar2 (OSCTXT* pctxt);
00998
01014 EXTERNJSON int rtJsonDecStringObject
01015 (OSCTXT* pctxt, const OSUTF8CHAR* name, OSUTF8CHAR** ppvalue);
01016
01031 EXTERNJSON int rtJsonDecStringValue (OSCTXT* pctxt, OSUTF8CHAR** ppvalue);
01032
01049 EXTERNJSON int rtJsonDecXmlStringValue (OSCTXT* pctxt, OSXMLSTRING* pvalue);
01050
01051 EXTERNJSON int rtJsonDecSkipWhitespace (OSCTXT* pctxt);
01052
01064 EXTERNJSON size_t rtJsonGetElemIdx
01065 (OSCTXT* pctxt, const OSUTF8NameAndLen nameArray[], size_t nrows);
01066
01072 #ifdef __cplusplus
01073 }
01074 #endif
01075
01076 #endif