1// <iosfwd> Forward declarations -*- C++ -*-
3// Copyright (C) 1997-2022 Free Software Foundation, Inc.
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
25/** @file include/iosfwd
26 * This is a Standard C++ Library header.
30// ISO C++ 14882: 27.2 Forward declarations
33#ifndef _GLIBCXX_IOSFWD
34#define _GLIBCXX_IOSFWD 1
36#pragma GCC system_header
38#include <bits/c++config.h>
39#include <bits/stringfwd.h> // For string forward declarations.
40#include <bits/postypes.h>
42namespace std _GLIBCXX_VISIBILITY(default)
44_GLIBCXX_BEGIN_NAMESPACE_VERSION
49 * Nearly all of the I/O classes are parameterized on the type of
50 * characters they read and write. (The major exception is ios_base at
51 * the top of the hierarchy.) This is a change from pre-Standard
52 * streams, which were not templates.
54 * For ease of use and compatibility, all of the basic_* I/O-related
55 * classes are given typedef names for both of the builtin character
56 * widths (wide and narrow). The typedefs are the same as the
57 * pre-Standard names, for example:
60 * typedef basic_ifstream<char> ifstream;
63 * Because properly forward-declaring these classes can be difficult, you
64 * should not do it yourself. Instead, include the <iosfwd>
65 * header, which contains only declarations of all the I/O classes as
66 * well as the typedefs. Trying to forward-declare the typedefs
67 * themselves (e.g., <code>class ostream;</code>) is not valid ISO C++.
69 * For more specific declarations, see
70 * https://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html#std.io.objects
76 template<typename _CharT, typename _Traits = char_traits<_CharT> >
79 template<typename _CharT, typename _Traits = char_traits<_CharT> >
80 class basic_streambuf;
82 template<typename _CharT, typename _Traits = char_traits<_CharT> >
85 template<typename _CharT, typename _Traits = char_traits<_CharT> >
88 template<typename _CharT, typename _Traits = char_traits<_CharT> >
92_GLIBCXX_BEGIN_NAMESPACE_CXX11
94 template<typename _CharT, typename _Traits = char_traits<_CharT>,
95 typename _Alloc = allocator<_CharT> >
96 class basic_stringbuf;
98 template<typename _CharT, typename _Traits = char_traits<_CharT>,
99 typename _Alloc = allocator<_CharT> >
100 class basic_istringstream;
102 template<typename _CharT, typename _Traits = char_traits<_CharT>,
103 typename _Alloc = allocator<_CharT> >
104 class basic_ostringstream;
106 template<typename _CharT, typename _Traits = char_traits<_CharT>,
107 typename _Alloc = allocator<_CharT> >
108 class basic_stringstream;
110_GLIBCXX_END_NAMESPACE_CXX11
112 template<typename _CharT, typename _Traits = char_traits<_CharT> >
115 template<typename _CharT, typename _Traits = char_traits<_CharT> >
116 class basic_ifstream;
118 template<typename _CharT, typename _Traits = char_traits<_CharT> >
119 class basic_ofstream;
121 template<typename _CharT, typename _Traits = char_traits<_CharT> >
124 template<typename _CharT, typename _Traits = char_traits<_CharT> >
125 class istreambuf_iterator;
127 template<typename _CharT, typename _Traits = char_traits<_CharT> >
128 class ostreambuf_iterator;
131 /// Base class for @c char streams.
132 typedef basic_ios<char> ios;
134 /// Base class for @c char buffers.
135 typedef basic_streambuf<char> streambuf;
137 /// Base class for @c char input streams.
138 typedef basic_istream<char> istream;
140 /// Base class for @c char output streams.
141 typedef basic_ostream<char> ostream;
143 /// Base class for @c char mixed input and output streams.
144 typedef basic_iostream<char> iostream;
146 /// Class for @c char memory buffers.
147 typedef basic_stringbuf<char> stringbuf;
149 /// Class for @c char input memory streams.
150 typedef basic_istringstream<char> istringstream;
152 /// Class for @c char output memory streams.
153 typedef basic_ostringstream<char> ostringstream;
155 /// Class for @c char mixed input and output memory streams.
156 typedef basic_stringstream<char> stringstream;
158 /// Class for @c char file buffers.
159 typedef basic_filebuf<char> filebuf;
161 /// Class for @c char input file streams.
162 typedef basic_ifstream<char> ifstream;
164 /// Class for @c char output file streams.
165 typedef basic_ofstream<char> ofstream;
167 /// Class for @c char mixed input and output file streams.
168 typedef basic_fstream<char> fstream;
170#ifdef _GLIBCXX_USE_WCHAR_T
171 /// Base class for @c wchar_t streams.
172 typedef basic_ios<wchar_t> wios;
174 /// Base class for @c wchar_t buffers.
175 typedef basic_streambuf<wchar_t> wstreambuf;
177 /// Base class for @c wchar_t input streams.
178 typedef basic_istream<wchar_t> wistream;
180 /// Base class for @c wchar_t output streams.
181 typedef basic_ostream<wchar_t> wostream;
183 /// Base class for @c wchar_t mixed input and output streams.
184 typedef basic_iostream<wchar_t> wiostream;
186 /// Class for @c wchar_t memory buffers.
187 typedef basic_stringbuf<wchar_t> wstringbuf;
189 /// Class for @c wchar_t input memory streams.
190 typedef basic_istringstream<wchar_t> wistringstream;
192 /// Class for @c wchar_t output memory streams.
193 typedef basic_ostringstream<wchar_t> wostringstream;
195 /// Class for @c wchar_t mixed input and output memory streams.
196 typedef basic_stringstream<wchar_t> wstringstream;
198 /// Class for @c wchar_t file buffers.
199 typedef basic_filebuf<wchar_t> wfilebuf;
201 /// Class for @c wchar_t input file streams.
202 typedef basic_ifstream<wchar_t> wifstream;
204 /// Class for @c wchar_t output file streams.
205 typedef basic_ofstream<wchar_t> wofstream;
207 /// Class for @c wchar_t mixed input and output file streams.
208 typedef basic_fstream<wchar_t> wfstream;
211#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
212 template<typename _CharT, typename _Traits = char_traits<_CharT>,
213 typename _Allocator = allocator<_CharT>>
215 template<typename _CharT, typename _Traits = char_traits<_CharT>,
216 typename _Allocator = allocator<_CharT>>
217 class basic_osyncstream;
219 using syncbuf = basic_syncbuf<char>;
220 using osyncstream = basic_osyncstream<char>;
222#ifdef _GLIBCXX_USE_WCHAR_T
223 using wsyncbuf = basic_syncbuf<wchar_t>;
224 using wosyncstream = basic_osyncstream<wchar_t>;
226#endif // C++20 && CXX11_ABI
228#if __cplusplus > 202002L
229 template<typename _CharT, typename _Traits = char_traits<_CharT>>
231 template<typename _CharT, typename _Traits = char_traits<_CharT>>
232 class basic_ispanstream;
233 template<typename _CharT, typename _Traits = char_traits<_CharT>>
234 class basic_ospanstream;
235 template<typename _CharT, typename _Traits = char_traits<_CharT>>
236 class basic_spanstream;
238 using spanbuf = basic_spanbuf<char>;
239 using ispanstream = basic_ispanstream<char>;
240 using ospanstream = basic_ospanstream<char>;
241 using spanstream = basic_spanstream<char>;
243#ifdef _GLIBCXX_USE_WCHAR_T
244 using wspanbuf = basic_spanbuf<wchar_t>;
245 using wispanstream = basic_ispanstream<wchar_t>;
246 using wospanstream = basic_ospanstream<wchar_t>;
247 using wspanstream = basic_spanstream<wchar_t>;
253_GLIBCXX_END_NAMESPACE_VERSION
256#endif /* _GLIBCXX_IOSFWD */