mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #89 from lioncash/noexcept
This commit is contained in:
commit
1af7146427
|
@ -16,7 +16,7 @@ u16 CObjectReference::RemoveReference() {
|
|||
|
||||
CObjectReference::CObjectReference(IObjectStore& objStore, std::unique_ptr<IObj>&& obj, const SObjectTag& objTag,
|
||||
CVParamTransfer buildParams)
|
||||
: x4_objTag(objTag), xC_objectStore(&objStore), x10_object(std::move(obj)), x14_params(buildParams) {}
|
||||
: x4_objTag(objTag), xC_objectStore(&objStore), x10_object(std::move(obj)), x14_params(std::move(buildParams)) {}
|
||||
CObjectReference::CObjectReference(std::unique_ptr<IObj>&& obj) : x10_object(std::move(obj)) {}
|
||||
|
||||
void CObjectReference::Unlock() {
|
||||
|
@ -128,7 +128,7 @@ CToken::CToken(const CToken& other) : x0_objRef(other.x0_objRef) {
|
|||
Lock();
|
||||
}
|
||||
}
|
||||
CToken::CToken(CToken&& other) : x0_objRef(other.x0_objRef), x4_lockHeld(other.x4_lockHeld) {
|
||||
CToken::CToken(CToken&& other) noexcept : x0_objRef(other.x0_objRef), x4_lockHeld(other.x4_lockHeld) {
|
||||
other.x0_objRef = nullptr;
|
||||
other.x4_lockHeld = false;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
CToken& operator=(CToken&& other);
|
||||
CToken() = default;
|
||||
CToken(const CToken& other);
|
||||
CToken(CToken&& other);
|
||||
CToken(CToken&& other) noexcept;
|
||||
CToken(IObj* obj);
|
||||
CToken(std::unique_ptr<IObj>&& obj);
|
||||
const SObjectTag* GetObjectTag() const;
|
||||
|
|
|
@ -16,26 +16,32 @@ class TObjOwnerParam : public IVParamObj {
|
|||
|
||||
public:
|
||||
TObjOwnerParam(T&& obj) : m_param(std::move(obj)) {}
|
||||
T& GetParam() { return m_param; }
|
||||
const T& GetParam() const { return m_param; }
|
||||
T& GetParam() noexcept { return m_param; }
|
||||
const T& GetParam() const noexcept { return m_param; }
|
||||
};
|
||||
|
||||
class CVParamTransfer {
|
||||
std::shared_ptr<IVParamObj> m_ref;
|
||||
|
||||
public:
|
||||
CVParamTransfer() = default;
|
||||
constexpr CVParamTransfer() noexcept = default;
|
||||
CVParamTransfer(IVParamObj* obj) : m_ref(obj) {}
|
||||
CVParamTransfer(const CVParamTransfer& other) : m_ref(other.m_ref) {}
|
||||
IVParamObj* GetObj() const { return m_ref.get(); }
|
||||
CVParamTransfer ShareTransferRef() const { return CVParamTransfer(*this); }
|
||||
|
||||
CVParamTransfer(const CVParamTransfer& other) noexcept = default;
|
||||
CVParamTransfer& operator=(const CVParamTransfer&) noexcept = default;
|
||||
|
||||
CVParamTransfer(CVParamTransfer&&) noexcept = default;
|
||||
CVParamTransfer& operator=(CVParamTransfer&&) noexcept = default;
|
||||
|
||||
IVParamObj* GetObj() const noexcept { return m_ref.get(); }
|
||||
CVParamTransfer ShareTransferRef() const noexcept { return CVParamTransfer(*this); }
|
||||
|
||||
template <class T>
|
||||
T& GetOwnedObj() const {
|
||||
T& GetOwnedObj() const noexcept {
|
||||
return static_cast<TObjOwnerParam<T>*>(GetObj())->GetParam();
|
||||
}
|
||||
|
||||
static CVParamTransfer Null() { return CVParamTransfer(); }
|
||||
static CVParamTransfer Null() noexcept { return CVParamTransfer(); }
|
||||
};
|
||||
|
||||
} // namespace urde
|
||||
|
|
Loading…
Reference in New Issue