28 #ifndef _chunkedostream_h 29 #define _chunkedostream_h 31 #include "chunked_stream.h" 41 class chunked_ostream;
57 unsigned int d_buf_size;
62 chunked_outbuf(std::ostream &os,
unsigned int buf_size) : d_os(os), d_buf_size(buf_size), d_buffer(0) {
63 if (d_buf_size & CHUNK_TYPE_MASK)
64 throw std::out_of_range(
"A chunked_outbuf (or chunked_ostream) was built using a buffer larger than 0x00ffffff");
67 d_buffer =
new char[buf_size];
71 setp(d_buffer, d_buffer + (buf_size - 1));
87 int_type
err_chunk(
const std::string &msg);
89 virtual std::streamsize
xsputn(
const char *s, std::streamsize num);
95 virtual int_type
sync();
129 chunked_ostream(std::ostream &os,
unsigned int buf_size) :
std::ostream(&d_cbuf), d_cbuf(os, buf_size) { }
164 #endif // _chunkedostream_h int_type write_end_chunk()
Send an end chunk. Normally, an end chunk is sent by closing the chunked_ostream, but this method can...
virtual int_type overflow(int c)
Virtual method called when the internal buffer would overflow. When the internal buffer fills...
top level DAP object to house generic methods
virtual std::streamsize xsputn(const char *s, std::streamsize num)
Write bytes to the chunked stream Write the bytes in s to the chunked stream.
int_type end_chunk()
Send an end chunk.
int_type err_chunk(const std::string &msg)
Send an error chunk While building up the next chunk, send an error chunk, ignoring the data currentl...
virtual int_type sync()
Synchronize the stream with its data sink.
chunked_ostream(std::ostream &os, unsigned int buf_size)
int_type data_chunk()
Write out the contents of the buffer as a chunk.
output buffer for a chunked stream This performs buffered output encoding the data in the stream usin...
int_type write_data_chunk()
Send the current contents of the buffer as a data chunk. Normally, the chunked_ostream object waits u...
A C++ stream class for chunked data. This class uses the chunked_outbuf class to provide for chunked ...
int_type write_err_chunk(const std::string &msg)
Send an error message down the stream. When called, this method dumps all the data currently in the b...
bool is_host_big_endian()
Does this host use big-endian byte order?