epoc32/include/stdapis/stlport/stl/_istreambuf_iterator.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_istreambuf_iterator.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,169 +0,0 @@
     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_ISTREAMBUF_ITERATOR_H
    1.27 -#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
    1.28 -
    1.29 -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
    1.30 -# include <stl/_iterator_base.h>
    1.31 -#endif
    1.32 -
    1.33 -#ifndef _STLP_INTERNAL_STREAMBUF
    1.34 -# include <stl/_streambuf.h>
    1.35 -#endif
    1.36 -
    1.37 -_STLP_BEGIN_NAMESPACE
    1.38 -
    1.39 -// defined in _istream.h
    1.40 -template <class _CharT, class _Traits>
    1.41 -extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ;
    1.42 -
    1.43 -// We do not read any characters until operator* is called. operator* calls sgetc 
    1.44 -// unless the iterator is unchanged from the last call in which case a cached value is
    1.45 -// used. Calls to operator++ use sbumpc.
    1.46 -
    1.47 -template<class _CharT, class _Traits>
    1.48 -class istreambuf_iterator
    1.49 -{
    1.50 -public:
    1.51 -  typedef _CharT                           char_type;
    1.52 -  typedef _Traits                          traits_type;
    1.53 -  typedef typename _Traits::int_type       int_type;
    1.54 -  typedef basic_streambuf<_CharT, _Traits> streambuf_type;
    1.55 -  typedef basic_istream<_CharT, _Traits>   istream_type;
    1.56 -
    1.57 -  typedef input_iterator_tag               iterator_category;
    1.58 -  typedef _CharT                           value_type;
    1.59 -  typedef typename _Traits::off_type       difference_type;
    1.60 -  typedef const _CharT*                    pointer;
    1.61 -  typedef const _CharT&                    reference;
    1.62 -
    1.63 -public:
    1.64 -  istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
    1.65 -  //  istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); }
    1.66 -  inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is);
    1.67 -
    1.68 -  char_type operator*() const { this->_M_getc(); return _M_c; }
    1.69 -  istreambuf_iterator<_CharT, _Traits>& operator++() { this->_M_bumpc(); return *this; }
    1.70 -  istreambuf_iterator<_CharT, _Traits>  operator++(int);
    1.71 -
    1.72 -  bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const {
    1.73 -    if (this->_M_buf)
    1.74 -      this->_M_getc();
    1.75 -    if (__i._M_buf)
    1.76 -      __i._M_getc(); 
    1.77 -    return this->_M_eof == __i._M_eof;
    1.78 -  }
    1.79 -
    1.80 -private:
    1.81 -  void _M_init(streambuf_type* __p) {
    1.82 -    _M_buf = __p;
    1.83 -    _M_eof = !__p;
    1.84 -    //    _M_is_initialized = _M_eof;
    1.85 -    _M_have_c = false;
    1.86 -  }
    1.87 -
    1.88 -  void _M_getc() const {
    1.89 -    if (_M_have_c)
    1.90 -      return;
    1.91 -    int_type __c = _M_buf->sgetc();
    1.92 -# if !defined (_STLP_NEED_MUTABLE) /* && ! defined (__SUNPRO_CC) */
    1.93 -    _M_c = traits_type::to_char_type(__c);
    1.94 -    _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
    1.95 -    _M_have_c = true;
    1.96 -# else
    1.97 -    typedef istreambuf_iterator<_CharT,_Traits> _Self;
    1.98 -    _Self* __that = __CONST_CAST(_Self*, this);
    1.99 -    __that->_M_c = __STATIC_CAST(_CharT, traits_type::to_char_type(__c));
   1.100 -    __that->_M_eof = traits_type::eq_int_type(__c, traits_type::eof());
   1.101 -    __that->_M_have_c = true;
   1.102 -# endif
   1.103 -  }
   1.104 -
   1.105 -  int_type _M_bumpc() {
   1.106 -  	int_type ch = _M_buf->sbumpc();
   1.107 -     _M_have_c = false;
   1.108 -	 return ch;
   1.109 -  }
   1.110 -
   1.111 -private:
   1.112 -  streambuf_type* _M_buf;
   1.113 -  mutable _CharT _M_c;
   1.114 -  mutable unsigned char _M_eof;
   1.115 -  mutable unsigned char _M_have_c;
   1.116 -};
   1.117 -
   1.118 -template<class _CharT, class _Traits>
   1.119 -inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) 
   1.120 -{ this->_M_init(_M_get_istreambuf(__is)); }
   1.121 -
   1.122 -template<class _CharT, class _Traits>
   1.123 -inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
   1.124 -                                  const istreambuf_iterator<_CharT, _Traits>& __y) {
   1.125 -  return __x.equal(__y);
   1.126 -}
   1.127 -
   1.128 -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
   1.129 -
   1.130 -template<class _CharT, class _Traits>
   1.131 -inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
   1.132 -                                  const istreambuf_iterator<_CharT, _Traits>& __y) {
   1.133 -  return !__x.equal(__y);
   1.134 -}
   1.135 -
   1.136 -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
   1.137 -
   1.138 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.139 -_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<char, char_traits<char> >;
   1.140 -#  if defined (INSTANTIATE_WIDE_STREAMS)
   1.141 -_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
   1.142 -#  endif
   1.143 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.144 -
   1.145 -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
   1.146 -template <class _CharT, class _Traits>
   1.147 -inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); }
   1.148 -template <class _CharT, class _Traits>
   1.149 -inline streamoff* _STLP_CALL 
   1.150 -distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; }
   1.151 -template <class _CharT, class _Traits>
   1.152 -inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; }
   1.153 -# endif
   1.154 -
   1.155 -template <class _CharT, class _Traits>
   1.156 -istreambuf_iterator<_CharT, _Traits>
   1.157 -istreambuf_iterator<_CharT, _Traits>::operator++(int) {
   1.158 -  istreambuf_iterator<_CharT, _Traits> __tmp = *this;
   1.159 -  __tmp._M_c = this->_M_bumpc();
   1.160 -  __tmp._M_have_c = true;
   1.161 -  this->_M_have_c = false;
   1.162 -  return __tmp;
   1.163 -}
   1.164 -
   1.165 -_STLP_END_NAMESPACE
   1.166 -
   1.167 -#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */
   1.168 -
   1.169 -// Local Variables:
   1.170 -// mode:C++
   1.171 -// End:
   1.172 -