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