SourceForge.net Logo
XMemory.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * $Id: XMemory.hpp 932889 2010-04-11 13:10:10Z borisk $
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_XMEMORY_HPP)
23 #define XERCESC_INCLUDE_GUARD_XMEMORY_HPP
24 
25 #include <xercesc/util/XercesDefs.hpp>
26 #include <stdlib.h>
27 
28 XERCES_CPP_NAMESPACE_BEGIN
29 
30 class MemoryManager;
31 
40 class XMLUTIL_EXPORT XMemory
41 {
42 public :
43  // -----------------------------------------------------------------------
44  // The C++ memory management
45  // -----------------------------------------------------------------------
48 
54  void* operator new(size_t size);
55 
56 #if defined(XERCES_MFC_SUPPORT)
57 
64  void* operator new(size_t size, const char* file, int line);
72  void operator delete(void* p, const char* file, int line);
73 #endif
74 
82  void* operator new(size_t size, MemoryManager* memMgr);
83 
90  void* operator new(size_t size, void* ptr);
91 
97  void operator delete(void* p);
98 
99  //The Borland compiler is complaining about duplicate overloading of delete
100 #if !defined(XERCES_NO_MATCHING_DELETE_OPERATOR)
101 
107  void operator delete(void* p, MemoryManager* memMgr);
108 
115  void operator delete(void* p, void* ptr);
116 #endif
117 
119 
120 protected :
121  // -----------------------------------------------------------------------
122  // Hidden Constructors
123  // -----------------------------------------------------------------------
126 
131  {
132  }
134 
135 #if defined(XERCES_NEED_XMEMORY_VIRTUAL_DESTRUCTOR)
136  virtual ~XMemory()
137  {
138  }
139 #endif
140 };
141 
142 XERCES_CPP_NAMESPACE_END
143 
144 #endif
Configurable memory manager.
Definition: MemoryManager.hpp:39
XMemory()
Protected default constructor.
Definition: XMemory.hpp:130
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:40