home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / stl / _string_io.h < prev    next >
C/C++ Source or Header  |  2001-06-28  |  4KB  |  123 lines

  1. /*
  2.  * Copyright (c) 1997-1999
  3.  * Silicon Graphics Computer Systems, Inc.
  4.  *
  5.  * Copyright (c) 1999 
  6.  * Boris Fomitchev
  7.  *
  8.  * This material is provided "as is", with absolutely no warranty expressed
  9.  * or implied. Any use is at your own risk.
  10.  *
  11.  * Permission to use or copy this software for any purpose is hereby granted 
  12.  * without fee, provided the above notices are retained on all copies.
  13.  * Permission to modify the code and to distribute modified code is granted,
  14.  * provided the above notices are retained, and a notice that the code was
  15.  * modified is included with the above copyright notice.
  16.  *
  17.  */
  18.  
  19. #ifndef _STLP_STRING_IO_H
  20. #define _STLP_STRING_IO_H
  21.  
  22. // this is for link-time instantiation
  23. #if !defined  ( _STLP_STRING )
  24. # include <string>
  25. # endif
  26.  
  27. //#ifndef _STLP_LOCALE
  28. //# include <locale>
  29. //#endif
  30.  
  31. # ifdef _STLP_DEBUG
  32. #  define basic_string _Nondebug_string
  33. # endif
  34.  
  35. // I/O.  
  36. _STLP_BEGIN_NAMESPACE
  37.  
  38. #if defined (_STLP_USE_NEW_IOSTREAMS)
  39.  
  40. template <class _CharT, class _Traits, class _Alloc>
  41. basic_ostream<_CharT, _Traits>& _STLP_CALL
  42. operator<<(basic_ostream<_CharT, _Traits>& __os, 
  43.            const basic_string<_CharT,_Traits,_Alloc>& __s);
  44.  
  45. template <class _CharT, class _Traits, class _Alloc>
  46. basic_istream<_CharT, _Traits>&  _STLP_CALL
  47. operator>>(basic_istream<_CharT, _Traits>& __is,
  48.            basic_string<_CharT,_Traits,_Alloc>& __s);
  49.  
  50. template <class _CharT, class _Traits, class _Alloc>    
  51. basic_istream<_CharT, _Traits>& _STLP_CALL 
  52. getline(basic_istream<_CharT, _Traits>& __is,
  53.         basic_string<_CharT,_Traits,_Alloc>& __s,
  54.         _CharT __delim);
  55.  
  56. # if !(defined (__BORLANDC__) && ! defined (_STLP_USE_OWN_NAMESPACE))
  57.  
  58. template <class _CharT, class _Traits, class _Alloc>    
  59. inline basic_istream<_CharT, _Traits>& _STLP_CALL 
  60. getline(basic_istream<_CharT, _Traits>& __is,
  61.         basic_string<_CharT,_Traits,_Alloc>& __s)
  62. {
  63.   return getline(__is, __s, __is.widen('\n'));
  64. }
  65. # endif
  66.  
  67. template <class _CharT, class _Traits>
  68. bool _STLP_CALL
  69. __stlp_string_fill(basic_ostream<_CharT, _Traits>& __os,
  70.                   basic_streambuf<_CharT, _Traits>* __buf,
  71.                   size_t __n);
  72. #elif ! defined ( _STLP_USE_NO_IOSTREAMS )
  73.  
  74. // (reg) For Watcom IO, this tells if ostream class is in .exe or in .dll
  75. # ifdef _WPRTLINK
  76. typedef _WPRTLINK ostream _OSTREAM_DLL;
  77. typedef _WPRTLINK istream _ISTREAM_DLL;
  78. #else
  79. typedef           ostream _OSTREAM_DLL;
  80. typedef           istream _ISTREAM_DLL;
  81. #endif
  82.  
  83. template <class _CharT, class _Traits, class _Alloc>
  84. _OSTREAM_DLL& _STLP_CALL operator<<(_OSTREAM_DLL& __os, 
  85.                     const basic_string<_CharT,_Traits,_Alloc>& __s);
  86.  
  87. template <class _CharT, class _Traits, class _Alloc>
  88. _ISTREAM_DLL& _STLP_CALL operator>>(_ISTREAM_DLL& __is, basic_string<_CharT,_Traits,_Alloc>& __s);
  89.  
  90. template <class _CharT, class _Traits, class _Alloc>    
  91. _ISTREAM_DLL& _STLP_CALL getline(_ISTREAM_DLL& __is,
  92.                  basic_string<_CharT,_Traits,_Alloc>& __s,
  93.                  _CharT __delim);
  94.  
  95.  
  96. template <class _CharT, class _Traits, class _Alloc>    
  97. inline _ISTREAM_DLL& _STLP_CALL 
  98. getline(_ISTREAM_DLL& __is, basic_string<_CharT,_Traits,_Alloc>& __s)
  99. {
  100.   return getline(__is, __s, '\n');
  101. }
  102.  
  103. inline void  _STLP_CALL
  104. __stlp_string_fill(_OSTREAM_DLL& __os, streambuf* __buf, size_t __n)
  105. {
  106.   char __f = __os.fill();
  107.   size_t __i;
  108.  
  109.   for (__i = 0; __i < __n; ++__i) __buf->sputc(__f);
  110. }
  111.  
  112. #endif /* _STLP_USE_NEW_IOSTREAMS */
  113.  
  114. _STLP_END_NAMESPACE
  115.  
  116. # undef basic_string
  117.  
  118. # if !defined (_STLP_LINK_TIME_INSTANTIATION)
  119. #  include <stl/_string_io.c>
  120. # endif
  121.  
  122. #endif /* _STLP_STRING_IO_H */
  123.