epoc32/include/stdapis/stlport/stl/_construct.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_construct.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,252 +0,0 @@
     1.4 -/*
     1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 - * Copyright (c) 1994
     1.7 - * Hewlett-Packard Company
     1.8 - *
     1.9 - * Copyright (c) 1996,1997
    1.10 - * Silicon Graphics Computer Systems, Inc.
    1.11 - *
    1.12 - * Copyright (c) 1997
    1.13 - * Moscow Center for SPARC Technology
    1.14 - *
    1.15 - * Copyright (c) 1999 
    1.16 - * Boris Fomitchev
    1.17 - *
    1.18 - * This material is provided "as is", with absolutely no warranty expressed
    1.19 - * or implied. Any use is at your own risk.
    1.20 - *
    1.21 - * Permission to use or copy this software for any purpose is hereby granted 
    1.22 - * without fee, provided the above notices are retained on all copies.
    1.23 - * Permission to modify the code and to distribute modified code is granted,
    1.24 - * provided the above notices are retained, and a notice that the code was
    1.25 - * modified is included with the above copyright notice.
    1.26 - *
    1.27 - */
    1.28 -
    1.29 -/* NOTE: This is an internal header file, included by other STL headers.
    1.30 - *   You should not attempt to use it directly.
    1.31 - */
    1.32 -
    1.33 -#ifndef _STLP_INTERNAL_CONSTRUCT_H
    1.34 -#define _STLP_INTERNAL_CONSTRUCT_H
    1.35 -
    1.36 -#ifdef _STLP_USE_TRAP_LEAVE
    1.37 -#include <e32base.h>
    1.38 -#endif // _STLP_USE_TRAP_LEAVE
    1.39 -
    1.40 -# if defined (_STLP_DEBUG_UNINITIALIZED) && ! defined (_STLP_CSTRING)
    1.41 -# include <cstring>
    1.42 -# endif
    1.43 -
    1.44 -# ifndef _STLP_INTERNAL_NEW_HEADER
    1.45 -#  include <stl/_new.h>
    1.46 -# endif
    1.47 -
    1.48 -
    1.49 -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
    1.50 -# include <stl/_iterator_base.h>
    1.51 -#endif
    1.52 -
    1.53 -_STLP_BEGIN_NAMESPACE
    1.54 -
    1.55 -# ifdef _STLP_TRIVIAL_DESTRUCTOR_BUG
    1.56 -template <class _Tp>
    1.57 -inline void __destroy_aux(_Tp* __pointer, const __false_type&) { __pointer->~_Tp(); }
    1.58 -template <class _Tp>
    1.59 -inline void __destroy_aux(_Tp* __pointer, const __true_type&) {}
    1.60 -# endif
    1.61 -
    1.62 -template <class _Tp>
    1.63 -inline void _Destroy(_Tp* __pointer) {
    1.64 -# if _MSC_VER >= 1010
    1.65 -  __pointer;
    1.66 -# endif	// _MSC_VER >= 1000
    1.67 -# ifdef _STLP_TRIVIAL_DESTRUCTOR_BUG
    1.68 -  typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
    1.69 -  __destroy_aux(__pointer, _Trivial_destructor());
    1.70 -# else
    1.71 -#  if ( defined (__BORLANDC__) && ( __BORLANDC__ < 0x500 ) )
    1.72 -    __pointer->_Tp::~_Tp();
    1.73 -#  else
    1.74 -    __pointer->~_Tp();
    1.75 -#  endif
    1.76 -# endif
    1.77 -# ifdef _STLP_DEBUG_UNINITIALIZED
    1.78 -	memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp));
    1.79 -# endif
    1.80 -}
    1.81 -
    1.82 -# if defined (new)
    1.83 -#   define _STLP_NEW_REDEFINE new
    1.84 -#   undef new
    1.85 -# endif 
    1.86 -
    1.87 -# ifdef _STLP_DEFAULT_CONSTRUCTOR_BUG
    1.88 -template <class _T1>
    1.89 -inline void _Construct_aux (_T1* __p, const __false_type&) {
    1.90 -_STLP_PLACEMENT_NEW (__p) _T1();
    1.91 -}
    1.92 -
    1.93 -template <class _T1>
    1.94 -inline void _Construct_aux (_T1* __p, const __true_type&) {
    1.95 -_STLP_PLACEMENT_NEW (__p) _T1(0);
    1.96 -}
    1.97 -# endif
    1.98 -
    1.99 -template <class _T1, class _T2>
   1.100 -inline void _Construct(_T1* __p, const _T2& __val) {
   1.101 -# ifdef _STLP_DEBUG_UNINITIALIZED
   1.102 -	memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
   1.103 -# endif
   1.104 -    _STLP_PLACEMENT_NEW (__p) _T1(__val);
   1.105 -}
   1.106 -
   1.107 -template <class _T1>
   1.108 -inline void _Construct(_T1* __p) {
   1.109 -# ifdef _STLP_DEBUG_UNINITIALIZED
   1.110 -  memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
   1.111 -# endif
   1.112 -# ifdef _STLP_DEFAULT_CONSTRUCTOR_BUG
   1.113 -typedef typename _Is_integer<_T1>::_Integral _Is_Integral;
   1.114 -_Construct_aux (__p, _Is_Integral() );
   1.115 -# else
   1.116 -  _STLP_PLACEMENT_NEW (__p) _T1();
   1.117 -# endif
   1.118 -}
   1.119 -
   1.120 -# if defined(_STLP_NEW_REDEFINE)
   1.121 -# ifdef DEBUG_NEW
   1.122 -#  define new DEBUG_NEW
   1.123 -# endif
   1.124 -#  undef _STLP_NEW_REDEFINE
   1.125 -# endif 
   1.126 -
   1.127 -template <class _ForwardIterator>
   1.128 -_STLP_INLINE_LOOP void
   1.129 -__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, const __false_type&) {
   1.130 -  for ( ; __first != __last; ++__first)
   1.131 -    _STLP_STD::_Destroy(&*__first);
   1.132 -}
   1.133 -
   1.134 -template <class _ForwardIterator> 
   1.135 -inline void __destroy_aux(_ForwardIterator, _ForwardIterator, const __true_type&) {}
   1.136 -
   1.137 -template <class _ForwardIterator, class _Tp>
   1.138 -inline void 
   1.139 -__destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*) {
   1.140 -  typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
   1.141 -  __destroy_aux(__first, __last, _Trivial_destructor());
   1.142 -}
   1.143 -
   1.144 -template <class _ForwardIterator>
   1.145 -inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) {
   1.146 -  __destroy(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
   1.147 -}
   1.148 -
   1.149 -inline void _Destroy(char*, char*) {}
   1.150 -# ifdef _STLP_HAS_WCHAR_T // dwa 8/15/97
   1.151 -inline void _Destroy(wchar_t*, wchar_t*) {}
   1.152 -inline void _Destroy(const wchar_t*, const wchar_t*) {}
   1.153 -# endif
   1.154 -
   1.155 -# ifndef _STLP_NO_ANACHRONISMS
   1.156 -// --------------------------------------------------
   1.157 -// Old names from the HP STL.
   1.158 -
   1.159 -template <class _T1, class _T2>
   1.160 -inline void construct(_T1* __p, const _T2& __val) {_Construct(__p, __val); }
   1.161 -template <class _T1>
   1.162 -inline void construct(_T1* __p) { _Construct(__p); }
   1.163 -template <class _Tp>
   1.164 -inline void destroy(_Tp* __pointer) {  _STLP_STD::_Destroy(__pointer); }
   1.165 -template <class _ForwardIterator>
   1.166 -inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy(__first, __last); }
   1.167 -# endif
   1.168 -
   1.169 -#ifdef _STLP_USE_TRAP_LEAVE
   1.170 -
   1.171 -struct TCleanupOverlay
   1.172 -{
   1.173 -    TAny *vtable;
   1.174 -    TAny *iBase;
   1.175 -    TAny *iTop;
   1.176 -    TAny *iNext;
   1.177 -};
   1.178 -
   1.179 -template <class _Tp>
   1.180 -struct _STLP_StackHelper {
   1.181 -  static unsigned int Check( void *ptr );
   1.182 -  static void* _NewLC (size_t __n);
   1.183 -};
   1.184 -
   1.185 -struct _STLP_StackPopper {
   1.186 -  ~_STLP_StackPopper() { CleanupStack::Pop(); }
   1.187 -};
   1.188 -
   1.189 -template <class _Tp>
   1.190 -struct _STLP_Cleanup {
   1.191 -  static void clear(TAny* __p);
   1.192 -};
   1.193 -
   1.194 -# define _STLP_PUSH_CLEANUP_ITEM(_Tp, __p)  CleanupStack::PushL(TCleanupItem(&_STLP_Cleanup< _Tp >::clear, (TAny*)__p));
   1.195 -# define _STLP_PUSH_STACK_ITEM(_Tp, __p)  _STLP_PUSH_CLEANUP_ITEM(_Tp, __p)   _STLP_StackPopper __Popper; _STLP_no_unused_variable_warning( __Popper );
   1.196 -# define _STLP_POP_IF_CHECK if (_STLP_StackHelper<bool>::Check(this)) CleanupStack::Pop();
   1.197 -# define _STLP_POP_CLEANUP_ITEM CleanupStack::Pop(); _STLP_POP_IF_CHECK
   1.198 -
   1.199 -# define _STLP_POP_ITEM CleanupStack::Pop();
   1.200 -
   1.201 -// to be used in complex object constructors
   1.202 -template <class _Tp>
   1.203 -struct _STLP_StackPusher {
   1.204 -  _STLP_StackPusher(_Tp * __p) { _STLP_PUSH_CLEANUP_ITEM(_Tp, (void*)__p) }
   1.205 -};
   1.206 -
   1.207 -template <class _Tp>
   1.208 -unsigned int _STLP_StackHelper<_Tp>::Check( void *ptr )
   1.209 -
   1.210 -{
   1.211 -    TCleanupTrapHandler *handler =
   1.212 -        (TCleanupTrapHandler *)User::TrapHandler();
   1.213 -
   1.214 -    CCleanup &cleanup = handler->Cleanup();
   1.215 -
   1.216 -    TCleanupOverlay *overlay = (TCleanupOverlay *)( &cleanup );
   1.217 -
   1.218 -    char *raw = (char *)(overlay->iNext) - 4;
   1.219 -    void *topptr = *( (void **)(raw) );
   1.220 -
   1.221 -    return ( ptr == topptr );
   1.222 -} 
   1.223 -
   1.224 -
   1.225 -template <class _Tp>
   1.226 -void* _STLP_StackHelper<_Tp>::_NewLC(size_t __n) { 
   1.227 -  void* __p = ::operator new (__n, ELeave) ; 
   1.228 -  // constructor will pop it back
   1.229 -  CleanupStack::PushL(__p); 
   1.230 -  return __p;
   1.231 -}
   1.232 -
   1.233 -template <class _Tp>
   1.234 -void _STLP_Cleanup<_Tp>::clear(TAny* __p)
   1.235 -{
   1.236 -  ((_Tp*)__p)->~_Tp();
   1.237 -}
   1.238 -
   1.239 -
   1.240 -#else
   1.241 -# define _STLP_PUSH_CLEANUP_ITEM(_Tp, __p)
   1.242 -# define _STLP_POP_CLEANUP_ITEM
   1.243 -# define _STLP_PUSH_STACK_ITEM(_Tp, p)
   1.244 -# define _STLP_POP_ITEM
   1.245 -# define _STLP_POP_IF_CHECK
   1.246 -# define TPush TLeave
   1.247 -#endif
   1.248 -
   1.249 -_STLP_END_NAMESPACE
   1.250 -
   1.251 -#endif /* _STLP_INTERNAL_CONSTRUCT_H */
   1.252 -
   1.253 -// Local Variables:
   1.254 -// mode:C++
   1.255 -// End: