2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CTOKEN
|
|
|
|
#define _CTOKEN
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-10-01 08:32:56 +00:00
|
|
|
#include "Kyoto/CObjectReference.hpp"
|
2022-10-09 05:13:17 +00:00
|
|
|
#include "Kyoto/IObj.hpp"
|
2022-09-13 04:26:54 +00:00
|
|
|
|
|
|
|
class CObjectReference;
|
2022-07-14 16:24:26 +00:00
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
class CToken {
|
|
|
|
public:
|
2022-08-13 01:26:00 +00:00
|
|
|
CToken() {}
|
2022-10-20 14:28:06 +00:00
|
|
|
CToken(CObjectReference* ref);
|
2022-09-13 04:26:54 +00:00
|
|
|
CToken(IObj* obj); // : x0_objRef(new CObjectReference(obj)), x4_lockHeld(false) {}
|
2022-08-13 01:26:00 +00:00
|
|
|
CToken(const CToken& other);
|
2022-04-10 00:17:06 +00:00
|
|
|
~CToken();
|
|
|
|
|
2022-09-13 04:26:54 +00:00
|
|
|
CObjOwnerDerivedFromIObjUntyped* GetObj();
|
2022-08-13 01:26:00 +00:00
|
|
|
void Lock();
|
2022-10-20 14:28:06 +00:00
|
|
|
void Unlock();
|
2022-10-01 08:32:56 +00:00
|
|
|
bool IsLoaded() const { return x0_objRef->IsLoaded(); }
|
2022-10-20 14:28:06 +00:00
|
|
|
void RemoveRef();
|
|
|
|
CToken& operator=(const CToken&);
|
2022-11-25 12:41:28 +00:00
|
|
|
bool HasReference() const { return x0_objRef != nullptr; }
|
2022-11-27 00:26:12 +00:00
|
|
|
const SObjectTag& GetTag() const { return x0_objRef->GetTag(); }
|
2023-11-10 23:16:36 +00:00
|
|
|
FourCC GetReferenceType() { return GetTag().GetType(); }
|
2022-10-09 05:13:17 +00:00
|
|
|
|
2022-11-15 20:06:18 +00:00
|
|
|
bool HasLock() { return x4_lockHeld; }
|
|
|
|
|
2023-01-11 19:08:11 +00:00
|
|
|
const CObjectReference* GetRef() const { return x0_objRef; }
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
private:
|
|
|
|
CObjectReference* x0_objRef;
|
|
|
|
bool x4_lockHeld;
|
|
|
|
};
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CTOKEN
|