genesis 1 #ifndef JSON_SPIRIT_READ_STREAM
genesis 2 #define JSON_SPIRIT_READ_STREAM
genesis 3
genesis 4
genesis 5
genesis 6
genesis 7
genesis 8
genesis 9 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
genesis 10 # pragma once
genesis 11 #endif
genesis 12
genesis 13 #include "json_spirit_reader_template.h"
genesis 14
genesis 15 namespace json_spirit
genesis 16 {
genesis 17
genesis 18
genesis 19
genesis 20
genesis 21 template< class Istream_type, class Value_type >
genesis 22 class Stream_reader
genesis 23 {
genesis 24 public:
genesis 25
genesis 26 Stream_reader( Istream_type& is )
genesis 27 : iters_( is )
genesis 28 {
genesis 29 }
genesis 30
genesis 31 bool read_next( Value_type& value )
genesis 32 {
genesis 33 return read_range( iters_.begin_, iters_.end_, value );
genesis 34 }
genesis 35
genesis 36 private:
genesis 37
genesis 38 typedef Multi_pass_iters< Istream_type > Mp_iters;
genesis 39
genesis 40 Mp_iters iters_;
genesis 41 };
genesis 42
genesis 43 template< class Istream_type, class Value_type >
genesis 44 class Stream_reader_thrower
genesis 45 {
genesis 46 public:
genesis 47
genesis 48 Stream_reader_thrower( Istream_type& is )
genesis 49 : iters_( is )
genesis 50 , posn_begin_( iters_.begin_, iters_.end_ )
genesis 51 , posn_end_( iters_.end_, iters_.end_ )
genesis 52 {
genesis 53 }
genesis 54
genesis 55 void read_next( Value_type& value )
genesis 56 {
genesis 57 posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value );
genesis 58 }
genesis 59
genesis 60 private:
genesis 61
genesis 62 typedef Multi_pass_iters< Istream_type > Mp_iters;
genesis 63 typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t;
genesis 64
genesis 65 Mp_iters iters_;
genesis 66 Posn_iter_t posn_begin_, posn_end_;
genesis 67 };
genesis 68 }
genesis 69
genesis 70 #endif