| 1 | // -*- C++ -*- |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 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 |
| 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; |
| 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 | |
| 26 | template<class T> class allocator; |
| 27 | |
| 28 | template <class charT, class traits = char_traits<charT> > class basic_ios; |
| 29 | |
| 30 | template <class charT, class traits = char_traits<charT> > class basic_streambuf; |
| 31 | template <class charT, class traits = char_traits<charT> > class basic_istream; |
| 32 | template <class charT, class traits = char_traits<charT> > class basic_ostream; |
| 33 | template <class charT, class traits = char_traits<charT> > class basic_iostream; |
| 34 | |
| 35 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 36 | class basic_stringbuf; |
| 37 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 38 | class basic_istringstream; |
| 39 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 40 | class basic_ostringstream; |
| 41 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
| 42 | class basic_stringstream; |
| 43 | |
| 44 | template <class charT, class traits = char_traits<charT> > class basic_filebuf; |
| 45 | template <class charT, class traits = char_traits<charT> > class basic_ifstream; |
| 46 | template <class charT, class traits = char_traits<charT> > class basic_ofstream; |
| 47 | template <class charT, class traits = char_traits<charT> > class basic_fstream; |
| 48 | |
| 49 | template <class charT, class traits = char_traits<charT> > class istreambuf_iterator; |
| 50 | template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator; |
| 51 | |
| 52 | typedef basic_ios<char> ios; |
| 53 | typedef basic_ios<wchar_t> wios; |
| 54 | |
| 55 | typedef basic_streambuf<char> streambuf; |
| 56 | typedef basic_istream<char> istream; |
| 57 | typedef basic_ostream<char> ostream; |
| 58 | typedef basic_iostream<char> iostream; |
| 59 | |
| 60 | typedef basic_stringbuf<char> stringbuf; |
| 61 | typedef basic_istringstream<char> istringstream; |
| 62 | typedef basic_ostringstream<char> ostringstream; |
| 63 | typedef basic_stringstream<char> stringstream; |
| 64 | |
| 65 | typedef basic_filebuf<char> filebuf; |
| 66 | typedef basic_ifstream<char> ifstream; |
| 67 | typedef basic_ofstream<char> ofstream; |
| 68 | typedef basic_fstream<char> fstream; |
| 69 | |
| 70 | typedef basic_streambuf<wchar_t> wstreambuf; |
| 71 | typedef basic_istream<wchar_t> wistream; |
| 72 | typedef basic_ostream<wchar_t> wostream; |
| 73 | typedef basic_iostream<wchar_t> wiostream; |
| 74 | |
| 75 | typedef basic_stringbuf<wchar_t> wstringbuf; |
| 76 | typedef basic_istringstream<wchar_t> wistringstream; |
| 77 | typedef basic_ostringstream<wchar_t> wostringstream; |
| 78 | typedef basic_stringstream<wchar_t> wstringstream; |
| 79 | |
| 80 | typedef basic_filebuf<wchar_t> wfilebuf; |
| 81 | typedef basic_ifstream<wchar_t> wifstream; |
| 82 | typedef basic_ofstream<wchar_t> wofstream; |
| 83 | typedef basic_fstream<wchar_t> wfstream; |
| 84 | |
| 85 | template <class state> class fpos; |
| 86 | using streampos = fpos<char_traits<char>::state_type>; |
| 87 | using wstreampos = fpos<char_traits<wchar_t>::state_type>; |
| 88 | using u8streampos = fpos<char_traits<char8_t>::state_type>; // C++20 |
| 89 | using u16streampos = fpos<char_traits<char16_t>::state_type>; |
| 90 | using u32streampos = fpos<char_traits<char32_t>::state_type>; |
| 91 | |
| 92 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> |
| 93 | class basic_syncbuf; // C++20 |
| 94 | |
| 95 | using syncbuf = basic_syncbuf<char>; // C++20 |
| 96 | using wsyncbuf = basic_syncbuf<wchar_t>; // C++20 |
| 97 | |
| 98 | template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> |
| 99 | class basic_osyncstream; // C++20 |
| 100 | |
| 101 | using osyncstream = basic_osyncstream<char>; // C++20 |
| 102 | using wosyncstream = basic_osyncstream<wchar_t>; // C++20 |
| 103 | |
| 104 | } // std |
| 105 | |
| 106 | */ |
| 107 | |
| 108 | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 109 | # include <__cxx03/iosfwd> |
| 110 | #else |
| 111 | # include <__config> |
| 112 | # include <__fwd/fstream.h> |
| 113 | # include <__fwd/ios.h> |
| 114 | # include <__fwd/istream.h> |
| 115 | # include <__fwd/memory.h> |
| 116 | # include <__fwd/ostream.h> |
| 117 | # include <__fwd/sstream.h> |
| 118 | # include <__fwd/streambuf.h> |
| 119 | # include <__fwd/string.h> |
| 120 | # include <__std_mbstate_t.h> |
| 121 | # include <version> |
| 122 | |
| 123 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 124 | # pragma GCC system_header |
| 125 | # endif |
| 126 | |
| 127 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 128 | |
| 129 | template <class _CharT, class _Traits = char_traits<_CharT> > |
| 130 | class istreambuf_iterator; |
| 131 | template <class _CharT, class _Traits = char_traits<_CharT> > |
| 132 | class ostreambuf_iterator; |
| 133 | |
| 134 | template <class _State> |
| 135 | class fpos; |
| 136 | typedef fpos<mbstate_t> streampos; |
| 137 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| 138 | typedef fpos<mbstate_t> wstreampos; |
| 139 | # endif |
| 140 | # if _LIBCPP_HAS_CHAR8_T |
| 141 | typedef fpos<mbstate_t> u8streampos; |
| 142 | # endif |
| 143 | typedef fpos<mbstate_t> u16streampos; |
| 144 | typedef fpos<mbstate_t> u32streampos; |
| 145 | |
| 146 | # if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM |
| 147 | |
| 148 | template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>> |
| 149 | class basic_syncbuf; |
| 150 | |
| 151 | using syncbuf = basic_syncbuf<char>; |
| 152 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| 153 | using wsyncbuf = basic_syncbuf<wchar_t>; |
| 154 | # endif |
| 155 | |
| 156 | template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>> |
| 157 | class basic_osyncstream; |
| 158 | |
| 159 | using osyncstream = basic_osyncstream<char>; |
| 160 | # if _LIBCPP_HAS_WIDE_CHARACTERS |
| 161 | using wosyncstream = basic_osyncstream<wchar_t>; |
| 162 | # endif |
| 163 | |
| 164 | # endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM |
| 165 | |
| 166 | template <class _CharT, class _Traits> |
| 167 | class __save_flags { |
| 168 | typedef basic_ios<_CharT, _Traits> __stream_type; |
| 169 | typedef typename __stream_type::fmtflags fmtflags; |
| 170 | |
| 171 | __stream_type& __stream_; |
| 172 | fmtflags __fmtflags_; |
| 173 | _CharT __fill_; |
| 174 | |
| 175 | public: |
| 176 | __save_flags(const __save_flags&) = delete; |
| 177 | __save_flags& operator=(const __save_flags&) = delete; |
| 178 | |
| 179 | _LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream) |
| 180 | : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {} |
| 181 | _LIBCPP_HIDE_FROM_ABI ~__save_flags() { |
| 182 | __stream_.flags(__fmtflags_); |
| 183 | __stream_.fill(__fill_); |
| 184 | } |
| 185 | }; |
| 186 | |
| 187 | _LIBCPP_END_NAMESPACE_STD |
| 188 | |
| 189 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 190 | |
| 191 | #endif // _LIBCPP_IOSFWD |
| 192 | |