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>
36 #include <Pt/String.h>
37 #include <Pt/NonCopyable.h>
59 explicit JsonReader(std::basic_istream<Pt::Char>& is);
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);
93 void setChunkSize(std::size_t n);
97 void setMaxSize(std::size_t n);
101 std::size_t maxSize()
const;
105 std::size_t usedSize()
const;
109 std::size_t line()
const;
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; }
231 #endif // include guard
Node & get()
Get current node.
Type type() const
Returns the type of the node.
Definition: Node.h:77
Protects derived classes from being copied.
Definition: NonCopyable.h:54
Reads JSON as a Stream of Nodes.
Definition: JsonReader.h:50
JSON document node.
Definition: Node.h:51
InputIterator current()
Returns an iterator to the current node.
Definition: JsonReader.h:216
Node & next()
Get next node.
InputIterator end() const
Returns an iterator to the end of the document.
Definition: JsonReader.h:222