encode overloads
Synopses
Declared in <baljsn_datumutil.h>
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 []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 []Types).
static
int
encode(
std::ostream& stream,
bdld::Datum const& datum);
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 []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 []Types).
static
int
encode(
bsl::string* result,
bdld::Datum const& datum);
Same as the preceding overload, loading into a std::pmr::string.
static
int
encode(
std::pmr::string* result,
bdld::Datum const& datum);
Same as the preceding overload, loading into a std::string.
static
int
encode(
std::string* result,
bdld::Datum const& datum);
Same as the preceding overload, using the specified options.
static
int
encode(
std::ostream& stream,
bdld::Datum const& datum,
DatumEncoderOptions const& options);
Same as the preceding overload, using the specified options.
static
int
encode(
bsl::string* result,
bdld::Datum const& datum,
DatumEncoderOptions const& options);
Same as the preceding overload, loading into a std::pmr::string.
static
int
encode(
std::pmr::string* result,
bdld::Datum const& datum,
DatumEncoderOptions const& options);
Same as the preceding overload, loading into a std::string.
static
int
encode(
std::string* result,
bdld::Datum const& datum,
DatumEncoderOptions const& options);
Created with MrDocs