Zipios++
outputstringstream.h
Go to the documentation of this file.
1#ifndef OUTPUTSTRINGSTREAM_H
2#define OUTPUTSTRINGSTREAM_H
3
4#include "zipios++/zipios-config.h"
5
6#include "zipios++/meta-iostreams.h"
7#include <string>
8
9namespace zipios {
10
11#if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM)
12
13typedef std::ostringstream OutputStringStream ;
14
15#else
16
24class OutputStringStream : public ostrstream {
25public:
26
29 inline string str() {
30 *this << ends ; // null terminate ostrstream
31 string o_str( ostrstream::str() ) ;
32 freeze( 0 ) ;
33 return o_str ;
34 }
35private:
36 // To avoid invoking such a member function in the base
37 // class if there is one!
38 string str() const ;
39};
40
41#endif
42
43} // namespace
44
45
46#endif
47
52/*
53 Zipios++ - a small C++ library that provides easy access to .zip files.
54 Copyright (C) 2000 Thomas Søndergaard
55
56 This library is free software; you can redistribute it and/or
57 modify it under the terms of the GNU Lesser General Public
58 License as published by the Free Software Foundation; either
59 version 2 of the License, or (at your option) any later version.
60
61 This library is distributed in the hope that it will be useful,
62 but WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64 Lesser General Public License for more details.
65
66 You should have received a copy of the GNU Lesser General Public
67 License along with this library; if not, write to the Free Software
68 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
69*/
OutputStringStream is typedefed to ostringstream if sstream is part of the standard library (unless Z...
string str()
Specialization of ostrstream::str() that takes care of null-terminating the string and unfreezing the...