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