mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Update Other.hpp
This commit is contained in:
parent
87cb6a2cba
commit
8d908208f0
@ -114,11 +114,7 @@ struct DpActivity
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpActivity() noexcept
|
~DpActivity() noexcept { Cleanup(); }
|
||||||
{
|
|
||||||
// Do we own this to try delete it?
|
|
||||||
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy assignment operator (disabled).
|
* Copy assignment operator (disabled).
|
||||||
*/
|
*/
|
||||||
@ -129,14 +125,24 @@ struct DpActivity
|
|||||||
DpActivity & operator = (DpActivity && o) noexcept
|
DpActivity & operator = (DpActivity && o) noexcept
|
||||||
{
|
{
|
||||||
if (this != &o) {
|
if (this != &o) {
|
||||||
// Do we own this to try delete it?
|
Cleanup();
|
||||||
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
|
|
||||||
// Transfer members values
|
// Transfer members values
|
||||||
mPtr = std::move(o.mPtr);
|
mPtr = std::move(o.mPtr);
|
||||||
mOwned = o.mOwned;
|
mOwned = o.mOwned;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Release any referenced resources and default to an empty/invalid state.
|
||||||
|
*/
|
||||||
|
void Cleanup()
|
||||||
|
{
|
||||||
|
// Do we own this to try delete it?
|
||||||
|
if (!mOwned && mPtr) {
|
||||||
|
// Not our job, simply forget about it
|
||||||
|
[[maybe_unused]] auto p = mPtr.release();
|
||||||
|
} else mPtr.reset(); // We own this so delete the instance
|
||||||
|
}
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Validate the managed handle.
|
* Validate the managed handle.
|
||||||
*/
|
*/
|
||||||
@ -302,11 +308,7 @@ struct DpPresence
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpPresence() noexcept
|
~DpPresence() noexcept { Cleanup(); }
|
||||||
{
|
|
||||||
// Do we own this to try delete it?
|
|
||||||
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy assignment operator (disabled).
|
* Copy assignment operator (disabled).
|
||||||
*/
|
*/
|
||||||
@ -317,14 +319,24 @@ struct DpPresence
|
|||||||
DpPresence & operator = (DpPresence && o) noexcept
|
DpPresence & operator = (DpPresence && o) noexcept
|
||||||
{
|
{
|
||||||
if (this != &o) {
|
if (this != &o) {
|
||||||
// Do we own this to try delete it?
|
Cleanup();
|
||||||
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
|
|
||||||
// Transfer members values
|
// Transfer members values
|
||||||
mPtr = std::move(o.mPtr);
|
mPtr = std::move(o.mPtr);
|
||||||
mOwned = o.mOwned;
|
mOwned = o.mOwned;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Release any referenced resources and default to an empty/invalid state.
|
||||||
|
*/
|
||||||
|
void Cleanup()
|
||||||
|
{
|
||||||
|
// Do we own this to try delete it?
|
||||||
|
if (!mOwned && mPtr) {
|
||||||
|
// Not our job, simply forget about it
|
||||||
|
[[maybe_unused]] auto p = mPtr.release();
|
||||||
|
} else mPtr.reset(); // We own this so delete the instance
|
||||||
|
}
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Validate the managed handle.
|
* Validate the managed handle.
|
||||||
*/
|
*/
|
||||||
@ -489,11 +501,7 @@ struct DpVoiceState
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpVoiceState() noexcept
|
~DpVoiceState() noexcept { Cleanup(); }
|
||||||
{
|
|
||||||
// Do we own this to try delete it?
|
|
||||||
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy assignment operator (disabled).
|
* Copy assignment operator (disabled).
|
||||||
*/
|
*/
|
||||||
@ -504,14 +512,24 @@ struct DpVoiceState
|
|||||||
DpVoiceState & operator = (DpVoiceState && o) noexcept
|
DpVoiceState & operator = (DpVoiceState && o) noexcept
|
||||||
{
|
{
|
||||||
if (this != &o) {
|
if (this != &o) {
|
||||||
// Do we own this to try delete it?
|
Cleanup();
|
||||||
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
|
|
||||||
// Transfer members values
|
// Transfer members values
|
||||||
mPtr = std::move(o.mPtr);
|
mPtr = std::move(o.mPtr);
|
||||||
mOwned = o.mOwned;
|
mOwned = o.mOwned;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Release any referenced resources and default to an empty/invalid state.
|
||||||
|
*/
|
||||||
|
void Cleanup()
|
||||||
|
{
|
||||||
|
// Do we own this to try delete it?
|
||||||
|
if (!mOwned && mPtr) {
|
||||||
|
// Not our job, simply forget about it
|
||||||
|
[[maybe_unused]] auto p = mPtr.release();
|
||||||
|
} else mPtr.reset(); // We own this so delete the instance
|
||||||
|
}
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Validate the managed handle.
|
* Validate the managed handle.
|
||||||
*/
|
*/
|
||||||
@ -579,7 +597,7 @@ struct DpVoiceState
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Check if user is surpressed.
|
* Check if user is surpressed.
|
||||||
*/
|
*/
|
||||||
SQMOD_NODISCARD bool IsSupressed() const { return Valid().is_supressed(); }
|
SQMOD_NODISCARD bool IsSuppressed() const { return Valid().is_suppressed(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user