4 * Hewlett-Packard Company
6 * Copyright (c) 1996-1998
7 * Silicon Graphics Computer Systems, Inc.
10 * Moscow Center for SPARC Technology
15 * This material is provided "as is", with absolutely no warranty expressed
16 * or implied. Any use is at your own risk.
18 * Permission to use or copy this software for any purpose is hereby granted
19 * without fee, provided the above notices are retained on all copies.
20 * Permission to modify the code and to distribute modified code is granted,
21 * provided the above notices are retained, and a notice that the code was
22 * modified is included with the above copyright notice.
26 /* NOTE: This is an internal header file, included by other STL headers.
27 * You should not attempt to use it directly.
30 #if !defined (_STLP_INTERNAL_STREAMBUF_ITERATOR_H)
31 #define _STLP_INTERNAL_STREAMBUF_ITERATOR_H
35 template <class _CharT, class _Traits>
36 basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_ostreambuf(basic_ostream<_CharT, _Traits>& ) ;
38 // The default template argument is declared in iosfwd
39 template<class _CharT, class _Traits>
40 class ostreambuf_iterator
43 typedef _CharT char_type;
44 typedef _Traits traits_type;
45 typedef typename _Traits::int_type int_type;
46 typedef basic_streambuf<_CharT, _Traits> streambuf_type;
47 typedef basic_ostream<_CharT, _Traits> ostream_type;
49 typedef output_iterator_tag iterator_category;
50 typedef void value_type;
51 typedef void difference_type;
53 typedef void reference;
56 ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {}
57 ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(_M_get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
59 ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) {
60 _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
65 ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; }
66 ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; }
67 ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; }
69 bool failed() const { return !_M_ok; }
72 streambuf_type* _M_buf;
78 #endif /* _STLP_INTERNAL_STREAMBUF_ITERATOR_H */