llvm-project
186 строк · 6.5 Кб
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_IOSFWD11#define _LIBCPP_IOSFWD12
13/*
14iosfwd 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
28template <class charT, class traits = char_traits<charT> > class basic_ios;
29
30template <class charT, class traits = char_traits<charT> > class basic_streambuf;
31template <class charT, class traits = char_traits<charT> > class basic_istream;
32template <class charT, class traits = char_traits<charT> > class basic_ostream;
33template <class charT, class traits = char_traits<charT> > class basic_iostream;
34
35template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
36class basic_stringbuf;
37template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
38class basic_istringstream;
39template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
40class basic_ostringstream;
41template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
42class basic_stringstream;
43
44template <class charT, class traits = char_traits<charT> > class basic_filebuf;
45template <class charT, class traits = char_traits<charT> > class basic_ifstream;
46template <class charT, class traits = char_traits<charT> > class basic_ofstream;
47template <class charT, class traits = char_traits<charT> > class basic_fstream;
48
49template <class charT, class traits = char_traits<charT> > class istreambuf_iterator;
50template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator;
51
52typedef basic_ios<char> ios;
53typedef basic_ios<wchar_t> wios;
54
55typedef basic_streambuf<char> streambuf;
56typedef basic_istream<char> istream;
57typedef basic_ostream<char> ostream;
58typedef basic_iostream<char> iostream;
59
60typedef basic_stringbuf<char> stringbuf;
61typedef basic_istringstream<char> istringstream;
62typedef basic_ostringstream<char> ostringstream;
63typedef basic_stringstream<char> stringstream;
64
65typedef basic_filebuf<char> filebuf;
66typedef basic_ifstream<char> ifstream;
67typedef basic_ofstream<char> ofstream;
68typedef basic_fstream<char> fstream;
69
70typedef basic_streambuf<wchar_t> wstreambuf;
71typedef basic_istream<wchar_t> wistream;
72typedef basic_ostream<wchar_t> wostream;
73typedef basic_iostream<wchar_t> wiostream;
74
75typedef basic_stringbuf<wchar_t> wstringbuf;
76typedef basic_istringstream<wchar_t> wistringstream;
77typedef basic_ostringstream<wchar_t> wostringstream;
78typedef basic_stringstream<wchar_t> wstringstream;
79
80typedef basic_filebuf<wchar_t> wfilebuf;
81typedef basic_ifstream<wchar_t> wifstream;
82typedef basic_ofstream<wchar_t> wofstream;
83typedef basic_fstream<wchar_t> wfstream;
84
85template <class state> class fpos;
86using streampos = fpos<char_traits<char>::state_type>;
87using wstreampos = fpos<char_traits<wchar_t>::state_type>;
88using u8streampos = fpos<char_traits<char8_t>::state_type>; // C++20
89using u16streampos = fpos<char_traits<char16_t>::state_type>;
90using u32streampos = fpos<char_traits<char32_t>::state_type>;
91
92template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
93class basic_syncbuf; // C++20
94
95using syncbuf = basic_syncbuf<char>; // C++20
96using wsyncbuf = basic_syncbuf<wchar_t>; // C++20
97
98template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
99class basic_osyncstream; // C++20
100
101using osyncstream = basic_osyncstream<char>; // C++20
102using wosyncstream = basic_osyncstream<wchar_t>; // C++20
103
104} // std
105
106*/
107
108#include <__config>109#include <__fwd/fstream.h>110#include <__fwd/ios.h>111#include <__fwd/istream.h>112#include <__fwd/memory.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_header122#endif123
124_LIBCPP_BEGIN_NAMESPACE_STD
125
126template <class _CharT, class _Traits = char_traits<_CharT> >127class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;128template <class _CharT, class _Traits = char_traits<_CharT> >129class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;130
131template <class _State>132class _LIBCPP_TEMPLATE_VIS fpos;133typedef fpos<mbstate_t> streampos;134#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS135typedef fpos<mbstate_t> wstreampos;136#endif137#ifndef _LIBCPP_HAS_NO_CHAR8_T138typedef fpos<mbstate_t> u8streampos;139#endif140typedef fpos<mbstate_t> u16streampos;141typedef fpos<mbstate_t> u32streampos;142
143#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)144
145template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>146class basic_syncbuf;147
148using syncbuf = basic_syncbuf<char>;149# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS150using wsyncbuf = basic_syncbuf<wchar_t>;151# endif152
153template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>154class basic_osyncstream;155
156using osyncstream = basic_osyncstream<char>;157# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS158using wosyncstream = basic_osyncstream<wchar_t>;159# endif160
161#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)162
163template <class _CharT, class _Traits>164class __save_flags {165typedef basic_ios<_CharT, _Traits> __stream_type;166typedef typename __stream_type::fmtflags fmtflags;167
168__stream_type& __stream_;169fmtflags __fmtflags_;170_CharT __fill_;171
172public:173__save_flags(const __save_flags&) = delete;174__save_flags& operator=(const __save_flags&) = delete;175
176_LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)177: __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}178_LIBCPP_HIDE_FROM_ABI ~__save_flags() {179__stream_.flags(__fmtflags_);180__stream_.fill(__fill_);181}182};183
184_LIBCPP_END_NAMESPACE_STD
185
186#endif // _LIBCPP_IOSFWD187