epoc32/include/stdapis/stlport/stl/_streambuf_iterator.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_streambuf_iterator.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/_streambuf_iterator.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,83 @@
     1.4 -_streambuf_iterator.h
     1.5 +/*
     1.6 + *
     1.7 + * Copyright (c) 1994
     1.8 + * Hewlett-Packard Company
     1.9 + *
    1.10 + * Copyright (c) 1996-1998
    1.11 + * Silicon Graphics Computer Systems, Inc.
    1.12 + *
    1.13 + * Copyright (c) 1997
    1.14 + * Moscow Center for SPARC Technology
    1.15 + *
    1.16 + * Copyright (c) 1999 
    1.17 + * Boris Fomitchev
    1.18 + *
    1.19 + * This material is provided "as is", with absolutely no warranty expressed
    1.20 + * or implied. Any use is at your own risk.
    1.21 + *
    1.22 + * Permission to use or copy this software for any purpose is hereby granted 
    1.23 + * without fee, provided the above notices are retained on all copies.
    1.24 + * Permission to modify the code and to distribute modified code is granted,
    1.25 + * provided the above notices are retained, and a notice that the code was
    1.26 + * modified is included with the above copyright notice.
    1.27 + *
    1.28 + */
    1.29 +
    1.30 +/* NOTE: This is an internal header file, included by other STL headers.
    1.31 + *   You should not attempt to use it directly.
    1.32 + */
    1.33 +
    1.34 +#if !defined (_STLP_INTERNAL_STREAMBUF_ITERATOR_H)
    1.35 +#define _STLP_INTERNAL_STREAMBUF_ITERATOR_H
    1.36 +
    1.37 +_STLP_BEGIN_NAMESPACE
    1.38 +
    1.39 +template <class _CharT, class _Traits>
    1.40 +basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_ostreambuf(basic_ostream<_CharT, _Traits>& ) ;
    1.41 +
    1.42 +// The default template argument is declared in iosfwd
    1.43 +template<class _CharT, class _Traits>
    1.44 +class ostreambuf_iterator
    1.45 +{
    1.46 +public:
    1.47 +  typedef _CharT                           char_type;
    1.48 +  typedef _Traits                          traits_type;
    1.49 +  typedef typename _Traits::int_type       int_type;
    1.50 +  typedef basic_streambuf<_CharT, _Traits> streambuf_type;
    1.51 +  typedef basic_ostream<_CharT, _Traits>   ostream_type;
    1.52 +
    1.53 +  typedef output_iterator_tag              iterator_category;
    1.54 +  typedef void                             value_type;
    1.55 +  typedef void                             difference_type;
    1.56 +  typedef void                             pointer;
    1.57 +  typedef void                             reference;
    1.58 +
    1.59 +public:
    1.60 +  ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {}
    1.61 +  ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(_M_get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
    1.62 +
    1.63 +  ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) {
    1.64 +    _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
    1.65 +                                               traits_type::eof());
    1.66 +    return *this;
    1.67 +  }    
    1.68 +  
    1.69 +  ostreambuf_iterator<_CharT, _Traits>& operator*()     { return *this; }
    1.70 +  ostreambuf_iterator<_CharT, _Traits>& operator++()    { return *this; }
    1.71 +  ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; }
    1.72 +
    1.73 +  bool failed() const { return !_M_ok; }
    1.74 +
    1.75 +private:
    1.76 +  streambuf_type* _M_buf;
    1.77 +  bool _M_ok;
    1.78 +};
    1.79 +
    1.80 +_STLP_END_NAMESPACE
    1.81 +
    1.82 +#endif /* _STLP_INTERNAL_STREAMBUF_ITERATOR_H */
    1.83 +
    1.84 +// Local Variables:
    1.85 +// mode:C++
    1.86 +// End:
    1.87 +