-
+ C035A5B3DE9D375F258D5D006AECC5182D4EDF393D91A8A311BEAE937C1AAF2C4B893E3DB6FEBA733DAB8B9D5D43C6ACCCD12786E5C298E9A6FC9418A9A8E019
bitcoin/src/json/json_spirit_stream_reader.h
(0 . 0)(1 . 101)
8188 // /****************************\
8189 // * EXPERIMENTAL BRANCH. *
8190 // * FOR LABORATORY USE ONLY. *
8191 // ********************************
8192 // ************
8193 // **************
8194 // ****************
8195 // **** **** ****
8196 // *** *** ***
8197 // *** *** ***
8198 // *** * * **
8199 // ******** ********
8200 // ******* ******
8201 // *** **
8202 // * ******* **
8203 // ** * * * * *
8204 // ** * * ***
8205 // **** * * * * ****
8206 // **** *** * * ** ***
8207 // **** ********* ******
8208 // ******* ***** *******
8209 // ********* ****** **
8210 // ** ****** ******
8211 // ** ******* **
8212 // ** ******* ***
8213 // **** ******** ************
8214 // ************ ************
8215 // ******** *******
8216 // ****** ****
8217 // *** ***
8218 // ********************************
8219 #ifndef JSON_SPIRIT_READ_STREAM
8220 #define JSON_SPIRIT_READ_STREAM
8221
8222 // Copyright John W. Wilkinson 2007 - 2009.
8223 // Distributed under the MIT License, see accompanying file LICENSE.txt
8224
8225 // json spirit version 4.03
8226
8227 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
8228 # pragma once
8229 #endif
8230
8231 #include "json_spirit_reader_template.h"
8232
8233 namespace json_spirit
8234 {
8235 // these classes allows you to read multiple top level contiguous values from a stream,
8236 // the normal stream read functions have a bug that prevent multiple top level values
8237 // from being read unless they are separated by spaces
8238
8239 template< class Istream_type, class Value_type >
8240 class Stream_reader
8241 {
8242 public:
8243
8244 Stream_reader( Istream_type& is )
8245 : iters_( is )
8246 {
8247 }
8248
8249 bool read_next( Value_type& value )
8250 {
8251 return read_range( iters_.begin_, iters_.end_, value );
8252 }
8253
8254 private:
8255
8256 typedef Multi_pass_iters< Istream_type > Mp_iters;
8257
8258 Mp_iters iters_;
8259 };
8260
8261 template< class Istream_type, class Value_type >
8262 class Stream_reader_thrower
8263 {
8264 public:
8265
8266 Stream_reader_thrower( Istream_type& is )
8267 : iters_( is )
8268 , posn_begin_( iters_.begin_, iters_.end_ )
8269 , posn_end_( iters_.end_, iters_.end_ )
8270 {
8271 }
8272
8273 void read_next( Value_type& value )
8274 {
8275 posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value );
8276 }
8277
8278 private:
8279
8280 typedef Multi_pass_iters< Istream_type > Mp_iters;
8281 typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t;
8282
8283 Mp_iters iters_;
8284 Posn_iter_t posn_begin_, posn_end_;
8285 };
8286 }
8287
8288 #endif