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