30#ifndef PT_JSON_JSON_READER_H
31#define PT_JSON_JSON_READER_H
33#include <Pt/Json/Api.h>
34#include <Pt/Json/Node.h>
35#include <Pt/IOStream.h>
37#include <Pt/NonCopyable.h>
67 std::basic_istream<Pt::Char>*
input();
71 void attach(std::basic_istream<Pt::Char>& is);
86 void reset(std::basic_istream<Pt::Char>& is);
132 JsonReaderImpl* impl()
136 JsonReaderImpl* _impl;
156 { _node = &_stream->get(); }
161 : _stream(it._stream), _node(it._node)
173 _stream = it._stream;
192 if(_node->type() == Node::EndDocument)
195 _node = &_stream->next();
203 {
return _node == it._node; }
208 {
return _node != it._node; }
Reads JSON as a Stream of Nodes.
Definition JsonReader.h:51
Node * advance()
Process availabe data from underlying input source.
InputIterator end() const
Returns an iterator to the end of the document.
Definition JsonReader.h:222
void reset(std::basic_istream< Pt::Char > &is)
Starts parsing with an input source.
Node & next()
Get next node.
JsonReader()
Default Constructor.
std::size_t maxSize() const
Returns the number of characters the parser may allocate.
JsonReader(std::basic_istream< Pt::Char > &is)
Construct with input source.
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.
void attach(std::basic_istream< Pt::Char > &is)
Sets the input source.
InputIterator current()
Returns an iterator to the current node.
Definition JsonReader.h:216
void setMaxSize(std::size_t n)
Sets the max number of characters the parser may allocate.
void reset()
Clears the reader state and input.
void setChunkSize(std::size_t n)
Sets the max size of a characters block.
Node & get()
Get current node.
std::size_t usedSize() const
Returns the number of characters the parser has allocated.
JSON document node.
Definition Node.h:52
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
Read and write JSON ducuments.
Core module.
Definition Allocator.h:33