Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- iosfwd -----------------------------------===// |
| 3 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_IOSFWD |
| 11 | #define _LIBCPP_IOSFWD |
| 12 | |
| 13 | /* |
| 14 | iosfwd synopsis |
| 15 | |
| 16 | namespace std |
| 17 | { |
| 18 | |
| 19 | template<class charT> struct char_traits; |
Marshall Clow | 8732fed | 2018-12-11 04:35:44 +0000 | [diff] [blame] | 20 | template<> struct char_traits<char>; |
| 21 | template<> struct char_traits<char8_t>; // C++20 |
| 22 | template<> struct char_traits<char16_t>; |
| 23 | template<> struct char_traits<char32_t>; |
| 24 | template<> struct char_traits<wchar_t>; |
| 25 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 26 | template<class T> class allocator; |
| 27 | |
Howard Hinnant | c8827ba | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 28 | class ios_base; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 29 | template <class charT, class traits = char_traits<charT> > class basic_ios; |
| 30 | |
| 31 | template <class charT, class traits = char_traits<charT> > class basic_streambuf; |
| 32 | template <class charT, class traits = char_traits<charT> > class basic_istream; |
| 33 | template <class charT, class traits = char_traits<charT> > class basic_ostream; |
| 34 | template <class charT, class traits = char_traits<charT> > class basic_iostream; |
| 35 | |
| 36 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 37 | class basic_stringbuf; |
| 38 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 39 | class basic_istringstream; |
| 40 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 41 | class basic_ostringstream; |
| 42 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 43 | class basic_stringstream; |
| 44 | |
| 45 | template <class charT, class traits = char_traits<charT> > class basic_filebuf; |
| 46 | template <class charT, class traits = char_traits<charT> > class basic_ifstream; |
| 47 | template <class charT, class traits = char_traits<charT> > class basic_ofstream; |
| 48 | template <class charT, class traits = char_traits<charT> > class basic_fstream; |
| 49 | |
| 50 | template <class charT, class traits = char_traits<charT> > class istreambuf_iterator; |
| 51 | template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator; |
| 52 | |
| 53 | typedef basic_ios<char> ios; |
| 54 | typedef basic_ios<wchar_t> wios; |
| 55 | |
| 56 | typedef basic_streambuf<char> streambuf; |
| 57 | typedef basic_istream<char> istream; |
| 58 | typedef basic_ostream<char> ostream; |
| 59 | typedef basic_iostream<char> iostream; |
| 60 | |
| 61 | typedef basic_stringbuf<char> stringbuf; |
| 62 | typedef basic_istringstream<char> istringstream; |
| 63 | typedef basic_ostringstream<char> ostringstream; |
| 64 | typedef basic_stringstream<char> stringstream; |
| 65 | |
| 66 | typedef basic_filebuf<char> filebuf; |
| 67 | typedef basic_ifstream<char> ifstream; |
| 68 | typedef basic_ofstream<char> ofstream; |
| 69 | typedef basic_fstream<char> fstream; |
| 70 | |
| 71 | typedef basic_streambuf<wchar_t> wstreambuf; |
| 72 | typedef basic_istream<wchar_t> wistream; |
| 73 | typedef basic_ostream<wchar_t> wostream; |
| 74 | typedef basic_iostream<wchar_t> wiostream; |
| 75 | |
| 76 | typedef basic_stringbuf<wchar_t> wstringbuf; |
| 77 | typedef basic_istringstream<wchar_t> wistringstream; |
| 78 | typedef basic_ostringstream<wchar_t> wostringstream; |
| 79 | typedef basic_stringstream<wchar_t> wstringstream; |
| 80 | |
| 81 | typedef basic_filebuf<wchar_t> wfilebuf; |
| 82 | typedef basic_ifstream<wchar_t> wifstream; |
| 83 | typedef basic_ofstream<wchar_t> wofstream; |
| 84 | typedef basic_fstream<wchar_t> wfstream; |
| 85 | |
| 86 | template <class state> class fpos; |
| 87 | typedef fpos<char_traits<char>::state_type> streampos; |
| 88 | typedef fpos<char_traits<wchar_t>::state_type> wstreampos; |
| 89 | |
| 90 | } // std |
| 91 | |
| 92 | */ |
| 93 | |
| 94 | #include <__config> |
Howard Hinnant | 155c2af | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 95 | #include <wchar.h> // for mbstate_t |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 96 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 97 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 98 | #pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 99 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 100 | |
| 101 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 102 | |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 103 | class _LIBCPP_TYPE_VIS ios_base; |
Howard Hinnant | d433527 | 2011-01-08 20:00:48 +0000 | [diff] [blame] | 104 | |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 105 | template<class _CharT> struct _LIBCPP_TEMPLATE_VIS char_traits; |
Marshall Clow | 8732fed | 2018-12-11 04:35:44 +0000 | [diff] [blame] | 106 | template<> struct char_traits<char>; |
| 107 | #ifndef _LIBCPP_NO_HAS_CHAR8_T |
| 108 | template<> struct char_traits<char8_t>; |
| 109 | #endif |
| 110 | template<> struct char_traits<char16_t>; |
| 111 | template<> struct char_traits<char32_t>; |
| 112 | template<> struct char_traits<wchar_t>; |
| 113 | |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 114 | template<class _Tp> class _LIBCPP_TEMPLATE_VIS allocator; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 115 | |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 116 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 117 | class _LIBCPP_TEMPLATE_VIS basic_ios; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 118 | |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 119 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 120 | class _LIBCPP_TEMPLATE_VIS basic_streambuf; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 121 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 122 | class _LIBCPP_TEMPLATE_VIS basic_istream; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 123 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 124 | class _LIBCPP_TEMPLATE_VIS basic_ostream; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 125 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 126 | class _LIBCPP_TEMPLATE_VIS basic_iostream; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 127 | |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 128 | template <class _CharT, class _Traits = char_traits<_CharT>, |
| 129 | class _Allocator = allocator<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 130 | class _LIBCPP_TEMPLATE_VIS basic_stringbuf; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 131 | template <class _CharT, class _Traits = char_traits<_CharT>, |
| 132 | class _Allocator = allocator<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 133 | class _LIBCPP_TEMPLATE_VIS basic_istringstream; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 134 | template <class _CharT, class _Traits = char_traits<_CharT>, |
| 135 | class _Allocator = allocator<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 136 | class _LIBCPP_TEMPLATE_VIS basic_ostringstream; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 137 | template <class _CharT, class _Traits = char_traits<_CharT>, |
| 138 | class _Allocator = allocator<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 139 | class _LIBCPP_TEMPLATE_VIS basic_stringstream; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 140 | |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 141 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 142 | class _LIBCPP_TEMPLATE_VIS basic_filebuf; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 143 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 144 | class _LIBCPP_TEMPLATE_VIS basic_ifstream; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 145 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 146 | class _LIBCPP_TEMPLATE_VIS basic_ofstream; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 147 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 148 | class _LIBCPP_TEMPLATE_VIS basic_fstream; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 149 | |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 150 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 151 | class _LIBCPP_TEMPLATE_VIS istreambuf_iterator; |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 152 | template <class _CharT, class _Traits = char_traits<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 153 | class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 154 | |
| 155 | typedef basic_ios<char> ios; |
| 156 | typedef basic_ios<wchar_t> wios; |
| 157 | |
| 158 | typedef basic_streambuf<char> streambuf; |
| 159 | typedef basic_istream<char> istream; |
| 160 | typedef basic_ostream<char> ostream; |
| 161 | typedef basic_iostream<char> iostream; |
| 162 | |
| 163 | typedef basic_stringbuf<char> stringbuf; |
| 164 | typedef basic_istringstream<char> istringstream; |
| 165 | typedef basic_ostringstream<char> ostringstream; |
| 166 | typedef basic_stringstream<char> stringstream; |
| 167 | |
| 168 | typedef basic_filebuf<char> filebuf; |
| 169 | typedef basic_ifstream<char> ifstream; |
| 170 | typedef basic_ofstream<char> ofstream; |
| 171 | typedef basic_fstream<char> fstream; |
| 172 | |
| 173 | typedef basic_streambuf<wchar_t> wstreambuf; |
| 174 | typedef basic_istream<wchar_t> wistream; |
| 175 | typedef basic_ostream<wchar_t> wostream; |
| 176 | typedef basic_iostream<wchar_t> wiostream; |
| 177 | |
| 178 | typedef basic_stringbuf<wchar_t> wstringbuf; |
| 179 | typedef basic_istringstream<wchar_t> wistringstream; |
| 180 | typedef basic_ostringstream<wchar_t> wostringstream; |
| 181 | typedef basic_stringstream<wchar_t> wstringstream; |
| 182 | |
| 183 | typedef basic_filebuf<wchar_t> wfilebuf; |
| 184 | typedef basic_ifstream<wchar_t> wifstream; |
| 185 | typedef basic_ofstream<wchar_t> wofstream; |
| 186 | typedef basic_fstream<wchar_t> wfstream; |
| 187 | |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 188 | template <class _State> class _LIBCPP_TEMPLATE_VIS fpos; |
Howard Hinnant | 155c2af | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 189 | typedef fpos<mbstate_t> streampos; |
| 190 | typedef fpos<mbstate_t> wstreampos; |
Marshall Clow | 8732fed | 2018-12-11 04:35:44 +0000 | [diff] [blame] | 191 | #ifndef _LIBCPP_NO_HAS_CHAR8_T |
| 192 | typedef fpos<mbstate_t> u8streampos; |
| 193 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 194 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS |
Howard Hinnant | 155c2af | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 195 | typedef fpos<mbstate_t> u16streampos; |
| 196 | typedef fpos<mbstate_t> u32streampos; |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 197 | #endif // _LIBCPP_HAS_NO_UNICODE_CHARS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 198 | |
Jonathan Roelofs | d3c81f4 | 2015-02-03 15:34:17 +0000 | [diff] [blame] | 199 | #if defined(_NEWLIB_VERSION) |
| 200 | // On newlib, off_t is 'long int' |
| 201 | typedef long int streamoff; // for char_traits in <string> |
| 202 | #else |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 203 | typedef long long streamoff; // for char_traits in <string> |
Jonathan Roelofs | d3c81f4 | 2015-02-03 15:34:17 +0000 | [diff] [blame] | 204 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 205 | |
| 206 | template <class _CharT, // for <stdexcept> |
| 207 | class _Traits = char_traits<_CharT>, |
Howard Hinnant | 5e9669f | 2010-09-21 16:04:28 +0000 | [diff] [blame] | 208 | class _Allocator = allocator<_CharT> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 209 | class _LIBCPP_TEMPLATE_VIS basic_string; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 210 | typedef basic_string<char, char_traits<char>, allocator<char> > string; |
| 211 | typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; |
| 212 | |
Eric Fiselier | 876c686 | 2016-02-20 00:19:45 +0000 | [diff] [blame] | 213 | |
| 214 | // Include other forward declarations here |
| 215 | template <class _Tp, class _Alloc = allocator<_Tp> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 216 | class _LIBCPP_TEMPLATE_VIS vector; |
Eric Fiselier | 876c686 | 2016-02-20 00:19:45 +0000 | [diff] [blame] | 217 | |
Louis Dionne | 3df65ce | 2020-10-15 13:27:27 -0400 | [diff] [blame^] | 218 | template <class _CharT, class _Traits> |
| 219 | class __save_flags |
| 220 | { |
| 221 | typedef basic_ios<_CharT, _Traits> __stream_type; |
| 222 | typedef typename __stream_type::fmtflags fmtflags; |
| 223 | |
| 224 | __stream_type& __stream_; |
| 225 | fmtflags __fmtflags_; |
| 226 | _CharT __fill_; |
| 227 | |
| 228 | __save_flags(const __save_flags&); |
| 229 | __save_flags& operator=(const __save_flags&); |
| 230 | public: |
| 231 | _LIBCPP_INLINE_VISIBILITY |
| 232 | explicit __save_flags(__stream_type& __stream) |
| 233 | : __stream_(__stream), |
| 234 | __fmtflags_(__stream.flags()), |
| 235 | __fill_(__stream.fill()) |
| 236 | {} |
| 237 | _LIBCPP_INLINE_VISIBILITY |
| 238 | ~__save_flags() |
| 239 | { |
| 240 | __stream_.flags(__fmtflags_); |
| 241 | __stream_.fill(__fill_); |
| 242 | } |
| 243 | }; |
| 244 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 245 | _LIBCPP_END_NAMESPACE_STD |
| 246 | |
| 247 | #endif // _LIBCPP_IOSFWD |