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::StringWriter Class Reference

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

#include <StringWriter.h>

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

Public Member Functions

 StringWriter (bool prettyPrint=false, std::string decorator=std::string(" "))
 
std::string write (const spt::json::Object &object) const
 
std::string write (const spt::json::Array &array) 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
StringWriter.h 5673 2014-10-25 22:47:51Z rakesh

Constructor & Destructor Documentation

spt::json::io::StringWriter::StringWriter ( 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

std::string spt::json::io::StringWriter::write ( const spt::json::Object object) const

Transform the specified JSON object into its string representation.

Parameters
objectThe JSON object to serialise
Returns
The JSON data as a string
Exceptions
std::runtime_errorIf the stream is not writable to.
std::string spt::json::io::StringWriter::write ( const spt::json::Array array) const

Transform the specified JSON array into its string representation.

Parameters
arrayThe JSON array to serialise
Returns
The JSON data as a string
Exceptions
std::runtime_errorIf the stream is not writable to.

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