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/rtxCommonDefs.h"
00042 #include "rtxsrc/rtxError.h"
00043 #include "rtxmlsrc/osrtxml.h"
00044
00045 #ifndef EXTERNJSON
00046 #ifdef BUILDJSONDLL
00047 #define EXTERNJSON __declspec(dllexport)
00048 #elif defined (USEJSONLDLL)
00049 #define EXTERNJSON __declspec(dllimport)
00050 #else
00051 #define EXTERNJSON
00052 #endif
00053 #endif
00054
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif
00058
00059 struct OSXMLElemIDRec;
00060
00061
00062
00063 #define OSJSONATTR 0x00008000
00064
00065
00066
00067 #define OSJSONPUTCOMMA(pctxt) \
00068 if ((pctxt)->lastChar != '{' && (pctxt)->lastChar != ',' \
00069 && (pctxt)->lastChar != '\0') OSRTSAFEPUTCHAR (pctxt, ',');
00070
00071
00072
00088 EXTERNJSON int rtJsonEncAnyAttr (OSCTXT* pctxt, const OSRTDList* pvalue);
00089
00099 EXTERNJSON int rtJsonEncIntValue (OSCTXT* pctxt, OSINT32 value);
00100
00111 EXTERNJSON int rtJsonEncInt64Value (OSCTXT* pctxt, OSINT64 value);
00112
00123 EXTERNJSON int rtJsonEncBase64StrValue (OSCTXT* pctxt, OSUINT32 nocts,
00124 const OSOCTET* value);
00134 EXTERNJSON int rtJsonEncBoolValue (OSCTXT* pctxt, OSBOOL value);
00135
00146 EXTERNJSON int rtJsonEncGYear (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00147
00158 EXTERNJSON int rtJsonEncGYearMonth (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00159
00170 EXTERNJSON int rtJsonEncGMonth (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00171
00182 EXTERNJSON int rtJsonEncGMonthDay (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00183
00194 EXTERNJSON int rtJsonEncGDay (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00195
00208 EXTERNJSON int rtJsonEncDate (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00209
00221 EXTERNJSON int rtJsonEncTime (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00222
00233 EXTERNJSON int rtJsonEncDateTime (OSCTXT* pctxt, const OSXSDDateTime* pvalue);
00234
00245 EXTERNJSON int rtJsonEncDecimalValue (OSCTXT* pctxt, OSREAL value,
00246 const OSDecimalFmt* pFmtSpec);
00247
00258 EXTERNJSON int rtJsonEncDoubleValue (OSCTXT* pctxt, OSREAL value,
00259 const OSDoubleFmt* pFmtSpec);
00260
00271 EXTERNJSON int rtJsonEncFloatValue (OSCTXT* pctxt, OSREAL value,
00272 const OSDoubleFmt* pFmtSpec);
00273
00284 EXTERNJSON int rtJsonEncHexStr (OSCTXT* pctxt, OSUINT32 nocts,
00285 const OSOCTET* data);
00286
00297 EXTERNJSON int rtJsonEncIndent (OSCTXT* pctxt);
00298
00309 EXTERNJSON int rtJsonEncStringObject (OSCTXT* pctxt,
00310 const OSUTF8CHAR* name, const OSUTF8CHAR* value);
00311
00324 EXTERNJSON int rtJsonEncStringObject2 (OSCTXT* pctxt,
00325 const OSUTF8CHAR* name, size_t nameLen,
00326 const OSUTF8CHAR* value, size_t valueLen);
00327
00338 EXTERNJSON int rtJsonEncStringPair (OSCTXT* pctxt,
00339 const OSUTF8CHAR* name, const OSUTF8CHAR* value);
00340
00353 EXTERNJSON int rtJsonEncStringPair2 (OSCTXT* pctxt,
00354 const OSUTF8CHAR* name, size_t nameLen,
00355 const OSUTF8CHAR* value, size_t valueLen);
00356
00366 EXTERNJSON int rtJsonEncStringValue (OSCTXT* pctxt, const OSUTF8CHAR* value);
00367
00378 EXTERNJSON int rtJsonEncStringValue2 (OSCTXT* pctxt,
00379 const OSUTF8CHAR* value, size_t valueLen);
00380
00391 EXTERNJSON int rtJsonEncUnicodeData (OSCTXT* pctxt,
00392 const OSUNICHAR* value, OSUINT32 nchars);
00393
00403 EXTERNJSON int rtJsonEncUIntValue (OSCTXT* pctxt, OSUINT32 value);
00404
00416 EXTERNJSON int rtJsonEncUInt64Value (OSCTXT* pctxt, OSUINT64 value);
00417
00442 EXTERNJSON int rtJsonDecAnyElem (OSCTXT* pctxt, OSUTF8CHAR** ppvalue);
00443
00459 EXTERNJSON int rtJsonDecAnyType (OSCTXT* pctxt, OSUTF8CHAR** ppvalue);
00460
00484 EXTERNJSON int rtJsonDecBase64Str (OSCTXT* pctxt,
00485 OSOCTET* pvalue, OSUINT32* pnocts,
00486 size_t bufsize);
00487
00504 EXTERNJSON int rtJsonDecDynBase64Str (OSCTXT* pctxt, OSDynOctStr* pvalue);
00505
00516 EXTERNJSON int rtJsonDecBool (OSCTXT* pctxt, OSBOOL* pvalue);
00517
00530 EXTERNJSON int rtJsonDecDate (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00531
00550 EXTERNJSON int rtJsonDecTime (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00551
00564 EXTERNJSON int rtJsonDecDateTime (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00565
00578 EXTERNJSON int rtJsonDecGYear (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00579
00592 EXTERNJSON int rtJsonDecGYearMonth (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00593
00606 EXTERNJSON int rtJsonDecGMonth (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00607
00620 EXTERNJSON int rtJsonDecGMonthDay (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00621
00634 EXTERNJSON int rtJsonDecGDay (OSCTXT* pctxt, OSXSDDateTime* pvalue);
00635
00648 EXTERNJSON int rtJsonDecDecimal (OSCTXT* pctxt, OSREAL* pvalue,
00649 int totalDigits, int fractionDigits);
00650
00663 EXTERNJSON int rtJsonDecDouble (OSCTXT* pctxt, OSREAL* pvalue);
00664
00689 EXTERNJSON int rtJsonDecHexStr (OSCTXT* pctxt, OSOCTET* pvalue,
00690 OSUINT32* pnocts, size_t bufsize);
00691
00709 EXTERNJSON int rtJsonDecDynHexStr (OSCTXT* pctxt, OSDynOctStr* pvalue);
00710
00724 EXTERNJSON int rtJsonDecInt8Value (OSCTXT* pctxt, OSINT8* pvalue);
00725
00738 EXTERNJSON int rtJsonDecInt16Value (OSCTXT* pctxt, OSINT16* pvalue);
00739
00752 EXTERNJSON int rtJsonDecInt32Value (OSCTXT* pctxt, OSINT32* pvalue);
00753 #define rtJsonDecIntValue rtJsonDecInt32Value
00754
00767 EXTERNJSON int rtJsonDecInt64Value (OSCTXT* pctxt, OSINT64* pvalue);
00768
00782 EXTERNJSON int rtJsonDecUInt8Value (OSCTXT* pctxt, OSUINT8* pvalue);
00783
00796 EXTERNJSON int rtJsonDecUInt16Value (OSCTXT* pctxt, OSUINT16* pvalue);
00797
00810 EXTERNJSON int rtJsonDecUInt32Value (OSCTXT* pctxt, OSUINT32* pvalue);
00811 #define rtJsonDecUIntValue rtJsonDecUInt32Value
00812
00825 EXTERNJSON int rtJsonDecUInt64Value (OSCTXT* pctxt, OSUINT64* pvalue);
00826
00836 EXTERNJSON int rtJsonDecMatchChar (OSCTXT* pctxt, OSUTF8CHAR ch);
00837
00850 EXTERNJSON int rtJsonDecMatchObjectStart
00851 (OSCTXT* pctxt, const OSUTF8NameAndLen* nameArray, size_t numNames);
00852
00865 EXTERNJSON int rtJsonDecMatchToken (OSCTXT* pctxt, const OSUTF8CHAR* token);
00866
00880 EXTERNJSON int rtJsonDecMatchToken2
00881 (OSCTXT* pctxt, const OSUTF8CHAR* token, size_t tokenLen);
00882
00893 EXTERNJSON int rtJsonDecNameValuePair (OSCTXT* pctxt, OSUTF8NVP* pvalue);
00894
00905 EXTERNJSON int rtJsonDecPeekChar (OSCTXT* pctxt, OSUTF8CHAR* pch);
00906
00922 EXTERNJSON int rtJsonDecStringObject
00923 (OSCTXT* pctxt, const OSUTF8CHAR* name, OSUTF8CHAR** ppvalue);
00924
00939 EXTERNJSON int rtJsonDecStringValue (OSCTXT* pctxt, OSUTF8CHAR** ppvalue);
00940
00957 EXTERNJSON int rtJsonDecXmlStringValue (OSCTXT* pctxt, OSXMLSTRING* pvalue);
00958
00959 EXTERNJSON int rtJsonDecSkipWhitespace (OSCTXT* pctxt);
00960
00972 EXTERNJSON size_t rtJsonGetElemIdx
00973 (OSCTXT* pctxt, const OSUTF8NameAndLen nameArray[], size_t nrows);
00974
00980 #ifdef __cplusplus
00981 }
00982 #endif
00983
00984 #endif