JsonReader Class Reference

#include <Pt/Json/JsonReader.h>

Reads JSON as a Stream of Nodes.

Inherits NonCopyable.

Public Member Functions

 JsonReader ()
 Default Constructor.
 
 JsonReader (std::basic_istream< Pt::Char > &is)
 Construct with input source.
 
 ~JsonReader ()
 Destructor.
 
Nodeadvance ()
 Process availabe data from underlying input source.
 
void attach (std::basic_istream< Pt::Char > &is)
 Sets the input source.
 
InputIterator current ()
 Returns an iterator to the current node.
 
InputIterator end () const
 Returns an iterator to the end of the document.
 
Nodeget ()
 Get current node.
 
std::basic_istream< Pt::Char > * input ()
 Returns the current input source or nullptr if none is set.
 
std::size_t line () const
 Returns the current line of the primary input source.
 
std::size_t maxSize () const
 Returns the number of characters the parser may allocate.
 
Nodenext ()
 Get next node.
 
void reset ()
 Clears the reader state and input. More...
 
void reset (std::basic_istream< Pt::Char > &is)
 Starts parsing with an input source. More...
 
void setChunkSize (std::size_t n)
 Sets the max size of a characters block. More...
 
void setMaxSize (std::size_t n)
 Sets the max number of characters the parser may allocate.
 
std::size_t usedSize () const
 Returns the number of characters the parser has allocated.
 

Member Function Documentation

void reset ( )

All input sources are removed and the parser state is reset to parse a new document.

void reset ( std::basic_istream< Pt::Char > &  is)

All previous input is removed and the parser is reset to parse a new document. This is essentially the same as calling reset() followed by addInput().

void setChunkSize ( std::size_t  n)

If an JSON element contains more character data than this limit, the content is reported as multiple nodes.