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