9#ifndef SQUID_SRC_BASE_PACKABLESTREAM_H
10#define SQUID_SRC_BASE_PACKABLESTREAM_H
18template <
class Buffer>
28 int_type
overflow(int_type aChar = traits_type::eof())
override {
29 std::streamsize pending(pptr() - pbase());
31 if (pending &&
sync())
32 return traits_type::eof();
34 if (aChar != traits_type::eof()) {
35 const char C =
static_cast<char>(aChar);
44 std::streamsize pending(pptr() - pbase());
50 std::streamsize
xsputn(
const char * chars, std::streamsize
number)
override {
62 void lowAppend(
const char *s,
const std::streamsize n) {
buf_.append(s,n);}
write-only std::streambuf that append()s all writes to a given Buffer
~AppendingStreamBuf() override=default
AppendingStreamBuf(Buffer &p)
void postSync()
for specializations that must customize the last sync() step
std::streamsize xsputn(const char *chars, std::streamsize number) override
int_type overflow(int_type aChar=traits_type::eof()) override
void lowAppend(const char *s, const std::streamsize n)
void postInit()
for specializations that must customize the last construction step
Buffer & buf_
the associated character sequence (a.k.a. the sink)
PackableStreamBuf theBuffer
PackableStream(Packable &p)