#include <baljsn_encoder.h>
This class implements a formatter providing operations for rending JSON text elements to an output stream (supplied at construction) according to a set of formatting options (also supplied at construction). This is a component-private class and should not be used outside of this component.
- Deprecated:
- Use baljsn::Formatter instead.
See baljsn_encoder
◆ Encoder_Formatter()
baljsn::Encoder_Formatter::Encoder_Formatter |
( |
bsl::ostream & |
stream, |
|
|
const EncoderOptions & |
options |
|
) |
| |
◆ ~Encoder_Formatter()
baljsn::Encoder_Formatter::~Encoder_Formatter |
( |
| ) |
|
|
default |
◆ closeArray()
void baljsn::Encoder_Formatter::closeArray |
( |
bool |
formatAsEmptyArrayFlag = false | ) |
|
Print onto the stream supplied at construction the sequence of characters designating the end of an array. Optionally specify formatAsEmptyArrayFlag
denoting if the array being closed should be formatted as an empty array. If formatAsEmptyArrayFlag
is not specified then the array being closed is formatted as an array having elements. Note that the formatting (and as a consequence the formatAsEmptyArrayFlag
) is relevant only if this formatter encodes in the pretty style and is ignored otherwise.
◆ closeDocument()
void baljsn::Encoder_Formatter::closeDocument |
( |
| ) |
|
Print onto the stream supplied at construction the sequence of characters designating the end of the document.
◆ closeElement()
void baljsn::Encoder_Formatter::closeElement |
( |
| ) |
|
Print onto the stream supplied at construction the sequence of characters designating the end of an element.
◆ closeObject()
void baljsn::Encoder_Formatter::closeObject |
( |
| ) |
|
Print onto the stream supplied at construction the sequence of characters designating the end of an object.
◆ indent()
void baljsn::Encoder_Formatter::indent |
( |
| ) |
|
Print onto the stream supplied at construction the sequence of whitespace characters for the proper indentation of an element given the encoding options supplied at construction.
◆ isArrayElement()
bool baljsn::Encoder_Formatter::isArrayElement |
( |
| ) |
const |
|
inline |
Return the value of the flag denoting if the current element refers to an array element.
◆ openArray()
void baljsn::Encoder_Formatter::openArray |
( |
bool |
formatAsEmptyArrayFlag = false | ) |
|
Print onto the stream supplied at construction the sequence of characters designating the start of an array. Optionally specify formatAsEmptyArrayFlag
denoting if the array being opened should be formatted as an empty array. If formatAsEmptyArrayFlag
is not specified then the array being opened is formatted as an array having elements. Note that the formatting (and as a consequence the formatAsEmptyArrayFlag
) is relevant only if this formatter encodes in the pretty style and is ignored otherwise.
◆ openDocument()
void baljsn::Encoder_Formatter::openDocument |
( |
| ) |
|
Print onto the stream supplied at construction the sequence of characters designating the start of the document.
◆ openElement()
int baljsn::Encoder_Formatter::openElement |
( |
const bsl::string & |
name | ) |
|
Print onto the stream supplied at construction the sequence of characters designating the start of an element having the specified name
. Return 0 on success and a non-zero value otherwise.
◆ openObject()
void baljsn::Encoder_Formatter::openObject |
( |
| ) |
|
Print onto the stream supplied at construction the sequence of characters designating the start of an object.
◆ setIsArrayElement()
void baljsn::Encoder_Formatter::setIsArrayElement |
( |
bool |
isArrayElement | ) |
|
|
inline |
Set the flag denoting if the current element refers to an array element to the specified isArrayElement
.
The documentation for this class was generated from the following file: