libstdc++
iosfwd
Go to the documentation of this file.
1// <iosfwd> Forward declarations -*- C++ -*-
2
3// Copyright (C) 1997-2022 Free Software Foundation, Inc.
4//
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)
9// any later version.
10
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.
15
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.
19
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/>.
24
25/** @file include/iosfwd
26 * This is a Standard C++ Library header.
27 */
28
29//
30// ISO C++ 14882: 27.2 Forward declarations
31//
32
33#ifndef _GLIBCXX_IOSFWD
34#define _GLIBCXX_IOSFWD 1
35
36#pragma GCC system_header
37
38#include <bits/c++config.h>
39#include <bits/stringfwd.h> // For string forward declarations.
40#include <bits/postypes.h>
41
42namespace std _GLIBCXX_VISIBILITY(default)
43{
44_GLIBCXX_BEGIN_NAMESPACE_VERSION
45
46 /**
47 * @defgroup io I/O
48 *
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.
53 *
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:
58 *
59 * @code
60 * typedef basic_ifstream<char> ifstream;
61 * @endcode
62 *
63 * Because properly forward-declaring these classes can be difficult, you
64 * should not do it yourself. Instead, include the &lt;iosfwd&gt;
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++.
68 *
69 * For more specific declarations, see
70 * https://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html#std.io.objects
71 *
72 * @{
73 */
74 class ios_base;
75
76 template<typename _CharT, typename _Traits = char_traits<_CharT> >
77 class basic_ios;
78
79 template<typename _CharT, typename _Traits = char_traits<_CharT> >
80 class basic_streambuf;
81
82 template<typename _CharT, typename _Traits = char_traits<_CharT> >
83 class basic_istream;
84
85 template<typename _CharT, typename _Traits = char_traits<_CharT> >
86 class basic_ostream;
87
88 template<typename _CharT, typename _Traits = char_traits<_CharT> >
89 class basic_iostream;
90
91
92_GLIBCXX_BEGIN_NAMESPACE_CXX11
93
94 template<typename _CharT, typename _Traits = char_traits<_CharT>,
95 typename _Alloc = allocator<_CharT> >
96 class basic_stringbuf;
97
98 template<typename _CharT, typename _Traits = char_traits<_CharT>,
99 typename _Alloc = allocator<_CharT> >
100 class basic_istringstream;
101
102 template<typename _CharT, typename _Traits = char_traits<_CharT>,
103 typename _Alloc = allocator<_CharT> >
104 class basic_ostringstream;
105
106 template<typename _CharT, typename _Traits = char_traits<_CharT>,
107 typename _Alloc = allocator<_CharT> >
108 class basic_stringstream;
109
110_GLIBCXX_END_NAMESPACE_CXX11
111
112 template<typename _CharT, typename _Traits = char_traits<_CharT> >
113 class basic_filebuf;
114
115 template<typename _CharT, typename _Traits = char_traits<_CharT> >
116 class basic_ifstream;
117
118 template<typename _CharT, typename _Traits = char_traits<_CharT> >
119 class basic_ofstream;
120
121 template<typename _CharT, typename _Traits = char_traits<_CharT> >
122 class basic_fstream;
123
124 template<typename _CharT, typename _Traits = char_traits<_CharT> >
125 class istreambuf_iterator;
126
127 template<typename _CharT, typename _Traits = char_traits<_CharT> >
128 class ostreambuf_iterator;
129
130
131 /// Base class for @c char streams.
133
134 /// Base class for @c char buffers.
136
137 /// Base class for @c char input streams.
139
140 /// Base class for @c char output streams.
142
143 /// Base class for @c char mixed input and output streams.
145
146 /// Class for @c char memory buffers.
148
149 /// Class for @c char input memory streams.
151
152 /// Class for @c char output memory streams.
154
155 /// Class for @c char mixed input and output memory streams.
157
158 /// Class for @c char file buffers.
160
161 /// Class for @c char input file streams.
163
164 /// Class for @c char output file streams.
166
167 /// Class for @c char mixed input and output file streams.
169
170#ifdef _GLIBCXX_USE_WCHAR_T
171 /// Base class for @c wchar_t streams.
173
174 /// Base class for @c wchar_t buffers.
176
177 /// Base class for @c wchar_t input streams.
179
180 /// Base class for @c wchar_t output streams.
182
183 /// Base class for @c wchar_t mixed input and output streams.
185
186 /// Class for @c wchar_t memory buffers.
188
189 /// Class for @c wchar_t input memory streams.
191
192 /// Class for @c wchar_t output memory streams.
194
195 /// Class for @c wchar_t mixed input and output memory streams.
197
198 /// Class for @c wchar_t file buffers.
200
201 /// Class for @c wchar_t input file streams.
203
204 /// Class for @c wchar_t output file streams.
206
207 /// Class for @c wchar_t mixed input and output file streams.
209#endif
210
211#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
212 template<typename _CharT, typename _Traits = char_traits<_CharT>,
213 typename _Allocator = allocator<_CharT>>
214 class basic_syncbuf;
215 template<typename _CharT, typename _Traits = char_traits<_CharT>,
216 typename _Allocator = allocator<_CharT>>
217 class basic_osyncstream;
218
219 using syncbuf = basic_syncbuf<char>;
220 using osyncstream = basic_osyncstream<char>;
221
222#ifdef _GLIBCXX_USE_WCHAR_T
223 using wsyncbuf = basic_syncbuf<wchar_t>;
224 using wosyncstream = basic_osyncstream<wchar_t>;
225#endif
226#endif // C++20 && CXX11_ABI
227
228#if __cplusplus > 202002L
229 template<typename _CharT, typename _Traits = char_traits<_CharT>>
230 class basic_spanbuf;
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;
237
238 using spanbuf = basic_spanbuf<char>;
239 using ispanstream = basic_ispanstream<char>;
240 using ospanstream = basic_ospanstream<char>;
241 using spanstream = basic_spanstream<char>;
242
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>;
248#endif
249#endif // C++23
250
251 /** @} */
252
253_GLIBCXX_END_NAMESPACE_VERSION
254} // namespace
255
256#endif /* _GLIBCXX_IOSFWD */
basic_ifstream< wchar_t > wifstream
Class for wchar_t input file streams.
Definition: iosfwd:202
basic_stringstream< char > stringstream
Class for char mixed input and output memory streams.
Definition: iosfwd:156
basic_iostream< wchar_t > wiostream
Base class for wchar_t mixed input and output streams.
Definition: iosfwd:184
basic_streambuf< char > streambuf
Base class for char buffers.
Definition: iosfwd:135
basic_stringbuf< wchar_t > wstringbuf
Class for wchar_t memory buffers.
Definition: iosfwd:187
basic_ostream< char > ostream
Base class for char output streams.
Definition: iosfwd:141
basic_ifstream< char > ifstream
Class for char input file streams.
Definition: iosfwd:162
basic_iostream< char > iostream
Base class for char mixed input and output streams.
Definition: iosfwd:144
basic_ios< wchar_t > wios
Base class for wchar_t streams.
Definition: iosfwd:172
basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: iosfwd:150
basic_streambuf< wchar_t > wstreambuf
Base class for wchar_t buffers.
Definition: iosfwd:175
basic_istringstream< wchar_t > wistringstream
Class for wchar_t input memory streams.
Definition: iosfwd:190
basic_fstream< wchar_t > wfstream
Class for wchar_t mixed input and output file streams.
Definition: iosfwd:208
basic_ofstream< char > ofstream
Class for char output file streams.
Definition: iosfwd:165
basic_ostringstream< wchar_t > wostringstream
Class for wchar_t output memory streams.
Definition: iosfwd:193
basic_istream< char > istream
Base class for char input streams.
Definition: iosfwd:138
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
Definition: iosfwd:181
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
Definition: iosfwd:178
basic_filebuf< char > filebuf
Class for char file buffers.
Definition: iosfwd:159
basic_filebuf< wchar_t > wfilebuf
Class for wchar_t file buffers.
Definition: iosfwd:199
basic_ofstream< wchar_t > wofstream
Class for wchar_t output file streams.
Definition: iosfwd:205
basic_fstream< char > fstream
Class for char mixed input and output file streams.
Definition: iosfwd:168
basic_stringstream< wchar_t > wstringstream
Class for wchar_t mixed input and output memory streams.
Definition: iosfwd:196
basic_ios< char > ios
Base class for char streams.
Definition: iosfwd:132
basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: iosfwd:153
basic_stringbuf< char > stringbuf
Class for char memory buffers.
Definition: iosfwd:147
ISO C++ entities toplevel namespace is std.
The actual work of input and output (for files).
Definition: fstream:86
Controlling input for files.
Definition: fstream:498
Controlling output for files.
Definition: fstream:759
Controlling input and output for files.
Definition: fstream:1022
Template class basic_ios, virtual base class for all stream classes.
Definition: basic_ios.h:68
The actual work of input and output (interface).
Definition: streambuf:123
The actual work of input and output (for std::string).
Definition: sstream:73
Controlling input for std::string.
Definition: sstream:538
Controlling output for std::string.
Definition: sstream:759
Controlling input and output for std::string.
Definition: sstream:980