31 reader::reader(
size_t max_message_length,
bool block_read) :
32 m_put_back(
reader::no_put_back),
34 m_max_message_length(max_message_length),
35 m_block_read(block_read),
size_t m_byte_index
Total number of characters read.
A class to read JSON messages from various types of input stream.
virtual int next()
Get the next character from the reader.
#define NAMESPACE
You can change the namespace of the whole library by changing this value.
Specific class of exceptions for IO errors of various types.
Maximum message length was exceeded.
unsigned char m_block[block_size]
If we're reading blocks, the block data.
Attempt to put back more than one character onto a reader.
int m_put_back
Character last put back. If equal to no_put_back then none was.
Common defs needed everywhere and, as far as is possible, platform specific changes.
virtual int read_next_char()=0
Implemented by derived classes to do the actual reading.
static const int no_put_back
Special character value indicating that no character has been put back.
virtual bool read_next_block()=0
size_t get_byte_index() const
Get the current byte index in the input.
size_t m_max_message_length
Maximum length of a message.
int m_block_index
If we're reading blocks, the index into the current block.
int read_next_char_from_block()
When in block read mode, get the next available character.
virtual void put_back(int c)
Put back a character so that it is returned by the next call to next().
The json_io_exception class.
void reset_byte_index()
Reset the byte index at the start of parsing a messege.
int m_block_num_bytes
If we're reading blocks, the number of bytes in the current block.
bool m_block_read
Whether to read in blocks or one byte at a time.