]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/libcxx/include/iosfwd
Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
[FreeBSD/FreeBSD.git] / contrib / llvm-project / libcxx / include / iosfwd
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 class ios_base;
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 using streampos  = fpos<char_traits<char>::state_type>;
88 using wstreampos = fpos<char_traits<wchar_t>::state_type>;
89 using u8streampos = fpos<char_traits<char8_t>::state_type>; // C++20
90 using u16streampos = fpos<char_traits<char16_t>::state_type>;
91 using u32streampos = fpos<char_traits<char32_t>::state_type>;
92
93 }  // std
94
95 */
96
97 #include <__assert> // all public C++ headers provide the assertion handler
98 #include <__config>
99 #include <__fwd/fstream.h>
100 #include <__fwd/ios.h>
101 #include <__fwd/istream.h>
102 #include <__fwd/ostream.h>
103 #include <__fwd/sstream.h>
104 #include <__fwd/streambuf.h>
105 #include <__fwd/string.h>
106 #include <__std_mbstate_t.h>
107 #include <version>
108
109 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
110 #  pragma GCC system_header
111 #endif
112
113 _LIBCPP_BEGIN_NAMESPACE_STD
114
115 class _LIBCPP_EXPORTED_FROM_ABI ios_base;
116
117 template <class _CharT, class _Traits = char_traits<_CharT> >
118     class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
119 template <class _CharT, class _Traits = char_traits<_CharT> >
120     class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
121
122 template <class _State>             class _LIBCPP_TEMPLATE_VIS fpos;
123 typedef fpos<mbstate_t>    streampos;
124 typedef fpos<mbstate_t>    wstreampos;
125 #ifndef _LIBCPP_HAS_NO_CHAR8_T
126 typedef fpos<mbstate_t>    u8streampos;
127 #endif
128 typedef fpos<mbstate_t>    u16streampos;
129 typedef fpos<mbstate_t>    u32streampos;
130
131 // Include other forward declarations here
132 template <class _Tp, class _Alloc = allocator<_Tp> >
133 class _LIBCPP_TEMPLATE_VIS vector;
134
135 template <class _CharT, class _Traits>
136 class __save_flags
137 {
138     typedef basic_ios<_CharT, _Traits> __stream_type;
139     typedef typename __stream_type::fmtflags fmtflags;
140
141     __stream_type& __stream_;
142     fmtflags       __fmtflags_;
143     _CharT         __fill_;
144
145     __save_flags(const __save_flags&);
146     __save_flags& operator=(const __save_flags&);
147 public:
148     _LIBCPP_INLINE_VISIBILITY
149     explicit __save_flags(__stream_type& __stream)
150         : __stream_(__stream),
151           __fmtflags_(__stream.flags()),
152           __fill_(__stream.fill())
153         {}
154     _LIBCPP_INLINE_VISIBILITY
155     ~__save_flags()
156     {
157         __stream_.flags(__fmtflags_);
158         __stream_.fill(__fill_);
159     }
160 };
161
162 _LIBCPP_END_NAMESPACE_STD
163
164 #endif // _LIBCPP_IOSFWD