00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #if !defined (_STLP_INTERNAL_STREAMBUF_ITERATOR_H)
00031 #define _STLP_INTERNAL_STREAMBUF_ITERATOR_H
00032
00033 _STLP_BEGIN_NAMESPACE
00034
00035 template <class _CharT, class _Traits>
00036 basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_ostreambuf(basic_ostream<_CharT, _Traits>& ) ;
00037
00038
00039 template<class _CharT, class _Traits>
00040 class ostreambuf_iterator
00041 {
00042 public:
00043 typedef _CharT char_type;
00044 typedef _Traits traits_type;
00045 typedef typename _Traits::int_type int_type;
00046 typedef basic_streambuf<_CharT, _Traits> streambuf_type;
00047 typedef basic_ostream<_CharT, _Traits> ostream_type;
00048
00049 typedef output_iterator_tag iterator_category;
00050 typedef void value_type;
00051 typedef void difference_type;
00052 typedef void pointer;
00053 typedef void reference;
00054
00055 public:
00056 ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {}
00057 ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(_M_get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
00058
00059 ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) {
00060 _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
00061 traits_type::eof());
00062 return *this;
00063 }
00064
00065 ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; }
00066 ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; }
00067 ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; }
00068
00069 bool failed() const { return !_M_ok; }
00070
00071 private:
00072 streambuf_type* _M_buf;
00073 bool _M_ok;
00074 };
00075
00076 _STLP_END_NAMESPACE
00077
00078 #endif
00079
00080
00081
00082
00083