// Copyright (c) 2011-2016 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once #include #include #include namespace System { class TcpConnection; class TcpStreambuf : public std::streambuf { public: explicit TcpStreambuf(TcpConnection& connection); TcpStreambuf(const TcpStreambuf&) = delete; ~TcpStreambuf(); TcpStreambuf& operator=(const TcpStreambuf&) = delete; private: TcpConnection& connection; std::array readBuf; std::array writeBuf; std::streambuf::int_type overflow(std::streambuf::int_type ch) override; int sync() override; std::streambuf::int_type underflow() override; bool dumpBuffer(bool finalize); }; }