mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-15 04:06:07 +00:00
Implement TObj*/IObj; finish matching CStringTable
This commit is contained in:
@@ -6,13 +6,33 @@
|
||||
namespace rstl {
|
||||
template < typename T >
|
||||
class auto_ptr {
|
||||
bool x0_has;
|
||||
T* x4_item;
|
||||
mutable bool x0_has;
|
||||
mutable T* x4_item;
|
||||
|
||||
public:
|
||||
auto_ptr() : x0_has(false), x4_item(nullptr) {}
|
||||
auto_ptr(T* ptr) : x0_has(ptr != nullptr), x4_item(ptr) {}
|
||||
~auto_ptr() {
|
||||
if (x0_has) {
|
||||
delete x4_item;
|
||||
}
|
||||
}
|
||||
// TODO check
|
||||
// auto_ptr(const auto_ptr& other) : x0_has(other.x0_has), x4_item(other.x4_item) {
|
||||
// other.x0_has = false;
|
||||
// }
|
||||
// TODO check
|
||||
// auto_ptr& operator=(const auto_ptr& other) {
|
||||
// x0_has = other.x4_item != nullptr;
|
||||
// x4_item = other.x4_item;
|
||||
// other.x0_has = false;
|
||||
// }
|
||||
T* get() { return x4_item; }
|
||||
T* operator->() { return get(); }
|
||||
T* release() const {
|
||||
x0_has = false;
|
||||
return x4_item;
|
||||
}
|
||||
};
|
||||
} // namespace rstl
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
single_ptr(T* ptr) : x0_ptr(ptr) {}
|
||||
~single_ptr() { delete x0_ptr; }
|
||||
T* get() { return x0_ptr; }
|
||||
const T* get() const { return x0_ptr; }
|
||||
T* operator->() { return x0_ptr; }
|
||||
void operator=(T* ptr) {
|
||||
delete x0_ptr;
|
||||
|
||||
Reference in New Issue
Block a user