1.1 --- a/epoc32/include/stdapis/stlport/stl/debug/_string.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/debug/_string.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,772 @@
1.4 -_string.h
1.5 +/*
1.6 + * Copyright (c) 1997-1999
1.7 + * Silicon Graphics Computer Systems, Inc.
1.8 + *
1.9 + * Copyright (c) 1999
1.10 + * Boris Fomitchev
1.11 + *
1.12 + * This material is provided "as is", with absolutely no warranty expressed
1.13 + * or implied. Any use is at your own risk.
1.14 + *
1.15 + * Permission to use or copy this software for any purpose is hereby granted
1.16 + * without fee, provided the above notices are retained on all copies.
1.17 + * Permission to modify the code and to distribute modified code is granted,
1.18 + * provided the above notices are retained, and a notice that the code was
1.19 + * modified is included with the above copyright notice.
1.20 + *
1.21 + */
1.22 +
1.23 +#ifndef _STLP_DBG_STRING_H
1.24 +#define _STLP_DBG_STRING_H
1.25 +
1.26 +#include <stl/debug/_iterator.h>
1.27 +
1.28 +# define _STLP_DBG_STRING_BASE _Nondebug_string <_CharT, _Traits, _Alloc>
1.29 +
1.30 +_STLP_BEGIN_NAMESPACE
1.31 +
1.32 +# ifdef _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS
1.33 +template <class _CharT,class _Traits, class _Alloc>
1.34 +inline _CharT*
1.35 +value_type(const _DBG_iter_base< _STLP_DBG_STRING_BASE >&) {
1.36 +return (_CharT*)0;
1.37 +}
1.38 +template <class _CharT, class _Traits, class _Alloc>
1.39 +inline random_access_iterator_tag
1.40 +iterator_category(const _DBG_iter_base< _STLP_DBG_STRING_BASE >&) {
1.41 + return random_access_iterator_tag();
1.42 +}
1.43 +# endif
1.44 +
1.45 +template <class _CharT, class _Traits, class _Alloc>
1.46 +class basic_string : public _STLP_DBG_STRING_BASE {
1.47 +private:
1.48 + typedef _STLP_DBG_STRING_BASE _Base;
1.49 + typedef basic_string<_CharT, _Traits, _Alloc> _Self;
1.50 +protected:
1.51 + mutable __owned_list _M_iter_list;
1.52 +public:
1.53 + __IMPORT_CONTAINER_TYPEDEFS(_Base)
1.54 + typedef _DBG_iter<_Base, _Nonconst_traits<value_type> > iterator;
1.55 + typedef _DBG_iter<_Base, _Const_traits<value_type> > const_iterator;
1.56 + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
1.57 +# ifdef _STLP_USE_NATIVE_STRING
1.58 + // this typedef is being used for conversions
1.59 + typedef _STLP_VENDOR_STD::basic_string<_CharT,_Traits,
1.60 + _STLP_VENDOR_STD::allocator<_CharT> > __std_string;
1.61 +# endif
1.62 +public: // Constructor, destructor, assignment.
1.63 + typedef typename _Base::_Reserve_t _Reserve_t;
1.64 +
1.65 + const _Base* _Get_base() const { return (const _Base*)this; }
1.66 + _Base* _Get_base() { return (_Base*)this; }
1.67 +
1.68 + basic_string() :_STLP_DBG_STRING_BASE(), _M_iter_list(_Get_base()) {}
1.69 +
1.70 + explicit basic_string(const allocator_type& __a):
1.71 + _STLP_DBG_STRING_BASE(__a), _M_iter_list(_Get_base()) {}
1.72 +
1.73 + basic_string(_Reserve_t __r, size_t __n,
1.74 + const allocator_type& __a = allocator_type())
1.75 + : _STLP_DBG_STRING_BASE(__r, __n, __a), _M_iter_list(_Get_base()) {}
1.76 +
1.77 + basic_string(const _Self& __s):
1.78 + _STLP_DBG_STRING_BASE(__s), _M_iter_list(_Get_base()) {}
1.79 +
1.80 + basic_string(const _Self& __s, size_type __pos, size_type __n = _Base::npos,
1.81 + const allocator_type& __a = allocator_type()):
1.82 + _STLP_DBG_STRING_BASE(__s, __pos, __n, __a), _M_iter_list(_Get_base()) {}
1.83 +
1.84 + basic_string(const _CharT* __s, size_type __n,
1.85 + const allocator_type& __a = allocator_type()):
1.86 + _STLP_DBG_STRING_BASE(__s, __n, __a), _M_iter_list(_Get_base()) {}
1.87 +
1.88 + basic_string(const _CharT* __s,
1.89 + const allocator_type& __a = allocator_type()):
1.90 + _STLP_DBG_STRING_BASE(__s, __a), _M_iter_list(_Get_base()) {}
1.91 +
1.92 + basic_string(size_type __n, _CharT __c,
1.93 + const allocator_type& __a = allocator_type()):
1.94 + _STLP_DBG_STRING_BASE(__n, __c, __a), _M_iter_list(_Get_base()) {}
1.95 +
1.96 +#if defined (_STLP_MEMBER_TEMPLATES) && !(defined(__MRC__)||(defined(__SC__) && !defined(__DMC__)))
1.97 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.98 + template <class _InputIterator>
1.99 + basic_string(_InputIterator __f, _InputIterator __l):
1.100 + _STLP_DBG_STRING_BASE(__f, __l), _M_iter_list(_Get_base()) {}
1.101 +# endif
1.102 + template <class _InputIterator>
1.103 + basic_string(_InputIterator __f, _InputIterator __l,
1.104 + const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL):
1.105 + _STLP_DBG_STRING_BASE(__f, __l, __a), _M_iter_list(_Get_base()) {}
1.106 +#else /* _STLP_MEMBER_TEMPLATES */
1.107 + basic_string(const_iterator __f, const_iterator __l,
1.108 + const allocator_type & __a = allocator_type()):
1.109 + _STLP_DBG_STRING_BASE(__f._M_iterator, __l._M_iterator, __a),
1.110 + _M_iter_list(_Get_base()) {}
1.111 +
1.112 + basic_string(const _CharT* __f, const _CharT* __l,
1.113 + const allocator_type& __a = allocator_type()):
1.114 + _STLP_DBG_STRING_BASE(__f, __l, __a), _M_iter_list(_Get_base()) {}
1.115 +#endif
1.116 +
1.117 +# ifdef _STLP_USE_NATIVE_STRING
1.118 + // these conversion operations still needed for
1.119 + // strstream, etc.
1.120 + basic_string (const __std_string& __x)
1.121 + : _STLP_DBG_STRING_BASE(__x.begin(), __x.end()), _M_iter_list(_Get_base()) {}
1.122 + operator __std_string() const { return __std_string(this->data()); }
1.123 +# endif
1.124 +
1.125 + // constructor from non-debug version
1.126 + basic_string (const _Base& __x)
1.127 + : _STLP_DBG_STRING_BASE(__x), _M_iter_list(_Get_base()) {}
1.128 +
1.129 + _Self& operator=(const _Self& __s) {
1.130 + _Base::operator=(__s);
1.131 + return *this;
1.132 + }
1.133 +
1.134 + _Self& operator=(const _CharT* __s) {
1.135 + _STLP_FIX_LITERAL_BUG(__s)
1.136 + _Base::operator=(__s);
1.137 + return *this;
1.138 + }
1.139 +
1.140 + _Self& operator=(_CharT __c) {
1.141 + _Base::operator=(__c);
1.142 + return *this;
1.143 + }
1.144 +
1.145 +public: // Iterators.
1.146 +
1.147 + iterator begin() { return iterator(&_M_iter_list, this->_M_start); }
1.148 + const_iterator begin() const { return const_iterator(&_M_iter_list,this->_M_start); }
1.149 + iterator end() { return iterator(&_M_iter_list,this->_M_finish); }
1.150 + const_iterator end() const { return const_iterator(&_M_iter_list,this->_M_finish); }
1.151 + void _M_deallocate_block() {
1.152 + _M_iter_list._Invalidate_all();
1.153 + _Base::_M_deallocate_block();
1.154 + }
1.155 +
1.156 + reverse_iterator rbegin()
1.157 + { return reverse_iterator(iterator(&_M_iter_list,this->_M_finish)); }
1.158 + reverse_iterator rend()
1.159 + { return reverse_iterator(iterator(&_M_iter_list,this->_M_start)); }
1.160 + const_reverse_iterator rbegin() const
1.161 + { return const_reverse_iterator(const_iterator(&_M_iter_list,this->_M_finish)); }
1.162 + const_reverse_iterator rend() const
1.163 + { return const_reverse_iterator(const_iterator(&_M_iter_list,this->_M_start)); }
1.164 +
1.165 +public: // Size, capacity, etc.
1.166 +
1.167 + void resize(size_type __n, _CharT __c) {
1.168 + _Base::resize(__n, __c);
1.169 + }
1.170 + void resize(size_type __n) { resize(__n, this->_M_null()); }
1.171 +
1.172 + void reserve(size_type __s= 0) {
1.173 + _Base::reserve(__s);
1.174 + }
1.175 +
1.176 + void clear() {
1.177 + _M_iter_list._Invalidate_all();
1.178 + _Base::clear();
1.179 + }
1.180 +
1.181 +public: // Element access.
1.182 +
1.183 + const_reference operator[](size_type __n) const
1.184 + { return *(begin() + __n); }
1.185 + reference operator[](size_type __n)
1.186 + { return *(begin() + __n); }
1.187 +
1.188 + const_reference at(size_type __n) const {
1.189 + if (__n >= this->size())
1.190 + this->_M_throw_out_of_range();
1.191 + return *(begin() + __n);
1.192 + }
1.193 +
1.194 + reference at(size_type __n) {
1.195 + if (__n >= this->size())
1.196 + this->_M_throw_out_of_range();
1.197 + return *(begin() + __n);
1.198 + }
1.199 +
1.200 +public: // Append, operator+=, push_back.
1.201 +
1.202 + _Self& operator+=(const _Self& __s) { return append(__s); }
1.203 + _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); }
1.204 + _Self& operator+=(_CharT __c) { push_back(__c); return *this; }
1.205 +
1.206 + _Self& append(const _Self& __s) { return append(__s._M_start, __s._M_finish); }
1.207 +
1.208 + _Self& append(const _Self& __s,
1.209 + size_type __pos, size_type __n)
1.210 + {
1.211 + _Base::append(__s, __pos, __n);
1.212 + return *this;
1.213 + }
1.214 +
1.215 + _Self& append(const _CharT* __s, size_type __n)
1.216 + { _STLP_FIX_LITERAL_BUG(__s) return append(__s, __s+__n); }
1.217 +
1.218 + _Self& append(const _CharT* __s)
1.219 + { _STLP_FIX_LITERAL_BUG(__s) return append(__s, __s + _Traits::length(__s)); }
1.220 +
1.221 + _Self& append(size_type __n, _CharT __c){
1.222 + _Base::append(__n, __c);
1.223 + return *this;
1.224 + }
1.225 +
1.226 +#ifdef _STLP_MEMBER_TEMPLATES
1.227 +
1.228 + // Check to see if _InputIterator is an integer type. If so, then
1.229 + // it can't be an iterator.
1.230 + template <class _InputIter>
1.231 + _Self& append(_InputIter __first, _InputIter __last) {
1.232 + _Base::append(__first, __last);
1.233 + return *this;
1.234 + }
1.235 +
1.236 +#ifdef _STLP_MSVC
1.237 +// specialization for append
1.238 + template <>
1.239 + inline _Self& append(iterator __f, iterator __l) {
1.240 + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
1.241 + __check_range(__f, __l);
1.242 + _Base::append(__f._M_iterator, __l._M_iterator);
1.243 + return *this;
1.244 + }
1.245 +#endif
1.246 +
1.247 +#else /* _STLP_MEMBER_TEMPLATES */
1.248 +
1.249 + _Self& append(const _CharT* __first, const _CharT* __last) {
1.250 + _Base::append(__first, __last);
1.251 + return *this;
1.252 + }
1.253 +
1.254 + _Self& append(const_iterator __first, const_iterator __last) {
1.255 + _Base::append(__first._M_iterator, __last._M_iterator);
1.256 + return *this;
1.257 + }
1.258 +#endif /* _STLP_MEMBER_TEMPLATES */
1.259 +
1.260 + void push_back(_CharT __c) {
1.261 + _Base::push_back(__c);
1.262 + }
1.263 +
1.264 + void pop_back() {
1.265 + __invalidate_iterator(&_M_iter_list,end());
1.266 + _Base::pop_back();
1.267 + }
1.268 +
1.269 +
1.270 +public: // Assign
1.271 +
1.272 + _Self& assign(const _Self& __s) {
1.273 + _Base::assign(__s);
1.274 + return *this;
1.275 + }
1.276 +
1.277 + _Self& assign(const _Self& __s,
1.278 + size_type __pos, size_type __n) {
1.279 + _Base::assign(__s, __pos, __n);
1.280 + return *this;
1.281 + }
1.282 +
1.283 + _Self& assign(const _CharT* __s, size_type __n)
1.284 + { _STLP_FIX_LITERAL_BUG(__s) return assign(__s, __s + __n); }
1.285 +
1.286 + _Self& assign(const _CharT* __s)
1.287 + { _STLP_FIX_LITERAL_BUG(__s) return assign(__s, __s + _Traits::length(__s)); }
1.288 +
1.289 + _Self& assign(size_type __n, _CharT __c) {
1.290 + _Base::assign(__n, __c);
1.291 + return *this;
1.292 + }
1.293 +
1.294 +#ifdef _STLP_MEMBER_TEMPLATES
1.295 + template <class _InputIter>
1.296 + inline _Self& assign(_InputIter __first, _InputIter __last) {
1.297 + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
1.298 + __check_range(__first, __last);
1.299 + _Base::assign(__first, __last);
1.300 + return *this;
1.301 + }
1.302 +
1.303 +#ifdef _STLP_MSVC
1.304 +// partial specialization for assign
1.305 +template <>
1.306 +inline _Self& assign(iterator __f, iterator __l) {
1.307 + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
1.308 + __check_range(__f, __l);
1.309 + _Base::assign(__f._M_iterator, __l._M_iterator);
1.310 + return *this;
1.311 + }
1.312 +#endif
1.313 +
1.314 +#else
1.315 + _Self& assign(const _CharT* __f, const _CharT* __l) {
1.316 + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
1.317 + __check_range(__f, __l);
1.318 + _Base::assign(__f, __l);
1.319 + return *this;
1.320 + }
1.321 + _Self& assign(const_iterator __f, const_iterator __l) {
1.322 +
1.323 + _Base::assign(__f._M_iterator, __l._M_iterator);
1.324 + return *this;
1.325 + }
1.326 +#endif /* _STLP_MEMBER_TEMPLATES */
1.327 +
1.328 +public: // Insert
1.329 +
1.330 + _Self& insert(size_type __pos, const _Self& __s) {
1.331 + _Base::insert(__pos, __s);
1.332 + return *this;
1.333 + }
1.334 +
1.335 + _Self& insert(size_type __pos, const _Self& __s,
1.336 + size_type __beg, size_type __n) {
1.337 + _Base::insert(__pos, __s, __beg, __n);
1.338 + return *this;
1.339 + }
1.340 +
1.341 + _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
1.342 + _STLP_FIX_LITERAL_BUG(__s)
1.343 + _Base::insert(__pos, __s, __n);
1.344 + return *this;
1.345 + }
1.346 +
1.347 + _Self& insert(size_type __pos, const _CharT* __s) {
1.348 + _STLP_FIX_LITERAL_BUG(__s)
1.349 + _Base::insert(__pos, __s);
1.350 + return *this;
1.351 + }
1.352 +
1.353 + _Self& insert(size_type __pos, size_type __n, _CharT __c) {
1.354 + _Base::insert(__pos, __n, __c);
1.355 + return *this;
1.356 + }
1.357 +
1.358 + iterator insert(iterator __p, _CharT __c) {
1.359 + _STLP_FIX_LITERAL_BUG(__p)
1.360 + __check_if_owner(&_M_iter_list,__p);
1.361 + return iterator(&_M_iter_list,_Base::insert(__p._M_iterator, __c));
1.362 + }
1.363 +
1.364 + void insert(iterator __p, size_t __n, _CharT __c) {
1.365 + __check_if_owner(&_M_iter_list,__p);
1.366 + _Base::insert(__p._M_iterator, __n, __c);
1.367 + }
1.368 +
1.369 +#ifdef _STLP_MEMBER_TEMPLATES
1.370 + template <class _InputIter>
1.371 + void insert(iterator __p, _InputIter __first, _InputIter __last) {
1.372 + __check_if_owner(&_M_iter_list,__p);
1.373 + __check_range(__first,__last);
1.374 + _Base::insert(__p._M_iterator, __first, __last);
1.375 + }
1.376 +#else /* _STLP_MEMBER_TEMPLATES */
1.377 + void insert(iterator __p, const _CharT* __first, const _CharT* __last) {
1.378 + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
1.379 + __check_if_owner(&_M_iter_list,__p);
1.380 + __check_range(__first,__last);
1.381 + _Base::insert(__p._M_iterator, __first, __last);
1.382 + }
1.383 + void insert(iterator __p, const_iterator __first, const_iterator __last) {
1.384 + __check_range(__first,__last);
1.385 + _Base::insert(__p._M_iterator, __first._M_iterator, __last._M_iterator);
1.386 + }
1.387 +#endif /* _STLP_MEMBER_TEMPLATES */
1.388 +
1.389 +public: // Erase.
1.390 + _Self& erase(size_type __pos = 0, size_type __n = _Base::npos) {
1.391 + _Base::erase(__pos, __n);
1.392 + return *this;
1.393 + }
1.394 + iterator erase(iterator __position) {
1.395 + __check_if_owner(&_M_iter_list, __position);
1.396 + __invalidate_iterator(&_M_iter_list,end());
1.397 + return iterator(&_M_iter_list, _Base::erase(__position._M_iterator));
1.398 + }
1.399 + iterator erase(iterator __first, iterator __last) {
1.400 + __check_range(__first, __last)&&__check_if_owner(&_M_iter_list,__first);
1.401 + if (__first != __last) {
1.402 + __invalidate_range(&_M_iter_list, __last, end());
1.403 + }
1.404 + return iterator(&_M_iter_list, _Base::erase(__first._M_iterator, __last._M_iterator));
1.405 + }
1.406 +
1.407 +public: // Substring.
1.408 + _Self substr(size_type __pos = 0, size_type __n = _Base::npos) const {
1.409 + if (__pos > this->size())
1.410 + this->_M_throw_out_of_range();
1.411 + return _Self(this->begin() + __pos,
1.412 + this->begin() + __pos + min(__n, this->size() - __pos),
1.413 + allocator_type());
1.414 + }
1.415 +public: // Replace. (Conceptually equivalent
1.416 + // to erase followed by insert.)
1.417 + _Self& replace(size_type __pos, size_type __n,
1.418 + const _Self& __s) {
1.419 + _Base::replace(__pos, __n, __s);
1.420 + return *this;
1.421 + }
1.422 +
1.423 + _Self& replace(size_type __pos1, size_type __n1,
1.424 + const _Self& __s,
1.425 + size_type __pos2, size_type __n2) {
1.426 + _Base::replace(__pos1, __n1, (const _Base&)__s, __pos2, __n2);
1.427 + return *this;
1.428 + }
1.429 +
1.430 + _Self& replace(size_type __pos, size_type __n1,
1.431 + const _CharT* __s, size_type __n2) {
1.432 + _STLP_FIX_LITERAL_BUG(__s)
1.433 + _Base::replace(__pos, __n1, __s, __n2);
1.434 + return *this;
1.435 + }
1.436 +
1.437 + _Self& replace(size_type __pos, size_type __n1,
1.438 + const _CharT* __s) {
1.439 + _STLP_FIX_LITERAL_BUG(__s)
1.440 + _Base::replace(__pos, __n1, __s);
1.441 + return *this;
1.442 + }
1.443 +
1.444 + _Self& replace(size_type __pos, size_type __n1,
1.445 + size_type __n2, _CharT __c) {
1.446 + _Base::replace(__pos, __n1, __n2, __c);
1.447 + return *this;
1.448 + }
1.449 +
1.450 + _Self& replace(iterator __first, iterator __last,
1.451 + const _Self& __s) {
1.452 + __check_if_owner(&_M_iter_list,__first);
1.453 + __check_range(__first, __last);
1.454 + _Base::replace(__first._M_iterator, __last._M_iterator,__s);
1.455 + return *this;
1.456 + }
1.457 +
1.458 + _Self& replace(iterator __first, iterator __last,
1.459 + const _CharT* __s, size_type __n) {
1.460 + _STLP_FIX_LITERAL_BUG(__s)
1.461 + __check_if_owner(&_M_iter_list,__first);
1.462 + __check_range(__first, __last);
1.463 + _Base::replace(__first._M_iterator, __last._M_iterator,__s, __n);
1.464 + return *this;
1.465 + }
1.466 +
1.467 + _Self& replace(iterator __first, iterator __last,
1.468 + const _CharT* __s) {
1.469 + _STLP_FIX_LITERAL_BUG(__s)
1.470 + __check_if_owner(&_M_iter_list,__first);
1.471 + __check_range(__first, __last);
1.472 + _Base::replace(__first._M_iterator, __last._M_iterator,__s);
1.473 + return *this;
1.474 + }
1.475 +
1.476 + _Self& replace(iterator __first, iterator __last,
1.477 + size_type __n, _CharT __c) {
1.478 + __check_if_owner(&_M_iter_list,__first);
1.479 + __check_range(__first, __last);
1.480 + _Base::replace(__first._M_iterator, __last._M_iterator, __n, __c);
1.481 + return *this;
1.482 + }
1.483 +
1.484 +#ifdef _STLP_MEMBER_TEMPLATES
1.485 + template <class _InputIter>
1.486 + _Self& replace(iterator __first, iterator __last,
1.487 + _InputIter __f, _InputIter __l) {
1.488 + __check_if_owner(&_M_iter_list, __first);
1.489 + __check_range(__first, __last);
1.490 + __check_range(__f, __l);
1.491 + _Base::replace(__first._M_iterator, __last._M_iterator, __f, __l);
1.492 + return *this;
1.493 + }
1.494 +#else /* _STLP_MEMBER_TEMPLATES */
1.495 + _Self& replace(iterator __first, iterator __last,
1.496 + const _CharT* __f, const _CharT* __l) {
1.497 + __check_if_owner(&_M_iter_list, __first);
1.498 + __check_range(__first, __last);
1.499 + __check_range(__f, __l);
1.500 + _Base::replace(__first._M_iterator, __last._M_iterator, __f, __l);
1.501 + return *this;
1.502 + }
1.503 +
1.504 + _Self& replace(iterator __first, iterator __last,
1.505 + const_iterator __f, const_iterator __l) {
1.506 + __check_if_owner(&_M_iter_list, __first);
1.507 + __check_range(__first, __last);
1.508 + __check_range(__f, __l);
1.509 + _Base::replace(__first._M_iterator, __last._M_iterator,
1.510 + __f._M_iterator, __l._M_iterator);
1.511 + return *this;
1.512 + }
1.513 +#endif /* _STLP_MEMBER_TEMPLATES */
1.514 +
1.515 +public: // Other modifier member functions.
1.516 +
1.517 + void swap(_Self& __s) {
1.518 + _M_iter_list._Swap_owners(__s._M_iter_list);
1.519 + _Base::swap(__s);
1.520 + }
1.521 +};
1.522 +
1.523 +
1.524 +// This is a hook to instantiate STLport exports in a designated DLL
1.525 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.526 +_STLP_EXPORT template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
1.527 +# if defined (_STLP_HAS_WCHAR_T)
1.528 +_STLP_EXPORT template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
1.529 +# endif
1.530 +# endif /* _STLP_USE_TEMPLATE_EXPORT */
1.531 +
1.532 +
1.533 +// ------------------------------------------------------------
1.534 +// Non-member functions.
1.535 +
1.536 +template <class _CharT, class _Traits, class _Alloc>
1.537 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.538 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __s,
1.539 + const basic_string<_CharT,_Traits,_Alloc>& __y)
1.540 +{
1.541 + return basic_string<_CharT,_Traits,_Alloc>(*__s._Get_base() + *__y._Get_base());
1.542 +}
1.543 +
1.544 +template <class _CharT, class _Traits, class _Alloc>
1.545 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.546 +operator+(const _CharT* __s,
1.547 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.548 + _STLP_FIX_LITERAL_BUG(__s)
1.549 + return basic_string<_CharT,_Traits,_Alloc>(__s + *__y._Get_base());
1.550 +}
1.551 +
1.552 +template <class _CharT, class _Traits, class _Alloc>
1.553 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.554 +operator+(_CharT __c,
1.555 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.556 + return basic_string<_CharT,_Traits,_Alloc>(__c + *__y._Get_base());
1.557 +}
1.558 +
1.559 +template <class _CharT, class _Traits, class _Alloc>
1.560 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.561 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.562 + const _CharT* __s) {
1.563 + _STLP_FIX_LITERAL_BUG(__s)
1.564 + return basic_string<_CharT,_Traits,_Alloc>(*__x._Get_base()+ __s);
1.565 +}
1.566 +
1.567 +template <class _CharT, class _Traits, class _Alloc>
1.568 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.569 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.570 + const _CharT __c) {
1.571 + return basic_string<_CharT,_Traits,_Alloc>(*__x._Get_base() + __c);
1.572 +}
1.573 +
1.574 +#ifdef _STLP_EXTRA_OPERATORS_FOR_DEBUG
1.575 +
1.576 +// Operator== and operator!=
1.577 +
1.578 +template <class _CharT, class _Traits, class _Alloc>
1.579 +inline bool _STLP_CALL
1.580 +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.581 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.582 + return (*__x._Get_base() == *__y._Get_base());
1.583 +}
1.584 +
1.585 +template <class _CharT, class _Traits, class _Alloc>
1.586 +inline bool _STLP_CALL
1.587 +operator==(const _CharT* __s,
1.588 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.589 + _STLP_FIX_LITERAL_BUG(__s)
1.590 + return (__s == *__y._Get_base());
1.591 +}
1.592 +
1.593 +template <class _CharT, class _Traits, class _Alloc>
1.594 +inline bool _STLP_CALL
1.595 +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.596 + const _CharT* __s) {
1.597 + _STLP_FIX_LITERAL_BUG(__s)
1.598 + return (*__x._Get_base() == __s);
1.599 +}
1.600 +
1.601 +// Operator< (and also >, <=, and >=).
1.602 +
1.603 +template <class _CharT, class _Traits, class _Alloc>
1.604 +inline bool _STLP_CALL
1.605 +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.606 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.607 + return (*__x._Get_base() < *__y._Get_base());
1.608 +}
1.609 +
1.610 +template <class _CharT, class _Traits, class _Alloc>
1.611 +inline bool _STLP_CALL
1.612 +operator<(const _CharT* __s,
1.613 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.614 + _STLP_FIX_LITERAL_BUG(__s)
1.615 + return (__s < *__y._Get_base());
1.616 +}
1.617 +
1.618 +template <class _CharT, class _Traits, class _Alloc>
1.619 +inline bool _STLP_CALL
1.620 +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.621 + const _CharT* __s) {
1.622 + _STLP_FIX_LITERAL_BUG(__s)
1.623 + return (*__x._Get_base() < __s);
1.624 +}
1.625 +
1.626 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
1.627 +
1.628 +template <class _CharT, class _Traits, class _Alloc>
1.629 +inline bool _STLP_CALL
1.630 +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.631 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.632 + return !(__x == __y);
1.633 +}
1.634 +
1.635 +template <class _CharT, class _Traits, class _Alloc>
1.636 +inline bool _STLP_CALL
1.637 +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.638 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.639 + return __y < __x;
1.640 +}
1.641 +
1.642 +template <class _CharT, class _Traits, class _Alloc>
1.643 +inline bool _STLP_CALL
1.644 +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.645 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.646 + return !(__y < __x);
1.647 +}
1.648 +
1.649 +template <class _CharT, class _Traits, class _Alloc>
1.650 +inline bool _STLP_CALL
1.651 +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.652 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.653 + return !(__x < __y);
1.654 +}
1.655 +
1.656 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.657 +
1.658 +template <class _CharT, class _Traits, class _Alloc>
1.659 +inline bool _STLP_CALL
1.660 +operator!=(const _CharT* __s,
1.661 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.662 + _STLP_FIX_LITERAL_BUG(__s)
1.663 + return !(__s == __y);
1.664 +}
1.665 +
1.666 +template <class _CharT, class _Traits, class _Alloc>
1.667 +inline bool _STLP_CALL
1.668 +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.669 + const _CharT* __s) {
1.670 + _STLP_FIX_LITERAL_BUG(__s)
1.671 + return !(__x == __s);
1.672 +}
1.673 +
1.674 +template <class _CharT, class _Traits, class _Alloc>
1.675 +inline bool _STLP_CALL
1.676 +operator>(const _CharT* __s,
1.677 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.678 + _STLP_FIX_LITERAL_BUG(__s)
1.679 + return __y < __s;
1.680 +}
1.681 +
1.682 +template <class _CharT, class _Traits, class _Alloc>
1.683 +inline bool _STLP_CALL
1.684 +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.685 + const _CharT* __s) {
1.686 + _STLP_FIX_LITERAL_BUG(__s)
1.687 + return __s < __x;
1.688 +}
1.689 +
1.690 +template <class _CharT, class _Traits, class _Alloc>
1.691 +inline bool _STLP_CALL
1.692 +operator<=(const _CharT* __s,
1.693 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.694 + _STLP_FIX_LITERAL_BUG(__s)
1.695 + return !(__y < __s);
1.696 +}
1.697 +
1.698 +template <class _CharT, class _Traits, class _Alloc>
1.699 +inline bool _STLP_CALL
1.700 +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.701 + const _CharT* __s) {
1.702 + _STLP_FIX_LITERAL_BUG(__s)
1.703 + return !(__s < __x);
1.704 +}
1.705 +
1.706 +template <class _CharT, class _Traits, class _Alloc>
1.707 +inline bool _STLP_CALL
1.708 +operator>=(const _CharT* __s,
1.709 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.710 + _STLP_FIX_LITERAL_BUG(__s)
1.711 + return !(__s < __y);
1.712 +}
1.713 +
1.714 +template <class _CharT, class _Traits, class _Alloc>
1.715 +inline bool _STLP_CALL
1.716 +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.717 + const _CharT* __s) {
1.718 + _STLP_FIX_LITERAL_BUG(__s)
1.719 + return !(__x < __s);
1.720 +}
1.721 +#endif /* if 0 */
1.722 +
1.723 +// Swap.
1.724 +#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
1.725 +template <class _CharT, class _Traits, class _Alloc>
1.726 +inline void swap(basic_string<_CharT,_Traits,_Alloc>& __x,
1.727 + basic_string<_CharT,_Traits,_Alloc>& __y) {
1.728 + __x.swap(__y);
1.729 +}
1.730 +#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
1.731 +
1.732 +// I/O.
1.733 +
1.734 +#ifdef _STLP_EXTRA_OPERATORS_FOR_DEBUG
1.735 +#if defined (_STLP_USE_NEW_IOSTREAMS) && ! defined (_STLP_OWN_IOSTREAMS)
1.736 +
1.737 +template <class _CharT, class _Traits, class _Alloc>
1.738 +basic_ostream<_CharT, _Traits>& _STLP_CALL
1.739 +operator<<(basic_ostream<_CharT, _Traits>& __os,
1.740 + const basic_string<_CharT,_Traits,_Alloc>& __s) {
1.741 + return __os << *__s._Get_base();
1.742 +}
1.743 +
1.744 +template <class _CharT, class _Traits, class _Alloc>
1.745 +basic_istream<_CharT, _Traits>& _STLP_CALL
1.746 +operator>>(basic_istream<_CharT, _Traits>& __is,
1.747 + basic_string<_CharT,_Traits,_Alloc>& __s) {
1.748 + return __is >> *__s._Get_base();
1.749 +}
1.750 +
1.751 +#elif ! defined ( _STLP_USE_NO_IOSTREAMS )
1.752 +
1.753 +template <class _CharT, class _Traits, class _Alloc>
1.754 +ostream& _STLP_CALL operator<<(ostream& __os,
1.755 + const basic_string<_CharT,_Traits,_Alloc>& __s) {
1.756 + return __os << *__s._Get_base();
1.757 +}
1.758 +
1.759 +template <class _CharT, class _Traits, class _Alloc>
1.760 +istream& _STLP_CALL operator>>(istream& __is, basic_string<_CharT,_Traits,_Alloc>& __s) {
1.761 + return __is >> *__s._Get_base();
1.762 +}
1.763 +
1.764 +#endif /* _STLP_USE_NEW_IOSTREAMS */
1.765 +#endif /* if _STLP_EXTRA_OPERATORS_FOR_DEBUG */
1.766 +
1.767 +
1.768 +_STLP_END_NAMESPACE
1.769 +
1.770 +#endif /* _STLP_DBG_STRING */
1.771 +
1.772 +
1.773 +// Local Variables:
1.774 +// mode:C++
1.775 +// End:
1.776 +