SPT JSON API  1.0.0
Developed by Sans Pareil Technologies, Inc. (SPT)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
spt::json::io::StreamWriter Class Reference

Writer for serialising spt::json::Json instances. More...

#include <StreamWriter.h>

+ Inheritance diagram for spt::json::io::StreamWriter:
+ Collaboration diagram for spt::json::io::StreamWriter:

Public Member Functions

 StreamWriter (bool prettyPrint=false, std::string decorator=std::string(" "))
 
void write (const spt::json::Object &object, std::ostream &stream) const
 
void write (const spt::json::Array &array, std::ostream &stream) const
 
- Public Member Functions inherited from spt::json::io::Writer
virtual ~Writer ()
 Virtual DTOR for subclasses. More...
 

Additional Inherited Members

- Protected Member Functions inherited from spt::json::io::Writer
 Writer (bool pp, std::string dec)
 
- Protected Attributes inherited from spt::json::io::Writer
bool prettyPrint = false
 
std::string decorator
 

Detailed Description

Writer for serialising spt::json::Json instances.

Date
Created 2013/05/07 19:45
Author
Rakesh Vidyadharan
Version
Id
StreamWriter.h 5673 2014-10-25 22:47:51Z rakesh

Constructor & Destructor Documentation

spt::json::io::StreamWriter::StreamWriter ( bool  prettyPrint = false,
std::string  decorator = std::string( "  " ) 
)
inlineexplicit

Create a new writer instance for serialising JSON data.

Parameters
prettyPrintFlag indicating whether output should be formatted for human readability or not.
decoratorThe decorator string to use for formating output.

Member Function Documentation

void spt::json::io::StreamWriter::write ( const spt::json::Object object,
std::ostream &  stream 
) const

Write the specified JSON object to the specified stream.

Parameters
objectThe JSON object to serialise
streamThe stream to serialise the object to.
Exceptions
std::runtime_errorIf the stream is not writable to.
void spt::json::io::StreamWriter::write ( const spt::json::Array array,
std::ostream &  stream 
) const

Write the specified JSON array to the specified stream.

Parameters
arrayThe JSON array to serialise
streamThe stream to serialise the array to.
Exceptions
std::runtime_errorIf the stream is not writable to.

The documentation for this class was generated from the following file: