1 // Backward-compat support -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2004, 2005, 2009, 2010, 2011
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
28 * Silicon Graphics Computer Systems, Inc.
30 * Permission to use, copy, modify, distribute and sell this software
31 * and its documentation for any purpose is hereby granted without fee,
32 * provided that the above copyright notice appear in all copies and
33 * that both that copyright notice and this permission notice appear
34 * in supporting documentation. Silicon Graphics makes no
35 * representations about the suitability of this software for any
36 * purpose. It is provided "as is" without express or implied warranty.
39 // WARNING: The classes defined in this header are DEPRECATED. This
40 // header is defined in section D.7.1 of the C++ standard, and it
41 // MAY BE REMOVED in a future standard revision. One should use the
42 // header <sstream> instead.
44 /** @file backward/strstream
45 * This is an internal header file, included by other library headers.
46 * Do not attempt to use it directly. @headername{sstream}
49 #ifndef _BACKWARD_STRSTREAM
50 #define _BACKWARD_STRSTREAM
52 #include "backward_warning.h"
59 namespace std _GLIBCXX_VISIBILITY(default)
61 _GLIBCXX_BEGIN_NAMESPACE_VERSION
63 // Class strstreambuf, a streambuf class that manages an array of char.
64 // Note that this class is not a template.
65 class strstreambuf : public basic_streambuf<char, char_traits<char> >
69 typedef char_traits<char> _Traits;
70 typedef basic_streambuf<char, _Traits> _Base;
73 // Constructor, destructor
74 explicit strstreambuf(streamsize __initial_capacity = 0);
75 strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
77 strstreambuf(char* __get, streamsize __n, char* __put = 0) throw ();
78 strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
79 strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
81 strstreambuf(const char* __get, streamsize __n) throw ();
82 strstreambuf(const signed char* __get, streamsize __n) throw ();
83 strstreambuf(const unsigned char* __get, streamsize __n) throw ();
85 virtual ~strstreambuf();
88 void freeze(bool = true) throw ();
90 _GLIBCXX_PURE int pcount() const throw ();
93 virtual int_type overflow(int_type __c = _Traits::eof());
94 virtual int_type pbackfail(int_type __c = _Traits::eof());
95 virtual int_type underflow();
96 virtual _Base* setbuf(char* __buf, streamsize __n);
97 virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
98 ios_base::openmode __mode
99 = ios_base::in | ios_base::out);
100 virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
101 = ios_base::in | ios_base::out);
105 operator=(const strstreambuf&);
107 strstreambuf(const strstreambuf&);
109 // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
110 char* _M_alloc(size_t);
113 // Helper function used in constructors.
114 void _M_setup(char* __get, char* __put, streamsize __n) throw ();
118 void* (*_M_alloc_fun)(size_t);
119 void (*_M_free_fun)(void*);
123 bool _M_constant : 1;
126 // Class istrstream, an istream that manages a strstreambuf.
127 class istrstream : public basic_istream<char>
130 explicit istrstream(char*);
131 explicit istrstream(const char*);
132 istrstream(char* , streamsize);
133 istrstream(const char*, streamsize);
134 virtual ~istrstream();
136 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
137 char* str() throw ();
144 class ostrstream : public basic_ostream<char>
148 ostrstream(char*, int, ios_base::openmode = ios_base::out);
149 virtual ~ostrstream();
151 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
152 void freeze(bool = true) throw();
153 char* str() throw ();
154 _GLIBCXX_PURE int pcount() const throw ();
161 class strstream : public basic_iostream<char>
164 typedef char char_type;
165 typedef char_traits<char>::int_type int_type;
166 typedef char_traits<char>::pos_type pos_type;
167 typedef char_traits<char>::off_type off_type;
170 strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
171 virtual ~strstream();
173 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
174 void freeze(bool = true) throw ();
175 _GLIBCXX_PURE int pcount() const throw ();
176 char* str() throw ();
182 _GLIBCXX_END_NAMESPACE_VERSION