// iosfwd standard header // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #pragma once #ifndef _IOSFWD_ #define _IOSFWD_ #include #if _STL_COMPILER_PREPROCESSOR #include #include #include #include #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 // I/O EXCEPTION MACROS #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 // STREAM POSITIONING TYPES (from ) using streamoff = long long; using streamsize = long long; // CLASS TEMPLATE fpos (from ) template 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(*this) - static_cast(_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(*this) == static_cast(_Right); } template , int> = 0> _NODISCARD friend bool operator==(const fpos& _Left, const _Int _Right) { return static_cast(_Left) == _Right; } template , int> = 0> _NODISCARD friend bool operator==(const _Int _Left, const fpos& _Right) { return _Left == static_cast(_Right); } _NODISCARD bool operator!=(const fpos& _Right) const { return static_cast(*this) != static_cast(_Right); } template , int> = 0> _NODISCARD friend bool operator!=(const fpos& _Left, const _Int _Right) { return static_cast(_Left) != _Right; } template , int> = 0> _NODISCARD friend bool operator!=(const _Int _Left, const fpos& _Right) { return _Left != static_cast(_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; // FORWARD REFERENCES class locale; template const _Facet& __CRTDECL use_facet(const locale&); template struct char_traits; template <> struct char_traits; #ifdef __cpp_char8_t template <> struct char_traits; #endif // __cpp_char8_t template <> struct char_traits; template <> struct char_traits; template <> struct char_traits; #ifdef _NATIVE_WCHAR_T_DEFINED template <> struct char_traits; #endif // _NATIVE_WCHAR_T_DEFINED template class allocator; class ios_base; template > class basic_ios; template > class istreambuf_iterator; template > class ostreambuf_iterator; template > class basic_streambuf; #pragma vtordisp(push, 2) // compiler bug workaround template > class basic_istream; template > class basic_ostream; #pragma vtordisp(pop) // compiler bug workaround template > class basic_iostream; template , class _Alloc = allocator<_Elem>> class basic_stringbuf; template , class _Alloc = allocator<_Elem>> class basic_istringstream; template , class _Alloc = allocator<_Elem>> class basic_ostringstream; template , class _Alloc = allocator<_Elem>> class basic_stringstream; template > class basic_filebuf; template > class basic_ifstream; template > class basic_ofstream; template > class basic_fstream; #if defined(_DLL_CPPLIB) template class num_get; template class num_put; template class collate; #endif // defined(_DLL_CPPLIB) // char TYPEDEFS using ios = basic_ios>; using streambuf = basic_streambuf>; using istream = basic_istream>; using ostream = basic_ostream>; using iostream = basic_iostream>; using stringbuf = basic_stringbuf, allocator>; using istringstream = basic_istringstream, allocator>; using ostringstream = basic_ostringstream, allocator>; using stringstream = basic_stringstream, allocator>; using filebuf = basic_filebuf>; using ifstream = basic_ifstream>; using ofstream = basic_ofstream>; using fstream = basic_fstream>; // wchar_t TYPEDEFS using wios = basic_ios>; using wstreambuf = basic_streambuf>; using wistream = basic_istream>; using wostream = basic_ostream>; using wiostream = basic_iostream>; using wstringbuf = basic_stringbuf, allocator>; using wistringstream = basic_istringstream, allocator>; using wostringstream = basic_ostringstream, allocator>; using wstringstream = basic_stringstream, allocator>; using wfilebuf = basic_filebuf>; using wifstream = basic_ifstream>; using wofstream = basic_ofstream>; using wfstream = basic_fstream>; #if defined(_CRTBLD) // unsigned short TYPEDEFS using ushistream = basic_istream>; using ushostream = basic_ostream>; using ushfilebuf = basic_filebuf>; #endif // defined(_CRTBLD) _STD_END #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) #endif // _STL_COMPILER_PREPROCESSOR #endif // _IOSFWD_