16 #ifndef INCLUDE_NN_NLIB_EXI_EXIALLOCATOR_H_ 17 #define INCLUDE_NN_NLIB_EXI_EXIALLOCATOR_H_ 23 #include "nn/nlib/Swap.h" 25 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 26 #undef NLIB_VIS_PUBLIC 27 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 33 struct ExiAllocatorInfo;
49 void* Realloc(
void* ptr,
size_t from_nbytes,
size_t nbytes)
NLIB_NOEXCEPT;
61 ExiAllocatorInfo* prv_;
62 friend class ExiAllocator;
70 static void* Realloc(
void* ptr,
size_t from_nbytes,
size_t nbytes)
NLIB_NOEXCEPT;
87 if (m_Al) ExiAllocator::Swap(rhs);
90 if (m_Swapped) ExiAllocator::Swap(m_Al);
99 #ifdef NN_PLATFORM_CTR 101 #define NEXI_DEF_NEW_DELETE(typeName) \ 102 static void* operator new(size_t size) throw() { \ 103 NLIB_ASSERT(size == sizeof(typeName)); \ 104 return ExiAllocator::Alloc(size); \ 106 static void* operator new(size_t size, const std::nothrow_t&) throw() { \ 107 NLIB_ASSERT(size == sizeof(typeName)); \ 108 return ExiAllocator::Alloc(size); \ 110 static void* operator new(size_t size, void* ptr) throw() { \ 111 return ::operator new(size, ptr); \ 113 static void operator delete(void* p) throw() { ExiAllocator::Dealloc(p); } \ 114 static void* operator new[](size_t size, void* p) throw(); \ 115 static void operator delete[](void* p) throw() 117 #define NEXI_DISALLOW_NEW_DELETE(typeName) \ 119 static void* operator new(size_t size, void* ptr) throw() { \ 120 return ::operator new(size, ptr); \ 124 static void* operator new(size_t size) throw(); \ 125 static void* operator new(size_t size, const std::nothrow_t&) throw(); \ 126 static void operator delete(void* p) throw(); \ 127 static void* operator new[](size_t size, void* p) throw(); \ 128 static void* operator new[](size_t size, const std::nothrow_t&) throw(); \ 129 static void operator delete[](void* p) throw() 131 #define NEXI_DEF_NEW_DELETE(typeName) \ 133 static void* operator new[](size_t size); \ 134 static void* operator new[](size_t size, void* p) NLIB_NOEXCEPT; \ 135 static void* operator new[](size_t size, const std::nothrow_t&) NLIB_NOEXCEPT; \ 136 static void operator delete[](void* p) NLIB_NOEXCEPT; \ 137 static void operator delete[](void* p, void* ptr) NLIB_NOEXCEPT; \ 138 static void operator delete[](void* p, const std::nothrow_t&) NLIB_NOEXCEPT; \ 141 static void* operator new(size_t size) { \ 142 NLIB_ASSERT(size == sizeof(typeName)); \ 143 return ExiAllocator::Alloc(size); \ 145 static void* operator new(size_t size, const std::nothrow_t&) NLIB_NOEXCEPT { \ 146 NLIB_ASSERT(size == sizeof(typeName)); \ 147 return ExiAllocator::Alloc(size); \ 149 static void* operator new(size_t size, void* ptr) NLIB_NOEXCEPT { \ 150 return ::operator new(size, ptr); \ 152 static void operator delete(void* p)NLIB_NOEXCEPT { ExiAllocator::Dealloc(p); } \ 153 static void operator delete(void* p, const std::nothrow_t&)NLIB_NOEXCEPT { \ 154 ExiAllocator::Dealloc(p); \ 156 static void operator delete(void* p, void* ptr)NLIB_NOEXCEPT { \ 157 return ::operator delete(p, ptr); \ 161 #define NEXI_DISALLOW_NEW_DELETE(typeName) \ 163 static void* operator new(size_t size, void* ptr) NLIB_NOEXCEPT { \ 164 return ::operator new(size, ptr); \ 166 static void operator delete(void* p, void* ptr)NLIB_NOEXCEPT { \ 167 return ::operator delete(p, ptr); \ 169 static void operator delete(void* p)NLIB_NOEXCEPT { \ 175 static void* operator new(size_t size); \ 176 static void* operator new(size_t size, const std::nothrow_t&) NLIB_NOEXCEPT; \ 177 static void operator delete(void* p, const std::nothrow_t&)NLIB_NOEXCEPT; \ 178 static void* operator new[](size_t size); \ 179 static void* operator new[](size_t size, void* p) NLIB_NOEXCEPT; \ 180 static void* operator new[](size_t size, const std::nothrow_t&) NLIB_NOEXCEPT; \ 181 static void operator delete[](void* p) NLIB_NOEXCEPT; \ 182 static void operator delete[](void* p, void* ptr) NLIB_NOEXCEPT; \ 183 static void operator delete[](void* p, const std::nothrow_t&) NLIB_NOEXCEPT 185 #define NEXI_DISALLOW_NEW_DELETE(typeName) NLIB_STATIC_ASSERT(true) 192 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 193 #undef NLIB_VIS_PUBLIC 194 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 197 #endif // INCLUDE_NN_NLIB_EXI_EXIALLOCATOR_H_ Allocator used by the XML parser. The user can also use it.
Defines constructs such as string-type typedef statements and utility macros.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
#define NLIB_SAFE_BOOL(class_name, exp)
Defines a safe operator bool function in the class. Uses the C++11 explicit bool if it is available f...
constexpr ExiAllocatorEx() noexcept
Instantiates the object with default parameters (default constructor).
Allocator that can be set for each instance of XmlStreamReader and XmlStreamWriter.
ExiAllocatorEx & operator=(const ExiAllocatorEx &rhs) noexcept
Assignment operator.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
A file that contains the configuration information for each development environment.
~ExiAllocatorEx() noexcept
Destructor.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
ExiAllocatorEx(const ExiAllocatorEx &rhs) noexcept
Copy constructor.