1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #include "salhelper/simplereferenceobject.hxx"
25 #include "osl/diagnose.h"
26
27 #ifndef INCLUDED_NEW
28 #include <new>
29 #define INCLUDED_NEW
30 #endif
31
32 using salhelper::SimpleReferenceObject;
33
~SimpleReferenceObject()34 SimpleReferenceObject::~SimpleReferenceObject() SAL_THROW(())
35 {
36 OSL_ASSERT(m_nCount == 0);
37 }
38
operator new(std::size_t nSize)39 void * SimpleReferenceObject::operator new(std::size_t nSize)
40 {
41 return ::operator new(nSize);
42 }
43
operator new(std::size_t nSize,std::nothrow_t const &)44 void * SimpleReferenceObject::operator new(std::size_t nSize,
45 std::nothrow_t const &)
46 SAL_THROW(())
47 {
48 #if defined WNT
49 return ::operator new(nSize);
50 // WNT lacks a global nothrow operator new...
51 #else // WNT
52 return ::operator new(nSize, std::nothrow);
53 #endif // WNT
54 }
55
operator delete(void * pPtr)56 void SimpleReferenceObject::operator delete(void * pPtr) SAL_THROW(())
57 {
58 ::operator delete(pPtr);
59 }
60
operator delete(void * pPtr,std::nothrow_t const &)61 void SimpleReferenceObject::operator delete(void * pPtr, std::nothrow_t const &)
62 SAL_THROW(())
63 {
64 #if defined WNT
65 ::operator delete(pPtr); // WNT lacks a global nothrow operator delete...
66 #else // WNT
67 ::operator delete(pPtr, std::nothrow);
68 #endif // WNT
69 }
70
operator delete[](void * pPtr)71 void SimpleReferenceObject::operator delete[](void * pPtr)
72 SAL_THROW(())
73 {
74 ::operator delete[](pPtr);
75 }
76