williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
|
williamr@2
|
3 |
* Copyright (c) 1999
|
williamr@2
|
4 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@2
|
5 |
*
|
williamr@2
|
6 |
* Copyright (c) 1999
|
williamr@2
|
7 |
* Boris Fomitchev
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@2
|
10 |
* or implied. Any use is at your own risk.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@2
|
13 |
* without fee, provided the above notices are retained on all copies.
|
williamr@2
|
14 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@2
|
15 |
* provided the above notices are retained, and a notice that the code was
|
williamr@2
|
16 |
* modified is included with the above copyright notice.
|
williamr@2
|
17 |
*
|
williamr@2
|
18 |
*/
|
williamr@2
|
19 |
#ifndef _STLP_ISTREAM_C
|
williamr@2
|
20 |
#define _STLP_ISTREAM_C
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#ifndef _STLP_INTERNAL_ISTREAM_H
|
williamr@2
|
23 |
# include <stl/_istream.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
|
williamr@2
|
26 |
# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef _STLP_LIMITS_H
|
williamr@2
|
29 |
# include <stl/_limits.h>
|
williamr@2
|
30 |
#endif
|
williamr@2
|
31 |
|
williamr@2
|
32 |
#ifndef _STLP_INTERNAL_NUM_GET_H
|
williamr@2
|
33 |
# include <stl/_num_get.h>
|
williamr@2
|
34 |
#endif
|
williamr@2
|
35 |
|
williamr@2
|
36 |
# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
|
williamr@2
|
37 |
// no wchar_t is supported for this mode
|
williamr@2
|
38 |
# define __BIS_int_type__ int
|
williamr@2
|
39 |
# define __BIS_pos_type__ streampos
|
williamr@2
|
40 |
# define __BIS_off_type__ streamoff
|
williamr@2
|
41 |
# else
|
williamr@2
|
42 |
# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type
|
williamr@2
|
43 |
# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type
|
williamr@2
|
44 |
# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type
|
williamr@2
|
45 |
# endif
|
williamr@2
|
46 |
|
williamr@2
|
47 |
_STLP_BEGIN_NAMESPACE
|
williamr@2
|
48 |
|
williamr@2
|
49 |
//----------------------------------------------------------------------
|
williamr@2
|
50 |
// Function object structs used by some member functions.
|
williamr@2
|
51 |
|
williamr@2
|
52 |
template <class _Traits>
|
williamr@2
|
53 |
struct _Is_not_wspace {
|
williamr@2
|
54 |
typedef typename _Traits::char_type argument_type;
|
williamr@2
|
55 |
typedef bool result_type;
|
williamr@2
|
56 |
|
williamr@2
|
57 |
const ctype<argument_type>* _M_ctype;
|
williamr@2
|
58 |
|
williamr@2
|
59 |
_Is_not_wspace(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
|
williamr@2
|
60 |
bool operator()(argument_type __c) const
|
williamr@2
|
61 |
{ return !_M_ctype->is(ctype_base::space, __c); }
|
williamr@2
|
62 |
};
|
williamr@2
|
63 |
|
williamr@2
|
64 |
template <class _Traits>
|
williamr@2
|
65 |
struct _Is_wspace_null {
|
williamr@2
|
66 |
typedef typename _Traits::char_type argument_type;
|
williamr@2
|
67 |
typedef bool result_type;
|
williamr@2
|
68 |
|
williamr@2
|
69 |
const ctype<argument_type>* _M_ctype;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
_Is_wspace_null(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
|
williamr@2
|
72 |
bool operator()(argument_type __c) const {
|
williamr@2
|
73 |
return _Traits::eq(__c, argument_type()) ||
|
williamr@2
|
74 |
_M_ctype->is(ctype_base::space, __c);
|
williamr@2
|
75 |
}
|
williamr@2
|
76 |
};
|
williamr@2
|
77 |
|
williamr@2
|
78 |
template <class _Traits>
|
williamr@2
|
79 |
struct _Scan_for_wspace {
|
williamr@2
|
80 |
typedef typename _Traits::char_type char_type;
|
williamr@2
|
81 |
typedef char_type* first_argument_type;
|
williamr@2
|
82 |
typedef char_type* second_argument_type;
|
williamr@2
|
83 |
typedef char_type* result_type;
|
williamr@2
|
84 |
|
williamr@2
|
85 |
const ctype<char_type>* _M_ctype;
|
williamr@2
|
86 |
|
williamr@2
|
87 |
_Scan_for_wspace(const ctype<char_type>* __ctype) : _M_ctype(__ctype) {}
|
williamr@2
|
88 |
const char_type*
|
williamr@2
|
89 |
operator()(const char_type* __first, const char_type* __last) const {
|
williamr@2
|
90 |
return _M_ctype->scan_is(ctype_base::space, __first, __last);
|
williamr@2
|
91 |
}
|
williamr@2
|
92 |
};
|
williamr@2
|
93 |
|
williamr@2
|
94 |
template <class _Traits>
|
williamr@2
|
95 |
struct _Scan_wspace_null {
|
williamr@2
|
96 |
typedef typename _Traits::char_type char_type;
|
williamr@2
|
97 |
typedef char_type* first_argument_type;
|
williamr@2
|
98 |
typedef char_type* second_argument_type;
|
williamr@2
|
99 |
typedef char_type* result_type;
|
williamr@2
|
100 |
|
williamr@2
|
101 |
const ctype<char_type>* _M_ctype;
|
williamr@2
|
102 |
|
williamr@2
|
103 |
_Scan_wspace_null(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
|
williamr@2
|
104 |
const char_type*
|
williamr@2
|
105 |
operator()(const char_type* __first, const char_type* __last) const {
|
williamr@2
|
106 |
__last = find_if(__first, __last,
|
williamr@2
|
107 |
_Eq_char_bound<_Traits>(char_type()));
|
williamr@2
|
108 |
return _M_ctype->scan_is(ctype_base::space, __first, __last);
|
williamr@2
|
109 |
}
|
williamr@2
|
110 |
};
|
williamr@2
|
111 |
|
williamr@2
|
112 |
template <class _Traits>
|
williamr@2
|
113 |
struct _Scan_for_not_wspace {
|
williamr@2
|
114 |
typedef typename _Traits::char_type char_type;
|
williamr@2
|
115 |
typedef char_type* first_argument_type;
|
williamr@2
|
116 |
typedef char_type* second_argument_type;
|
williamr@2
|
117 |
typedef char_type* result_type;
|
williamr@2
|
118 |
|
williamr@2
|
119 |
const ctype<char_type>* _M_ctype;
|
williamr@2
|
120 |
|
williamr@2
|
121 |
_Scan_for_not_wspace(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
|
williamr@2
|
122 |
const char_type*
|
williamr@2
|
123 |
operator()(const char_type* __first, const char_type* __last) const {
|
williamr@2
|
124 |
return _M_ctype->scan_not(ctype_base::space, __first, __last);
|
williamr@2
|
125 |
}
|
williamr@2
|
126 |
};
|
williamr@2
|
127 |
|
williamr@2
|
128 |
template <class _Traits>
|
williamr@2
|
129 |
struct _Scan_for_char_val
|
williamr@2
|
130 |
{
|
williamr@2
|
131 |
typedef typename _Traits::char_type char_type;
|
williamr@2
|
132 |
typedef char_type* first_argument_type;
|
williamr@2
|
133 |
typedef char_type* second_argument_type;
|
williamr@2
|
134 |
typedef char_type* result_type;
|
williamr@2
|
135 |
|
williamr@2
|
136 |
char_type _M_val;
|
williamr@2
|
137 |
|
williamr@2
|
138 |
_Scan_for_char_val(char_type __val) : _M_val(__val) {}
|
williamr@2
|
139 |
|
williamr@2
|
140 |
const char_type*
|
williamr@2
|
141 |
operator()(const char_type* __first, const char_type* __last) const {
|
williamr@2
|
142 |
return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val));
|
williamr@2
|
143 |
}
|
williamr@2
|
144 |
};
|
williamr@2
|
145 |
|
williamr@2
|
146 |
template <class _Traits>
|
williamr@2
|
147 |
struct _Scan_for_int_val
|
williamr@2
|
148 |
{
|
williamr@2
|
149 |
typedef typename _Traits::char_type char_type;
|
williamr@2
|
150 |
typedef typename _Traits::int_type int_type;
|
williamr@2
|
151 |
typedef char_type* first_argument_type;
|
williamr@2
|
152 |
typedef char_type* second_argument_type;
|
williamr@2
|
153 |
typedef char_type* result_type;
|
williamr@2
|
154 |
|
williamr@2
|
155 |
int_type _M_val;
|
williamr@2
|
156 |
|
williamr@2
|
157 |
_Scan_for_int_val(int_type __val) : _M_val(__val) {}
|
williamr@2
|
158 |
|
williamr@2
|
159 |
const char_type*
|
williamr@2
|
160 |
operator()(const char_type* __first, const char_type* __last) const {
|
williamr@2
|
161 |
return find_if(__first, __last,
|
williamr@2
|
162 |
_Eq_int_bound<_Traits>(_M_val));
|
williamr@2
|
163 |
}
|
williamr@2
|
164 |
};
|
williamr@2
|
165 |
|
williamr@2
|
166 |
// Helper function: try to push back a character to a streambuf,
|
williamr@2
|
167 |
// return true if the pushback succeeded. Does not throw.
|
williamr@2
|
168 |
|
williamr@2
|
169 |
template <class _CharT, class _Traits>
|
williamr@2
|
170 |
bool _STLP_CALL
|
williamr@2
|
171 |
__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c)
|
williamr@2
|
172 |
{
|
williamr@2
|
173 |
bool ret;
|
williamr@2
|
174 |
_STLP_TRY {
|
williamr@2
|
175 |
const typename _Traits::int_type __eof = _Traits::eof();
|
williamr@2
|
176 |
ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof);
|
williamr@2
|
177 |
}
|
williamr@2
|
178 |
_STLP_CATCH_ALL {
|
williamr@2
|
179 |
ret = false;
|
williamr@2
|
180 |
}
|
williamr@2
|
181 |
return ret;
|
williamr@2
|
182 |
}
|
williamr@2
|
183 |
|
williamr@2
|
184 |
template <class _CharT, class _Traits>
|
williamr@2
|
185 |
basic_istream<_CharT, _Traits>& _STLP_CALL
|
williamr@2
|
186 |
ws(basic_istream<_CharT, _Traits>& __is)
|
williamr@2
|
187 |
{
|
williamr@2
|
188 |
typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
|
williamr@2
|
189 |
_Sentry __sentry(__is, _No_Skip_WS()); // Don't skip whitespace.
|
williamr@2
|
190 |
if (__sentry)
|
williamr@2
|
191 |
__is._M_skip_whitespace(false);
|
williamr@2
|
192 |
return __is;
|
williamr@2
|
193 |
}
|
williamr@2
|
194 |
|
williamr@2
|
195 |
// Helper functions for istream<>::sentry constructor.
|
williamr@2
|
196 |
template <class _CharT, class _Traits>
|
williamr@2
|
197 |
bool
|
williamr@2
|
198 |
_M_init_skip(basic_istream<_CharT, _Traits>& __is) {
|
williamr@2
|
199 |
if (__is.good()) {
|
williamr@2
|
200 |
if (__is.tie())
|
williamr@2
|
201 |
__is.tie()->flush();
|
williamr@2
|
202 |
|
williamr@2
|
203 |
__is._M_skip_whitespace(true);
|
williamr@2
|
204 |
}
|
williamr@2
|
205 |
|
williamr@2
|
206 |
if (!__is.good()) {
|
williamr@2
|
207 |
__is.setstate(ios_base::failbit);
|
williamr@2
|
208 |
return false;
|
williamr@2
|
209 |
} else
|
williamr@2
|
210 |
return true;
|
williamr@2
|
211 |
}
|
williamr@2
|
212 |
|
williamr@2
|
213 |
template <class _CharT, class _Traits>
|
williamr@2
|
214 |
bool
|
williamr@2
|
215 |
_M_init_noskip(basic_istream<_CharT, _Traits>& __is){
|
williamr@2
|
216 |
if (__is.good()) {
|
williamr@2
|
217 |
if (__is.tie())
|
williamr@2
|
218 |
__is.tie()->flush();
|
williamr@2
|
219 |
|
williamr@2
|
220 |
if (!__is.rdbuf())
|
williamr@2
|
221 |
__is.setstate(ios_base::badbit);
|
williamr@2
|
222 |
}
|
williamr@2
|
223 |
else
|
williamr@2
|
224 |
__is.setstate(ios_base::failbit);
|
williamr@2
|
225 |
return __is.good();
|
williamr@2
|
226 |
}
|
williamr@2
|
227 |
|
williamr@2
|
228 |
//----------------------------------------------------------------------
|
williamr@2
|
229 |
// Definitions of basic_istream<>'s noninline member functions.
|
williamr@2
|
230 |
|
williamr@2
|
231 |
// Helper function for formatted input of numbers.
|
williamr@2
|
232 |
template <class _CharT, class _Traits, class _Number>
|
williamr@2
|
233 |
ios_base::iostate _STLP_CALL
|
williamr@2
|
234 |
_M_get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val)
|
williamr@2
|
235 |
{
|
williamr@2
|
236 |
typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
|
williamr@2
|
237 |
ios_base::iostate __err = 0;
|
williamr@2
|
238 |
_Sentry __sentry( __that ); // Skip whitespace.
|
williamr@2
|
239 |
if (__sentry) {
|
williamr@2
|
240 |
typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get;
|
williamr@2
|
241 |
_STLP_TRY {
|
williamr@2
|
242 |
((const _Num_get&)use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()),
|
williamr@2
|
243 |
0, __that, __err, __val);
|
williamr@2
|
244 |
}
|
williamr@2
|
245 |
_STLP_CATCH_ALL {
|
williamr@2
|
246 |
__that._M_handle_exception(ios_base::badbit);
|
williamr@2
|
247 |
}
|
williamr@2
|
248 |
if (__err) __that.setstate(__err);
|
williamr@2
|
249 |
}
|
williamr@2
|
250 |
return __err;
|
williamr@2
|
251 |
}
|
williamr@2
|
252 |
|
williamr@2
|
253 |
|
williamr@2
|
254 |
// Unformatted input
|
williamr@2
|
255 |
|
williamr@2
|
256 |
template <class _CharT, class _Traits>
|
williamr@2
|
257 |
__BIS_int_type__
|
williamr@2
|
258 |
basic_istream<_CharT, _Traits>::peek()
|
williamr@2
|
259 |
{
|
williamr@2
|
260 |
typename _Traits::int_type __tmp = _Traits::eof();
|
williamr@2
|
261 |
|
williamr@2
|
262 |
this->_M_gcount = 0;
|
williamr@2
|
263 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
264 |
|
williamr@2
|
265 |
if (__sentry) {
|
williamr@2
|
266 |
_STLP_TRY {
|
williamr@2
|
267 |
__tmp = this->rdbuf()->sgetc();
|
williamr@2
|
268 |
}
|
williamr@2
|
269 |
_STLP_CATCH_ALL {
|
williamr@2
|
270 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
271 |
}
|
williamr@2
|
272 |
}
|
williamr@2
|
273 |
else
|
williamr@2
|
274 |
{
|
williamr@2
|
275 |
if (this->_S_eof(__tmp))
|
williamr@2
|
276 |
{
|
williamr@2
|
277 |
this->clear();
|
williamr@2
|
278 |
this->setstate(ios_base::eofbit);
|
williamr@2
|
279 |
}
|
williamr@2
|
280 |
}
|
williamr@2
|
281 |
return __tmp;
|
williamr@2
|
282 |
}
|
williamr@2
|
283 |
|
williamr@2
|
284 |
|
williamr@2
|
285 |
template <class _CharT, class _Traits>
|
williamr@2
|
286 |
__BIS_int_type__
|
williamr@2
|
287 |
basic_istream<_CharT, _Traits>::get()
|
williamr@2
|
288 |
{
|
williamr@2
|
289 |
typename _Traits::int_type __tmp = _Traits::eof();
|
williamr@2
|
290 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
291 |
this->_M_gcount = 0;
|
williamr@2
|
292 |
|
williamr@2
|
293 |
if (__sentry) {
|
williamr@2
|
294 |
_STLP_TRY {
|
williamr@2
|
295 |
__tmp = this->rdbuf()->sbumpc();
|
williamr@2
|
296 |
}
|
williamr@2
|
297 |
_STLP_CATCH_ALL {
|
williamr@2
|
298 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
299 |
}
|
williamr@2
|
300 |
|
williamr@2
|
301 |
if (!this->_S_eof(__tmp))
|
williamr@2
|
302 |
this->_M_gcount = 1;
|
williamr@2
|
303 |
}
|
williamr@2
|
304 |
|
williamr@2
|
305 |
if (_M_gcount == 0)
|
williamr@2
|
306 |
this->setstate(ios_base::eofbit | ios_base::failbit);
|
williamr@2
|
307 |
|
williamr@2
|
308 |
return __tmp;
|
williamr@2
|
309 |
}
|
williamr@2
|
310 |
|
williamr@2
|
311 |
template <class _CharT, class _Traits>
|
williamr@2
|
312 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
313 |
basic_istream<_CharT, _Traits>::get(_CharT& __c)
|
williamr@2
|
314 |
{
|
williamr@2
|
315 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
316 |
this->_M_gcount = 0;
|
williamr@2
|
317 |
|
williamr@2
|
318 |
if (__sentry) {
|
williamr@2
|
319 |
typename _Traits::int_type __tmp = _Traits::eof();
|
williamr@2
|
320 |
_STLP_TRY {
|
williamr@2
|
321 |
__tmp = this->rdbuf()->sbumpc();
|
williamr@2
|
322 |
}
|
williamr@2
|
323 |
_STLP_CATCH_ALL {
|
williamr@2
|
324 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
325 |
}
|
williamr@2
|
326 |
|
williamr@2
|
327 |
if (!this->_S_eof(__tmp)) {
|
williamr@2
|
328 |
this->_M_gcount = 1;
|
williamr@2
|
329 |
__c = _Traits::to_char_type(__tmp);
|
williamr@2
|
330 |
}
|
williamr@2
|
331 |
}
|
williamr@2
|
332 |
|
williamr@2
|
333 |
if (this->_M_gcount == 0)
|
williamr@2
|
334 |
this->setstate(ios_base::eofbit | ios_base::failbit);
|
williamr@2
|
335 |
|
williamr@2
|
336 |
return *this;
|
williamr@2
|
337 |
}
|
williamr@2
|
338 |
|
williamr@2
|
339 |
|
williamr@2
|
340 |
|
williamr@2
|
341 |
// Read characters and discard them. The standard specifies a single
|
williamr@2
|
342 |
// function with two arguments, each with a default. We instead use
|
williamr@2
|
343 |
// three overloded functions, because it's possible to implement the
|
williamr@2
|
344 |
// first two more efficiently than the fully general third version.
|
williamr@2
|
345 |
template <class _CharT, class _Traits>
|
williamr@2
|
346 |
basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore()
|
williamr@2
|
347 |
{
|
williamr@2
|
348 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
349 |
this->_M_gcount = 0;
|
williamr@2
|
350 |
|
williamr@2
|
351 |
if (__sentry) {
|
williamr@2
|
352 |
int_type __c;
|
williamr@2
|
353 |
_STLP_TRY {
|
williamr@2
|
354 |
__c = this->rdbuf()->sbumpc();
|
williamr@2
|
355 |
}
|
williamr@2
|
356 |
_STLP_CATCH_ALL {
|
williamr@2
|
357 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
358 |
return *this;
|
williamr@2
|
359 |
}
|
williamr@2
|
360 |
|
williamr@2
|
361 |
if (!this->_S_eof(__c))
|
williamr@2
|
362 |
this->_M_gcount = 1;
|
williamr@2
|
363 |
else
|
williamr@2
|
364 |
this->setstate(ios_base::eofbit);
|
williamr@2
|
365 |
}
|
williamr@2
|
366 |
|
williamr@2
|
367 |
return *this;
|
williamr@2
|
368 |
}
|
williamr@2
|
369 |
|
williamr@2
|
370 |
// Putback
|
williamr@2
|
371 |
|
williamr@2
|
372 |
template <class _CharT, class _Traits>
|
williamr@2
|
373 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
374 |
basic_istream<_CharT, _Traits>::putback(_CharT __c) {
|
williamr@2
|
375 |
this->_M_gcount = 0;
|
williamr@2
|
376 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
377 |
|
williamr@2
|
378 |
if (__sentry) {
|
williamr@2
|
379 |
typename _Traits::int_type __tmp = _Traits::eof();
|
williamr@2
|
380 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
381 |
// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
|
williamr@2
|
382 |
if (__buf) {
|
williamr@2
|
383 |
_STLP_TRY {
|
williamr@2
|
384 |
__tmp = __buf->sputbackc(__c);
|
williamr@2
|
385 |
}
|
williamr@2
|
386 |
_STLP_CATCH_ALL {
|
williamr@2
|
387 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
388 |
}
|
williamr@2
|
389 |
}
|
williamr@2
|
390 |
if (this->_S_eof(__tmp))
|
williamr@2
|
391 |
this->setstate(ios_base::badbit);
|
williamr@2
|
392 |
}
|
williamr@2
|
393 |
else
|
williamr@2
|
394 |
this->setstate(ios_base::failbit);
|
williamr@2
|
395 |
|
williamr@2
|
396 |
return *this;
|
williamr@2
|
397 |
}
|
williamr@2
|
398 |
|
williamr@2
|
399 |
template <class _CharT, class _Traits>
|
williamr@2
|
400 |
basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
|
williamr@2
|
401 |
this->_M_gcount = 0;
|
williamr@2
|
402 |
|
williamr@2
|
403 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
404 |
|
williamr@2
|
405 |
if (__sentry) {
|
williamr@2
|
406 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
407 |
// if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
|
williamr@2
|
408 |
if (__buf) {
|
williamr@2
|
409 |
_STLP_TRY {
|
williamr@2
|
410 |
_CharT __tmp;
|
williamr@2
|
411 |
__tmp = __buf->sungetc();
|
williamr@2
|
412 |
#ifdef __SYMBIAN32__
|
williamr@2
|
413 |
if (__tmp == (_CharT)-1) //chek for eof
|
williamr@2
|
414 |
#else
|
williamr@2
|
415 |
if (this->_S_eof(__tmp))
|
williamr@2
|
416 |
#endif
|
williamr@2
|
417 |
this->setstate(ios_base::badbit);
|
williamr@2
|
418 |
}
|
williamr@2
|
419 |
_STLP_CATCH_ALL {
|
williamr@2
|
420 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
421 |
}
|
williamr@2
|
422 |
} else
|
williamr@2
|
423 |
this->setstate(ios_base::badbit);
|
williamr@2
|
424 |
}
|
williamr@2
|
425 |
else
|
williamr@2
|
426 |
this->setstate(ios_base::failbit);
|
williamr@2
|
427 |
|
williamr@2
|
428 |
return *this;
|
williamr@2
|
429 |
}
|
williamr@2
|
430 |
|
williamr@2
|
431 |
// Positioning and buffer control.
|
williamr@2
|
432 |
|
williamr@2
|
433 |
template <class _CharT, class _Traits>
|
williamr@2
|
434 |
int basic_istream<_CharT, _Traits>::sync() {
|
williamr@2
|
435 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
436 |
|
williamr@2
|
437 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
438 |
if (__buf) {
|
williamr@2
|
439 |
if (__buf->pubsync() == -1) {
|
williamr@2
|
440 |
this->setstate(ios_base::badbit);
|
williamr@2
|
441 |
return -1;
|
williamr@2
|
442 |
}
|
williamr@2
|
443 |
else
|
williamr@2
|
444 |
return 0;
|
williamr@2
|
445 |
}
|
williamr@2
|
446 |
else
|
williamr@2
|
447 |
return -1;
|
williamr@2
|
448 |
}
|
williamr@2
|
449 |
|
williamr@2
|
450 |
template <class _CharT, class _Traits>
|
williamr@2
|
451 |
__BIS_pos_type__
|
williamr@2
|
452 |
basic_istream<_CharT, _Traits>::tellg() {
|
williamr@2
|
453 |
#ifndef __SYMBIAN32__
|
williamr@2
|
454 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
455 |
#endif
|
williamr@2
|
456 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
457 |
return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
|
williamr@2
|
458 |
: pos_type(-1);
|
williamr@2
|
459 |
}
|
williamr@2
|
460 |
|
williamr@2
|
461 |
template <class _CharT, class _Traits>
|
williamr@2
|
462 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
463 |
basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
|
williamr@2
|
464 |
#ifndef __SYMBIAN32__
|
williamr@2
|
465 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
466 |
#endif
|
williamr@2
|
467 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
468 |
if (!this->fail() && __buf)
|
williamr@2
|
469 |
{
|
williamr@2
|
470 |
pos_type pos = __buf->pubseekpos(__pos, ios_base::in);
|
williamr@2
|
471 |
if(pos == pos_type(off_type(-1)))
|
williamr@2
|
472 |
this->setstate(ios_base::failbit);
|
williamr@2
|
473 |
}
|
williamr@2
|
474 |
return *this;
|
williamr@2
|
475 |
}
|
williamr@2
|
476 |
|
williamr@2
|
477 |
template <class _CharT, class _Traits>
|
williamr@2
|
478 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
479 |
basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
|
williamr@2
|
480 |
{
|
williamr@2
|
481 |
#ifndef __SYMBIAN32__
|
williamr@2
|
482 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
483 |
#endif
|
williamr@2
|
484 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
485 |
if (!this->fail() && __buf)
|
williamr@2
|
486 |
{
|
williamr@2
|
487 |
|
williamr@2
|
488 |
pos_type pos = __buf->pubseekoff(__off, __dir, ios_base::in);
|
williamr@2
|
489 |
if(pos == pos_type(off_type(-1)))
|
williamr@2
|
490 |
this->setstate(ios_base::failbit);
|
williamr@2
|
491 |
}
|
williamr@2
|
492 |
return *this;
|
williamr@2
|
493 |
}
|
williamr@2
|
494 |
|
williamr@2
|
495 |
// Formatted input of characters and character arrays.
|
williamr@2
|
496 |
|
williamr@2
|
497 |
template <class _CharT, class _Traits>
|
williamr@2
|
498 |
void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c)
|
williamr@2
|
499 |
{
|
williamr@2
|
500 |
// typename _Traits::int_type __tmp = _Traits::eof();
|
williamr@2
|
501 |
|
williamr@2
|
502 |
sentry __sentry(*this); // Skip whitespace.
|
williamr@2
|
503 |
|
williamr@2
|
504 |
if (__sentry) {
|
williamr@2
|
505 |
typename _Traits::int_type __tmp = _Traits::eof();
|
williamr@2
|
506 |
|
williamr@2
|
507 |
_STLP_TRY {
|
williamr@2
|
508 |
__tmp = this->rdbuf()->sbumpc();
|
williamr@2
|
509 |
}
|
williamr@2
|
510 |
_STLP_CATCH_ALL {
|
williamr@2
|
511 |
this->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
512 |
return;
|
williamr@2
|
513 |
}
|
williamr@2
|
514 |
|
williamr@2
|
515 |
if (!this->_S_eof(__tmp))
|
williamr@2
|
516 |
__c = _Traits::to_char_type(__tmp);
|
williamr@2
|
517 |
else
|
williamr@2
|
518 |
this->setstate(ios_base::eofbit | ios_base::failbit);
|
williamr@2
|
519 |
}
|
williamr@2
|
520 |
}
|
williamr@2
|
521 |
|
williamr@2
|
522 |
|
williamr@2
|
523 |
//---------------------------------------------------------------------------
|
williamr@2
|
524 |
// istream's helper functions.
|
williamr@2
|
525 |
|
williamr@2
|
526 |
// A generic function for unbuffered input. We stop when we reach EOF,
|
williamr@2
|
527 |
// or when we have extracted _Num characters, or when the function object
|
williamr@2
|
528 |
// __is_delim return true. In the last case, it extracts the character
|
williamr@2
|
529 |
// for which __is_delim is true, if and only if __extract_delim is true.
|
williamr@2
|
530 |
// It appends a null character to the end of the string; this means that
|
williamr@2
|
531 |
// it may store up to _Num + 1 characters.
|
williamr@2
|
532 |
//
|
williamr@2
|
533 |
// __is_getline governs two corner cases: reading _Num characters without
|
williamr@2
|
534 |
// encountering delim or eof (in which case failbit is set if __is_getline
|
williamr@2
|
535 |
// is true); and reading _Num characters where the _Num+1'st character is
|
williamr@2
|
536 |
// eof (in which case eofbit is set if __is_getline is true).
|
williamr@2
|
537 |
//
|
williamr@2
|
538 |
// It is assumed that __is_delim never throws.
|
williamr@2
|
539 |
//
|
williamr@2
|
540 |
// Return value is the number of characters extracted, including the
|
williamr@2
|
541 |
// delimiter if it is extracted. Note that the number of characaters
|
williamr@2
|
542 |
// extracted isn't necessarily the same as the number stored.
|
williamr@2
|
543 |
|
williamr@2
|
544 |
template < class _CharT, class _Traits, class _Is_Delim>
|
williamr@2
|
545 |
streamsize _STLP_CALL
|
williamr@2
|
546 |
_M_read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
|
williamr@2
|
547 |
streamsize _Num, _CharT* __s,
|
williamr@2
|
548 |
_Is_Delim __is_delim,
|
williamr@2
|
549 |
bool __extract_delim, bool __append_null,
|
williamr@2
|
550 |
bool __is_getline)
|
williamr@2
|
551 |
{
|
williamr@2
|
552 |
streamsize __n = 0;
|
williamr@2
|
553 |
ios_base::iostate __status = 0;
|
williamr@2
|
554 |
|
williamr@2
|
555 |
typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
|
williamr@2
|
556 |
// The operations that can potentially throw are sbumpc, snextc, and sgetc.
|
williamr@2
|
557 |
_STLP_TRY {
|
williamr@2
|
558 |
# if 0
|
williamr@2
|
559 |
int_type __c = __buf->sgetc();
|
williamr@2
|
560 |
while (true) {
|
williamr@2
|
561 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
562 |
if (__n < _Num || __is_getline)
|
williamr@2
|
563 |
__status |= ios_base::eofbit;
|
williamr@2
|
564 |
break;
|
williamr@2
|
565 |
}
|
williamr@2
|
566 |
|
williamr@2
|
567 |
else if (__is_delim(__c)) {
|
williamr@2
|
568 |
if (__extract_delim) { // Extract and discard current character.
|
williamr@2
|
569 |
__buf->sbumpc();
|
williamr@2
|
570 |
++__n;
|
williamr@2
|
571 |
}
|
williamr@2
|
572 |
break;
|
williamr@2
|
573 |
}
|
williamr@2
|
574 |
|
williamr@2
|
575 |
else if (__n == _Num) {
|
williamr@2
|
576 |
if (__is_getline)
|
williamr@2
|
577 |
__status |= ios_base::failbit;
|
williamr@2
|
578 |
break;
|
williamr@2
|
579 |
}
|
williamr@2
|
580 |
|
williamr@2
|
581 |
*__s++ = _Traits::to_char_type(__c);
|
williamr@2
|
582 |
++__n;
|
williamr@2
|
583 |
__c = __buf->snextc();
|
williamr@2
|
584 |
}
|
williamr@2
|
585 |
# else
|
williamr@2
|
586 |
// int_type __c = __buf->sbumpc(); // __buf->sgetc();
|
williamr@2
|
587 |
while (true) {
|
williamr@2
|
588 |
|
williamr@2
|
589 |
int_type __c = __buf->sbumpc(); // sschwarz
|
williamr@2
|
590 |
|
williamr@2
|
591 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
592 |
if (__n < _Num || __is_getline)
|
williamr@2
|
593 |
__status |= ios_base::eofbit;
|
williamr@2
|
594 |
break;
|
williamr@2
|
595 |
}
|
williamr@2
|
596 |
|
williamr@2
|
597 |
else if (__is_delim(__c)) {
|
williamr@2
|
598 |
if (__extract_delim) { // Extract and discard current character.
|
williamr@2
|
599 |
// __buf->sbumpc();
|
williamr@2
|
600 |
++__n;
|
williamr@2
|
601 |
}
|
williamr@2
|
602 |
break;
|
williamr@2
|
603 |
}
|
williamr@2
|
604 |
|
williamr@2
|
605 |
else { // regular character
|
williamr@2
|
606 |
|
williamr@2
|
607 |
*__s++ = _Traits::to_char_type(__c);
|
williamr@2
|
608 |
++__n;
|
williamr@2
|
609 |
|
williamr@2
|
610 |
}
|
williamr@2
|
611 |
|
williamr@2
|
612 |
if (__n == _Num) {
|
williamr@2
|
613 |
if (__is_getline) // didn't find delimiter as one of the _Num chars
|
williamr@2
|
614 |
__status |= ios_base::failbit;
|
williamr@2
|
615 |
break;
|
williamr@2
|
616 |
}
|
williamr@2
|
617 |
|
williamr@2
|
618 |
// *__s++ = _Traits::to_char_type(__c);
|
williamr@2
|
619 |
// ++__n;
|
williamr@2
|
620 |
|
williamr@2
|
621 |
}
|
williamr@2
|
622 |
|
williamr@2
|
623 |
# endif
|
williamr@2
|
624 |
|
williamr@2
|
625 |
}
|
williamr@2
|
626 |
_STLP_CATCH_ALL {
|
williamr@2
|
627 |
__that->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
628 |
*__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
|
williamr@2
|
629 |
return __n;
|
williamr@2
|
630 |
}
|
williamr@2
|
631 |
|
williamr@2
|
632 |
if (__append_null)
|
williamr@2
|
633 |
*__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
|
williamr@2
|
634 |
if (__status)
|
williamr@2
|
635 |
__that->setstate(__status); // This might throw.
|
williamr@2
|
636 |
return __n;
|
williamr@2
|
637 |
}
|
williamr@2
|
638 |
|
williamr@2
|
639 |
// Much like _M_read_unbuffered, but with one additional function object:
|
williamr@2
|
640 |
// __scan_delim(first, last) returns the first pointer p in [first, last)
|
williamr@2
|
641 |
// such that __is_delim(p) is true.
|
williamr@2
|
642 |
|
williamr@2
|
643 |
template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
|
williamr@2
|
644 |
streamsize _STLP_CALL
|
williamr@2
|
645 |
_M_read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
|
williamr@2
|
646 |
streamsize _Num, _CharT* __s,
|
williamr@2
|
647 |
_Is_Delim __is_delim, _Scan_Delim __scan_delim,
|
williamr@2
|
648 |
bool __extract_delim, bool __append_null,
|
williamr@2
|
649 |
bool __is_getline)
|
williamr@2
|
650 |
{
|
williamr@2
|
651 |
streamsize __n = 0;
|
williamr@2
|
652 |
ios_base::iostate __status = 0;
|
williamr@2
|
653 |
bool __done = false;
|
williamr@2
|
654 |
|
williamr@2
|
655 |
_STLP_TRY {
|
williamr@2
|
656 |
while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
|
williamr@2
|
657 |
const _CharT* __first = __buf->_M_gptr();
|
williamr@2
|
658 |
const _CharT* __last = __buf->_M_egptr();
|
williamr@2
|
659 |
ptrdiff_t __request = _Num - __n;
|
williamr@2
|
660 |
|
williamr@2
|
661 |
const _CharT* __p = __scan_delim(__first, __last);
|
williamr@2
|
662 |
ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
|
williamr@2
|
663 |
_Traits::copy(__s, __first, __chunk);
|
williamr@2
|
664 |
__s += __chunk;
|
williamr@2
|
665 |
__n += __chunk;
|
williamr@2
|
666 |
__buf->_M_gbump((int)__chunk);
|
williamr@2
|
667 |
|
williamr@2
|
668 |
// We terminated by finding delim.
|
williamr@2
|
669 |
if (__p != __last && __p - __first <= __request) {
|
williamr@2
|
670 |
if (__extract_delim) {
|
williamr@2
|
671 |
__n += 1;
|
williamr@2
|
672 |
__buf->_M_gbump(1);
|
williamr@2
|
673 |
}
|
williamr@2
|
674 |
__done = true;
|
williamr@2
|
675 |
}
|
williamr@2
|
676 |
|
williamr@2
|
677 |
// We terminated by reading all the characters we were asked for.
|
williamr@2
|
678 |
else if(__n == _Num) {
|
williamr@2
|
679 |
|
williamr@2
|
680 |
// Find out if we have reached eof. This matters for getline.
|
williamr@2
|
681 |
if (__is_getline) {
|
williamr@2
|
682 |
if (__chunk == __last - __first) {
|
williamr@2
|
683 |
if (__that->_S_eof(__buf->sgetc()))
|
williamr@2
|
684 |
__status |= ios_base::eofbit;
|
williamr@2
|
685 |
}
|
williamr@2
|
686 |
else
|
williamr@2
|
687 |
__status |= ios_base::failbit;
|
williamr@2
|
688 |
}
|
williamr@2
|
689 |
__done = true;
|
williamr@2
|
690 |
}
|
williamr@2
|
691 |
|
williamr@2
|
692 |
// The buffer contained fewer than _Num - __n characters. Either we're
|
williamr@2
|
693 |
// at eof, or we should refill the buffer and try again.
|
williamr@2
|
694 |
else {
|
williamr@2
|
695 |
if (__that->_S_eof(__buf->sgetc())) {
|
williamr@2
|
696 |
__status |= ios_base::eofbit;
|
williamr@2
|
697 |
__done = true;
|
williamr@2
|
698 |
}
|
williamr@2
|
699 |
}
|
williamr@2
|
700 |
} // Close the while loop.
|
williamr@2
|
701 |
}
|
williamr@2
|
702 |
_STLP_CATCH_ALL {
|
williamr@2
|
703 |
__that->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
704 |
__done = true;
|
williamr@2
|
705 |
}
|
williamr@2
|
706 |
|
williamr@2
|
707 |
if (__done) {
|
williamr@2
|
708 |
if (__append_null)
|
williamr@2
|
709 |
*__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
|
williamr@2
|
710 |
if (__status != 0)
|
williamr@2
|
711 |
__that->setstate(__status); // This might throw.
|
williamr@2
|
712 |
return __n;
|
williamr@2
|
713 |
}
|
williamr@2
|
714 |
|
williamr@2
|
715 |
// If execution has reached this point, then we have an empty buffer but
|
williamr@2
|
716 |
// we have not reached eof. What that means is that the streambuf has
|
williamr@2
|
717 |
// decided to switch from buffered to unbuffered input. We switch to
|
williamr@2
|
718 |
// to _M_read_unbuffered.
|
williamr@2
|
719 |
|
williamr@2
|
720 |
return __n + _M_read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim,
|
williamr@2
|
721 |
__extract_delim,__append_null,__is_getline);
|
williamr@2
|
722 |
}
|
williamr@2
|
723 |
|
williamr@2
|
724 |
|
williamr@2
|
725 |
|
williamr@2
|
726 |
|
williamr@2
|
727 |
template <class _CharT, class _Traits>
|
williamr@2
|
728 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
729 |
basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n,
|
williamr@2
|
730 |
_CharT __delim) {
|
williamr@2
|
731 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
732 |
this->_M_gcount = 0;
|
williamr@2
|
733 |
|
williamr@2
|
734 |
if (__sentry) {
|
williamr@2
|
735 |
if (__n > 0) {
|
williamr@2
|
736 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
737 |
|
williamr@2
|
738 |
if (__buf->egptr() != __buf->gptr())
|
williamr@2
|
739 |
this->_M_gcount =
|
williamr@2
|
740 |
_M_read_buffered(this, __buf, __n - 1, __s,
|
williamr@2
|
741 |
_Eq_char_bound<_Traits>(__delim),
|
williamr@2
|
742 |
_Scan_for_char_val<_Traits>(__delim),
|
williamr@2
|
743 |
false, true, false);
|
williamr@2
|
744 |
else
|
williamr@2
|
745 |
this->_M_gcount =
|
williamr@2
|
746 |
_M_read_unbuffered(this, __buf, __n - 1, __s,
|
williamr@2
|
747 |
_Eq_char_bound<_Traits>(__delim),
|
williamr@2
|
748 |
false, true, false);
|
williamr@2
|
749 |
}
|
williamr@2
|
750 |
}
|
williamr@2
|
751 |
#ifdef __SYMBIAN32__
|
williamr@2
|
752 |
*(__s + this->_M_gcount) = _STLP_DEFAULT_CONSTRUCTED(_CharT);
|
williamr@2
|
753 |
#endif //__SYMBIAN32__
|
williamr@2
|
754 |
if (this->_M_gcount == 0)
|
williamr@2
|
755 |
this->setstate(ios_base::failbit);
|
williamr@2
|
756 |
|
williamr@2
|
757 |
return *this;
|
williamr@2
|
758 |
}
|
williamr@2
|
759 |
|
williamr@2
|
760 |
// Getline is essentially identical to get, except that it extracts
|
williamr@2
|
761 |
// the delimiter.
|
williamr@2
|
762 |
template <class _CharT, class _Traits>
|
williamr@2
|
763 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
764 |
basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n,
|
williamr@2
|
765 |
_CharT __delim) {
|
williamr@2
|
766 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
767 |
this->_M_gcount = 0;
|
williamr@2
|
768 |
|
williamr@2
|
769 |
if (__sentry) {
|
williamr@2
|
770 |
if (__n > 0) {
|
williamr@2
|
771 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
772 |
this->_M_gcount = __buf->egptr() != __buf->gptr()
|
williamr@2
|
773 |
? _M_read_buffered(this, __buf, __n - 1, __s,
|
williamr@2
|
774 |
_Eq_char_bound<_Traits>(__delim),
|
williamr@2
|
775 |
_Scan_for_char_val<_Traits>(__delim),
|
williamr@2
|
776 |
true, true, true)
|
williamr@2
|
777 |
: _M_read_unbuffered(this, __buf, __n - 1, __s,
|
williamr@2
|
778 |
_Eq_char_bound<_Traits>(__delim),
|
williamr@2
|
779 |
true, true, true);
|
williamr@2
|
780 |
}
|
williamr@2
|
781 |
}
|
williamr@2
|
782 |
|
williamr@2
|
783 |
if (this->_M_gcount == 0)
|
williamr@2
|
784 |
this->setstate(ios_base::failbit);
|
williamr@2
|
785 |
|
williamr@2
|
786 |
return *this;
|
williamr@2
|
787 |
}
|
williamr@2
|
788 |
|
williamr@2
|
789 |
// Read n characters. We don't look for any delimiter, and we don't
|
williamr@2
|
790 |
// put in a terminating null character.
|
williamr@2
|
791 |
template <class _CharT, class _Traits>
|
williamr@2
|
792 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
793 |
basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
|
williamr@2
|
794 |
{
|
williamr@2
|
795 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
796 |
this->_M_gcount = 0;
|
williamr@2
|
797 |
|
williamr@2
|
798 |
if (__sentry && !this->eof()) {
|
williamr@2
|
799 |
basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf();
|
williamr@2
|
800 |
if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
801 |
_M_gcount
|
williamr@2
|
802 |
= _M_read_buffered(this, __buf, __n, __s,
|
williamr@2
|
803 |
_Constant_unary_fun<bool, int_type>(false),
|
williamr@2
|
804 |
_Project2nd<const _CharT*, const _CharT*>(),
|
williamr@2
|
805 |
false, false, false);
|
williamr@2
|
806 |
else
|
williamr@2
|
807 |
_M_gcount
|
williamr@2
|
808 |
= _M_read_unbuffered(this, __buf, __n, __s,
|
williamr@2
|
809 |
_Constant_unary_fun<bool, int_type>(false),
|
williamr@2
|
810 |
false, false, false);
|
williamr@2
|
811 |
}
|
williamr@2
|
812 |
else
|
williamr@2
|
813 |
this->setstate(ios_base::failbit);
|
williamr@2
|
814 |
|
williamr@2
|
815 |
if (this->eof())
|
williamr@2
|
816 |
this->setstate(ios_base::eofbit | ios_base::failbit);
|
williamr@2
|
817 |
|
williamr@2
|
818 |
return *this;
|
williamr@2
|
819 |
}
|
williamr@2
|
820 |
|
williamr@2
|
821 |
|
williamr@2
|
822 |
// Read n or fewer characters. We don't look for any delimiter, and
|
williamr@2
|
823 |
// we don't put in a terminating null character.
|
williamr@2
|
824 |
template <class _CharT, class _Traits>
|
williamr@2
|
825 |
streamsize
|
williamr@2
|
826 |
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax)
|
williamr@2
|
827 |
{
|
williamr@2
|
828 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
829 |
this->_M_gcount = 0;
|
williamr@2
|
830 |
|
williamr@2
|
831 |
if (__sentry && !this->eof() && __nmax >= 0) {
|
williamr@2
|
832 |
|
williamr@2
|
833 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
834 |
streamsize __avail = __buf->in_avail();
|
williamr@2
|
835 |
|
williamr@2
|
836 |
// fbp : isn't full-blown setstate required here ?
|
williamr@2
|
837 |
if (__avail == -1)
|
williamr@2
|
838 |
this->_M_setstate_nothrow(ios_base::eofbit);
|
williamr@2
|
839 |
|
williamr@2
|
840 |
else if (__avail != 0) {
|
williamr@2
|
841 |
|
williamr@2
|
842 |
if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
843 |
_M_gcount
|
williamr@2
|
844 |
= _M_read_buffered(this, __buf, (min) (__avail, __nmax), __s,
|
williamr@2
|
845 |
_Constant_unary_fun<bool, int_type>(false),
|
williamr@2
|
846 |
_Project2nd<const _CharT*, const _CharT*>(),
|
williamr@2
|
847 |
false, false, false);
|
williamr@2
|
848 |
else
|
williamr@2
|
849 |
_M_gcount
|
williamr@2
|
850 |
= _M_read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
|
williamr@2
|
851 |
_Constant_unary_fun<bool, int_type>(false),
|
williamr@2
|
852 |
false, false, false);
|
williamr@2
|
853 |
}
|
williamr@2
|
854 |
}
|
williamr@2
|
855 |
else {
|
williamr@2
|
856 |
// fbp : changed so that failbit is set only there, to pass Dietmar's test
|
williamr@2
|
857 |
if (this->eof())
|
williamr@2
|
858 |
this->setstate(ios_base::eofbit | ios_base::failbit);
|
williamr@2
|
859 |
else
|
williamr@2
|
860 |
{
|
williamr@2
|
861 |
if (__nmax < 0)
|
williamr@2
|
862 |
{
|
williamr@2
|
863 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
864 |
streamsize __avail = __buf->in_avail();
|
williamr@2
|
865 |
if(__avail == -1)
|
williamr@2
|
866 |
this->setstate(ios_base::eofbit);
|
williamr@2
|
867 |
}
|
williamr@2
|
868 |
else
|
williamr@2
|
869 |
this->setstate(ios_base::failbit);
|
williamr@2
|
870 |
}
|
williamr@2
|
871 |
}
|
williamr@2
|
872 |
|
williamr@2
|
873 |
// if (this->eof())
|
williamr@2
|
874 |
// this->setstate(ios_base::eofbit | ios_base::failbit);
|
williamr@2
|
875 |
|
williamr@2
|
876 |
return _M_gcount;
|
williamr@2
|
877 |
}
|
williamr@2
|
878 |
|
williamr@2
|
879 |
template <class _CharT, class _Traits>
|
williamr@2
|
880 |
void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s)
|
williamr@2
|
881 |
{
|
williamr@2
|
882 |
sentry __sentry(*this); // Skip whitespace.
|
williamr@2
|
883 |
|
williamr@2
|
884 |
if (__sentry) {
|
williamr@2
|
885 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
886 |
streamsize __nmax = this->width() > 0
|
williamr@2
|
887 |
? this->width() - 1
|
williamr@2
|
888 |
: (numeric_limits<streamsize>::max)() / sizeof(_CharT) - 1;
|
williamr@2
|
889 |
|
williamr@2
|
890 |
streamsize __n = __buf->gptr() != __buf->egptr()
|
williamr@2
|
891 |
? _M_read_buffered(this, __buf, __nmax, __s,
|
williamr@2
|
892 |
_Is_wspace_null<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
|
williamr@2
|
893 |
_Scan_wspace_null<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
|
williamr@2
|
894 |
false, true, false)
|
williamr@2
|
895 |
: _M_read_unbuffered(this, __buf, __nmax, __s,
|
williamr@2
|
896 |
_Is_wspace_null<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
|
williamr@2
|
897 |
false, true, false);
|
williamr@2
|
898 |
if (__n == 0)
|
williamr@2
|
899 |
this->setstate(ios_base::failbit);
|
williamr@2
|
900 |
}
|
williamr@2
|
901 |
this->width(0);
|
williamr@2
|
902 |
}
|
williamr@2
|
903 |
|
williamr@2
|
904 |
// A generic unbuffered function for ignoring characters. We stop
|
williamr@2
|
905 |
// when we reach EOF, or when the function object __is_delim returns
|
williamr@2
|
906 |
// true. In the last case, it extracts the character for which
|
williamr@2
|
907 |
// __is_delim is true, if and only if __extract_delim is true.
|
williamr@2
|
908 |
|
williamr@2
|
909 |
template < class _CharT, class _Traits, class _Is_Delim>
|
williamr@2
|
910 |
void _STLP_CALL
|
williamr@2
|
911 |
_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
|
williamr@2
|
912 |
basic_streambuf<_CharT, _Traits>* __buf,
|
williamr@2
|
913 |
_Is_Delim __is_delim,
|
williamr@2
|
914 |
bool __extract_delim, bool __set_failbit)
|
williamr@2
|
915 |
{
|
williamr@2
|
916 |
bool __done = false;
|
williamr@2
|
917 |
ios_base::iostate __status = 0;
|
williamr@2
|
918 |
typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
|
williamr@2
|
919 |
|
williamr@2
|
920 |
_STLP_TRY {
|
williamr@2
|
921 |
#ifdef __SYMBIAN32__
|
williamr@2
|
922 |
int_type __c = __buf->sgetc();
|
williamr@2
|
923 |
do {
|
williamr@2
|
924 |
|
williamr@2
|
925 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
926 |
__done = true;
|
williamr@2
|
927 |
__status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
|
williamr@2
|
928 |
: ios_base::eofbit;
|
williamr@2
|
929 |
break;
|
williamr@2
|
930 |
}
|
williamr@2
|
931 |
|
williamr@2
|
932 |
else if (__is_delim(__c)) {
|
williamr@2
|
933 |
__done = true;
|
williamr@2
|
934 |
if (__extract_delim)
|
williamr@2
|
935 |
__buf->snextc();
|
williamr@2
|
936 |
break;
|
williamr@2
|
937 |
|
williamr@2
|
938 |
}
|
williamr@2
|
939 |
__c = __buf->snextc();
|
williamr@2
|
940 |
} while(!__done);
|
williamr@2
|
941 |
#else
|
williamr@2
|
942 |
while (!__done) {
|
williamr@2
|
943 |
int_type __c = __buf->sbumpc();
|
williamr@2
|
944 |
|
williamr@2
|
945 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
946 |
__done = true;
|
williamr@2
|
947 |
__status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
|
williamr@2
|
948 |
: ios_base::eofbit;
|
williamr@2
|
949 |
}
|
williamr@2
|
950 |
|
williamr@2
|
951 |
else if (__is_delim(__c)) {
|
williamr@2
|
952 |
__done = true;
|
williamr@2
|
953 |
if (!__extract_delim)
|
williamr@2
|
954 |
if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
|
williamr@2
|
955 |
__status |= ios_base::failbit;
|
williamr@2
|
956 |
}
|
williamr@2
|
957 |
}
|
williamr@2
|
958 |
#endif
|
williamr@2
|
959 |
}
|
williamr@2
|
960 |
_STLP_CATCH_ALL {
|
williamr@2
|
961 |
__that->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
962 |
}
|
williamr@2
|
963 |
|
williamr@2
|
964 |
__that->setstate(__status);
|
williamr@2
|
965 |
}
|
williamr@2
|
966 |
|
williamr@2
|
967 |
// A generic buffered function for ignoring characters. Much like
|
williamr@2
|
968 |
// _M_ignore_unbuffered, but with one additional function object:
|
williamr@2
|
969 |
// __scan_delim(first, last) returns the first pointer p in [first,
|
williamr@2
|
970 |
// last) such that __is_delim(p) is true.
|
williamr@2
|
971 |
|
williamr@2
|
972 |
template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
|
williamr@2
|
973 |
void _STLP_CALL
|
williamr@2
|
974 |
_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
|
williamr@2
|
975 |
basic_streambuf<_CharT, _Traits>* __buf,
|
williamr@2
|
976 |
_Is_Delim __is_delim, _Scan_Delim __scan_delim,
|
williamr@2
|
977 |
bool __extract_delim, bool __set_failbit)
|
williamr@2
|
978 |
{
|
williamr@2
|
979 |
bool __at_eof = false;
|
williamr@2
|
980 |
bool __found_delim = false;
|
williamr@2
|
981 |
|
williamr@2
|
982 |
_STLP_TRY {
|
williamr@2
|
983 |
while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) {
|
williamr@2
|
984 |
const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
|
williamr@2
|
985 |
__buf->_M_gbump((int)(__p - __buf->_M_gptr()));
|
williamr@2
|
986 |
|
williamr@2
|
987 |
if (__p != __buf->_M_egptr()) { // We found delim, so we're done.
|
williamr@2
|
988 |
if (__extract_delim)
|
williamr@2
|
989 |
__buf->_M_gbump(1);
|
williamr@2
|
990 |
__found_delim = true;
|
williamr@2
|
991 |
}
|
williamr@2
|
992 |
|
williamr@2
|
993 |
else // No delim. Try to refil the buffer.
|
williamr@2
|
994 |
__at_eof = __that->_S_eof(__buf->sgetc());
|
williamr@2
|
995 |
} // Close the while loop.
|
williamr@2
|
996 |
}
|
williamr@2
|
997 |
_STLP_CATCH_ALL {
|
williamr@2
|
998 |
__that->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
999 |
return;
|
williamr@2
|
1000 |
}
|
williamr@2
|
1001 |
|
williamr@2
|
1002 |
if (__at_eof) {
|
williamr@2
|
1003 |
__that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
|
williamr@2
|
1004 |
: ios_base::eofbit);
|
williamr@2
|
1005 |
return;
|
williamr@2
|
1006 |
}
|
williamr@2
|
1007 |
if (__found_delim)
|
williamr@2
|
1008 |
return;
|
williamr@2
|
1009 |
|
williamr@2
|
1010 |
// If execution has reached this point, then we have an empty buffer but
|
williamr@2
|
1011 |
// we have not reached eof. What that means is that the streambuf has
|
williamr@2
|
1012 |
// decided to switch from a buffered to an unbuffered mode. We switch
|
williamr@2
|
1013 |
// to _M_ignore_unbuffered.
|
williamr@2
|
1014 |
_M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit);
|
williamr@2
|
1015 |
}
|
williamr@2
|
1016 |
|
williamr@2
|
1017 |
// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered
|
williamr@2
|
1018 |
// with an explicit count _Num. Return value is the number of
|
williamr@2
|
1019 |
// characters extracted.
|
williamr@2
|
1020 |
//
|
williamr@2
|
1021 |
// The function object __max_chars takes two arguments, _Num and __n
|
williamr@2
|
1022 |
// (the latter being the number of characters we have already read),
|
williamr@2
|
1023 |
// and returns the maximum number of characters to read from the buffer.
|
williamr@2
|
1024 |
// We parameterize _M_ignore_buffered so that we can use it for both
|
williamr@2
|
1025 |
// bounded and unbounded input; for the former the function object should
|
williamr@2
|
1026 |
// be minus<>, and for the latter it should return a constant maximum value.
|
williamr@2
|
1027 |
|
williamr@2
|
1028 |
template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim>
|
williamr@2
|
1029 |
streamsize _STLP_CALL
|
williamr@2
|
1030 |
_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
|
williamr@2
|
1031 |
basic_streambuf<_CharT, _Traits>* __buf,
|
williamr@2
|
1032 |
streamsize _Num, _Max_Chars __max_chars,
|
williamr@2
|
1033 |
_Is_Delim __is_delim,
|
williamr@2
|
1034 |
bool __extract_delim, bool __set_failbit)
|
williamr@2
|
1035 |
{
|
williamr@2
|
1036 |
streamsize __n = 0;
|
williamr@2
|
1037 |
ios_base::iostate __status = 0;
|
williamr@2
|
1038 |
typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
|
williamr@2
|
1039 |
|
williamr@2
|
1040 |
_STLP_TRY {
|
williamr@2
|
1041 |
while (__max_chars(_Num, __n) > 0) {
|
williamr@2
|
1042 |
int_type __c = __buf->sbumpc();
|
williamr@2
|
1043 |
|
williamr@2
|
1044 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
1045 |
__status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
|
williamr@2
|
1046 |
: ios_base::eofbit;
|
williamr@2
|
1047 |
break;
|
williamr@2
|
1048 |
}
|
williamr@2
|
1049 |
|
williamr@2
|
1050 |
else if (__is_delim(__c)) {
|
williamr@2
|
1051 |
if (__extract_delim)
|
williamr@2
|
1052 |
++__n;
|
williamr@2
|
1053 |
else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
|
williamr@2
|
1054 |
__status |= ios_base::failbit;
|
williamr@2
|
1055 |
|
williamr@2
|
1056 |
break;
|
williamr@2
|
1057 |
}
|
williamr@2
|
1058 |
// fbp : added counter increment to pass Dietmar's test
|
williamr@2
|
1059 |
++__n;
|
williamr@2
|
1060 |
}
|
williamr@2
|
1061 |
}
|
williamr@2
|
1062 |
_STLP_CATCH_ALL {
|
williamr@2
|
1063 |
__that->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
1064 |
}
|
williamr@2
|
1065 |
|
williamr@2
|
1066 |
if (__status)
|
williamr@2
|
1067 |
__that->setstate(__status); // This might throw.
|
williamr@2
|
1068 |
return __n;
|
williamr@2
|
1069 |
}
|
williamr@2
|
1070 |
|
williamr@2
|
1071 |
template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim>
|
williamr@2
|
1072 |
streamsize _STLP_CALL
|
williamr@2
|
1073 |
_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
|
williamr@2
|
1074 |
basic_streambuf<_CharT, _Traits>* __buf,
|
williamr@2
|
1075 |
streamsize _Num,
|
williamr@2
|
1076 |
_Max_Chars __max_chars,
|
williamr@2
|
1077 |
_Is_Delim __is_delim, _Scan_Delim __scan_delim,
|
williamr@2
|
1078 |
bool __extract_delim, bool __set_failbit)
|
williamr@2
|
1079 |
{
|
williamr@2
|
1080 |
streamsize __n = 0;
|
williamr@2
|
1081 |
bool __at_eof = false;
|
williamr@2
|
1082 |
bool __done = false;
|
williamr@2
|
1083 |
|
williamr@2
|
1084 |
_STLP_TRY {
|
williamr@2
|
1085 |
while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
|
williamr@2
|
1086 |
ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr();
|
williamr@2
|
1087 |
streamsize __m = __max_chars(_Num, __n);
|
williamr@2
|
1088 |
|
williamr@2
|
1089 |
if (__avail >= __m) { // We have more characters than we need.
|
williamr@2
|
1090 |
const _CharT* __last = __buf->_M_gptr() + __m;
|
williamr@2
|
1091 |
const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last);
|
williamr@2
|
1092 |
ptrdiff_t __chunk = __p - __buf->_M_gptr();
|
williamr@2
|
1093 |
__n += __chunk;
|
williamr@2
|
1094 |
__buf->_M_gbump((int)__chunk);
|
williamr@2
|
1095 |
|
williamr@2
|
1096 |
if (__extract_delim && __p != __last) {
|
williamr@2
|
1097 |
__n += 1;
|
williamr@2
|
1098 |
__buf->_M_gbump(1);
|
williamr@2
|
1099 |
}
|
williamr@2
|
1100 |
|
williamr@2
|
1101 |
__done = true;
|
williamr@2
|
1102 |
}
|
williamr@2
|
1103 |
|
williamr@2
|
1104 |
else {
|
williamr@2
|
1105 |
const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
|
williamr@2
|
1106 |
ptrdiff_t __chunk = __p - __buf->_M_gptr();
|
williamr@2
|
1107 |
__n += __chunk;
|
williamr@2
|
1108 |
__buf->_M_gbump((int)__chunk);
|
williamr@2
|
1109 |
|
williamr@2
|
1110 |
if (__p != __buf->_M_egptr()) { // We found delim.
|
williamr@2
|
1111 |
if (__extract_delim) {
|
williamr@2
|
1112 |
__n += 1;
|
williamr@2
|
1113 |
__buf->_M_gbump(1);
|
williamr@2
|
1114 |
}
|
williamr@2
|
1115 |
|
williamr@2
|
1116 |
__done = true;
|
williamr@2
|
1117 |
}
|
williamr@2
|
1118 |
|
williamr@2
|
1119 |
// We didn't find delim. Try to refill the buffer.
|
williamr@2
|
1120 |
else if (__that->_S_eof(__buf->sgetc())) {
|
williamr@2
|
1121 |
__done = true;
|
williamr@2
|
1122 |
__at_eof = true;
|
williamr@2
|
1123 |
}
|
williamr@2
|
1124 |
}
|
williamr@2
|
1125 |
} // Close the while loop.
|
williamr@2
|
1126 |
}
|
williamr@2
|
1127 |
_STLP_CATCH_ALL {
|
williamr@2
|
1128 |
__that->_M_handle_exception(ios_base::badbit);
|
williamr@2
|
1129 |
return __n;
|
williamr@2
|
1130 |
}
|
williamr@2
|
1131 |
|
williamr@2
|
1132 |
if (__at_eof)
|
williamr@2
|
1133 |
__that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
|
williamr@2
|
1134 |
: ios_base::eofbit);
|
williamr@2
|
1135 |
|
williamr@2
|
1136 |
if (__done)
|
williamr@2
|
1137 |
return __n;
|
williamr@2
|
1138 |
|
williamr@2
|
1139 |
// If execution has reached this point, then we have an empty buffer but
|
williamr@2
|
1140 |
// we have not reached eof. What that means is that the streambuf has
|
williamr@2
|
1141 |
// decided to switch from buffered to unbuffered input. We switch to
|
williamr@2
|
1142 |
// to _M_ignore_unbuffered.
|
williamr@2
|
1143 |
|
williamr@2
|
1144 |
return __n + _M_ignore_unbuffered( __that, __buf, _Num, __max_chars,
|
williamr@2
|
1145 |
__is_delim, __extract_delim, __set_failbit);
|
williamr@2
|
1146 |
}
|
williamr@2
|
1147 |
|
williamr@2
|
1148 |
|
williamr@2
|
1149 |
template <class _CharT, class _Traits>
|
williamr@2
|
1150 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
1151 |
basic_istream<_CharT, _Traits>::ignore(streamsize __n)
|
williamr@2
|
1152 |
{
|
williamr@2
|
1153 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
1154 |
this->_M_gcount = 0;
|
williamr@2
|
1155 |
|
williamr@2
|
1156 |
if (__sentry) {
|
williamr@2
|
1157 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
1158 |
typedef _Constant_unary_fun<bool, int_type> _Const_bool;
|
williamr@2
|
1159 |
typedef _Constant_binary_fun<streamsize, streamsize, streamsize>
|
williamr@2
|
1160 |
_Const_streamsize;
|
williamr@2
|
1161 |
const streamsize __maxss = (numeric_limits<streamsize>::max)();
|
williamr@2
|
1162 |
|
williamr@2
|
1163 |
if (__n == (numeric_limits<int>::max)()) {
|
williamr@2
|
1164 |
if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
1165 |
_M_gcount
|
williamr@2
|
1166 |
= _M_ignore_buffered(this, __buf,
|
williamr@2
|
1167 |
__maxss, _Const_streamsize(__maxss),
|
williamr@2
|
1168 |
_Const_bool(false),
|
williamr@2
|
1169 |
_Project2nd<const _CharT*, const _CharT*>(),
|
williamr@2
|
1170 |
false, false);
|
williamr@2
|
1171 |
else
|
williamr@2
|
1172 |
_M_gcount = _M_ignore_unbuffered(this, __buf,
|
williamr@2
|
1173 |
__maxss, _Const_streamsize(__maxss),
|
williamr@2
|
1174 |
_Const_bool(false), false, false);
|
williamr@2
|
1175 |
}
|
williamr@2
|
1176 |
else {
|
williamr@2
|
1177 |
if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
1178 |
_M_gcount
|
williamr@2
|
1179 |
= _M_ignore_buffered(this, __buf,
|
williamr@2
|
1180 |
__n, minus<streamsize>(),
|
williamr@2
|
1181 |
_Const_bool(false),
|
williamr@2
|
1182 |
_Project2nd<const _CharT*, const _CharT*>(),
|
williamr@2
|
1183 |
false, false);
|
williamr@2
|
1184 |
else
|
williamr@2
|
1185 |
_M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
|
williamr@2
|
1186 |
_Const_bool(false), false, false);
|
williamr@2
|
1187 |
}
|
williamr@2
|
1188 |
}
|
williamr@2
|
1189 |
|
williamr@2
|
1190 |
return *this;
|
williamr@2
|
1191 |
}
|
williamr@2
|
1192 |
|
williamr@2
|
1193 |
template <class _CharT, class _Traits>
|
williamr@2
|
1194 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
1195 |
basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim)
|
williamr@2
|
1196 |
{
|
williamr@2
|
1197 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
1198 |
this->_M_gcount = 0;
|
williamr@2
|
1199 |
|
williamr@2
|
1200 |
if (__sentry) {
|
williamr@2
|
1201 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
1202 |
typedef _Constant_unary_fun<bool, int_type> _Const_bool;
|
williamr@2
|
1203 |
typedef _Constant_binary_fun<streamsize, streamsize, streamsize>
|
williamr@2
|
1204 |
_Const_streamsize;
|
williamr@2
|
1205 |
const streamsize __maxss = (numeric_limits<streamsize>::max)();
|
williamr@2
|
1206 |
|
williamr@2
|
1207 |
if (__n == (numeric_limits<int>::max)()) {
|
williamr@2
|
1208 |
if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
1209 |
_M_gcount = _M_ignore_buffered(this, __buf,
|
williamr@2
|
1210 |
__maxss, _Const_streamsize(__maxss),
|
williamr@2
|
1211 |
_Eq_int_bound<_Traits>(__delim),
|
williamr@2
|
1212 |
_Scan_for_int_val<_Traits>(__delim),
|
williamr@2
|
1213 |
true, false);
|
williamr@2
|
1214 |
else
|
williamr@2
|
1215 |
_M_gcount = _M_ignore_unbuffered(this, __buf,
|
williamr@2
|
1216 |
__maxss, _Const_streamsize(__maxss),
|
williamr@2
|
1217 |
_Eq_int_bound<_Traits>(__delim),
|
williamr@2
|
1218 |
true, false);
|
williamr@2
|
1219 |
}
|
williamr@2
|
1220 |
else {
|
williamr@2
|
1221 |
if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
1222 |
_M_gcount = _M_ignore_buffered(this, __buf,
|
williamr@2
|
1223 |
__n, minus<streamsize>(),
|
williamr@2
|
1224 |
_Eq_int_bound<_Traits>(
|
williamr@2
|
1225 |
__delim),
|
williamr@2
|
1226 |
_Scan_for_int_val<_Traits>(__delim),
|
williamr@2
|
1227 |
true, false);
|
williamr@2
|
1228 |
else
|
williamr@2
|
1229 |
_M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
|
williamr@2
|
1230 |
_Eq_int_bound<_Traits>(__delim),
|
williamr@2
|
1231 |
true, false);
|
williamr@2
|
1232 |
}
|
williamr@2
|
1233 |
}
|
williamr@2
|
1234 |
|
williamr@2
|
1235 |
return *this;
|
williamr@2
|
1236 |
}
|
williamr@2
|
1237 |
|
williamr@2
|
1238 |
// This member function does not construct a sentry object, because
|
williamr@2
|
1239 |
// it is called from sentry's constructor.
|
williamr@2
|
1240 |
template <class _CharT, class _Traits>
|
williamr@2
|
1241 |
void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit)
|
williamr@2
|
1242 |
{
|
williamr@2
|
1243 |
basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
|
williamr@2
|
1244 |
if (!__buf)
|
williamr@2
|
1245 |
this->setstate(ios_base::badbit);
|
williamr@2
|
1246 |
else if (__buf->gptr() != __buf->egptr())
|
williamr@2
|
1247 |
_M_ignore_buffered(this, __buf,
|
williamr@2
|
1248 |
_Is_not_wspace<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
|
williamr@2
|
1249 |
_Scan_for_not_wspace<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
|
williamr@2
|
1250 |
false, __set_failbit);
|
williamr@2
|
1251 |
else
|
williamr@2
|
1252 |
_M_ignore_unbuffered(this, __buf,
|
williamr@2
|
1253 |
_Is_not_wspace<_Traits>((const ctype<_CharT>*)this->_M_ctype_facet()),
|
williamr@2
|
1254 |
false, __set_failbit);
|
williamr@2
|
1255 |
}
|
williamr@2
|
1256 |
|
williamr@2
|
1257 |
|
williamr@2
|
1258 |
// This is a very simple loop that reads characters from __src and puts
|
williamr@2
|
1259 |
// them into __dest. It looks complicated because of the (standard-
|
williamr@2
|
1260 |
// mandated) exception handling policy.
|
williamr@2
|
1261 |
//
|
williamr@2
|
1262 |
// We stop when we get an exception, when we fail to insert into the
|
williamr@2
|
1263 |
// output streambuf, or when __is_delim is true.
|
williamr@2
|
1264 |
|
williamr@2
|
1265 |
template < class _CharT, class _Traits, class _Is_Delim>
|
williamr@2
|
1266 |
streamsize _STLP_CALL
|
williamr@2
|
1267 |
_M_copy_unbuffered( basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
|
williamr@2
|
1268 |
basic_streambuf<_CharT, _Traits>* __dest,
|
williamr@2
|
1269 |
_Is_Delim __is_delim,
|
williamr@2
|
1270 |
bool __extract_delim, bool __rethrow)
|
williamr@2
|
1271 |
{
|
williamr@2
|
1272 |
streamsize __extracted = 0;
|
williamr@2
|
1273 |
ios_base::iostate __status = 0;
|
williamr@2
|
1274 |
typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
|
williamr@2
|
1275 |
int_type __c;
|
williamr@2
|
1276 |
|
williamr@2
|
1277 |
_STLP_TRY {
|
williamr@2
|
1278 |
#ifdef __SYMBIAN32__
|
williamr@2
|
1279 |
__c = __src->sgetc();
|
williamr@2
|
1280 |
for(;; __c = __src->snextc()){
|
williamr@2
|
1281 |
|
williamr@2
|
1282 |
// If we failed to get a character, then quit.
|
williamr@2
|
1283 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
1284 |
__status |= ios_base::eofbit;
|
williamr@2
|
1285 |
break;
|
williamr@2
|
1286 |
}
|
williamr@2
|
1287 |
// If it's the delimiter, then quit.
|
williamr@2
|
1288 |
else if (__is_delim(__c)) {
|
williamr@2
|
1289 |
if (!__extract_delim)
|
williamr@2
|
1290 |
__status |= ios_base::failbit;
|
williamr@2
|
1291 |
break;
|
williamr@2
|
1292 |
}
|
williamr@2
|
1293 |
|
williamr@2
|
1294 |
else {
|
williamr@2
|
1295 |
|
williamr@2
|
1296 |
// Try to put the character in the output streambuf.
|
williamr@2
|
1297 |
_STLP_TRY {
|
williamr@2
|
1298 |
if (!__that->_S_eof(__dest->sputc(__c)))
|
williamr@2
|
1299 |
++__extracted;
|
williamr@2
|
1300 |
else
|
williamr@2
|
1301 |
break;
|
williamr@2
|
1302 |
}
|
williamr@2
|
1303 |
_STLP_CATCH_ALL {
|
williamr@2
|
1304 |
__status |= ios_base::failbit;
|
williamr@2
|
1305 |
break;
|
williamr@2
|
1306 |
}
|
williamr@2
|
1307 |
|
williamr@2
|
1308 |
}
|
williamr@2
|
1309 |
|
williamr@2
|
1310 |
} /* while (true) */
|
williamr@2
|
1311 |
#else
|
williamr@2
|
1312 |
while (true) {
|
williamr@2
|
1313 |
|
williamr@2
|
1314 |
// Get a character. If there's an exception, catch and (maybe) rethrow it.
|
williamr@2
|
1315 |
__c = __src->sbumpc();
|
williamr@2
|
1316 |
|
williamr@2
|
1317 |
// If we failed to get a character, then quit.
|
williamr@2
|
1318 |
if (__that->_S_eof(__c)) {
|
williamr@2
|
1319 |
__status |= ios_base::eofbit;
|
williamr@2
|
1320 |
break;
|
williamr@2
|
1321 |
}
|
williamr@2
|
1322 |
// If it's the delimiter, then quit.
|
williamr@2
|
1323 |
else if (__is_delim(__c)) {
|
williamr@2
|
1324 |
if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c)))
|
williamr@2
|
1325 |
__status |= ios_base::failbit;
|
williamr@2
|
1326 |
break;
|
williamr@2
|
1327 |
}
|
williamr@2
|
1328 |
|
williamr@2
|
1329 |
else {
|
williamr@2
|
1330 |
|
williamr@2
|
1331 |
// Try to put the character in the output streambuf.
|
williamr@2
|
1332 |
bool __failed = false;
|
williamr@2
|
1333 |
_STLP_TRY {
|
williamr@2
|
1334 |
if (!__that->_S_eof(__dest->sputc(__c)))
|
williamr@2
|
1335 |
++__extracted;
|
williamr@2
|
1336 |
else
|
williamr@2
|
1337 |
__failed = true;
|
williamr@2
|
1338 |
}
|
williamr@2
|
1339 |
_STLP_CATCH_ALL {
|
williamr@2
|
1340 |
__failed = true;
|
williamr@2
|
1341 |
}
|
williamr@2
|
1342 |
|
williamr@2
|
1343 |
// If we failed to put the character in the output streambuf, then
|
williamr@2
|
1344 |
// try to push it back to the input streambuf.
|
williamr@2
|
1345 |
if (__failed && !__pushback(__src, _Traits::to_char_type(__c)))
|
williamr@2
|
1346 |
__status |= ios_base::failbit;
|
williamr@2
|
1347 |
|
williamr@2
|
1348 |
// fbp : avoiding infinite loop in io-27-6-1-2-3.exp
|
williamr@2
|
1349 |
if (__failed)
|
williamr@2
|
1350 |
break;
|
williamr@2
|
1351 |
}
|
williamr@2
|
1352 |
|
williamr@2
|
1353 |
} /* while (true) */
|
williamr@2
|
1354 |
#endif
|
williamr@2
|
1355 |
}
|
williamr@2
|
1356 |
// fbp : this try/catch moved here in reasonable assumption
|
williamr@2
|
1357 |
// __is_delim never throw (__pushback is guaranteed not to)
|
williamr@2
|
1358 |
_STLP_CATCH_ALL {
|
williamr@2
|
1359 |
// See 27.6.1.2.3, paragraph 13.
|
williamr@2
|
1360 |
if (__rethrow && __extracted == 0)
|
williamr@2
|
1361 |
__that->_M_handle_exception(ios_base::failbit);
|
williamr@2
|
1362 |
}
|
williamr@2
|
1363 |
__that->setstate(__status);
|
williamr@2
|
1364 |
return __extracted;
|
williamr@2
|
1365 |
}
|
williamr@2
|
1366 |
|
williamr@2
|
1367 |
// Buffered copying from one streambuf to another. We copy the characters
|
williamr@2
|
1368 |
// in chunks, rather than one at a time. We still have to worry about all
|
williamr@2
|
1369 |
// of the error conditions we checked in _M_copy_unbuffered, plus one more:
|
williamr@2
|
1370 |
// the streambuf might decide to switch from a buffered to an unbuffered mode.
|
williamr@2
|
1371 |
|
williamr@2
|
1372 |
template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
|
williamr@2
|
1373 |
streamsize _STLP_CALL
|
williamr@2
|
1374 |
_M_copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
|
williamr@2
|
1375 |
basic_streambuf<_CharT, _Traits>* __dest,
|
williamr@2
|
1376 |
_Scan_Delim __scan_delim, _Is_Delim __is_delim,
|
williamr@2
|
1377 |
bool __extract_delim, bool __rethrow)
|
williamr@2
|
1378 |
{
|
williamr@2
|
1379 |
streamsize __extracted = 0;
|
williamr@2
|
1380 |
ios_base::iostate __status = 0;
|
williamr@2
|
1381 |
typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
|
williamr@2
|
1382 |
int_type __c = _Traits::eof();
|
williamr@2
|
1383 |
_CharT* __first = __src->_M_gptr();
|
williamr@2
|
1384 |
ptrdiff_t __avail = __src->_M_egptr() - __first;
|
williamr@2
|
1385 |
// fbp : introduced to move catch/try blocks out of the loop
|
williamr@2
|
1386 |
bool __do_handle_exceptions;
|
williamr@2
|
1387 |
|
williamr@2
|
1388 |
_STLP_TRY {
|
williamr@2
|
1389 |
while (true) {
|
williamr@2
|
1390 |
__do_handle_exceptions = false ;
|
williamr@2
|
1391 |
const _CharT* __last = __scan_delim(__first, __src->_M_egptr());
|
williamr@2
|
1392 |
|
williamr@2
|
1393 |
// Try to copy the entire input buffer to the output buffer.
|
williamr@2
|
1394 |
streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr()
|
williamr@2
|
1395 |
? (__last - __first) + 1
|
williamr@2
|
1396 |
: (__last - __first));
|
williamr@2
|
1397 |
__src->_M_gbump((int)__n);
|
williamr@2
|
1398 |
__extracted += __n;
|
williamr@2
|
1399 |
|
williamr@2
|
1400 |
// from this on, catch() will call _M_handle_exceptions()
|
williamr@2
|
1401 |
__do_handle_exceptions = true;
|
williamr@2
|
1402 |
|
williamr@2
|
1403 |
if (__n < __avail) // We found the delimiter, or else failed to
|
williamr@2
|
1404 |
break; // copy some characters.
|
williamr@2
|
1405 |
|
williamr@2
|
1406 |
__c = __src->sgetc();
|
williamr@2
|
1407 |
|
williamr@2
|
1408 |
// Three possibilities: we succeeded in refilling the buffer, or
|
williamr@2
|
1409 |
// we got EOF, or the streambuf has switched to unbuffered mode.
|
williamr@2
|
1410 |
__first = __src->_M_gptr();
|
williamr@2
|
1411 |
__avail = __src->_M_egptr() - __first;
|
williamr@2
|
1412 |
|
williamr@2
|
1413 |
if (__avail > 0)
|
williamr@2
|
1414 |
{} // dwa 1/16/00 -- suppress a Metrowerks warning
|
williamr@2
|
1415 |
else if (__that->_S_eof(__c)) {
|
williamr@2
|
1416 |
__status |= ios_base::eofbit;
|
williamr@2
|
1417 |
break;
|
williamr@2
|
1418 |
}
|
williamr@2
|
1419 |
else
|
williamr@2
|
1420 |
return __extracted + _M_copy_unbuffered(__that, __src, __dest, __is_delim,
|
williamr@2
|
1421 |
__extract_delim, __rethrow);
|
williamr@2
|
1422 |
} /* while */
|
williamr@2
|
1423 |
}
|
williamr@2
|
1424 |
|
williamr@2
|
1425 |
_STLP_CATCH_ALL {
|
williamr@2
|
1426 |
// See 27.6.1.2.3, paragraph 13.
|
williamr@2
|
1427 |
if (__rethrow && __do_handle_exceptions && __extracted == 0)
|
williamr@2
|
1428 |
__that->_M_handle_exception(ios_base::failbit);
|
williamr@2
|
1429 |
}
|
williamr@2
|
1430 |
|
williamr@2
|
1431 |
if (__status)
|
williamr@2
|
1432 |
__that->setstate(__status); // This might throw.
|
williamr@2
|
1433 |
return __extracted;
|
williamr@2
|
1434 |
}
|
williamr@2
|
1435 |
|
williamr@2
|
1436 |
|
williamr@2
|
1437 |
|
williamr@2
|
1438 |
template <class _CharT, class _Traits>
|
williamr@2
|
1439 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
1440 |
basic_istream<_CharT, _Traits>
|
williamr@2
|
1441 |
::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim)
|
williamr@2
|
1442 |
{
|
williamr@2
|
1443 |
sentry __sentry(*this, _No_Skip_WS());
|
williamr@2
|
1444 |
this->_M_gcount = 0;
|
williamr@2
|
1445 |
|
williamr@2
|
1446 |
if (__sentry) {
|
williamr@2
|
1447 |
basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
|
williamr@2
|
1448 |
|
williamr@2
|
1449 |
if (__src)
|
williamr@2
|
1450 |
this->_M_gcount = __src->egptr() != __src->gptr()
|
williamr@2
|
1451 |
? _M_copy_buffered(this, __src, &__dest,
|
williamr@2
|
1452 |
_Scan_for_char_val<_Traits>(__delim),
|
williamr@2
|
1453 |
_Eq_char_bound<_Traits>(__delim),
|
williamr@2
|
1454 |
false, false)
|
williamr@2
|
1455 |
: _M_copy_unbuffered(this, __src, &__dest,
|
williamr@2
|
1456 |
_Eq_char_bound<_Traits>(__delim),
|
williamr@2
|
1457 |
false, false);
|
williamr@2
|
1458 |
}
|
williamr@2
|
1459 |
|
williamr@2
|
1460 |
if (this->_M_gcount == 0)
|
williamr@2
|
1461 |
this->setstate(ios_base::failbit);
|
williamr@2
|
1462 |
|
williamr@2
|
1463 |
return *this;
|
williamr@2
|
1464 |
}
|
williamr@2
|
1465 |
|
williamr@2
|
1466 |
// Copying characters into a streambuf.
|
williamr@2
|
1467 |
template <class _CharT, class _Traits>
|
williamr@2
|
1468 |
basic_istream<_CharT, _Traits>&
|
williamr@2
|
1469 |
basic_istream<_CharT, _Traits>
|
williamr@2
|
1470 |
::operator>>(basic_streambuf<_CharT, _Traits>* __dest)
|
williamr@2
|
1471 |
{
|
williamr@2
|
1472 |
streamsize __n = 0;
|
williamr@2
|
1473 |
typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
|
williamr@2
|
1474 |
_Sentry __sentry(*this);
|
williamr@2
|
1475 |
if (__sentry) {
|
williamr@2
|
1476 |
basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
|
williamr@2
|
1477 |
if (__src && __dest)
|
williamr@2
|
1478 |
__n = __src->egptr() != __src->gptr()
|
williamr@2
|
1479 |
? _M_copy_buffered(this, __src, __dest,
|
williamr@2
|
1480 |
_Project2nd<const _CharT*, const _CharT*>(),
|
williamr@2
|
1481 |
_Constant_unary_fun<bool, int_type>(false),
|
williamr@2
|
1482 |
false, true)
|
williamr@2
|
1483 |
: _M_copy_unbuffered(this, __src, __dest,
|
williamr@2
|
1484 |
_Constant_unary_fun<bool, int_type>(false),
|
williamr@2
|
1485 |
false, true);
|
williamr@2
|
1486 |
}
|
williamr@2
|
1487 |
|
williamr@2
|
1488 |
if (__n == 0)
|
williamr@2
|
1489 |
this->setstate(ios_base::failbit);
|
williamr@2
|
1490 |
|
williamr@2
|
1491 |
return *this;
|
williamr@2
|
1492 |
}
|
williamr@2
|
1493 |
|
williamr@2
|
1494 |
// ----------------------------------------------------------------
|
williamr@2
|
1495 |
// basic_iostream<> class
|
williamr@2
|
1496 |
// ----------------------------------------------------------------
|
williamr@2
|
1497 |
|
williamr@2
|
1498 |
template <class _CharT, class _Traits>
|
williamr@2
|
1499 |
_STLP_EXP_DECLSPEC basic_iostream<_CharT, _Traits>
|
williamr@2
|
1500 |
::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf)
|
williamr@2
|
1501 |
: basic_ios<_CharT, _Traits>(),
|
williamr@2
|
1502 |
basic_istream<_CharT, _Traits>(__buf),
|
williamr@2
|
1503 |
basic_ostream<_CharT, _Traits>(__buf)
|
williamr@2
|
1504 |
{
|
williamr@2
|
1505 |
this->init(__buf);
|
williamr@2
|
1506 |
}
|
williamr@2
|
1507 |
|
williamr@2
|
1508 |
template <class _CharT, class _Traits>
|
williamr@2
|
1509 |
_STLP_EXP_DECLSPEC basic_iostream<_CharT, _Traits>::~basic_iostream()
|
williamr@2
|
1510 |
{}
|
williamr@2
|
1511 |
|
williamr@2
|
1512 |
|
williamr@2
|
1513 |
template <class _CharT, class _Traits>
|
williamr@2
|
1514 |
_STLP_EXP_DECLSPEC basic_istream<_CharT, _Traits>
|
williamr@2
|
1515 |
::basic_istream(basic_streambuf<_CharT, _Traits>* __buf) :
|
williamr@2
|
1516 |
basic_ios<_CharT, _Traits>(), _M_gcount(0) {
|
williamr@2
|
1517 |
this->init(__buf);
|
williamr@2
|
1518 |
}
|
williamr@2
|
1519 |
|
williamr@2
|
1520 |
template <class _CharT, class _Traits>
|
williamr@2
|
1521 |
_STLP_EXP_DECLSPEC basic_istream<_CharT, _Traits>
|
williamr@2
|
1522 |
::~basic_istream() {}
|
williamr@2
|
1523 |
|
williamr@2
|
1524 |
|
williamr@2
|
1525 |
|
williamr@2
|
1526 |
_STLP_END_NAMESPACE
|
williamr@2
|
1527 |
|
williamr@2
|
1528 |
# undef __BIS_int_type__
|
williamr@2
|
1529 |
# undef __BIS_pos_type__
|
williamr@2
|
1530 |
# undef __BIS_off_type__
|
williamr@2
|
1531 |
|
williamr@2
|
1532 |
# endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */
|
williamr@2
|
1533 |
|
williamr@2
|
1534 |
#endif /* _STLP_ISTREAM_C */
|