TODO: Note change in clause 27 docs.
[official-gcc.git] / libstdc++-v3 / include / std / std_iosfwd.h
blob124c8ffc5ff09e7ed37fcaca5e74418497c589f5
1 // Forwarding declarations -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2001, 2002 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 2, or (at your option)
9 // any later version.
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 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
31 // ISO C++ 14882: 27.2 Forward declarations
34 /** @file iosfwd
35 * This is a Standard C++ Library header. You should @c #include this header
36 * in your programs, rather than any of the "st[dl]_*.h" implementation files.
39 #ifndef _CPP_IOSFWD
40 #define _CPP_IOSFWD 1
42 #pragma GCC system_header
44 #include <bits/c++config.h>
45 #include <bits/stringfwd.h> // For string forward declarations.
46 #include <bits/fpos.h>
47 #include <bits/functexcept.h>
49 namespace std
51 template<typename _CharT, typename _Traits = char_traits<_CharT> >
52 class basic_ios;
54 template<typename _CharT, typename _Traits = char_traits<_CharT> >
55 class basic_streambuf;
57 template<typename _CharT, typename _Traits = char_traits<_CharT> >
58 class basic_istream;
60 template<typename _CharT, typename _Traits = char_traits<_CharT> >
61 class basic_ostream;
63 template<typename _CharT, typename _Traits = char_traits<_CharT> >
64 class basic_iostream;
66 template<typename _CharT, typename _Traits = char_traits<_CharT>,
67 typename _Alloc = allocator<_CharT> >
68 class basic_stringbuf;
70 template<typename _CharT, typename _Traits = char_traits<_CharT>,
71 typename _Alloc = allocator<_CharT> >
72 class basic_istringstream;
74 template<typename _CharT, typename _Traits = char_traits<_CharT>,
75 typename _Alloc = allocator<_CharT> >
76 class basic_ostringstream;
78 template<typename _CharT, typename _Traits = char_traits<_CharT>,
79 typename _Alloc = allocator<_CharT> >
80 class basic_stringstream;
82 template<typename _CharT, typename _Traits = char_traits<_CharT> >
83 class basic_filebuf;
85 template<typename _CharT, typename _Traits = char_traits<_CharT> >
86 class basic_ifstream;
88 template<typename _CharT, typename _Traits = char_traits<_CharT> >
89 class basic_ofstream;
91 template<typename _CharT, typename _Traits = char_traits<_CharT> >
92 class basic_fstream;
94 template<typename _CharT, typename _Traits = char_traits<_CharT> >
95 class istreambuf_iterator;
97 template<typename _CharT, typename _Traits = char_traits<_CharT> >
98 class ostreambuf_iterator;
100 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
101 // Not included. (??? Apparently no LWG number?)
102 class ios_base;
103 #endif
105 /**
106 * @defgroup s27_2_iosfwd I/O Forward Declarations
108 * Nearly all of the I/O classes are parameterized on the type of
109 * characters they read and write. (The major exception is ios_base at
110 * the top of the hierarchy.) This is a change from pre-Standard
111 * streams, which were not templates.
113 * For ease of use and compatibility, all of the basic_* I/O-related
114 * classes are given typedef names for both of the builtin character
115 * widths (wide and narrow). The typedefs are the same as the
116 * pre-Standard names, for example:
118 * @code
119 * typedef basic_ifstream<char> ifstream;
120 * @endcode
122 * Because properly forward-declaring these classes can be difficult, you
123 * should not do it yourself. Instead, include the &lt;iosfwd&gt;
124 * header, which contains only declarations of all the I/O classes as
125 * well as the typedefs. Trying to forward-declare the typedefs
126 * themselves (e.g., "class ostream;") is not valid ISO C++.
128 * For more specific declarations, see
129 * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10
131 * @{
133 typedef basic_ios<char> ios; ///< @isiosfwd
134 typedef basic_streambuf<char> streambuf; ///< @isiosfwd
135 typedef basic_istream<char> istream; ///< @isiosfwd
136 typedef basic_ostream<char> ostream; ///< @isiosfwd
137 typedef basic_iostream<char> iostream; ///< @isiosfwd
138 typedef basic_stringbuf<char> stringbuf; ///< @isiosfwd
139 typedef basic_istringstream<char> istringstream; ///< @isiosfwd
140 typedef basic_ostringstream<char> ostringstream; ///< @isiosfwd
141 typedef basic_stringstream<char> stringstream; ///< @isiosfwd
142 typedef basic_filebuf<char> filebuf; ///< @isiosfwd
143 typedef basic_ifstream<char> ifstream; ///< @isiosfwd
144 typedef basic_ofstream<char> ofstream; ///< @isiosfwd
145 typedef basic_fstream<char> fstream; ///< @isiosfwd
147 #ifdef _GLIBCPP_USE_WCHAR_T
148 typedef basic_ios<wchar_t> wios; ///< @isiosfwd
149 typedef basic_streambuf<wchar_t> wstreambuf; ///< @isiosfwd
150 typedef basic_istream<wchar_t> wistream; ///< @isiosfwd
151 typedef basic_ostream<wchar_t> wostream; ///< @isiosfwd
152 typedef basic_iostream<wchar_t> wiostream; ///< @isiosfwd
153 typedef basic_stringbuf<wchar_t> wstringbuf; ///< @isiosfwd
154 typedef basic_istringstream<wchar_t> wistringstream; ///< @isiosfwd
155 typedef basic_ostringstream<wchar_t> wostringstream; ///< @isiosfwd
156 typedef basic_stringstream<wchar_t> wstringstream; ///< @isiosfwd
157 typedef basic_filebuf<wchar_t> wfilebuf; ///< @isiosfwd
158 typedef basic_ifstream<wchar_t> wifstream; ///< @isiosfwd
159 typedef basic_ofstream<wchar_t> wofstream; ///< @isiosfwd
160 typedef basic_fstream<wchar_t> wfstream; ///< @isiosfwd
161 #endif
162 /** @} */
163 } // namespace std
165 #endif