This class implements a formatter providing operations for rendering JSON text elements to an output stream (supplied at construction) according to a set of formatting options (also supplied at construction).
Declared in <baljsn_formatter.h>
class Formatter;
| Name | Description |
|---|---|
Formatter [constructor] | Constructors |
addArrayElementSeparator | Print onto the stream supplied at construction the sequence of characters designating an array element separator (i.e., ,). The behavior is undefined unless this Formatter is currently formatting a member. |
closeArray | Print onto the stream supplied at construction the sequence of characters designating the end of an array (referred to as an "array" in JSON). Optionally specify formatAsEmptyArray denoting if the array being closed should be formatted as an empty array. If formatAsEmptyArray is not specified then the array being closed is formatted as an array having elements. The behavior is undefined unless this Formatter is currently formatting an array. Note that the formatting (and as a consequence the formatAsEmptyArray) is relevant only if this formatter encodes in the pretty style and is ignored otherwise. |
closeMember | Print onto the stream supplied at construction the sequence of characters designating the end of an member (referred to as a "name/value pair" in JSON). The behavior is undefined unless this Formatter is currently formatting a member. |
closeObject | Print onto the stream supplied at construction the sequence of characters designating the end of an object (referred to as an "object" in JSON). The behavior is undefined unless this Formatter is currently formatting an object. |
nestingDepth | Return the number of currently open nested objects or arrays. |
openArray | Print onto the stream supplied at construction the sequence of characters designating the start of an array (referred to as an "array" in JSON). Optionally specify formatAsEmptyArray denoting if the array being opened should be formatted as an empty array. If formatAsEmptyArray is not specified then the array being opened is formatted as an array having elements. Note that the formatting (and as a consequence the formatAsEmptyArray) is relevant only if this formatter encodes in the pretty style and is ignored otherwise. |
openMember | Print onto the stream supplied at construction the sequence of characters designating the start of a member (referred to as a "name/value pair" in JSON) having the specified name. Return 0 on success and a non-zero value otherwise. |
openObject | Print onto the stream supplied at construction the sequence of characters designating the start of an object (referred to as an "object" in JSON). |
putNullValue | Print onto the stream supplied at construction the value corresponding to a null element. Return 0 on success and a non-zero value otherwise. |
putValue | Print onto the stream supplied at construction the specified value. Optionally specify options according which value should be encoded. Return 0 on success and a non-zero value otherwise. |