Json Box  0.6.1
This is a JSON C++ library. It can write and read JSON files with ease and speed.
Public Member Functions | Private Attributes | List of all members
JsonBox::OutputFilter< Inserter > Class Template Reference

#include <OutputFilter.h>

Inherits streambuf.

Public Member Functions

 OutputFilter (std::streambuf *newDestination, Inserter newInserter, bool newDeleteWhenFinished=false)
 
 OutputFilter (std::streambuf *newDestination, bool newDeleteWhenFinished=false)
 
virtual ~OutputFilter ()
 
virtual int_type overflow (int_type ch)
 
virtual int_type underflow ()
 
Inserter & getInserter ()
 
std::streambuf * getDestination () const
 

Private Attributes

std::streambuf * destination
 Pointer to the destination streambuf. More...
 
Inserter inserter
 
bool deleteWhenFinished
 

Detailed Description

template<typename Inserter>
class JsonBox::OutputFilter< Inserter >

Templated class used to filter output in an std::ostream. The custom mechanic of the filtering is easily implemented in the given Inserter. An output filter can be used to add indentation to an std::ostream, it can be used to log an std::ostream, etc.

Template Parameters
InserterType used as the inserter for the output filter.

Constructor & Destructor Documentation

template<typename Inserter >
JsonBox::OutputFilter< Inserter >::OutputFilter ( std::streambuf *  newDestination,
Inserter  newInserter,
bool  newDeleteWhenFinished = false 
)
inline

Parameterized constructor.

Parameters
newDestinationPointer to the streambuf destination.
newInserterInserter to use to filter the output.
newDeleteWhenFinishedUsed to know if the instance will have to delete its destination streambuf or not.
template<typename Inserter >
JsonBox::OutputFilter< Inserter >::OutputFilter ( std::streambuf *  newDestination,
bool  newDeleteWhenFinished = false 
)
inline

Parameterized constructor.

Parameters
newDestinationPointer to the streambuf destination.
newDeleteWhenFinishedUsed to know if the instance will have to delete its destination streambuf or not.
template<typename Inserter >
virtual JsonBox::OutputFilter< Inserter >::~OutputFilter ( )
inlinevirtual

Destructor. Takes care of deleting the destination streambuf if necessary.

Member Function Documentation

template<typename Inserter >
std::streambuf* JsonBox::OutputFilter< Inserter >::getDestination ( ) const
inline

Gets the destination streambuf.

Returns
Pointer to the destination streambuf.
template<typename Inserter >
Inserter& JsonBox::OutputFilter< Inserter >::getInserter ( )
inline

Gets the inserter's instance.

Returns
Reference to the inserter.
template<typename Inserter >
virtual int_type JsonBox::OutputFilter< Inserter >::overflow ( int_type  ch)
inlinevirtual

Actual function that calls the inserter to filter the output.

Returns
Unspecified value not equal to traits::eof() on success, traits::eof() on failure.
template<typename Inserter >
virtual int_type JsonBox::OutputFilter< Inserter >::underflow ( )
inlinevirtual

Since it's an output filter, we don't need to do anything here.

Member Data Documentation

template<typename Inserter >
bool JsonBox::OutputFilter< Inserter >::deleteWhenFinished
private

Bool used to know if the filter must delete its destination filter or not.

See also
JsonBox::Filter<Inserter>::destination
template<typename Inserter >
std::streambuf* JsonBox::OutputFilter< Inserter >::destination
private

Pointer to the destination streambuf.

template<typename Inserter >
Inserter JsonBox::OutputFilter< Inserter >::inserter
private

Inserter to use to insert new characters in the destination streambuf.

See also
JsonBox::Filter<Inserter>::destination

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