ReactOS 0.4.15-dev-7958-gcd0bb1a
_ostreambuf_iterator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 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// WARNING: This is an internal header file, included by other C++
19// standard library headers. You should not attempt to use this header
20// file directly.
21
22
23#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
24#define _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
25
26#ifndef _STLP_INTERNAL_STREAMBUF
27# include <stl/_streambuf.h>
28#endif
29
31
33
34template<class _CharT, class _Traits>
36
38
39// The default template argument is declared in iosfwd
40template <class _CharT, class _Traits>
42 public iterator<output_iterator_tag, void, void, void, void> {
43public:
44 typedef _CharT char_type;
45 typedef _Traits traits_type;
46 typedef typename _Traits::int_type int_type;
49
51 typedef void value_type;
52 typedef void difference_type;
53 typedef void pointer;
54 typedef void reference;
55
56public:
58 // ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(__get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
60
62 _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
63 traits_type::eof());
64 return *this;
65 }
66
70
71 bool failed() const { return !_M_ok; }
72
73private:
75 bool _M_ok;
76};
77
78template <class _CharT, class _Traits>
80 : _M_buf(_STLP_PRIV __get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
81
82#if defined (_STLP_USE_TEMPLATE_EXPORT)
84# if defined (INSTANTIATE_WIDE_STREAMS)
86# endif
87#endif /* _STLP_USE_TEMPLATE_EXPORT */
88
89#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
90template <class _CharT, class _Traits>
92iterator_category(const ostreambuf_iterator<_CharT, _Traits>&) { return output_iterator_tag(); }
93#endif
94
96
97#endif /* _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H */
98
99// Local Variables:
100// mode:C++
101// End:
102
#define output_iterator_tag
Definition: _abbrevs.h:26
#define _STLP_CALL
Definition: _bc.h:131
#define _STLP_PRIV
Definition: _dm.h:70
#define _STLP_NOTHROW
Definition: _intel.h:35
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE basic_streambuf< _CharT, _Traits > *_STLP_CALL __get_ostreambuf(basic_ostream< _CharT, _Traits > &)
Definition: _ostream.h:233
int_type sputc(char_type __c)
Definition: _streambuf.h:198
basic_streambuf< _CharT, _Traits > streambuf_type
ostreambuf_iterator< _CharT, _Traits > & operator++(int)
ostreambuf_iterator< _CharT, _Traits > & operator*()
basic_ostream< _CharT, _Traits > ostream_type
ostreambuf_iterator< _CharT, _Traits > & operator++()
ostreambuf_iterator< _CharT, _Traits > & operator=(char_type __c)
streambuf_type * _M_buf
output_iterator_tag iterator_category
_Traits::int_type int_type
ostreambuf_iterator(streambuf_type *__buf) _STLP_NOTHROW
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
#define _STLP_EXPORT_TEMPLATE_CLASS
Definition: features.h:987
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
#define __c
Definition: schilyio.h:209