prime/include/Kyoto/CToken.hpp

39 lines
906 B
C++
Raw Normal View History

#ifndef _CTOKEN
#define _CTOKEN
#include "types.h"
#include "Kyoto/CObjectReference.hpp"
#include "Kyoto/IObj.hpp"
class CObjectReference;
class CToken {
public:
2022-08-13 01:26:00 +00:00
CToken() {}
2022-10-20 14:28:06 +00:00
CToken(CObjectReference* ref);
CToken(IObj* obj); // : x0_objRef(new CObjectReference(obj)), x4_lockHeld(false) {}
2022-08-13 01:26:00 +00:00
CToken(const CToken& other);
~CToken();
CObjOwnerDerivedFromIObjUntyped* GetObj();
2022-08-13 01:26:00 +00:00
void Lock();
2022-10-20 14:28:06 +00:00
void Unlock();
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(); }
FourCC GetReferenceType() { return GetTag().type; }
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; }
private:
CObjectReference* x0_objRef;
bool x4_lockHeld;
};
#endif // _CTOKEN