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