// 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 ostream_interface { public: virtual ~ostream_interface() {} virtual std::streambuf *get_streambuf() = 0; }; /////////////////////////////////////////////////////////////////////////// } /////////////////////////////////////////////////////////////////////////// namespace adaptors { /////////////////////////////////////////////////////////////////////// // Use this template to implement your ostream implementation if you // need to provide your own streambuf implementation template class ostream : public saga::impl::ostream_interface { public: ostream() {} ~ostream() {} std::streambuf *get_streambuf() { return &buffer_; } private: StreamBuf buffer_; }; /////////////////////////////////////////////////////////////////////// // Use this template to implement your ostream implementation if you // need to use a existing streambuf instance class ostream_ptr : public saga::impl::ostream_interface { public: ostream_ptr(std::streambuf *buffer) : buffer_(buffer) {} ~ostream_ptr() {} std::streambuf *get_streambuf() { return buffer_; } private: std::streambuf *buffer_; }; /////////////////////////////////////////////////////////////////////////// } /////////////////////////////////////////////////////////////////////////////// } // namespace saga