1.1 --- a/epoc32/include/stdapis/stlport/stl/debug/_tree.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/debug/_tree.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,249 @@
1.4 -_tree.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_TREE_H
1.35 +#define _STLP_INTERNAL_DBG_TREE_H
1.36 +
1.37 +#include <stl/debug/_iterator.h>
1.38 +#include <stl/_function.h>
1.39 +#include <stl/_alloc.h>
1.40 +
1.41 +# undef _DBG_Rb_tree
1.42 +# define _DBG_Rb_tree _Rb_tree
1.43 +
1.44 +# define _STLP_DBG_TREE_SUPER __WORKAROUND_DBG_RENAME(Rb_tree) <_Key, _Value, _KeyOfValue, _Compare, _Alloc>
1.45 +
1.46 +_STLP_BEGIN_NAMESPACE
1.47 +
1.48 +# ifdef _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS
1.49 +template <class _Key, class _Value, class _KeyOfValue, class _Compare, class _Alloc >
1.50 +inline _Value*
1.51 +value_type(const _DBG_iter_base< _STLP_DBG_TREE_SUPER >&) {
1.52 + return (_Value*)0;
1.53 +}
1.54 +template <class _Key, class _Value, class _KeyOfValue, class _Compare, class _Alloc >
1.55 +inline bidirectional_iterator_tag
1.56 +iterator_category(const _DBG_iter_base< _STLP_DBG_TREE_SUPER >&) {
1.57 + return bidirectional_iterator_tag();
1.58 +}
1.59 +# endif
1.60 +
1.61 +template <class _Key, class _Value, class _KeyOfValue, class _Compare,
1.62 + _STLP_DBG_ALLOCATOR_SELECT(_Value) >
1.63 +class _DBG_Rb_tree : public _STLP_DBG_TREE_SUPER {
1.64 + typedef _STLP_DBG_TREE_SUPER _Base;
1.65 + typedef _DBG_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Self;
1.66 +protected:
1.67 + friend class __owned_link;
1.68 + mutable __owned_list _M_iter_list;
1.69 +
1.70 +public:
1.71 + __IMPORT_CONTAINER_TYPEDEFS(_Base)
1.72 + typedef typename _Base::key_type key_type;
1.73 +
1.74 + typedef _DBG_iter<_Base, _Nonconst_traits<value_type> > iterator;
1.75 + typedef _DBG_iter<_Base, _Const_traits<value_type> > const_iterator;
1.76 +
1.77 + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
1.78 +
1.79 +protected:
1.80 +
1.81 + //typedef typename _Base::key_param_type key_param_type;
1.82 + //typedef typename _Base::val_param_type val_param_type;
1.83 +
1.84 + void _Invalidate_all() {_M_iter_list._Invalidate_all();}
1.85 +
1.86 + void _Invalidate_iterator(const iterator& __it) {
1.87 + __invalidate_iterator(&_M_iter_list,__it);
1.88 + }
1.89 + void _Invalidate_iterators(const iterator& __first, const iterator& __last) {
1.90 + iterator __cur = __first;
1.91 + while (__cur != __last) __invalidate_iterator(&_M_iter_list, __cur++);
1.92 + }
1.93 +
1.94 + const _Base* _Get_base() const { return (const _Base*)this; }
1.95 + _Base* _Get_base() { return (_Base*)this; }
1.96 +
1.97 +public:
1.98 + _DBG_Rb_tree() : _STLP_DBG_TREE_SUPER(),
1.99 + _M_iter_list(_Get_base()) {}
1.100 + _DBG_Rb_tree(const _Compare& __comp) :
1.101 + _STLP_DBG_TREE_SUPER(__comp), _M_iter_list(_Get_base()) {}
1.102 + _DBG_Rb_tree(const _Compare& __comp, const allocator_type& __a):
1.103 + _STLP_DBG_TREE_SUPER(__comp, __a), _M_iter_list(_Get_base()) {}
1.104 + _DBG_Rb_tree(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x):
1.105 + _STLP_DBG_TREE_SUPER(__x), _M_iter_list(_Get_base()) {}
1.106 + ~_DBG_Rb_tree() { _Invalidate_all(); }
1.107 +
1.108 + _Self& operator=(const _Self& __x) {
1.109 + _Invalidate_all();
1.110 + (_Base&)*this = (const _Base&)__x;
1.111 + return *this;
1.112 + }
1.113 +
1.114 + iterator begin() { return iterator(&_M_iter_list,_Base::begin()); }
1.115 + const_iterator begin() const { return const_iterator(&_M_iter_list, _Base::begin()); }
1.116 + iterator end() { return iterator(&_M_iter_list, _Base::end()); }
1.117 + const_iterator end() const { return const_iterator(&_M_iter_list,_Base::end()); }
1.118 +
1.119 +public:
1.120 + reverse_iterator rbegin() { return reverse_iterator(end()); }
1.121 + const_reverse_iterator rbegin() const {
1.122 + return const_reverse_iterator(end());
1.123 + }
1.124 + reverse_iterator rend() { return reverse_iterator(begin()); }
1.125 + const_reverse_iterator rend() const {
1.126 + return const_reverse_iterator(begin());
1.127 + }
1.128 + void swap(_Self& __t) {
1.129 + _Base::swap(__t);
1.130 + _M_iter_list._Swap_owners(__t._M_iter_list);
1.131 + }
1.132 +
1.133 +public:
1.134 +
1.135 + iterator find(const key_type& __x) {
1.136 + return iterator(&_M_iter_list, _Base::find(__x));
1.137 + }
1.138 + const_iterator find(const key_type& __x) const {
1.139 + return const_iterator(&_M_iter_list, _Base::find(__x));
1.140 + }
1.141 +
1.142 + iterator lower_bound(const key_type& __x) {
1.143 + return iterator(&_M_iter_list, _Base::lower_bound(__x));
1.144 + }
1.145 + const_iterator lower_bound(const key_type& __x) const {
1.146 + return const_iterator(&_M_iter_list, _Base::lower_bound(__x));
1.147 + }
1.148 +
1.149 + iterator upper_bound(const key_type& __x) {
1.150 + return iterator(&_M_iter_list, _Base::upper_bound(__x));
1.151 + }
1.152 + const_iterator upper_bound(const key_type& __x) const {
1.153 + return const_iterator(&_M_iter_list, _Base::upper_bound(__x));
1.154 + }
1.155 +
1.156 + pair<iterator,iterator> equal_range(const key_type& __x) {
1.157 + return pair<iterator, iterator>(iterator(&_M_iter_list, _Base::lower_bound(__x)),
1.158 + iterator(&_M_iter_list, _Base::upper_bound(__x)));
1.159 + }
1.160 + pair<const_iterator, const_iterator> equal_range(const key_type& __x) const {
1.161 + return pair<const_iterator,const_iterator>(const_iterator(&_M_iter_list, _Base::lower_bound(__x)),
1.162 + const_iterator(&_M_iter_list, _Base::upper_bound(__x)));
1.163 + }
1.164 +
1.165 + pair<iterator,bool> insert_unique(const value_type& __x) {
1.166 + _STLP_STD::pair<_STLP_HEADER_TYPENAME _Base::iterator, bool> __res = _Base::insert_unique(__x);
1.167 + return pair<iterator,bool>( iterator(&_M_iter_list, __res.first), __res.second ) ;
1.168 + }
1.169 + iterator insert_equal(const value_type& __x) {
1.170 + return iterator(&_M_iter_list, _Base::insert_equal(__x));
1.171 + }
1.172 +
1.173 + iterator insert_unique(iterator __position, const value_type& __x) {
1.174 + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__position))
1.175 + return iterator(&_M_iter_list, _Base::insert_unique(__position._M_iterator, __x));
1.176 + }
1.177 + iterator insert_equal(iterator __position, const value_type& __x) {
1.178 + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__position))
1.179 + return iterator(&_M_iter_list, _Base::insert_equal(__position._M_iterator, __x));
1.180 + }
1.181 +
1.182 +#ifdef _STLP_MEMBER_TEMPLATES
1.183 + template<class _II>
1.184 + void insert_equal(_II __first, _II __last) {
1.185 + _Base::insert_equal(__first, __last);
1.186 + }
1.187 + template<class _II>
1.188 + void insert_unique(_II __first, _II __last) {
1.189 + _Base::insert_unique(__first, __last);
1.190 + }
1.191 +#else /* _STLP_MEMBER_TEMPLATES */
1.192 + void insert_unique(const_iterator __first, const_iterator __last) {
1.193 + _Base::insert_unique(__first._M_iterator, __last._M_iterator);
1.194 + }
1.195 + void insert_unique(const value_type* __first, const value_type* __last) {
1.196 + _Base::insert_unique(__first, __last);
1.197 + }
1.198 + void insert_equal(const_iterator __first, const_iterator __last) {
1.199 + _Base::insert_equal(__first._M_iterator, __last._M_iterator);
1.200 + }
1.201 + void insert_equal(const value_type* __first, const value_type* __last) {
1.202 + _Base::insert_equal(__first, __last);
1.203 + }
1.204 +#endif /* _STLP_MEMBER_TEMPLATES */
1.205 +
1.206 + void erase(iterator __position) {
1.207 + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__position))
1.208 + _STLP_DEBUG_CHECK(_Dereferenceable(__position))
1.209 + _Invalidate_iterator(__position);
1.210 + _Base::erase(__position._M_iterator);
1.211 + }
1.212 + size_type erase(const key_type& __x) {
1.213 + pair<iterator,iterator> __p = equal_range(__x);
1.214 + size_type __n = distance(__p.first, __p.second);
1.215 + _Invalidate_iterators(__p.first, __p.second);
1.216 + _Base::erase(__p.first._M_iterator, __p.second._M_iterator);
1.217 + return __n;
1.218 + }
1.219 +
1.220 + void erase(iterator __first, iterator __last) {
1.221 + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __first)&&
1.222 + __check_if_owner(&_M_iter_list, __last))
1.223 + _Invalidate_iterators(__first, __last);
1.224 + _Base::erase(__first._M_iterator, __last._M_iterator);
1.225 + }
1.226 + void erase(const key_type* __first, const key_type* __last) {
1.227 + while (__first != __last) erase(*__first++);
1.228 + }
1.229 +
1.230 + void clear() {
1.231 + _Invalidate_all();
1.232 + _Base::clear();
1.233 + }
1.234 +};
1.235 +
1.236 +#define _STLP_TEMPLATE_HEADER template <class _Key, class _Value, class _KeyOfValue, class _Compare, class _Alloc>
1.237 +#define _STLP_TEMPLATE_CONTAINER _DBG_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
1.238 +#define _STLP_TEMPLATE_CONTAINER_BASE _STLP_DBG_TREE_SUPER
1.239 +#include <stl/debug/_relops_cont.h>
1.240 +#undef _STLP_TEMPLATE_CONTAINER_BASE
1.241 +#undef _STLP_TEMPLATE_CONTAINER
1.242 +#undef _STLP_TEMPLATE_HEADER
1.243 +
1.244 +_STLP_END_NAMESPACE
1.245 +
1.246 +# undef _STLP_DBG_TREE_SUPER
1.247 +
1.248 +#endif /* _STLP_INTERNAL_DBG_TREE_H */
1.249 +
1.250 +// Local Variables:
1.251 +// mode:C++
1.252 +// End:
1.253 +