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/requires_hosted.h> // iostreams
39
40#include <bits/c++config.h>
41#include <bits/stringfwd.h> // For string forward declarations.
42#include <bits/postypes.h>
43
44namespace std _GLIBCXX_VISIBILITY(default)
45{
46_GLIBCXX_BEGIN_NAMESPACE_VERSION
47
48 /**
49 * @defgroup io I/O
50 *
51 * Nearly all of the I/O classes are parameterized on the type of
52 * characters they read and write. (The major exception is ios_base at
53 * the top of the hierarchy.) This is a change from pre-Standard
54 * streams, which were not templates.
55 *
56 * For ease of use and compatibility, all of the basic_* I/O-related
57 * classes are given typedef names for both of the builtin character
58 * widths (wide and narrow). The typedefs are the same as the
59 * pre-Standard names, for example:
60 *
61 * @code
62 * typedef basic_ifstream<char> ifstream;
63 * @endcode
64 *
65 * Because properly forward-declaring these classes can be difficult, you
66 * should not do it yourself. Instead, include the &lt;iosfwd&gt;
67 * header, which contains only declarations of all the I/O classes as
68 * well as the typedefs. Trying to forward-declare the typedefs
69 * themselves (e.g., <code>class ostream;</code>) is not valid ISO C++.
70 *
71 * For more specific declarations, see
72 * https://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html#std.io.objects
73 *
74 * @{
75 */
76 class ios_base;
77
78 template<typename _CharT, typename _Traits = char_traits<_CharT> >
79 class basic_ios;
80
81 template<typename _CharT, typename _Traits = char_traits<_CharT> >
82 class basic_streambuf;
83
84 template<typename _CharT, typename _Traits = char_traits<_CharT> >
85 class basic_istream;
86
87 template<typename _CharT, typename _Traits = char_traits<_CharT> >
88 class basic_ostream;
89
90 template<typename _CharT, typename _Traits = char_traits<_CharT> >
91 class basic_iostream;
92
93
94_GLIBCXX_BEGIN_NAMESPACE_CXX11
95
96 template<typename _CharT, typename _Traits = char_traits<_CharT>,
97 typename _Alloc = allocator<_CharT> >
98 class basic_stringbuf;
99
100 template<typename _CharT, typename _Traits = char_traits<_CharT>,
101 typename _Alloc = allocator<_CharT> >
102 class basic_istringstream;
103
104 template<typename _CharT, typename _Traits = char_traits<_CharT>,
105 typename _Alloc = allocator<_CharT> >
106 class basic_ostringstream;
107
108 template<typename _CharT, typename _Traits = char_traits<_CharT>,
109 typename _Alloc = allocator<_CharT> >
110 class basic_stringstream;
111
112_GLIBCXX_END_NAMESPACE_CXX11
113
114 template<typename _CharT, typename _Traits = char_traits<_CharT> >
115 class basic_filebuf;
116
117 template<typename _CharT, typename _Traits = char_traits<_CharT> >
118 class basic_ifstream;
119
120 template<typename _CharT, typename _Traits = char_traits<_CharT> >
121 class basic_ofstream;
122
123 template<typename _CharT, typename _Traits = char_traits<_CharT> >
124 class basic_fstream;
125
126 template<typename _CharT, typename _Traits = char_traits<_CharT> >
127 class istreambuf_iterator;
128
129 template<typename _CharT, typename _Traits = char_traits<_CharT> >
130 class ostreambuf_iterator;
131
132
133 /// Base class for @c char streams.
135
136 /// Base class for @c char buffers.
138
139 /// Base class for @c char input streams.
141
142 /// Base class for @c char output streams.
144
145 /// Base class for @c char mixed input and output streams.
147
148 /// Class for @c char memory buffers.
150
151 /// Class for @c char input memory streams.
153
154 /// Class for @c char output memory streams.
156
157 /// Class for @c char mixed input and output memory streams.
159
160 /// Class for @c char file buffers.
162
163 /// Class for @c char input file streams.
165
166 /// Class for @c char output file streams.
168
169 /// Class for @c char mixed input and output file streams.
171
172#ifdef _GLIBCXX_USE_WCHAR_T
173 /// Base class for @c wchar_t streams.
175
176 /// Base class for @c wchar_t buffers.
178
179 /// Base class for @c wchar_t input streams.
181
182 /// Base class for @c wchar_t output streams.
184
185 /// Base class for @c wchar_t mixed input and output streams.
187
188 /// Class for @c wchar_t memory buffers.
190
191 /// Class for @c wchar_t input memory streams.
193
194 /// Class for @c wchar_t output memory streams.
196
197 /// Class for @c wchar_t mixed input and output memory streams.
199
200 /// Class for @c wchar_t file buffers.
202
203 /// Class for @c wchar_t input file streams.
205
206 /// Class for @c wchar_t output file streams.
208
209 /// Class for @c wchar_t mixed input and output file streams.
211#endif
212
213#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
214 template<typename _CharT, typename _Traits = char_traits<_CharT>,
215 typename _Allocator = allocator<_CharT>>
216 class basic_syncbuf;
217 template<typename _CharT, typename _Traits = char_traits<_CharT>,
218 typename _Allocator = allocator<_CharT>>
219 class basic_osyncstream;
220
221 using syncbuf = basic_syncbuf<char>;
222 using osyncstream = basic_osyncstream<char>;
223
224#ifdef _GLIBCXX_USE_WCHAR_T
225 using wsyncbuf = basic_syncbuf<wchar_t>;
226 using wosyncstream = basic_osyncstream<wchar_t>;
227#endif
228#endif // C++20 && CXX11_ABI
229
230#if __cplusplus > 202002L
231 template<typename _CharT, typename _Traits = char_traits<_CharT>>
232 class basic_spanbuf;
233 template<typename _CharT, typename _Traits = char_traits<_CharT>>
234 class basic_ispanstream;
235 template<typename _CharT, typename _Traits = char_traits<_CharT>>
236 class basic_ospanstream;
237 template<typename _CharT, typename _Traits = char_traits<_CharT>>
238 class basic_spanstream;
239
240 using spanbuf = basic_spanbuf<char>;
241 using ispanstream = basic_ispanstream<char>;
242 using ospanstream = basic_ospanstream<char>;
243 using spanstream = basic_spanstream<char>;
244
245#ifdef _GLIBCXX_USE_WCHAR_T
246 using wspanbuf = basic_spanbuf<wchar_t>;
247 using wispanstream = basic_ispanstream<wchar_t>;
248 using wospanstream = basic_ospanstream<wchar_t>;
249 using wspanstream = basic_spanstream<wchar_t>;
250#endif
251#endif // C++23
252
253 /** @} */
254
255_GLIBCXX_END_NAMESPACE_VERSION
256} // namespace
257
258#endif /* _GLIBCXX_IOSFWD */
basic_ifstream< wchar_t > wifstream
Class for wchar_t input file streams.
Definition: iosfwd:204
basic_stringstream< char > stringstream
Class for char mixed input and output memory streams.
Definition: iosfwd:158
basic_iostream< wchar_t > wiostream
Base class for wchar_t mixed input and output streams.
Definition: iosfwd:186
basic_streambuf< char > streambuf
Base class for char buffers.
Definition: iosfwd:137
basic_stringbuf< wchar_t > wstringbuf
Class for wchar_t memory buffers.
Definition: iosfwd:189
basic_ostream< char > ostream
Base class for char output streams.
Definition: iosfwd:143
basic_ifstream< char > ifstream
Class for char input file streams.
Definition: iosfwd:164
basic_iostream< char > iostream
Base class for char mixed input and output streams.
Definition: iosfwd:146
basic_ios< wchar_t > wios
Base class for wchar_t streams.
Definition: iosfwd:174
basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: iosfwd:152
basic_streambuf< wchar_t > wstreambuf
Base class for wchar_t buffers.
Definition: iosfwd:177
basic_istringstream< wchar_t > wistringstream
Class for wchar_t input memory streams.
Definition: iosfwd:192
basic_fstream< wchar_t > wfstream
Class for wchar_t mixed input and output file streams.
Definition: iosfwd:210
basic_ofstream< char > ofstream
Class for char output file streams.
Definition: iosfwd:167
basic_ostringstream< wchar_t > wostringstream
Class for wchar_t output memory streams.
Definition: iosfwd:195
basic_istream< char > istream
Base class for char input streams.
Definition: iosfwd:140
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
Definition: iosfwd:183
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
Definition: iosfwd:180
basic_filebuf< char > filebuf
Class for char file buffers.
Definition: iosfwd:161
basic_filebuf< wchar_t > wfilebuf
Class for wchar_t file buffers.
Definition: iosfwd:201
basic_ofstream< wchar_t > wofstream
Class for wchar_t output file streams.
Definition: iosfwd:207
basic_fstream< char > fstream
Class for char mixed input and output file streams.
Definition: iosfwd:170
basic_stringstream< wchar_t > wstringstream
Class for wchar_t mixed input and output memory streams.
Definition: iosfwd:198
basic_ios< char > ios
Base class for char streams.
Definition: iosfwd:134
basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: iosfwd:155
basic_stringbuf< char > stringbuf
Class for char memory buffers.
Definition: iosfwd:149
ISO C++ entities toplevel namespace is std.
The actual work of input and output (for files).
Definition: fstream:88
Controlling input for files.
Definition: fstream:500
Controlling output for files.
Definition: fstream:761
Controlling input and output for files.
Definition: fstream:1024
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:125
The actual work of input and output (for std::string).
Definition: sstream:75
Controlling input for std::string.
Definition: sstream:540
Controlling output for std::string.
Definition: sstream:761
Controlling input and output for std::string.
Definition: sstream:982