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 _GLIBCXX_IOSFWD 41 #define _GLIBCXX_IOSFWD 1 42 43 #pragma GCC system_header 44 45 #include <bits/c++config.h> 46 #include <bits/c++locale.h> 47 #include <bits/c++io.h> 48 #include <cctype> // For isspace, etc. 49 #include <bits/stringfwd.h> // For string forward declarations. 50 #include <bits/postypes.h> 51 #include <bits/functexcept.h> 52 53 namespace std 54 { 55 template<typename _CharT, typename _Traits = char_traits<_CharT> > 56 class basic_ios; 57 58 template<typename _CharT, typename _Traits = char_traits<_CharT> > 59 class basic_streambuf; 60 61 template<typename _CharT, typename _Traits = char_traits<_CharT> > 62 class basic_istream; 63 64 template<typename _CharT, typename _Traits = char_traits<_CharT> > 65 class basic_ostream; 66 67 template<typename _CharT, typename _Traits = char_traits<_CharT> > 68 class basic_iostream; 69 70 template<typename _CharT, typename _Traits = char_traits<_CharT>, 71 typename _Alloc = allocator<_CharT> > 72 class basic_stringbuf; 73 74 template<typename _CharT, typename _Traits = char_traits<_CharT>, 75 typename _Alloc = allocator<_CharT> > 76 class basic_istringstream; 77 78 template<typename _CharT, typename _Traits = char_traits<_CharT>, 79 typename _Alloc = allocator<_CharT> > 80 class basic_ostringstream; 81 82 template<typename _CharT, typename _Traits = char_traits<_CharT>, 83 typename _Alloc = allocator<_CharT> > 84 class basic_stringstream; 85 86 template<typename _CharT, typename _Traits = char_traits<_CharT> > 87 class basic_filebuf; 88 89 template<typename _CharT, typename _Traits = char_traits<_CharT> > 90 class basic_ifstream; 91 92 template<typename _CharT, typename _Traits = char_traits<_CharT> > 93 class basic_ofstream; 94 95 template<typename _CharT, typename _Traits = char_traits<_CharT> > 96 class basic_fstream; 97 98 template<typename _CharT, typename _Traits = char_traits<_CharT> > 99 class istreambuf_iterator; 100 101 template<typename _CharT, typename _Traits = char_traits<_CharT> > 102 class ostreambuf_iterator; 103 104 // _GLIBCXX_RESOLVE_LIB_DEFECTS 105 // Not included. (??? Apparently no LWG number?) 106 class ios_base; 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 <iosfwd> 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 _GLIBCXX_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 /* _GLIBCXX_IOSFWD */ 169