This component‐private utility struct provides a suite of functions that encode bdlat types in the JSON format.

Synopsis

Declared in <baljsn_encodeimplutil.h>

template<class FORMATTER>
struct EncodeImplUtil;

Type Aliases

Name

Description

FormattingMode

FormattingMode is an alias to the type of an int‐valued bdlat_FormattingMode bit‐field. A FormattingMode value is not valid unless it is equal to an enumerator of bdlat_FormattingMode or a valid bitwise‐or of two or more such enumerators. See bdlat_formattingmode for a description of the set of valid formatting‐mode values.

ThisUtil

ThisUtil is a convenience alias for this utility struct.

Static Member Functions

Name

Description

closeDocument

Print the sequence of characters that designate the end of a JSON document to the specified outputStream according to the specified encoding options. See the baljsn_encoderoptions for a description of the effects, if any, of each option in the options on the end of a JSON document.

encode

encode overloads

encodeCharArray

Encode the JSON representation of the specified value to the specified JSON formatter. Use the specified options to configure aspects of the JSON representation of the value. Return 0 on success, and a non‐zero value otherwise.

encodeEmptyArray

Encode the representation of the empty‐array JSON value to the specified formatter.

encodeMember

encodeMember overloads

encodeMemberPrefix

encodeMemberPrefix overloads

encodeNonEmptyArray

Encode the JSON representation of the specified value to the specified JSON formatter. Use the specified options to configure aspects of the JSON representation of the value. If this operation is not successful, load an unspecified, human‐readable description of the error condition to the specified logStream. Return 0 on success, and a non‐zero value otherwise. The behavior is undefined unless the value is non‐empty and the specified TYPE satisfies both the static and dynamic requirements of the Array bdlat type‐category concept. See baljsn_encoderoptions for a description of the effects, if any, of each option in the options on the JSON representation of the selection. See the package‐level documentation of bdlat for an introduction to the requirements of bdlat type‐category concepts.

encodeObjectPrefix

If the specified formattingMode does not have the bdlat_FormattingMode::e_UNTAGGED bit set, encode a "left brace" JSON token to the specified formatter, and encoding nothing to the formatter otherwise. If this operation encodes a token to the formatter, load the value false to the specified isPrefixEmpty, and the value true otherwise.

encodeObjectSuffix

If the specified formattingMode does not have the bdlat_FormattingMode::e_UNTAGGED bit set, encode a "right brace" JSON token to the specified formatter, and encoding nothing to the formatter otherwise. If this operation encodes a token to the formatter, load the value false to the specified isSuffixEmpty, and the value true otherwise.

encodeSimpleValue

Encode the JSON representation of the specified value to the specified JSON formatter. Use the specified options to configure aspects of the JSON representation of the value. Return 0 on success, and a non‐zero value otherwise. The behavior is undefined unless the specified TYPE satisfies both the static and dynamic requirements of the Simple bdlat type‐category concept. See baljsn_encoderoptions for a description of the effects, if any, of each option in the options on the JSON representation of the value. See the package‐level documentation of bdlat for an introduction to the requirements of bdlat type‐category concepts.

openDocument

Print the sequence of characters that designate the start of a JSON document to the specified outputStream according to the specified encoding options. See baljsn_encoderoptions for a description of the effects, if any, of each option in the options on the start of a JSON document.

validate

validate overloads

validateChoice

Determine if the specified value satisfies the requirements for encoding using this component. If the value meets the encoding requirements, return 0, otherwise load an unspecified, human‐readable description of the requirements that are not satisfied by the value to the specified logStream and return a non‐zero value. The value is required to not have an undefined selectionId.

Created with MrDocs