1 // Backward-compat support -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2004, 2005, 2009, 2010
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 #ifndef _BACKWARD_STRSTREAM
45 #define _BACKWARD_STRSTREAM
47 #include "backward_warning.h"
54 _GLIBCXX_BEGIN_NAMESPACE(std)
56 // Class strstreambuf, a streambuf class that manages an array of char.
57 // Note that this class is not a template.
58 class strstreambuf : public basic_streambuf<char, char_traits<char> >
62 typedef char_traits<char> _Traits;
63 typedef basic_streambuf<char, _Traits> _Base;
66 // Constructor, destructor
67 explicit strstreambuf(streamsize __initial_capacity = 0);
68 strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
70 strstreambuf(char* __get, streamsize __n, char* __put = 0) throw ();
71 strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
72 strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
74 strstreambuf(const char* __get, streamsize __n) throw ();
75 strstreambuf(const signed char* __get, streamsize __n) throw ();
76 strstreambuf(const unsigned char* __get, streamsize __n) throw ();
78 virtual ~strstreambuf();
81 void freeze(bool = true) throw ();
83 _GLIBCXX_PURE int pcount() const throw ();
86 virtual int_type overflow(int_type __c = _Traits::eof());
87 virtual int_type pbackfail(int_type __c = _Traits::eof());
88 virtual int_type underflow();
89 virtual _Base* setbuf(char* __buf, streamsize __n);
90 virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
91 ios_base::openmode __mode
92 = ios_base::in | ios_base::out);
93 virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
94 = ios_base::in | ios_base::out);
98 operator=(const strstreambuf&);
100 strstreambuf(const strstreambuf&);
102 // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
103 char* _M_alloc(size_t);
106 // Helper function used in constructors.
107 void _M_setup(char* __get, char* __put, streamsize __n) throw ();
111 void* (*_M_alloc_fun)(size_t);
112 void (*_M_free_fun)(void*);
116 bool _M_constant : 1;
119 // Class istrstream, an istream that manages a strstreambuf.
120 class istrstream : public basic_istream<char>
123 explicit istrstream(char*);
124 explicit istrstream(const char*);
125 istrstream(char* , streamsize);
126 istrstream(const char*, streamsize);
127 virtual ~istrstream();
129 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
130 char* str() throw ();
137 class ostrstream : public basic_ostream<char>
141 ostrstream(char*, int, ios_base::openmode = ios_base::out);
142 virtual ~ostrstream();
144 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
145 void freeze(bool = true) throw();
146 char* str() throw ();
147 _GLIBCXX_PURE int pcount() const throw ();
154 class strstream : public basic_iostream<char>
157 typedef char char_type;
158 typedef char_traits<char>::int_type int_type;
159 typedef char_traits<char>::pos_type pos_type;
160 typedef char_traits<char>::off_type off_type;
163 strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
164 virtual ~strstream();
166 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
167 void freeze(bool = true) throw ();
168 _GLIBCXX_PURE int pcount() const throw ();
169 char* str() throw ();
175 _GLIBCXX_END_NAMESPACE