SequoiaDB
 All Classes Files Functions Variables Enumerations Enumerator
jstobs.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2011-2018 SequoiaDB Ltd.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 *******************************************************************************/
16 
20 #ifndef JSTOBS__H
21 #define JSTOBS__H
22 
23 #include "cJSON.h"
24 #include "core.h"
25 #include "bson/bson.h"
26 
27 SDB_EXTERN_C_START
28 
36 SDB_EXPORT void JsonSetPrintfLog( void (*pFun)( const CHAR *pFunc,
37  const CHAR *pFile,
38  UINT32 line,
39  const CHAR *pFmt,
40  ... ) ) ;
41 
42 //Compatible with the old version, the new code is not recommended use.
43 SDB_EXPORT BOOLEAN jsonToBson ( bson *bs, const CHAR *json_str ) ;
44 
45 //Compatible with the old version, the new code is not recommended use.
46 SDB_EXPORT BOOLEAN jsonToBson2 ( bson *bs,
47  const CHAR *json_str,
48  BOOLEAN isMongo,
49  BOOLEAN isBatch ) ;
50 
58 SDB_EXPORT BOOLEAN json2bson2( const CHAR *pJson, bson *pBson ) ;
59 
76 SDB_EXPORT BOOLEAN json2bson( const CHAR *pJson,
77  CJSON_MACHINE *pMachine,
78  INT32 parseMode,
79  BOOLEAN isCheckEnd,
80  BOOLEAN isUnicode,
81  bson *pBson ) ;
82 
83 SDB_EXPORT void setJsonPrecision( const CHAR *pFloatFmt ) ;
84 
99 SDB_EXPORT BOOLEAN bsonToJson ( CHAR *buffer, INT32 bufsize, const bson *b,
100  BOOLEAN toCSV, BOOLEAN skipUndefined ) ;
101 
116 SDB_EXPORT BOOLEAN bsonToJson2 ( CHAR *buffer, INT32 bufsize, const bson *b,
117  BOOLEAN isStrict ) ;
118 
119 SDB_EXTERN_C_END
120 
121 #endif // end JSTOBS__H