1
#ifndef JSON_SPIRIT_READ_STREAM
2
#define JSON_SPIRIT_READ_STREAM
4
// Copyright John W. Wilkinson 2007 - 2011
5
// Distributed under the MIT License, see accompanying file LICENSE.txt
7
// json spirit version 4.05
9
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
13
#include "json_spirit_reader_template.h"
17
// these classes allows you to read multiple top level contiguous values from a stream,
18
// the normal stream read functions have a bug that prevent multiple top level values
19
// from being read unless they are separated by spaces
21
template< class Istream_type, class Value_type >
26
Stream_reader( Istream_type& is )
31
bool read_next( Value_type& value )
33
return read_range( iters_.begin_, iters_.end_, value );
38
typedef Multi_pass_iters< Istream_type > Mp_iters;
43
template< class Istream_type, class Value_type >
44
class Stream_reader_thrower
48
Stream_reader_thrower( Istream_type& is )
50
, posn_begin_( iters_.begin_, iters_.end_ )
51
, posn_end_( iters_.end_, iters_.end_ )
55
void read_next( Value_type& value )
57
posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value );
62
typedef Multi_pass_iters< Istream_type > Mp_iters;
63
typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t;
66
Posn_iter_t posn_begin_, posn_end_;