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;
53 void* Realloc(
void* ptr,
size_t from_nbytes,
size_t nbytes)
NLIB_NOEXCEPT;
60 bool IsValid() const NLIB_NOEXCEPT {
return prv_ !=
nullptr; }
65 ExiAllocatorInfo* prv_;
74 static void* Realloc(
void* ptr,
size_t from_nbytes,
size_t nbytes)
NLIB_NOEXCEPT;
93 if (m_Al) ExiAllocator::Swap(rhs);
96 if (m_Swapped) ExiAllocator::Swap(m_Al);
105 #ifdef NN_PLATFORM_CTR 107 #define NEXI_DEF_NEW_DELETE(typeName) \ 108 static void* operator new(size_t size) throw() { \ 109 NLIB_ASSERT(size == sizeof(typeName)); \ 110 return ExiAllocator::Alloc(size); \ 112 static void* operator new(size_t size, const std::nothrow_t&) throw() { \ 113 NLIB_ASSERT(size == sizeof(typeName)); \ 114 return ExiAllocator::Alloc(size); \ 116 static void* operator new(size_t size, void* ptr) throw() { \ 117 return ::operator new(size, ptr); \ 119 static void operator delete(void* p) throw() { ExiAllocator::Dealloc(p); } \ 120 static void* operator new[](size_t size, void* p) throw(); \ 121 static void operator delete[](void* p) throw() 123 #define NEXI_DISALLOW_NEW_DELETE(typeName) \ 125 static void* operator new(size_t size, void* ptr) throw() { \ 126 return ::operator new(size, ptr); \ 129 static void* operator new(size_t size) throw(); \ 130 static void* operator new(size_t size, const std::nothrow_t&) throw(); \ 131 static void operator delete(void* p) throw(); \ 132 static void* operator new[](size_t size, void* p) throw(); \ 133 static void* operator new[](size_t size, const std::nothrow_t&) throw(); \ 134 static void operator delete[](void* p) throw() 136 #define NEXI_DEF_NEW_DELETE(typeName) \ 138 static void* operator new[](size_t size); \ 139 static void* operator new[](size_t size, void* p) NLIB_NOEXCEPT; \ 140 static void* operator new[](size_t size, const std::nothrow_t&) NLIB_NOEXCEPT; \ 141 static void operator delete[](void* p) NLIB_NOEXCEPT; \ 142 static void operator delete[](void* p, void* ptr) NLIB_NOEXCEPT; \ 143 static void operator delete[](void* p, const std::nothrow_t&) NLIB_NOEXCEPT; \ 145 static void* operator new(size_t size) { \ 146 NLIB_ASSERT(size == sizeof(typeName)); \ 147 return ExiAllocator::Alloc(size); \ 149 static void* operator new(size_t size, const std::nothrow_t&) NLIB_NOEXCEPT { \ 150 NLIB_ASSERT(size == sizeof(typeName)); \ 151 return ExiAllocator::Alloc(size); \ 153 static void* operator new(size_t size, void* ptr) NLIB_NOEXCEPT { \ 154 return ::operator new(size, ptr); \ 156 static void operator delete(void* p) NLIB_NOEXCEPT { ExiAllocator::Dealloc(p); } \ 157 static void operator delete(void* p, const std::nothrow_t&) NLIB_NOEXCEPT { \ 158 ExiAllocator::Dealloc(p); \ 160 static void operator delete(void* p, void* ptr) NLIB_NOEXCEPT { \ 161 return ::operator delete(p, ptr); \ 165 #define NEXI_DISALLOW_NEW_DELETE(typeName) \ 167 static void* operator new(size_t size, void* ptr) NLIB_NOEXCEPT { \ 168 return ::operator new(size, ptr); \ 170 static void operator delete(void* p, void* ptr) NLIB_NOEXCEPT { \ 171 return ::operator delete(p, ptr); \ 173 static void operator delete(void* p) NLIB_NOEXCEPT { \ 178 static void* operator new(size_t size); \ 179 static void* operator new(size_t size, const std::nothrow_t&) NLIB_NOEXCEPT; \ 180 static void operator delete(void* p, const std::nothrow_t&) NLIB_NOEXCEPT; \ 181 static void* operator new[](size_t size); \ 182 static void* operator new[](size_t size, void* p) NLIB_NOEXCEPT; \ 183 static void* operator new[](size_t size, const std::nothrow_t&) NLIB_NOEXCEPT; \ 184 static void operator delete[](void* p) NLIB_NOEXCEPT; \ 185 static void operator delete[](void* p, void* ptr) NLIB_NOEXCEPT; \ 186 static void operator delete[](void* p, const std::nothrow_t&) NLIB_NOEXCEPT 188 #define NEXI_DISALLOW_NEW_DELETE(typeName) NLIB_STATIC_ASSERT(true) 195 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 196 #undef NLIB_VIS_PUBLIC 197 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 200 #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...
bool IsValid() const noexcept
Returns true if the allocator has been initialized.
void swap(ExiAllocatorEx &rhs) noexcept
Swaps the contents of an object.
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.