This class implements a formatter for rendering JSON text elements.

Synopsis

Declared in <baljsn_simpleformatter.h>

class SimpleFormatter;

Description

This class provides operations for rendering JSON text elements to an output stream (supplied at construction) according to a set of formatting options (also supplied at construction). This class has an interface that's easier to use than that of baljsn::Formatter, and generates more correctly‐formatted pretty output.

Enums

Name

Description

ArrayFormattingStyle

This enum lists all possible array formatting styles.

Member Functions

Name

Description

SimpleFormatter [constructor]

Constructors

~SimpleFormatter [destructor]

Destroy this object. Note that correct JSON has been generated if the isCompleteJSON() call returns true.

addMemberName

Print name in double‐quotes onto the stream supplied at construction.

addNullValue

addNullValue overloads

addValue

addValue overloads

allocator

Return the allocator used by this object to supply memory.

closeArray

Print the characters that end a JSON array onto the output stream.

closeObject

Print the characters that end a JSON object onto the output stream.

isCompleteJSON

Return whether this formatter has produced complete JSON.

isFormattingArray

Return whether this formatter is currently formatting an array.

isFormattingObject

Return whether this formatter is currently formatting an object.

isNameNeeded

Return whether a subsequent value must supply a name.

openArray

openArray overloads

openObject

openObject overloads

operator BloombergLP::bslmf::NestedTraitDeclaration<SimpleFormatter, UsesBslmaAllocator>

Declare that SimpleFormatter uses a bslma allocator.

Created with MrDocs