// iosfwd standard header -- modified by Jim Fawcett for Demonstrations #ifndef _IOSFWD_ #define _IOSFWD_ #include #include #include #include _STD_BEGIN ////////////////////////////////////////////////////// // stuff removed here and from other places as well // ////////////////////////////////////////////////////// // _E is the character type, usually char or wchar_t template struct char_traits { typedef _E char_type; typedef _E int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void __cdecl assign(_E& _X, const _E& _Y) {_X = _Y; } static bool __cdecl eq(const _E& _X, const _E& _Y) {return (_X == _Y); } static bool __cdecl lt(const _E& _X, const _E& _Y) {return (_X < _Y); } //----< compare arrays of char_type >----------------------------------- static int __cdecl compare(const _E *_U, const _E *_V, size_t _N) { for (size_t _I = 0; _I < _N; ++_I, ++_U, ++_V) if (!eq(*_U, *_V)) return (lt(*_U, *_V) ? -1 : +1); return (0); } //----< return number of chars before terminator, e.g., _E(0) >--------- static size_t __cdecl length(const _E *_U) { size_t _N; for (_N = 0; !eq(*_U, _E(0)); ++_U) ++_N; return (_N); } //----< copy using the assign() member function >------------------------ static _E * __cdecl copy(_E *_U, const _E *_V, size_t _N) { _E *_S = _U; for (; 0 < _N; --_N, ++_U, ++_V) assign(*_U, *_V); return (_S); } //----< linear search for char using eq() member function >--------------- static const _E * __cdecl find(const _E *_U, size_t _N, const _E& _C) { for (; 0 < _N; --_N, ++_U) if (eq(*_U, _C)) return (_U); return (0); } //----< copy array, possibly into self >----------------------------------- static _E * __cdecl move(_E *_U, const _E *_V, size_t _N) { _E *_Ans = _U; if (_V < _U && _U < _V + _N) for (_U += _N, _V += _N; 0 < _N; --_N) assign(*--_U, *--_V); else for (; 0 < _N; --_N, ++_U, ++_V) assign(*_U, *_V); return (_Ans); } //----< assign a char to first _N locations >--------------------- static _E * __cdecl assign(_E *_U, size_t _N, const _E& _C) { _E *_Ans = _U; for (; 0 < _N; --_N, ++_U) assign(*_U, _C); return (_Ans); } //----< cast int_type to char_type >------------------------------- static _E __cdecl to_char_type(const int_type& _C) { return ((_E)_C); } //----< cast char_type to int_type >------------------------------- static int_type __cdecl to_int_type(const _E& _C) { return ((int_type)_C); } //----< are two int_types equal? >--------------------------------- static bool __cdecl eq_int_type(const int_type& _X, const int_type& _Y) { return (_X == _Y); } //----< return EOF int_type >--------------------------------------- static int_type __cdecl eof() { return (EOF); } //----< is this int_type != EOF? >---------------------------------- static int_type __cdecl not_eof(const int_type& _C) { return (_C != eof() ? _C : !eof()); } }; // STRUCT char_traits template<> struct _CRTIMP char_traits { typedef wchar_t _E; typedef _E 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(_E& _X, const _E& _Y) {_X = _Y; } static bool __cdecl eq(const _E& _X, const _E& _Y) {return (_X == _Y); } static bool __cdecl lt(const _E& _X, const _E& _Y) {return (_X < _Y); } static int __cdecl compare(const _E *_U, const _E *_V, size_t _N) {return (wmemcmp(_U, _V, _N)); } static size_t __cdecl length(const _E *_U) {return (wcslen(_U)); } static _E *__cdecl copy(_E *_U, const _E *_V, size_t _N) {return (wmemcpy(_U, _V, _N)); } static const _E * __cdecl find(const _E *_U, size_t _N, const _E& _C) {return ((const _E *)wmemchr(_U, _C, _N)); } static _E * __cdecl move(_E *_U, const _E *_V, size_t _N) {return (wmemmove(_U, _V, _N)); } static _E * __cdecl assign(_E *_U, size_t _N, const _E& _C) {return (wmemset(_U, _C, _N)); } static _E __cdecl to_char_type(const int_type& _C) {return ((_E)_C); } static int_type __cdecl to_int_type(const _E& _C) {return ((int_type)_C); } static bool __cdecl eq_int_type(const int_type& _X, const int_type& _Y) {return (_X == _Y); } static int_type __cdecl eof() {return (WEOF); } static int_type __cdecl not_eof(const int_type& _C) {return (_C != eof() ? _C : !eof()); } }; // STRUCT char_traits (FROM ) template<> struct _CRTIMP char_traits { typedef char _E; typedef _E char_type; typedef int int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void __cdecl assign(_E& _X, const _E& _Y) {_X = _Y; } static bool __cdecl eq(const _E& _X, const _E& _Y) {return (_X == _Y); } static bool __cdecl lt(const _E& _X, const _E& _Y) {return (_X < _Y); } static int __cdecl compare(const _E *_U, const _E *_V, size_t _N) {return (memcmp(_U, _V, _N)); } static size_t __cdecl length(const _E *_U) {return (strlen(_U)); } static _E * __cdecl copy(_E *_U, const _E *_V, size_t _N) {return ((_E *)memcpy(_U, _V, _N)); } static const _E * __cdecl find(const _E *_U, size_t _N, const _E& _C) {return ((const _E *)memchr(_U, _C, _N)); } static _E * __cdecl move(_E *_U, const _E *_V, size_t _N) {return ((_E *)memmove(_U, _V, _N)); } static _E * __cdecl assign(_E *_U, size_t _N, const _E& _C) {return ((_E *)memset(_U, _C, _N)); } static _E __cdecl to_char_type(const int_type& _C) {return ((_E)_C); } static int_type __cdecl to_int_type(const _E& _C) {return ((int_type)((unsigned char)_C)); } static bool __cdecl eq_int_type(const int_type& _X, const int_type& _Y) {return (_X == _Y); } static int_type __cdecl eof() {return (EOF); } static int_type __cdecl not_eof(const int_type& _C) {return (_C != eof() ? _C : !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 _A = allocator<_E> > class basic_stringbuf; template, class _A = allocator<_E> > class basic_istringstream; template, class _A = allocator<_E> > class basic_ostringstream; template, class _A = allocator<_E> > class basic_stringstream; template > class basic_filebuf; template > class basic_ifstream; template > class basic_ofstream; template > class basic_fstream; // 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; // wchar_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; _STD_END /* * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED. * Consult your license regarding permissions and restrictions. */