JsonWriter Class Reference

#include <Pt/Json/JsonWriter.h>

Writes JSON to a text stream.

Public Member Functions

 JsonWriter ()
 Constructor.
 
 JsonWriter (std::basic_ostream< Char > &os)
 Constructs with output stream.
 
 ~JsonWriter ()
 Destructor.
 
const Pt::Stringindent () const
 Returns the indentation string.
 
bool isFormatting () const
 Returns true if indentation should be written.
 
std::basic_ostream< Char > * output ()
 Returns the output stream or a nullptr if none was set.
 
void reset ()
 Clears the writer state and output. More...
 
void reset (std::basic_ostream< Char > &os)
 Clears the writer state and output. More...
 
void setFormatting (bool value)
 Indicates wether indentation should be written.
 
void setIndent (const Pt::String &indent)
 Sets the indentation string.
 
void writeArray ()
 Writes the begin of an array.
 
void writeArrayEnd ()
 Writes the end of an array.
 
void writeBool (bool value)
 Writes an boolean value.
 
void writeFloat (long double value)
 Writes an float value.
 
void writeInt (Pt::int64_t value)
 Writes an integer value.
 
void writeMember (const Pt::Char *name, std::size_t nameSize)
 Writes a member.
 
void writeMember (const Pt::String &name)
 Writes a member.
 
void writeMember (const char *name)
 Writes a member.
 
void writeNull ()
 Writes an null value.
 
void writeObject ()
 Writes the begin of an object.
 
void writeObjectEnd ()
 Writes the end of an object.
 
void writeString (const Pt::Char *value, std::size_t valueSize)
 Writes a string value.
 
void writeString (const Pt::String &value)
 Writes a string value.
 
void writeUInt (Pt::uint64_t value)
 Writes an unsigned integer value.
 

Member Function Documentation

void reset ( )

Ther output stream is removed and the writer state is reset to write a new document. The formatting options are not changed.

void reset ( std::basic_ostream< Char > &  os)

The output stream is set and the writer state is reset to write a new document. The formatting options are not changed.