1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_ostreambuf_iterator.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,97 @@
1.4 +/*
1.5 + * Copyright (c) 1999
1.6 + * Silicon Graphics Computer Systems, Inc.
1.7 + *
1.8 + * Copyright (c) 1999
1.9 + * Boris Fomitchev
1.10 + *
1.11 + * This material is provided "as is", with absolutely no warranty expressed
1.12 + * or implied. Any use is at your own risk.
1.13 + *
1.14 + * Permission to use or copy this software for any purpose is hereby granted
1.15 + * without fee, provided the above notices are retained on all copies.
1.16 + * Permission to modify the code and to distribute modified code is granted,
1.17 + * provided the above notices are retained, and a notice that the code was
1.18 + * modified is included with the above copyright notice.
1.19 + *
1.20 + */
1.21 +// WARNING: This is an internal header file, included by other C++
1.22 +// standard library headers. You should not attempt to use this header
1.23 +// file directly.
1.24 +
1.25 +
1.26 +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
1.27 +#define _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
1.28 +
1.29 +#ifndef _STLP_INTERNAL_STREAMBUF
1.30 +# include <stl/_streambuf.h>
1.31 +#endif
1.32 +
1.33 +_STLP_BEGIN_NAMESPACE
1.34 +
1.35 +template <class _CharT, class _Traits>
1.36 +extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_ostreambuf(basic_ostream<_CharT, _Traits>& ) ;
1.37 +
1.38 +// The default template argument is declared in iosfwd
1.39 +template<class _CharT, class _Traits>
1.40 +class ostreambuf_iterator
1.41 +{
1.42 +public:
1.43 + typedef _CharT char_type;
1.44 + typedef _Traits traits_type;
1.45 + typedef typename _Traits::int_type int_type;
1.46 + typedef basic_streambuf<_CharT, _Traits> streambuf_type;
1.47 + typedef basic_ostream<_CharT, _Traits> ostream_type;
1.48 +
1.49 + typedef output_iterator_tag iterator_category;
1.50 + typedef void value_type;
1.51 + typedef void difference_type;
1.52 + typedef void pointer;
1.53 + typedef void reference;
1.54 +
1.55 +public:
1.56 + ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {}
1.57 + // ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(_M_get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
1.58 + inline ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW;
1.59 +
1.60 + ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) {
1.61 + _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
1.62 + traits_type::eof());
1.63 + return *this;
1.64 + }
1.65 +
1.66 + ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; }
1.67 + ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; }
1.68 + ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; }
1.69 +
1.70 + bool failed() const { return !_M_ok; }
1.71 +
1.72 +private:
1.73 + streambuf_type* _M_buf;
1.74 + bool _M_ok;
1.75 +};
1.76 +
1.77 +template <class _CharT, class _Traits>
1.78 +inline ostreambuf_iterator<_CharT, _Traits>::ostreambuf_iterator(basic_ostream<_CharT, _Traits>& __o) _STLP_NOTHROW : _M_buf(_M_get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
1.79 +
1.80 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.81 +_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator<char, char_traits<char> >;
1.82 +# if defined (INSTANTIATE_WIDE_STREAMS)
1.83 +_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator<wchar_t, char_traits<wchar_t> >;
1.84 +# endif
1.85 +# endif /* _STLP_USE_TEMPLATE_EXPORT */
1.86 +
1.87 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.88 +template <class _CharT, class _Traits>
1.89 +inline output_iterator_tag _STLP_CALL
1.90 +iterator_category(const ostreambuf_iterator<_CharT, _Traits>&) { return output_iterator_tag(); }
1.91 +# endif
1.92 +
1.93 +_STLP_END_NAMESPACE
1.94 +
1.95 +#endif /* _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H */
1.96 +
1.97 +// Local Variables:
1.98 +// mode:C++
1.99 +// End:
1.100 +