williamr@4: /* williamr@4: * Copyright (c) 1997-1999 williamr@4: * Silicon Graphics Computer Systems, Inc. williamr@4: * williamr@4: * Copyright (c) 1999 williamr@4: * Boris Fomitchev williamr@4: * williamr@4: * This material is provided "as is", with absolutely no warranty expressed williamr@4: * or implied. Any use is at your own risk. williamr@4: * williamr@4: * Permission to use or copy this software for any purpose is hereby granted williamr@4: * without fee, provided the above notices are retained on all copies. williamr@4: * Permission to modify the code and to distribute modified code is granted, williamr@4: * provided the above notices are retained, and a notice that the code was williamr@4: * modified is included with the above copyright notice. williamr@4: * williamr@4: */ williamr@4: williamr@4: #ifndef _STLP_STRING_IO_H williamr@4: #define _STLP_STRING_IO_H williamr@4: williamr@4: // this is for link-time instantiation williamr@4: #if !defined ( _STLP_STRING ) williamr@4: # include williamr@4: # endif williamr@4: williamr@4: //#ifndef _STLP_LOCALE williamr@4: //# include williamr@4: //#endif williamr@4: williamr@4: # ifdef _STLP_DEBUG williamr@4: # define basic_string _Nondebug_string williamr@4: # endif williamr@4: williamr@4: // I/O. williamr@4: _STLP_BEGIN_NAMESPACE williamr@4: williamr@4: #if defined (_STLP_USE_NEW_IOSTREAMS) williamr@4: williamr@4: template williamr@4: basic_ostream<_CharT, _Traits>& _STLP_CALL williamr@4: operator<<(basic_ostream<_CharT, _Traits>& __os, williamr@4: const basic_string<_CharT,_Traits,_Alloc>& __s); williamr@4: williamr@4: template williamr@4: basic_istream<_CharT, _Traits>& _STLP_CALL williamr@4: operator>>(basic_istream<_CharT, _Traits>& __is, williamr@4: basic_string<_CharT,_Traits,_Alloc>& __s); williamr@4: williamr@4: template williamr@4: basic_istream<_CharT, _Traits>& _STLP_CALL williamr@4: getline(basic_istream<_CharT, _Traits>& __is, williamr@4: basic_string<_CharT,_Traits,_Alloc>& __s, williamr@4: _CharT __delim); williamr@4: williamr@4: # if !(defined (__BORLANDC__) && ! defined (_STLP_USE_OWN_NAMESPACE)) williamr@4: williamr@4: template williamr@4: inline basic_istream<_CharT, _Traits>& _STLP_CALL williamr@4: getline(basic_istream<_CharT, _Traits>& __is, williamr@4: basic_string<_CharT,_Traits,_Alloc>& __s) williamr@4: { williamr@4: return getline(__is, __s, __is.widen('\n')); williamr@4: } williamr@4: # endif williamr@4: williamr@4: template williamr@4: bool _STLP_CALL williamr@4: __stlp_string_fill(basic_ostream<_CharT, _Traits>& __os, williamr@4: basic_streambuf<_CharT, _Traits>* __buf, williamr@4: size_t __n); williamr@4: #elif ! defined ( _STLP_USE_NO_IOSTREAMS ) williamr@4: williamr@4: // (reg) For Watcom IO, this tells if ostream class is in .exe or in .dll williamr@4: # ifdef _WPRTLINK williamr@4: typedef _WPRTLINK ostream _OSTREAM_DLL; williamr@4: typedef _WPRTLINK istream _ISTREAM_DLL; williamr@4: #else williamr@4: typedef ostream _OSTREAM_DLL; williamr@4: typedef istream _ISTREAM_DLL; williamr@4: #endif williamr@4: williamr@4: template williamr@4: _OSTREAM_DLL& _STLP_CALL operator<<(_OSTREAM_DLL& __os, williamr@4: const basic_string<_CharT,_Traits,_Alloc>& __s); williamr@4: williamr@4: template williamr@4: _ISTREAM_DLL& _STLP_CALL operator>>(_ISTREAM_DLL& __is, basic_string<_CharT,_Traits,_Alloc>& __s); williamr@4: williamr@4: template williamr@4: _ISTREAM_DLL& _STLP_CALL getline(_ISTREAM_DLL& __is, williamr@4: basic_string<_CharT,_Traits,_Alloc>& __s, williamr@4: _CharT __delim); williamr@4: williamr@4: williamr@4: template williamr@4: inline _ISTREAM_DLL& _STLP_CALL williamr@4: getline(_ISTREAM_DLL& __is, basic_string<_CharT,_Traits,_Alloc>& __s) williamr@4: { williamr@4: return getline(__is, __s, '\n'); williamr@4: } williamr@4: williamr@4: inline void _STLP_CALL williamr@4: __stlp_string_fill(_OSTREAM_DLL& __os, streambuf* __buf, size_t __n) williamr@4: { williamr@4: char __f = __os.fill(); williamr@4: size_t __i; williamr@4: williamr@4: for (__i = 0; __i < __n; ++__i) __buf->sputc(__f); williamr@4: } williamr@4: williamr@4: #endif /* _STLP_USE_NEW_IOSTREAMS */ williamr@4: williamr@4: _STLP_END_NAMESPACE williamr@4: williamr@4: # undef basic_string williamr@4: williamr@4: # if !defined (_STLP_LINK_TIME_INSTANTIATION) williamr@4: # include williamr@4: # endif williamr@4: williamr@4: #endif /* _STLP_STRING_IO_H */