// iosfwd standard header #pragma once #ifndef _IOSFWD_ #define _IOSFWD_ #include #include #include #include #pragma pack(push,8) #pragma warning(push,3) _STD_BEGIN // STREAM POSITIONING TYPES (from ) #ifdef _WIN64 typedef __int64 streamoff; typedef __int64 streamsize; #else typedef long streamoff; typedef int streamsize; #endif extern _CRTIMP2 fpos_t _Fpz; extern _CRTIMP2 const streamoff _BADOFF; // TEMPLATE CLASS fpos (from ) template class fpos { // store arbitrary file position typedef fpos<_Statetype> _Myt; public: fpos(streamoff _Off = 0) : _Myoff(_Off), _Fpos(_Fpz), _Mystate(_Stz) { // construct with stream offset } fpos(_Statetype _State, fpos_t _Fileposition) : _Myoff(0), _Fpos(_Fileposition), _Mystate(_State) { // construct with conversion state and C file position } _Statetype state() const { // return conversion state return (_Mystate); } void state(_Statetype _State) { // set conversion state _Mystate = _State; } fpos_t seekpos() const { // return C file position return (_Fpos); } operator streamoff() const { // return offset return (_Myoff + _FPOSOFF(_Fpos)); } streamoff operator-(const _Myt& _Right) const { // return difference of file positions as an offset return ((streamoff)*this - (streamoff)_Right); } _Myt& operator+=(streamoff _Off) { // add offset _Myoff += _Off; return (*this); } _Myt& operator-=(streamoff _Off) { // subtract offset _Myoff -= _Off; return (*this); } _Myt operator+(streamoff _Off) const { // return this + offset _Myt _Tmp = *this; return (_Tmp += _Off); } _Myt operator-(streamoff _Off) const { // return this - offset _Myt _Tmp = *this; return (_Tmp -= _Off); } bool operator==(const _Myt& _Right) const { // test for file position equality return ((streamoff)*this == (streamoff)_Right); } bool operator!=(const _Myt& _Right) const { // test for file position inequality return (!(*this == _Right)); } private: static _Statetype _Stz; // initial conversion state streamoff _Myoff; // stream offset fpos_t _Fpos; // C file position _Statetype _Mystate; // current conversion state }; // STATIC fpos::_Stz OBJECT template _Statetype fpos<_Statetype>::_Stz; typedef fpos streampos; typedef streampos wstreampos; // TEMPLATE STRUCT char_traits (FROM ) template struct char_traits { // properties of a string or stream element typedef _Elem char_type; typedef _Elem int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void __cdecl assign(_Elem& _Left, const _Elem& _Right) { // assign an element _Left = _Right; } static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right) { // test for element equality return (_Left == _Right); } static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right) { // test if _Left precedes _Right return (_Left < _Right); } static int __cdecl compare(const _Elem *_First1, const _Elem *_First2, size_t _Count) { // compare [_First1, _First1 + _Count) with [_First2, ...) for (; 0 < _Count; --_Count, ++_First1, ++_First2) if (!eq(*_First1, *_First2)) return (lt(*_First1, *_First2) ? -1 : +1); return (0); } static size_t __cdecl length(const _Elem *_First) { // find length of null-terminated sequence size_t _Count; for (_Count = 0; !eq(*_First, _Elem()); ++_First) ++_Count; return (_Count); } static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First1, _First1 + _Count) to [_First2, ...) _Elem *_Next = _First1; for (; 0 < _Count; --_Count, ++_Next, ++_First2) assign(*_Next, *_First2); return (_First1); } static const _Elem *__cdecl find(const _Elem *_First, size_t _Count, const _Elem& _Ch) { // look for _Ch in [_First, _First + _Count) for (; 0 < _Count; --_Count, ++_First) if (eq(*_First, _Ch)) return (_First); return (0); } static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First1, _First1 + _Count) to [_First2, ...) _Elem *_Next = _First1; if (_First2 < _Next && _Next < _First2 + _Count) for (_Next += _Count, _First2 += _Count; 0 < _Count; --_Count) assign(*--_Next, *--_First2); else for (; 0 < _Count; --_Count, ++_Next, ++_First2) assign(*_Next, *_First2); return (_First1); } static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch) { // assign _Count * _Ch to [_First, ...) _Elem *_Next = _First; for (; 0 < _Count; --_Count, ++_Next) assign(*_Next, _Ch); return (_First); } static _Elem __cdecl to_char_type(const int_type& _Meta) { // convert metacharacter to character return (_Meta); } static int_type __cdecl to_int_type(const _Elem& _Ch) { // convert character to metacharacter return (_Ch); } static bool __cdecl eq_int_type(const int_type& _Left, const int_type& _Right) { // test for metacharacter equality return (_Left == _Right); } static int_type __cdecl eof() { // return end-of-file metacharacter return ((int_type)EOF); } static int_type __cdecl not_eof(const int_type& _Meta) { // return anything but EOF return (_Meta != eof() ? _Meta : !eof()); } }; // STRUCT char_traits template<> struct _CRTIMP2 char_traits { // properties of a string or stream wchar_t element typedef wchar_t _Elem; typedef _Elem char_type; // for overloads typedef wint_t int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void __cdecl assign(_Elem& _Left, const _Elem& _Right) { // assign an element _Left = _Right; } static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right) { // test for element equality return (_Left == _Right); } static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right) { // test if _Left precedes _Right return (_Left < _Right); } static int __cdecl compare(const _Elem *_First1, const _Elem *_First2, size_t _Count) { // compare [_First1, _First1 + _Count) with [_First2, ...) return (::wmemcmp(_First1, _First2, _Count)); } static size_t __cdecl length(const _Elem *_First) { // find length of null-terminated sequence return (::wcslen(_First)); } static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First1, _First1 + _Count) to [_First2, ...) return (::wmemcpy(_First1, _First2, _Count)); } static const _Elem *__cdecl find(const _Elem *_First, size_t _Count, const _Elem& _Ch) { // look for _Ch in [_First, _First + _Count) return ((const _Elem *)::wmemchr(_First, _Ch, _Count)); } static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First1, _First1 + _Count) to [_First2, ...) return (::wmemmove(_First1, _First2, _Count)); } static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch) { // assign _Count * _Ch to [_First, ...) return (::wmemset(_First, _Ch, _Count)); } static _Elem __cdecl to_char_type(const int_type& _Meta) { // convert metacharacter to character return (_Meta); } static int_type __cdecl to_int_type(const _Elem& _Ch) { // convert character to metacharacter return (_Ch); } static bool __cdecl eq_int_type(const int_type& _Left, const int_type& _Right) { // test for metacharacter equality return (_Left == _Right); } static int_type __cdecl eof() { // return end-of-file metacharacter return (WEOF); } static int_type __cdecl not_eof(const int_type& _Meta) { // return anything but EOF return (_Meta != eof() ? _Meta : !eof()); } }; // STRUCT char_traits (FROM ) template<> struct _CRTIMP2 char_traits { // properties of a string or stream char element typedef char _Elem; typedef _Elem char_type; typedef int int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void __cdecl assign(_Elem& _Left, const _Elem& _Right) { // assign an element _Left = _Right; } static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right) { // test for element equality return (_Left == _Right); } static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right) { // test if _Left precedes _Right return (_Left < _Right); } static int __cdecl compare(const _Elem *_First1, const _Elem *_First2, size_t _Count) { // compare [_First1, _First1 + _Count) with [_First2, ...) return (::memcmp(_First1, _First2, _Count)); } static size_t __cdecl length(const _Elem *_First) { // find length of null-terminated string return (::strlen(_First)); } static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First1, _First1 + _Count) to [_First2, ...) return ((_Elem *)::memcpy(_First1, _First2, _Count)); } static const _Elem *__cdecl find(const _Elem *_First, size_t _Count, const _Elem& _Ch) { // look for _Ch in [_First, _First + _Count) return ((const _Elem *)::memchr(_First, _Ch, _Count)); } static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First1, _First1 + _Count) to [_First2, ...) return ((_Elem *)::memmove(_First1, _First2, _Count)); } static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch) { // assign _Count * _Ch to [_First, ...) return ((_Elem *)::memset(_First, _Ch, _Count)); } static _Elem __cdecl to_char_type(const int_type& _Meta) { // convert metacharacter to character return ((_Elem)_Meta); } static int_type __cdecl to_int_type(const _Elem& _Ch) { // convert character to metacharacter return ((unsigned char)_Ch); } static bool __cdecl eq_int_type(const int_type& _Left, const int_type& _Right) { // test for metacharacter equality return (_Left == _Right); } static int_type __cdecl eof() { // return end-of-file metacharacter return (EOF); } static int_type __cdecl not_eof(const int_type& _Meta) { // return anything but EOF return (_Meta != eof() ? _Meta : !eof()); } }; // FORWARD REFERENCES template class allocator; class ios_base; template > class basic_ios; template > class istreambuf_iterator; template > class ostreambuf_iterator; template > class basic_streambuf; template > class basic_istream; template > class basic_ostream; 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; #ifdef _DLL_CPPLIB template class num_get; template class num_put; template class collate; #endif // _DLL_CPPLIB // char TYPEDEFS typedef basic_ios > ios; typedef basic_streambuf > streambuf; typedef basic_istream > istream; typedef basic_ostream > ostream; typedef basic_iostream > iostream; typedef basic_stringbuf, allocator > stringbuf; typedef basic_istringstream, allocator > istringstream; typedef basic_ostringstream, allocator > ostringstream; typedef basic_stringstream, allocator > stringstream; typedef basic_filebuf > filebuf; typedef basic_ifstream > ifstream; typedef basic_ofstream > ofstream; typedef basic_fstream > fstream; // wchat_t TYPEDEFS typedef basic_ios > wios; typedef basic_streambuf > wstreambuf; typedef basic_istream > wistream; typedef basic_ostream > wostream; typedef basic_iostream > wiostream; typedef basic_stringbuf, allocator > wstringbuf; typedef basic_istringstream, allocator > wistringstream; typedef basic_ostringstream, allocator > wostringstream; typedef basic_stringstream, allocator > wstringstream; typedef basic_filebuf > wfilebuf; typedef basic_ifstream > wifstream; typedef basic_ofstream > wofstream; typedef basic_fstream > wfstream; #ifdef _DLL_CPPLIB typedef num_get > > numget; typedef num_get > > wnumget; typedef num_put > > numput; typedef num_put > > wnumput; typedef collate ncollate; typedef collate wcollate; #endif // _DLL_CPPLIB _STD_END #pragma warning(pop) #pragma pack(pop) #endif /* _IOSFWD_ */ /* * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED. * Consult your license regarding permissions and restrictions. V3.10:0009 */