BloombergLP::baljsn::EncodeImplUtil::encode

encode overloads

Synopses

Declared in <baljsn_encodeimplutil.h>

Encode the JSON representation of value to jsonStream.

template<class TYPE>
static
int
encode(
    std::ostream* jsonStream,
    TYPE const& value,
    EncoderOptions const& options = EncoderOptions());
» more...

Encode the JSON representation of value to jsonStream, logging errors to logStream.

template<class TYPE>
static
int
encode(
    std::ostream* logStream,
    std::ostream* jsonStream,
    TYPE const& value,
    EncoderOptions const& options = EncoderOptions());
» more...

Encode the JSON representation of value to formatter.

template<class TYPE>
static
int
encode(
    bool* isValueEmpty,
    FORMATTER* formatter,
    std::ostream* logStream,
    TYPE const& value,
    FormattingMode formattingMode,
    EncoderOptions const& options,
    bool isFirstMember);
» more...

Return Value

0 on success, and a non-zero value otherwise

Parameters

NameDescription
jsonStreamstream that receives the JSON representation
valuevalue to encode
optionsencoding options
logStreamstream for human-readable error descriptions
isValueEmptyreceives whether the representation is empty
formatterJSON formatter that receives the encoded tokens
formattingModeformatting-mode bit-field for the value
isFirstMemberif true, omit a leading sequence delimiter