BloombergLP::baljsn::Encoder::encode

encode overloads

Synopses

Declared in <baljsn_encoder.h>

Encode value as JSON onto stream using default options.

template<class TYPE>
int
encode(
    std::ostream& stream,
    TYPE const& value);
» more...

Encode the specified value of (template parameter) TYPE into the specified streamBuf. Return 0 on success, and a non-zero value otherwise.

template<class TYPE>
int
encode(
    std::streambuf* streamBuf,
    TYPE const& value);
» more...

Encode value as JSON onto stream using options.

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

Same as the preceding overload, accepting a nullable options pointer.

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

Encode value as JSON onto streamBuf using options.

template<class TYPE>
int
encode(
    std::streambuf* streamBuf,
    TYPE const& value,
    EncoderOptions const& options);
» more...

Same as the preceding overload, accepting a nullable options pointer.

template<class TYPE>
int
encode(
    std::streambuf* streamBuf,
    TYPE const& value,
    EncoderOptions const* options);
» more...

Return Value

0 on success, and a non-zero value otherwise

Parameters

NameDescription
streamoutput stream for JSON
valuevalue to encode
streamBufoutput buffer for JSON
optionsencoding options