00001 #ifndef OUTPUTSTRINGSTREAM_H 00002 #define OUTPUTSTRINGSTREAM_H 00003 00004 #include "zipios++/zipios-config.h" 00005 00006 #include "zipios++/meta-iostreams.h" 00007 #include <string> 00008 00009 namespace zipios { 00010 00011 #if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) 00012 00013 typedef ostringstream OutputStringStream ; 00014 00015 #else 00016 00024 class OutputStringStream : public ostrstream { 00025 public: 00026 00029 inline string str() { 00030 *this << ends ; // null terminate ostrstream 00031 string o_str( ostrstream::str() ) ; 00032 freeze( 0 ) ; 00033 return o_str ; 00034 } 00035 private: 00036 // To avoid invoking such a member function in the base 00037 // class if there is one! 00038 string str() const ; 00039 }; 00040 00041 #endif 00042 00043 } // namespace 00044 00045 00046 #endif 00047 00052 /* 00053 Zipios++ - a small C++ library that provides easy access to .zip files. 00054 Copyright (C) 2000 Thomas Søndergaard 00055 00056 This library is free software; you can redistribute it and/or 00057 modify it under the terms of the GNU Lesser General Public 00058 License as published by the Free Software Foundation; either 00059 version 2 of the License, or (at your option) any later version. 00060 00061 This library is distributed in the hope that it will be useful, 00062 but WITHOUT ANY WARRANTY; without even the implied warranty of 00063 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00064 Lesser General Public License for more details. 00065 00066 You should have received a copy of the GNU Lesser General Public 00067 License along with this library; if not, write to the Free Software 00068 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00069 */