1 // 2 // VMime library (http://www.vmime.org) 3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org> 4 // 5 // This program is free software; you can redistribute it and/or 6 // modify it under the terms of the GNU General Public License as 7 // published by the Free Software Foundation; either version 3 of 8 // the License, or (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License along 16 // with this program; if not, write to the Free Software Foundation, Inc., 17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 // 19 // Linking this library statically or dynamically with other modules is making 20 // a combined work based on this library. Thus, the terms and conditions of 21 // the GNU General Public License cover the whole combination. 22 // 23 24 #ifndef VMIME_UTILITY_OUTPUTSTREAMADAPTER_HPP_INCLUDED 25 #define VMIME_UTILITY_OUTPUTSTREAMADAPTER_HPP_INCLUDED 26 27 28 #include "vmime/utility/outputStream.hpp" 29 30 #include <ostream> 31 32 33 namespace vmime { 34 namespace utility { 35 36 37 /** An adapter class for C++ standard output streams. 38 */ 39 40 class VMIME_EXPORT outputStreamAdapter : public outputStream 41 { 42 public: 43 44 /** @param os output stream to wrap 45 */ 46 outputStreamAdapter(std::ostream& os); 47 48 void flush(); 49 50 protected: 51 52 void writeImpl(const byte_t* const data, const size_t count); 53 54 private: 55 56 std::ostream& m_stream; 57 }; 58 59 60 } // utility 61 } // vmime 62 63 64 #endif // VMIME_UTILITY_OUTPUTSTREAMADAPTER_HPP_INCLUDED 65 66