-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathiosfwd
288 lines (249 loc) · 10.1 KB
/
iosfwd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
// iosfwd standard header
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#pragma once
#ifndef _IOSFWD_
#define _IOSFWD_
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#include <cstdio>
#include <cstring>
#include <cwchar>
#include <xstddef>
#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
_STD_BEGIN
#if _HAS_EXCEPTIONS
#define _TRY_IO_BEGIN _TRY_BEGIN // begin try block
#define _CATCH_IO_END \
_CATCH_ALL /* catch block for _Myios */ \
_Myios::setstate(ios_base::badbit, true); /* set badbit and rethrow */ \
_CATCH_END
#define _CATCH_IO_(xtype, x) \
_CATCH_ALL /* catch block for basic_ios x */ \
(x) \
.setstate(xtype::badbit, true); /* set badbit and rethrow */ \
_CATCH_END
#else // _HAS_EXCEPTIONS
#define _TRY_IO_BEGIN { // begin try block
#define _CATCH_IO_END } // catch block for _Myios
#define _CATCH_IO_(xtype, x) } // catch block for basic_ios x
#endif // _HAS_EXCEPTIONS
// from <streambuf>
using streamoff = long long;
using streamsize = long long;
template <class _Statetype>
class fpos { // store arbitrary file position
public:
/* implicit */ fpos(streamoff _Off = 0) : _Myoff(_Off), _Fpos(0), _Mystate() {}
fpos(_Statetype _State, fpos_t _Fileposition) : _Myoff(_Fileposition), _Fpos(0), _Mystate(_State) {}
_NODISCARD _Statetype state() const {
return _Mystate;
}
void state(_Statetype _State) {
_Mystate = _State;
}
operator streamoff() const {
// TRANSITION, ABI: We currently always set _Fpos to 0 but older .objs containing old
// basic_filebuf would set _Fpos.
return _Myoff + _Fpos;
}
#ifndef _REMOVE_FPOS_SEEKPOS
_DEPRECATE_FPOS_SEEKPOS fpos_t seekpos() const noexcept {
return {};
}
#endif // _REMOVE_FPOS_SEEKPOS
_NODISCARD streamoff operator-(const fpos& _Right) const {
return static_cast<streamoff>(*this) - static_cast<streamoff>(_Right);
}
fpos& operator+=(streamoff _Off) { // add offset
_Myoff += _Off;
return *this;
}
fpos& operator-=(streamoff _Off) { // subtract offset
_Myoff -= _Off;
return *this;
}
_NODISCARD fpos operator+(streamoff _Off) const {
fpos _Tmp = *this;
_Tmp += _Off;
return _Tmp;
}
_NODISCARD fpos operator-(streamoff _Off) const {
fpos _Tmp = *this;
_Tmp -= _Off;
return _Tmp;
}
_NODISCARD bool operator==(const fpos& _Right) const {
return static_cast<streamoff>(*this) == static_cast<streamoff>(_Right);
}
template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0>
_NODISCARD_FRIEND bool operator==(const fpos& _Left, const _Int _Right) {
return static_cast<streamoff>(_Left) == _Right;
}
template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0>
_NODISCARD_FRIEND bool operator==(const _Int _Left, const fpos& _Right) {
return _Left == static_cast<streamoff>(_Right);
}
_NODISCARD bool operator!=(const fpos& _Right) const {
return static_cast<streamoff>(*this) != static_cast<streamoff>(_Right);
}
template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0>
_NODISCARD_FRIEND bool operator!=(const fpos& _Left, const _Int _Right) {
return static_cast<streamoff>(_Left) != _Right;
}
template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0>
_NODISCARD_FRIEND bool operator!=(const _Int _Left, const fpos& _Right) {
return _Left != static_cast<streamoff>(_Right);
}
private:
streamoff _Myoff; // stream offset
fpos_t _Fpos; // TRANSITION, ABI. C file position, not currently used
_Statetype _Mystate; // current conversion state
};
using streampos = fpos<_Mbstatet>;
using wstreampos = streampos;
#ifdef __cpp_lib_char8_t
using u8streampos = streampos;
#endif // __cpp_lib_char8_t
using u16streampos = streampos;
using u32streampos = streampos;
class locale;
template <class _Facet>
const _Facet& __CRTDECL use_facet(const locale&);
template <class _Elem>
struct char_traits;
template <>
struct char_traits<char>;
#ifdef __cpp_char8_t
template <>
struct char_traits<char8_t>;
#endif // __cpp_char8_t
template <>
struct char_traits<char16_t>;
template <>
struct char_traits<char32_t>;
template <>
struct char_traits<wchar_t>;
#ifdef _CRTBLD
template <>
struct char_traits<unsigned short>;
#endif // _CRTBLD
template <class _Ty>
class allocator;
class ios_base;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_ios;
template <class _Elem, class _Traits = char_traits<_Elem>>
class istreambuf_iterator;
template <class _Elem, class _Traits = char_traits<_Elem>>
class ostreambuf_iterator;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_streambuf;
#pragma vtordisp(push, 2) // compiler bug workaround
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_istream;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_ostream;
#pragma vtordisp(pop) // compiler bug workaround
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_iostream;
template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>>
class basic_stringbuf;
template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>>
class basic_istringstream;
template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>>
class basic_ostringstream;
template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>>
class basic_stringstream;
#if _HAS_CXX23
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_spanbuf;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_ispanstream;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_ospanstream;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_spanstream;
#endif // _HAS_CXX23
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_filebuf;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_ifstream;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_ofstream;
template <class _Elem, class _Traits = char_traits<_Elem>>
class basic_fstream;
#if _HAS_CXX20
template <class _Elem, class _Traits = char_traits<_Elem>>
class _Basic_syncbuf_impl;
template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>>
class basic_syncbuf;
template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>>
class basic_osyncstream;
#endif // _HAS_CXX20
#if defined(_DLL_CPPLIB)
template <class _Elem, class _InIt>
class num_get;
template <class _Elem, class _OutIt>
class num_put;
template <class _Elem>
class collate;
#endif // defined(_DLL_CPPLIB)
using ios = basic_ios<char, char_traits<char>>;
using streambuf = basic_streambuf<char, char_traits<char>>;
using istream = basic_istream<char, char_traits<char>>;
using ostream = basic_ostream<char, char_traits<char>>;
using iostream = basic_iostream<char, char_traits<char>>;
using stringbuf = basic_stringbuf<char, char_traits<char>, allocator<char>>;
using istringstream = basic_istringstream<char, char_traits<char>, allocator<char>>;
using ostringstream = basic_ostringstream<char, char_traits<char>, allocator<char>>;
using stringstream = basic_stringstream<char, char_traits<char>, allocator<char>>;
using filebuf = basic_filebuf<char, char_traits<char>>;
using ifstream = basic_ifstream<char, char_traits<char>>;
using ofstream = basic_ofstream<char, char_traits<char>>;
using fstream = basic_fstream<char, char_traits<char>>;
#if _HAS_CXX20
using syncbuf = basic_syncbuf<char>;
using osyncstream = basic_osyncstream<char>;
#endif // _HAS_CXX20
#if _HAS_CXX23
using spanbuf = basic_spanbuf<char>;
using ispanstream = basic_ispanstream<char>;
using ospanstream = basic_ospanstream<char>;
using spanstream = basic_spanstream<char>;
#endif // _HAS_CXX23
using wios = basic_ios<wchar_t, char_traits<wchar_t>>;
using wstreambuf = basic_streambuf<wchar_t, char_traits<wchar_t>>;
using wistream = basic_istream<wchar_t, char_traits<wchar_t>>;
using wostream = basic_ostream<wchar_t, char_traits<wchar_t>>;
using wiostream = basic_iostream<wchar_t, char_traits<wchar_t>>;
using wstringbuf = basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>;
using wistringstream = basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>;
using wostringstream = basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>;
using wstringstream = basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>;
using wfilebuf = basic_filebuf<wchar_t, char_traits<wchar_t>>;
using wifstream = basic_ifstream<wchar_t, char_traits<wchar_t>>;
using wofstream = basic_ofstream<wchar_t, char_traits<wchar_t>>;
using wfstream = basic_fstream<wchar_t, char_traits<wchar_t>>;
#if _HAS_CXX20
using wsyncbuf = basic_syncbuf<wchar_t>;
using wosyncstream = basic_osyncstream<wchar_t>;
#endif // _HAS_CXX20
#if _HAS_CXX23
using wspanbuf = basic_spanbuf<wchar_t>;
using wispanstream = basic_ispanstream<wchar_t>;
using wospanstream = basic_ospanstream<wchar_t>;
using wspanstream = basic_spanstream<wchar_t>;
#endif // _HAS_CXX23
_STD_END
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _IOSFWD_