Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

baljsn::DatumUtil Struct Reference

#include <baljsn_datumutil.h>

List of all members.

Static Public Member Functions

static int decode (bdld::ManagedDatum *result, const bsl::string_view &json)
static int decode (bdld::ManagedDatum *result, const bsl::string_view &json, const DatumDecoderOptions &options)
static int decode (bdld::ManagedDatum *result, bsl::ostream *errorStream, const bsl::string_view &json)
static int decode (bdld::ManagedDatum *result, bsl::ostream *errorStream, const bsl::string_view &json, const DatumDecoderOptions &options)
static int decode (bdld::ManagedDatum *result, bsl::streambuf *jsonBuffer)
static int decode (bdld::ManagedDatum *result, bsl::streambuf *jsonBuffer, const DatumDecoderOptions &options)
static int decode (bdld::ManagedDatum *result, bsl::ostream *errorStream, bsl::streambuf *jsonBuffer)
static int decode (bdld::ManagedDatum *result, bsl::ostream *errorStream, bsl::streambuf *jsonBuffer, const DatumDecoderOptions &options)
static int encode (bsl::string *result, const bdld::Datum &datum)
static int encode (std::string *result, const bdld::Datum &datum)
static int encode (bsl::string *result, const bdld::Datum &datum, const DatumEncoderOptions &options)
static int encode (std::string *result, const bdld::Datum &datum, const DatumEncoderOptions &options)
static int encode (bsl::ostream &stream, const bdld::Datum &datum)
static int encode (bsl::ostream &stream, const bdld::Datum &datum, const DatumEncoderOptions &options)

Detailed Description

This struct provides a namespace for a suite of functions that convert between a JSON formated string and a bdld::Datum.

See Component baljsn_datumutil


Member Function Documentation

static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
const bsl::string_view &  json 
) [static]
static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
const bsl::string_view &  json,
const DatumDecoderOptions options 
) [static]
static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
bsl::ostream *  errorStream,
const bsl::string_view &  json 
) [static]
static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
bsl::ostream *  errorStream,
const bsl::string_view &  json,
const DatumDecoderOptions options 
) [static]

Decode the specified json into the specified result. If the optionally specified errorStream is non-null, a description of any errors that occur during parsing will be output to this stream. If the optionally specified options argument is not present, treat it as a default-constructed DatumDecoderOptions. Return 0 on success, and a negative value if json could not be decoded (either because it is ill-formed, or if a constraint imposed by option is violated). An error status will be returned if json contains arrays or objects that are nested beyond a depth configured by options.maxNestedDepth(). The mapping of types in JSON to the types supported by Datum is described in Supported Types.

static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
bsl::streambuf *  jsonBuffer 
) [static]
static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
bsl::streambuf *  jsonBuffer,
const DatumDecoderOptions options 
) [static]
static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
bsl::ostream *  errorStream,
bsl::streambuf *  jsonBuffer 
) [static]
static int baljsn::DatumUtil::decode ( bdld::ManagedDatum result,
bsl::ostream *  errorStream,
bsl::streambuf *  jsonBuffer,
const DatumDecoderOptions options 
) [static]

Decode the JSON string provided by the specified jsonBuffer into the specified result. If the optionally specified errorStream is non-null, a description of any errors that occur during parsing will be output to this stream. If the optionally specified options argument is not present, treat it as a default-constructed DatumDecoderOptions. Return 0 on success, and a negative value if json could not be decoded (either because it is ill-formed, or if a constraint imposed by option is violated). An error status will be returned if json contains arrays or objects that are nested beyond a depth configured by options.maxNestedDepth(). The mapping of types in JSON to the types supported by Datum is described in Supported Types.

static int baljsn::DatumUtil::encode ( bsl::string result,
const bdld::Datum datum 
) [static]
static int baljsn::DatumUtil::encode ( std::string *  result,
const bdld::Datum datum 
) [static]
static int baljsn::DatumUtil::encode ( bsl::string result,
const bdld::Datum datum,
const DatumEncoderOptions options 
) [static]
static int baljsn::DatumUtil::encode ( std::string *  result,
const bdld::Datum datum,
const DatumEncoderOptions options 
) [static]

Encode the specified datum as a JSON string, and load the specified result with the encoded JSON string. Return 0 on success, and a negative value if datum could not be encoded (with no effect on result). If the optionally specified options argument is not present, treat it as a default-constructed DatumEncoderOptions. If options.strictTypes is true and a type that is not supported by JSON, or a singular double value (e.g., NaN or infinity) is being encoded (see Supported Types) return a positive value, but also populate result with an encoded JSON string (i.e., the value of result is the same regardless of the strictTypes option, but if strictTypes is true a non-zero positive status will be returned). The mapping of types supported by Datum to JSON types is described in Supported Types.

static int baljsn::DatumUtil::encode ( bsl::ostream &  stream,
const bdld::Datum datum 
) [static]
static int baljsn::DatumUtil::encode ( bsl::ostream &  stream,
const bdld::Datum datum,
const DatumEncoderOptions options 
) [static]

Encode the specified datum as a JSON string, and write it into the specified stream. Return 0 on success, and a negative value if datum could not be encoded (which may leave a partial JSON sequence on the stream). If the optionally specified options argument is not present, treat it as a default-constructed DatumEncoderOptions. If options.strictTypes is true and a type that is not supported by JSON, or a singular double value (e.g., NaN or infinity) is being encoded (see Supported Types) return a positive value, but also populate result with an encoded JSON string (i.e., the value of result is the same regardless of the strictTypes option, but if strictTypes is true a non-zero positive status will be returned). The mapping of types supported by Datum to JSON types is described in Supported Types.


The documentation for this struct was generated from the following file: