2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(- * * ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
16 * Part of : standard c++ library.
21 #ifndef _SYMCPP_NEW_H_
22 #define _SYMCPP_NEW_H_
25 #ifndef _STLP_FEATURES_H
26 # include <stl/config/features.h>
32 # include <stl/_cstddef.h> //Include the STLP internal header to make macros/typedefs expected of <csddef> available.
33 # define _STLP_CSTDDEF //Define this macro so that <cstddef> doesn't get included by new_eabi.h
39 typedef unsigned size_t;
41 class bad_alloc : public exception
44 IMPORT_C bad_alloc() __NO_THROW;
45 IMPORT_C bad_alloc(const bad_alloc&) __NO_THROW;
46 IMPORT_C bad_alloc& operator=(const bad_alloc&) __NO_THROW; // { return *this;}
48 IMPORT_C virtual ~bad_alloc() __NO_THROW; // {}
49 IMPORT_C virtual const char* what() const __NO_THROW; // { return "bad_alloc";}
53 extern const nothrow_t nothrow;
55 typedef void (*new_handler)();
57 IMPORT_C new_handler set_new_handler(new_handler) __NO_THROW;
62 IMPORT_C void* operator new(std::size_t) __THROW(std::bad_alloc);
63 IMPORT_C void operator delete(void*) __NO_THROW;
65 IMPORT_C void* operator new(std::size_t, const std::nothrow_t&) __NO_THROW;
66 IMPORT_C void operator delete(void*, const std::nothrow_t&) __NO_THROW;
68 #ifndef __PLACEMENT_NEW_INLINE
69 #define __PLACEMENT_NEW_INLINE
70 inline void* operator new(std::size_t, void* p) __NO_THROW
75 inline void operator delete(void*, void*) __NO_THROW
82 IMPORT_C void* operator new[](std::size_t) __THROW(std::bad_alloc);
83 IMPORT_C void operator delete[](void*) __NO_THROW;
85 IMPORT_C void* operator new[](std::size_t, const std::nothrow_t&) __NO_THROW;
86 IMPORT_C void operator delete[](void*, const std::nothrow_t&) __NO_THROW;
88 #ifndef __PLACEMENT_VEC_NEW_INLINE
89 #define __PLACEMENT_VEC_NEW_INLINE
90 inline void* operator new[](std::size_t, void* p) __NO_THROW
95 inline void operator delete[](void*, void*) __NO_THROW
100 // Symbian additions (not part of standard C++).
101 IMPORT_C void* operator new(std::size_t, std::size_t) __NO_THROW;
102 IMPORT_C void operator delete(void*, std::size_t) __NO_THROW;
109 # include <exception>
110 # include <stl/_cstddef.h>
114 struct nothrow_t { };
115 extern const nothrow_t nothrow;
117 class bad_alloc : public exception {
119 bad_alloc () __NO_THROW {};
120 bad_alloc ( const bad_alloc &) __NO_THROW {};
121 bad_alloc & operator =( const bad_alloc &) __NO_THROW { return *this;}
122 virtual const char * what () const __NO_THROW { return "bad_alloc";}
125 typedef void (* new_handler )();
126 new_handler set_new_handler ( new_handler new_p ) __NO_THROW;
129 IMPORT_C void* operator new (std::size_t) __THROW(std::bad_alloc);
130 IMPORT_C void operator delete (void*) __NO_THROW;
132 IMPORT_C void* operator new (std::size_t, const std::nothrow_t&) __NO_THROW;
133 IMPORT_C void operator delete (void*, const std::nothrow_t&) __NO_THROW;
135 IMPORT_C void* operator new[] (std::size_t) __THROW(std::bad_alloc);
136 IMPORT_C void operator delete[] (void*) __NO_THROW;
138 IMPORT_C void* operator new[] (std::size_t, const std::nothrow_t&) __NO_THROW;
139 IMPORT_C void operator delete[] (void*, const std::nothrow_t&) __NO_THROW;
141 # ifndef __PLACEMENT_NEW_INLINE
142 # define __PLACEMENT_NEW_INLINE
143 inline void* operator new(std::size_t, void* aBase) __NO_THROW
146 inline void operator delete(void*, void*) __NO_THROW {}
147 # endif //__PLACEMENT_NEW_INLINE
149 # ifndef __PLACEMENT_VEC_NEW_INLINE
150 # define __PLACEMENT_VEC_NEW_INLINE
151 inline void* operator new[](std::size_t, void* aBase) __NO_THROW
154 inline void operator delete[](void* , void*) __NO_THROW {}
155 # endif //__PLACEMENT_VEC_NEW_INLINE
158 #endif //_SYMCPP_NEW_H_