Data Structures | Public Member Functions | Protected Attributes
Json::StreamWriter Class Referenceabstract

#include <json.h>

Inheritance diagram for Json::StreamWriter:
Json::BuiltStyledStreamWriter Json::BuiltStyledStreamWriter

Data Structures

class  Factory
 A simple abstract factory. More...
 

Public Member Functions

 StreamWriter ()
 
virtual ~StreamWriter ()
 
virtual int write (Value const &root, OStream *sout)=0
 

Protected Attributes

OStreamsout_
 

Detailed Description

Usage:

using namespace Json;
void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
std::unique_ptr<StreamWriter> const writer(
factory.newStreamWriter());
writer->write(value, &std::cout);
std::cout << std::endl; // add lf and flush
}

Constructor & Destructor Documentation

Json::StreamWriter::StreamWriter ( )
Json::StreamWriter::~StreamWriter ( )
virtualdefault

Member Function Documentation

virtual int Json::StreamWriter::write ( Value const &  root,
OStream sout 
)
pure virtual

Write Value into document as configured in sub-class. Do not take ownership of sout, but maintain a reference during function.

Precondition
sout != NULL
Returns
zero on success (For now, we always return zero, so check the stream instead.)
Exceptions
std::exceptionpossibly, depending on configuration

Implemented in Json::BuiltStyledStreamWriter, and Json::BuiltStyledStreamWriter.

Field Documentation

OStream* Json::StreamWriter::sout_
protected

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