join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
chunkstream.hpp
Go to the documentation of this file.
1
25#ifndef __JOIN_CHUNKTREAM_HPP__
26#define __JOIN_CHUNKTREAM_HPP__
27
28// libjoin.
29#include <join/streambuf.hpp>
30
31namespace join
32{
37 {
38 public:
44 Chunkstreambuf (std::streambuf* streambuf, bool own = false);
45
52 Chunkstreambuf (std::streambuf* streambuf, std::streamsize chunksize, bool own = false);
53
58 Chunkstreambuf (const Chunkstreambuf& other) = delete;
59
65 Chunkstreambuf& operator= (const Chunkstreambuf& other) = delete;
66
72
79
83 virtual ~Chunkstreambuf ();
84
85 protected:
90 virtual int_type underflow () override;
91
97 virtual int_type overflow (int_type c = traits_type::eof ()) override;
98
103 virtual int_type sync () override;
104
106 std::streamsize _chunksize = 16384;
107
109 std::unique_ptr <char []> _buf;
110 };
111
115 class Chunkstream : public std::iostream
116 {
117 public:
122 Chunkstream (std::iostream& stream);
123
129 Chunkstream (std::iostream& stream, std::streamsize chunksize);
130
135 Chunkstream (const Chunkstream& other) = delete;
136
142 Chunkstream& operator=(const Chunkstream& other) = delete;
143
148 Chunkstream (Chunkstream&& other);
149
156
160 virtual ~Chunkstream () = default;
161
162 protected:
165 };
166}
167
168#endif
chunk stream.
Definition chunkstream.hpp:116
Chunkstreambuf _chunkbuf
chunkstream buffer.
Definition chunkstream.hpp:164
Chunkstream(std::iostream &stream)
create the chunk stream instance.
Definition chunkstream.cpp:222
Chunkstream & operator=(const Chunkstream &other)=delete
copy assignment operator.
Chunkstream(const Chunkstream &other)=delete
copy constructor.
virtual ~Chunkstream()=default
destroy the chunk stream instance.
chunk stream buffer.
Definition chunkstream.hpp:37
Chunkstreambuf & operator=(const Chunkstreambuf &other)=delete
copy assignment operator.
virtual int_type overflow(int_type c=traits_type::eof()) override
writes characters to the associated output sequence from the put area.
Definition chunkstream.cpp:165
Chunkstreambuf(std::streambuf *streambuf, bool own=false)
create the chunk stream buffer instance.
Definition chunkstream.cpp:39
virtual int_type underflow() override
reads characters from the associated input sequence to the get area.
Definition chunkstream.cpp:95
std::streamsize _chunksize
chunk size.
Definition chunkstream.hpp:106
Chunkstreambuf(const Chunkstreambuf &other)=delete
copy constructor.
virtual int_type sync() override
synchronizes the buffers with the associated character sequence.
Definition chunkstream.cpp:209
std::unique_ptr< char[]> _buf
internal buffer.
Definition chunkstream.hpp:109
virtual ~Chunkstreambuf()
destroy the chunk stream buffer instance.
Definition chunkstream.cpp:83
stream buffer decorator.
Definition streambuf.hpp:38
Definition acceptor.hpp:32