// Copyright (c) 2005-2007 Hartmut Kaiser (hartmut.kaiser@gmail.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include /////////////////////////////////////////////////////////////////////////////// namespace saga { namespace impl { /////////////////////////////////////////////////////////////////////// class istream_interface { public: virtual ~istream_interface() {} virtual std::streambuf *get_streambuf() = 0; }; /////////////////////////////////////////////////////////////////////////// } /////////////////////////////////////////////////////////////////////////// namespace adaptors { /////////////////////////////////////////////////////////////////////// // Use this template to implement your istream implementation if you // need to provide your own streambuf implementation template class istream : public saga::impl::istream_interface { public: istream() {} ~istream() {} std::streambuf *get_streambuf() { return &buffer_; } private: StreamBuf buffer_; }; /////////////////////////////////////////////////////////////////////// // Use this template to implement your istream implementation if you // need to use a existing streambuf instance class istream_ptr : public saga::impl::istream_interface { public: istream_ptr(std::streambuf *buffer) : buffer_(buffer) {} ~istream_ptr() {} std::streambuf *get_streambuf() { return buffer_; } private: std::streambuf *buffer_; }; /////////////////////////////////////////////////////////////////////////// } /////////////////////////////////////////////////////////////////////////////// } // namespace saga