ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

_iterator_old.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Copyright (c) 1996-1998
00007  * Silicon Graphics Computer Systems, Inc.
00008  *
00009  * Copyright (c) 1997
00010  * Moscow Center for SPARC Technology
00011  *
00012  * Copyright (c) 1999
00013  * Boris Fomitchev
00014  *
00015  * This material is provided "as is", with absolutely no warranty expressed
00016  * or implied. Any use is at your own risk.
00017  *
00018  * Permission to use or copy this software for any purpose is hereby granted
00019  * without fee, provided the above notices are retained on all copies.
00020  * Permission to modify the code and to distribute modified code is granted,
00021  * provided the above notices are retained, and a notice that the code was
00022  * modified is included with the above copyright notice.
00023  *
00024  */
00025 
00026 /* NOTE: This is an internal header file, included by other STL headers.
00027  *   You should not attempt to use it directly.
00028  */
00029 
00030 #ifndef _STLP_INTERNAL_ITERATOR_OLD_H
00031 #define _STLP_INTERNAL_ITERATOR_OLD_H
00032 
00033 #ifndef _STLP_INTERNAL_ITERATOR_BASE_H
00034 #  include <stl/_iterator_base.h>
00035 #endif
00036 
00037 _STLP_BEGIN_NAMESPACE
00038 
00039 #ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
00040 
00041 template <class _Container>
00042 inline output_iterator_tag _STLP_CALL
00043 iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
00044 template <class _Container>
00045 inline output_iterator_tag _STLP_CALL
00046 iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
00047 template <class _Container>
00048 inline output_iterator_tag _STLP_CALL
00049 iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
00050 
00051 #endif
00052 
00053 template <class _BidirectionalIterator, class _Tp,
00054           _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
00055 #if defined (_STLP_MSVC50_COMPATIBILITY)
00056 #  define __Reference _Reference, class _Pointer
00057 #  define Reference__ _Reference, _Pointer
00058           _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
00059 #else
00060 #  define __Reference _Reference
00061 #  define Reference__ _Reference
00062 #endif
00063           _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
00064 class reverse_bidirectional_iterator {
00065   typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
00066                                          Reference__, _Distance> _Self;
00067   //  friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
00068 protected:
00069   _BidirectionalIterator current;
00070 public:
00071   typedef bidirectional_iterator_tag iterator_category;
00072   typedef _Tp                        value_type;
00073   typedef _Distance                  difference_type;
00074 #  if defined (_STLP_MSVC50_COMPATIBILITY)
00075   typedef _Pointer                   pointer;
00076 #  else
00077   typedef _Tp*                       pointer;
00078 #  endif
00079   typedef _Reference                 reference;
00080 
00081   reverse_bidirectional_iterator() {}
00082   explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
00083     : current(__x) {}
00084   _BidirectionalIterator base() const { return current; }
00085   _Reference operator*() const {
00086     _BidirectionalIterator __tmp = current;
00087     return *(--__tmp);
00088   }
00089 
00090   _STLP_DEFINE_ARROW_OPERATOR
00091 
00092   _Self& operator++() {
00093     --current;
00094     return *this;
00095   }
00096   _Self operator++(int) {
00097     _Self __tmp = *this;
00098     --current;
00099     return __tmp;
00100   }
00101   _Self& operator--() {
00102     ++current;
00103     return *this;
00104   }
00105   _Self operator--(int) {
00106     _Self __tmp = *this;
00107     ++current;
00108     return __tmp;
00109   }
00110 };
00111 
00112 #ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
00113 template <class _BidirectionalIterator, class _Tp, class __Reference,
00114           class _Distance>
00115 inline bidirectional_iterator_tag _STLP_CALL
00116 iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
00117 { return bidirectional_iterator_tag(); }
00118 template <class _BidirectionalIterator, class _Tp, class __Reference,
00119   class _Distance>
00120 inline _Tp* _STLP_CALL
00121 value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
00122 { return (_Tp*) 0; }
00123 template <class _BidirectionalIterator, class _Tp, class __Reference,
00124           class _Distance>
00125 inline _Distance* _STLP_CALL
00126 distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
00127 { return (_Distance*) 0; }
00128 #endif
00129 
00130 template <class _BidirectionalIterator, class _Tp, class __Reference,
00131           class _Distance>
00132 inline bool  _STLP_CALL operator==(
00133     const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
00134                                                Reference__, _Distance>& __x,
00135     const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
00136                                                Reference__, _Distance>& __y)
00137 { return __x.base() == __y.base(); }
00138 
00139 #ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
00140 
00141 template <class _BiIter, class _Tp, class __Reference, class _Distance>
00142 inline bool  _STLP_CALL operator!=(
00143     const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
00144     const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
00145 { return !(__x == __y); }
00146 
00147 #endif
00148 
00149 #if !defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
00150 
00151 // This is the old version of reverse_iterator, as found in the original
00152 //  HP STL.  It does not use partial specialization.
00153 
00154 template <class _RandomAccessIterator, class _Tp,
00155           _STLP_DFL_TMPL_PARAM(_Reference,_Tp&),
00156 #  if defined (_STLP_MSVC50_COMPATIBILITY)
00157           _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
00158 #  endif
00159           _STLP_DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
00160 class reverse_iterator {
00161   typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance> _Self;
00162 protected:
00163   _RandomAccessIterator __current;
00164 public:
00165   typedef random_access_iterator_tag iterator_category;
00166   typedef _Tp                        value_type;
00167   typedef _Distance                  difference_type;
00168 #  if defined (_STLP_MSVC50_COMPATIBILITY)
00169   typedef _Pointer                   pointer;
00170 #  else
00171   typedef _Tp*                       pointer;
00172 #  endif
00173   typedef _Reference                 reference;
00174 
00175   reverse_iterator() {}
00176   reverse_iterator(const _Self& __x) : __current(__x.base()) {}
00177   explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
00178   _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
00179 
00180   _RandomAccessIterator base() const { return __current; }
00181   _Reference operator*() const { return *(__current - (difference_type)1); }
00182 
00183   _STLP_DEFINE_ARROW_OPERATOR
00184 
00185   _Self& operator++() {
00186     --__current;
00187     return *this;
00188   }
00189   _Self operator++(int) {
00190     _Self __tmp = *this;
00191     --__current;
00192     return __tmp;
00193   }
00194   _Self& operator--() {
00195     ++__current;
00196     return *this;
00197   }
00198   _Self operator--(int) {
00199     _Self __tmp = *this;
00200     ++__current;
00201     return __tmp;
00202   }
00203   _Self operator+(_Distance __n) const {
00204     return _Self(__current - __n);
00205   }
00206   _Self& operator+=(_Distance __n) {
00207     __current -= __n;
00208     return *this;
00209   }
00210   _Self operator-(_Distance __n) const {
00211     return _Self(__current + __n);
00212   }
00213   _Self& operator-=(_Distance __n) {
00214     __current += __n;
00215     return *this;
00216   }
00217   _Reference operator[](_Distance __n) const { return *(*this + __n); }
00218 };
00219 
00220 #  ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
00221 template <class _RandomAccessIterator, class _Tp,
00222           class __Reference, class _Distance>
00223 inline random_access_iterator_tag _STLP_CALL
00224 iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
00225 { return random_access_iterator_tag(); }
00226 template <class _RandomAccessIterator, class _Tp,
00227   class __Reference, class _Distance>
00228 inline _Tp*  _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
00229 { return (_Tp*) 0; }
00230 template <class _RandomAccessIterator, class _Tp,
00231           class __Reference, class _Distance>
00232 inline _Distance*  _STLP_CALL
00233 distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
00234 { return (_Distance*) 0; }
00235 #  endif
00236 
00237 template <class _RandomAccessIterator, class _Tp,
00238           class __Reference, class _Distance>
00239 inline bool  _STLP_CALL
00240 operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
00241                                   Reference__, _Distance>& __x,
00242            const reverse_iterator<_RandomAccessIterator, _Tp,
00243                                   Reference__, _Distance>& __y)
00244 {
00245   return __x.base() == __y.base();
00246 }
00247 
00248 template <class _RandomAccessIterator, class _Tp,
00249           class __Reference, class _Distance>
00250 inline bool _STLP_CALL
00251 operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
00252                                  Reference__, _Distance>& __x,
00253           const reverse_iterator<_RandomAccessIterator, _Tp,
00254                                  Reference__, _Distance>& __y)
00255 {
00256   return __y.base() < __x.base();
00257 }
00258 
00259 #  ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
00260 
00261 template <class _RandomAccessIterator, class _Tp,
00262           class __Reference, class _Distance>
00263 inline bool _STLP_CALL
00264 operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
00265                                   Reference__, _Distance>& __x,
00266            const reverse_iterator<_RandomAccessIterator, _Tp,
00267                                   Reference__, _Distance>& __y) {
00268   return !(__x == __y);
00269 }
00270 
00271 template <class _RandomAccessIterator, class _Tp,
00272           class __Reference, class _Distance>
00273 inline bool _STLP_CALL
00274 operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
00275                                  Reference__, _Distance>& __x,
00276           const reverse_iterator<_RandomAccessIterator, _Tp,
00277                                  Reference__, _Distance>& __y) {
00278   return __y < __x;
00279 }
00280 
00281 template <class _RandomAccessIterator, class _Tp,
00282           class __Reference, class _Distance>
00283 inline bool _STLP_CALL
00284 operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
00285                                   Reference__, _Distance>& __x,
00286            const reverse_iterator<_RandomAccessIterator, _Tp,
00287                                   Reference__, _Distance>& __y) {
00288   return !(__y < __x);
00289 }
00290 
00291 template <class _RandomAccessIterator, class _Tp,
00292           class __Reference, class _Distance>
00293 inline bool _STLP_CALL
00294 operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
00295                                   Reference__, _Distance>& __x,
00296            const reverse_iterator<_RandomAccessIterator, _Tp,
00297                                   Reference__, _Distance>& __y) {
00298   return !(__x < __y);
00299 }
00300 
00301 #  endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
00302 
00303 template <class _RandomAccessIterator, class _Tp,
00304           class __Reference, class _Distance>
00305 inline _Distance  _STLP_CALL
00306 operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
00307                                  Reference__, _Distance>& __x,
00308           const reverse_iterator<_RandomAccessIterator, _Tp,
00309                                  Reference__, _Distance>& __y)
00310 {
00311   return __y.base() - __x.base();
00312 }
00313 
00314 template <class _RandomAccessIterator, class _Tp,
00315           class __Reference, class _Distance>
00316 inline reverse_iterator<_RandomAccessIterator, _Tp,
00317                         Reference__, _Distance>  _STLP_CALL
00318 operator+(_Distance __n,
00319           const reverse_iterator<_RandomAccessIterator, _Tp,
00320                                  Reference__, _Distance>& __x)
00321 {
00322   return reverse_iterator<_RandomAccessIterator, _Tp,
00323                           Reference__, _Distance>(__x.base() - __n);
00324 }
00325 
00326 #endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
00327 
00328 _STLP_END_NAMESPACE
00329 
00330 #endif /* _STLP_INTERNAL_ITERATOR_H */
00331 
00332 // Local Variables:
00333 // mode:C++
00334 // End:

Generated on Sun May 27 2012 04:29:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.