BloombergLP::baljsn::EncodeImplUtil::encodeMemberPrefix

Encode any needed comma and member-name tokens before a member value.

Synopsis

Declared in <baljsn_encodeimplutil.h>

static
int
encodeMemberPrefix(
    FORMATTER* formatter,
    std::ostream* logStream,
    std::string_view const& memberName,
    bool isFirstMember);

Description

If the specified isFirstMember flag is false, encode a "comma" JSON token to the specified formatter, and do not encode a "comma" JSON token otherwise. If the specified formattingMode does not have the bdlat_FormattingMode::e_UNTAGGED bit set, encode a JSON "string" token having the specified memberName contents, and encode a JSON "colon" token after the string, and do not encode these tokens otherwise. If this operation is not successful, load an unspecified, human-readable description of the error condition to the specified logStream. Optionally specify isPrefixEmpty. If this operation encodes a token to the formatter, load the value false to isPrefixEmpty if specified, and the value true otherwise. Return 0 on success, and a non-zero value otherwise.

Return Value

0 on success, and a non-zero value otherwise

Parameters

NameDescription
formatterJSON formatter that receives the encoded tokens
logStreamstream for human-readable error descriptions
memberNamename of the member
isFirstMemberif true, omit a leading comma