BloombergLP::baljsn::Formatter::Formatter

Constructors

Synopses

Declared in <baljsn_formatter.h>

Create a Formatter that writes JSON text to the specified stream.

Formatter(
    std::ostream& stream,
    bool usePrettyStyle = false,
    int initialIndentLevel = 0,
    int spacesPerLevel = 0,
    bslma::Allocator* basicAllocator = 0);
» more...

Create a Formatter object having the specified stream, usePrettyStyle, initialIndentLevel, spacesPerLevel, escapeForwardSlash, and basicAllocator attributes.

Formatter(
    std::ostream& stream,
    bool usePrettyStyle,
    int initialIndentLevel,
    int spacesPerLevel,
    bool escapeForwardSlash,
    bslma::Allocator* basicAllocator = 0);
» more...

Parameters

NameDescription
streamoutput stream for formatted JSON
usePrettyStylewhether to use pretty encoding style
initialIndentLevelstarting indentation level for pretty style
spacesPerLevelspaces per indentation level for pretty style
basicAllocatormemory allocator; null uses the default
escapeForwardSlashwhether to escape / as /