20 #include "mongo/bson/bsonobj.h"
21 #include "mongo/base/status.h"
22 #include "mongo/client/export_macros.h"
39 MONGO_CLIENT_API BSONObj MONGO_CLIENT_FUNC
fromjson(
const std::string& str);
42 MONGO_CLIENT_API BSONObj MONGO_CLIENT_FUNC
fromjson(
const char* str,
int* len = NULL);
59 MONGO_CLIENT_API
bool isArray(
const StringData& str);
68 MONGO_CLIENT_API std::string
tojson(
const BSONArray& arr,
79 MONGO_CLIENT_API std::string
tojson(
const BSONObj& obj,
320 Status regexPat(std::string* result);
321 Status regexOpt(std::string* result);
346 Status field(std::string* result);
355 Status quotedString(std::string* result);
391 Status chars(std::string* result,
const char* terminalSet,
const char* allowedSet = NULL);
399 std::string encodeUTF8(
unsigned char first,
unsigned char second)
const;
407 inline bool peekToken(
const char* token);
415 inline bool readToken(
const char* token);
423 bool readTokenImpl(
const char* token,
bool advance =
true);
435 bool match(
char matchChar,
const char* matchSet)
const;
455 inline int offset() {
456 return (_input - _buf);
471 const char*
const _buf;
473 const char*
const _input_end;
JsonStringFormat
Formatting mode for generating JSON from BSON.
Definition: oid.h:205
Status represents an error state or the absence thereof.
Definition: status.h:50
MONGO_CLIENT_API BSONObj MONGO_CLIENT_FUNC fromjson(const std::string &str)
Create a BSONObj from a JSON http://www.json.org, http://www.ietf.org/rfc/rfc4627.txt string.
A StringData object wraps a 'const string&' or a 'const char*' without copying its contents...
Definition: string_data.h:43
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
Parser class.
Definition: json.h:88
strict RFC format
Definition: oid.h:207
Utility for creating a BSONObj.
Definition: bsonobjbuilder.h:53
MONGO_CLIENT_API bool isArray(const StringData &str)
Tests whether the JSON string is an Array.
MONGO_CLIENT_API std::string tojson(const BSONArray &arr, JsonStringFormat format=Strict, bool pretty=false)
Convert a BSONArray to a JSON string.