epoc32/include/stdapis/stlport/stl/debug/_deque.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/stlport/stl/debug/_deque.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/debug/_deque.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,281 @@
     1.4 -_deque.h
     1.5 +/*
     1.6 + *
     1.7 + * Copyright (c) 1994
     1.8 + * Hewlett-Packard Company
     1.9 + *
    1.10 + * Copyright (c) 1996,1997
    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 +#ifndef _STLP_INTERNAL_DBG_DEQUE_H
    1.35 +#define _STLP_INTERNAL_DBG_DEQUE_H
    1.36 +
    1.37 +#include <stl/debug/_iterator.h>
    1.38 +
    1.39 +# if !defined (_STLP_USE_WRAPPER_FOR_ALLOC_PARAM) && !defined (_STLP_NO_DEFAULT_NON_TYPE_PARAM)
    1.40 +#  undef  _DBG_deque
    1.41 +#  define _DBG_deque deque
    1.42 +# endif
    1.43 +
    1.44 +# define _DEQUE_WRAPPER _DBG_deque<_Tp,_Alloc>
    1.45 +
    1.46 +# define _STLP_DEQUE_SUPER   __WORKAROUND_DBG_RENAME(deque) <_Tp,_Alloc>
    1.47 +
    1.48 +_STLP_BEGIN_NAMESPACE
    1.49 +
    1.50 +# ifdef _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS
    1.51 +template <class _Tp, class _Alloc>
    1.52 +inline _Tp* value_type(const  _DBG_iter_base< _STLP_DEQUE_SUPER >&) {
    1.53 +  return (_Tp*)0;
    1.54 +}
    1.55 +template <class _Tp, class _Alloc>
    1.56 +inline random_access_iterator_tag iterator_category(const  _DBG_iter_base< _STLP_DEQUE_SUPER >&) {
    1.57 +  return random_access_iterator_tag();
    1.58 +}
    1.59 +# endif
    1.60 +
    1.61 +template <class _Tp, _STLP_DBG_ALLOCATOR_SELECT(_Tp) >
    1.62 +class _DBG_deque : public _STLP_DEQUE_SUPER {
    1.63 +
    1.64 +  typedef _DBG_deque<_Tp,_Alloc> _Self;
    1.65 +  typedef _STLP_DEQUE_SUPER _Base;
    1.66 +
    1.67 +public:                         // Basic types
    1.68 +
    1.69 +  __IMPORT_CONTAINER_TYPEDEFS(_Base)
    1.70 +
    1.71 +public:                         // Iterators
    1.72 +  typedef _DBG_iter< _STLP_DEQUE_SUPER, _Nonconst_traits<value_type> >    iterator;
    1.73 +  typedef _DBG_iter< _STLP_DEQUE_SUPER, _Const_traits<value_type> >   const_iterator;
    1.74 +
    1.75 +  _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
    1.76 +
    1.77 +protected:
    1.78 +  __owned_list _M_iter_list;
    1.79 +  void _Invalidate_iterator(const iterator& __it) { 
    1.80 +    __invalidate_iterator(&_M_iter_list,__it);
    1.81 +  }
    1.82 +  void _Invalidate_all() {
    1.83 +      _M_iter_list._Invalidate_all();
    1.84 +  }
    1.85 +
    1.86 +public:                         // Basic accessors
    1.87 +  iterator begin() { return iterator(&_M_iter_list, this->_M_start); }
    1.88 +  iterator end() { return iterator(&_M_iter_list, this->_M_finish); }
    1.89 +  const_iterator begin() const { 
    1.90 +    return const_iterator(&_M_iter_list, this->_M_start); 
    1.91 +  }
    1.92 +  const_iterator end() const { 
    1.93 +    return const_iterator(&_M_iter_list,  this->_M_finish); 
    1.94 +  }
    1.95 +
    1.96 +  reverse_iterator rbegin() { return reverse_iterator(end()); }
    1.97 +  reverse_iterator rend() { return reverse_iterator(begin()); }
    1.98 +  const_reverse_iterator rbegin() const 
    1.99 +    { return const_reverse_iterator(end()); }
   1.100 +  const_reverse_iterator rend() const 
   1.101 +    { return const_reverse_iterator(begin()); }
   1.102 +
   1.103 +  reference operator[](size_type __n)
   1.104 +    { return begin()[difference_type(__n)]; }
   1.105 +  const_reference operator[](size_type __n) const 
   1.106 +    { return begin()[difference_type(__n)]; }
   1.107 +
   1.108 +  reference front() { return *begin(); }
   1.109 +  reference back() {
   1.110 +    iterator __tmp = end();
   1.111 +    --__tmp;
   1.112 +    return *__tmp;
   1.113 +  }
   1.114 +  const_reference front() const { return *begin(); }
   1.115 +  const_reference back() const {
   1.116 +    const_iterator __tmp = end();
   1.117 +    --__tmp;
   1.118 +    return *__tmp;
   1.119 +  }
   1.120 +
   1.121 +public:                         // Constructor, destructor.
   1.122 +
   1.123 +  const _Base* _Get_base() const { return (const _Base*)this; }
   1.124 +
   1.125 +  explicit _DBG_deque(const allocator_type& __a = allocator_type()) :
   1.126 +    _STLP_DEQUE_SUPER(__a), _M_iter_list(_Get_base()) {}
   1.127 +  _DBG_deque(const _Self& __x) : _STLP_DEQUE_SUPER(__x), _M_iter_list(_Get_base()) {}
   1.128 +  _DBG_deque(size_type __n, const value_type& __value,
   1.129 +        const allocator_type& __a = allocator_type()) : 
   1.130 +    _STLP_DEQUE_SUPER(__n, __value, __a), _M_iter_list(_Get_base()) {}
   1.131 +  explicit _DBG_deque(size_type __n) : _STLP_DEQUE_SUPER(__n), _M_iter_list(_Get_base()) {}
   1.132 +
   1.133 +#ifdef _STLP_MEMBER_TEMPLATES
   1.134 +  template <class _InputIterator>
   1.135 +  _DBG_deque(_InputIterator __first, _InputIterator __last,
   1.136 +        const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) : 
   1.137 +    _STLP_DEQUE_SUPER(__first, __last, __a) , _M_iter_list(_Get_base()) {}
   1.138 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
   1.139 +  template <class _InputIterator>
   1.140 +  _DBG_deque(_InputIterator __first, _InputIterator __last):
   1.141 +    _STLP_DEQUE_SUPER(__first, __last, allocator_type()) , _M_iter_list(_Get_base()) {}
   1.142 +# endif
   1.143 +#else /* _STLP_MEMBER_TEMPLATES */
   1.144 +  _DBG_deque(const value_type* __first, const value_type* __last,
   1.145 +        const allocator_type& __a = allocator_type()) 
   1.146 +    : _STLP_DEQUE_SUPER(__first, __last, __a), _M_iter_list(_Get_base()) {}
   1.147 +
   1.148 +  _DBG_deque(const_iterator __first, const_iterator __last,
   1.149 +        const allocator_type& __a = allocator_type()) 
   1.150 +    : _STLP_DEQUE_SUPER(__first._M_iterator, __last._M_iterator, __a), 
   1.151 +      _M_iter_list(_Get_base()) {}
   1.152 +#endif /* _STLP_MEMBER_TEMPLATES */
   1.153 +
   1.154 +  _Self& operator= (const _Self& __x) {
   1.155 +    _Invalidate_all();
   1.156 +    (_Base&)*this = (const _Base&)__x; 
   1.157 +    return *this;
   1.158 +  }
   1.159 +
   1.160 +  void swap(_Self& __x) {
   1.161 +    _M_iter_list._Swap_owners(__x._M_iter_list);
   1.162 +    _Base::swap(__x);
   1.163 +  }
   1.164 +
   1.165 +public: 
   1.166 +  void assign(size_type __n, const _Tp& __val) {
   1.167 +    _Base::assign(__n, __val);
   1.168 +  }
   1.169 +
   1.170 +#ifdef _STLP_MEMBER_TEMPLATES
   1.171 +
   1.172 +  template <class _InputIterator>
   1.173 +  void assign(_InputIterator __first, _InputIterator __last) {
   1.174 +    _Base::assign(__first, __last);
   1.175 +  }
   1.176 +#endif /* _STLP_MEMBER_TEMPLATES */
   1.177 +
   1.178 +public:                         // push_* and pop_*
   1.179 +  
   1.180 +  void push_back(const value_type& __t) {
   1.181 +    _Invalidate_all();
   1.182 +    _Base::push_back(__t);
   1.183 +  }
   1.184 +
   1.185 +  void push_back() {
   1.186 +    _Invalidate_all();
   1.187 +    _Base::push_back();
   1.188 +  }
   1.189 +
   1.190 +  void push_front(const value_type& __t) {
   1.191 +    _Invalidate_all();
   1.192 +    _Base::push_front(__t);
   1.193 +  }
   1.194 +
   1.195 +  void push_front() {
   1.196 +    _Base::push_front();
   1.197 +    _Invalidate_all();
   1.198 +  }
   1.199 +
   1.200 +
   1.201 +  void pop_back() {
   1.202 +    _Invalidate_iterator(end());
   1.203 +    _Base::pop_back();
   1.204 +  }
   1.205 +
   1.206 +  void pop_front() {
   1.207 +    _Invalidate_iterator(begin());        
   1.208 +    _Base::pop_front();
   1.209 +  }
   1.210 +
   1.211 +public:                         // Insert
   1.212 +
   1.213 +  iterator insert(iterator __position, const value_type& __x) {
   1.214 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __position))
   1.215 +    // fbp : invalidation !
   1.216 +    return iterator(&_M_iter_list, _Base::insert(__position._M_iterator, __x));
   1.217 +  }
   1.218 +
   1.219 +  iterator insert(iterator __position) { 
   1.220 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __position))
   1.221 +    // fbp : invalidation !
   1.222 +    return iterator(&_M_iter_list, _Base::insert(__position._M_iterator));
   1.223 +  }
   1.224 +
   1.225 +  void insert(iterator __position, size_type __n, const value_type& __x) {
   1.226 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __position))
   1.227 +    // fbp : invalidation !
   1.228 +    _Base::insert(__position._M_iterator, __n, __x);
   1.229 +  }
   1.230 +
   1.231 +#ifdef _STLP_MEMBER_TEMPLATES  
   1.232 +  template <class _InputIterator>
   1.233 +  void insert(iterator __position, _InputIterator __first, _InputIterator __last) {
   1.234 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __position))
   1.235 +    // fbp : invalidation !
   1.236 +    _Base::insert(__position._M_iterator, __first, __last);
   1.237 +  }
   1.238 +#else /* _STLP_MEMBER_TEMPLATES */
   1.239 +  void insert(iterator __position,
   1.240 +              const value_type* __first, const value_type* __last) {
   1.241 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __position))
   1.242 +    _Base::insert(__position._M_iterator, __first, __last);
   1.243 +  }
   1.244 +  void insert(iterator __position,
   1.245 +              const_iterator __first, const_iterator __last) {
   1.246 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __position))
   1.247 +    _Base::insert(__position._M_iterator, __first._M_iterator, __last._M_iterator);
   1.248 +  }
   1.249 +#endif /* _STLP_MEMBER_TEMPLATES */
   1.250 +
   1.251 +public:                         // Erase
   1.252 +  iterator erase(iterator __pos) {
   1.253 +    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos) && (__pos != end()))
   1.254 +    return iterator (&_M_iter_list, _Base::erase(__pos._M_iterator));
   1.255 +  }
   1.256 +
   1.257 +  iterator erase(iterator __first, iterator __last) {
   1.258 +    _STLP_DEBUG_CHECK(__first >= begin() && __last <= end())
   1.259 +    return iterator (&_M_iter_list, _Base::erase(__first._M_iterator, __last._M_iterator));
   1.260 +  }
   1.261 +  
   1.262 +  void clear() {
   1.263 +    _Invalidate_all();
   1.264 +    _Base::clear();
   1.265 +  }
   1.266 +};
   1.267 +
   1.268 +#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
   1.269 +#define _STLP_TEMPLATE_CONTAINER _DBG_deque<_Tp, _Alloc>
   1.270 +#define _STLP_TEMPLATE_CONTAINER_BASE _STLP_DEQUE_SUPER
   1.271 +#include <stl/debug/_relops_cont.h>
   1.272 +#undef _STLP_TEMPLATE_CONTAINER_BASE
   1.273 +#undef _STLP_TEMPLATE_CONTAINER
   1.274 +#undef _STLP_TEMPLATE_HEADER
   1.275 +
   1.276 +_STLP_END_NAMESPACE 
   1.277 +
   1.278 +# undef _DBG_deque
   1.279 +# undef _STLP_DEQUE_SUPER
   1.280 +  
   1.281 +#endif /* _STLP_INTERNAL_DEQUE_H */
   1.282 +
   1.283 +// Local Variables:
   1.284 +// mode:C++
   1.285 +// End: