28 #ifndef _chunked_istream_h 29 #define _chunked_istream_h 31 #include "chunked_stream.h" 58 std::string d_error_message;
67 void m_buffer_alloc() {
69 d_buffer =
new char[d_buf_size];
99 : d_is(is), d_buf_size(size), d_buffer(0), d_twiddle_bytes(false), d_set_twiddle(false), d_error(false) {
100 if (d_buf_size & CHUNK_TYPE_MASK)
101 throw std::out_of_range(
"A chunked_outbuf (or chunked_ostream) was built using a buffer larger than 0x00ffffff");
112 int bytes_in_buffer()
const {
return (egptr() - gptr()); }
116 bool twiddle_bytes()
const {
return d_twiddle_bytes; }
118 bool error()
const {
return d_error; }
119 std::string error_message()
const {
return d_error_message; }
124 virtual std::streamsize
xsgetn(
char* s, std::streamsize num);
131 chunked_istream(std::istream &is,
int size) : std::istream(&d_cbuf), d_cbuf(is, size) { }
152 bool error()
const {
return d_cbuf.error(); }
153 std::string error_message()
const {
return d_cbuf.error_message(); }
158 #endif // _chunked_istream_h int_type read_next_chunk()
Read a chunk Normally the chunked nature of a chunked_istream/chunked_inbuf is hidden from the caller...
top level DAP object to house generic methods
virtual int_type underflow()
Insert new characters into the buffer This specialization of underflow is called when the gptr() is a...
virtual std::streamsize xsgetn(char *s, std::streamsize num)
Read a block of data This specialization of xsgetn() reads num bytes and puts them in s first reading...
chunked_inbuf(std::istream &is, int size)
Build a chunked input buffer.
int bytes_in_buffer() const
bool twiddle_bytes() const