mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Update Message.hpp
This commit is contained in:
parent
8d908208f0
commit
57321af0c7
@ -73,11 +73,7 @@ struct DpSelectOption
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpSelectOption() noexcept
|
~DpSelectOption() 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).
|
||||||
*/
|
*/
|
||||||
@ -88,14 +84,24 @@ struct DpSelectOption
|
|||||||
DpSelectOption & operator = (DpSelectOption && o) noexcept
|
DpSelectOption & operator = (DpSelectOption && 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.
|
||||||
*/
|
*/
|
||||||
@ -246,11 +252,7 @@ struct DpComponent
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpComponent() noexcept
|
~DpComponent() 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).
|
||||||
*/
|
*/
|
||||||
@ -261,14 +263,24 @@ struct DpComponent
|
|||||||
DpComponent & operator = (DpComponent && o) noexcept
|
DpComponent & operator = (DpComponent && 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.
|
||||||
*/
|
*/
|
||||||
@ -331,11 +343,7 @@ struct DpEmbedFooter
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpEmbedFooter() noexcept
|
~DpEmbedFooter() 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).
|
||||||
*/
|
*/
|
||||||
@ -346,14 +354,24 @@ struct DpEmbedFooter
|
|||||||
DpEmbedFooter & operator = (DpEmbedFooter && o) noexcept
|
DpEmbedFooter & operator = (DpEmbedFooter && 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.
|
||||||
*/
|
*/
|
||||||
@ -416,11 +434,7 @@ struct DpEmbedImage
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpEmbedImage() noexcept
|
~DpEmbedImage() 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).
|
||||||
*/
|
*/
|
||||||
@ -431,14 +445,24 @@ struct DpEmbedImage
|
|||||||
DpEmbedImage & operator = (DpEmbedImage && o) noexcept
|
DpEmbedImage & operator = (DpEmbedImage && 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.
|
||||||
*/
|
*/
|
||||||
@ -501,11 +525,7 @@ struct DpEmbedProvider
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpEmbedProvider() noexcept
|
~DpEmbedProvider() 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).
|
||||||
*/
|
*/
|
||||||
@ -516,14 +536,24 @@ struct DpEmbedProvider
|
|||||||
DpEmbedProvider & operator = (DpEmbedProvider && o) noexcept
|
DpEmbedProvider & operator = (DpEmbedProvider && 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.
|
||||||
*/
|
*/
|
||||||
@ -586,11 +616,7 @@ struct DpEmbedAuthor
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpEmbedAuthor() noexcept
|
~DpEmbedAuthor() 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).
|
||||||
*/
|
*/
|
||||||
@ -601,14 +627,24 @@ struct DpEmbedAuthor
|
|||||||
DpEmbedAuthor & operator = (DpEmbedAuthor && o) noexcept
|
DpEmbedAuthor & operator = (DpEmbedAuthor && 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.
|
||||||
*/
|
*/
|
||||||
@ -671,11 +707,7 @@ struct DpEmbedField
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpEmbedField() noexcept
|
~DpEmbedField() 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).
|
||||||
*/
|
*/
|
||||||
@ -686,14 +718,24 @@ struct DpEmbedField
|
|||||||
DpEmbedField & operator = (DpEmbedField && o) noexcept
|
DpEmbedField & operator = (DpEmbedField && 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.
|
||||||
*/
|
*/
|
||||||
@ -756,11 +798,7 @@ struct DpEmbed
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpEmbed() noexcept
|
~DpEmbed() 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).
|
||||||
*/
|
*/
|
||||||
@ -771,14 +809,24 @@ struct DpEmbed
|
|||||||
DpEmbed & operator = (DpEmbed && o) noexcept
|
DpEmbed & operator = (DpEmbed && 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.
|
||||||
*/
|
*/
|
||||||
@ -841,11 +889,7 @@ struct DpReaction
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpReaction() noexcept
|
~DpReaction() 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).
|
||||||
*/
|
*/
|
||||||
@ -856,14 +900,24 @@ struct DpReaction
|
|||||||
DpReaction & operator = (DpReaction && o) noexcept
|
DpReaction & operator = (DpReaction && 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.
|
||||||
*/
|
*/
|
||||||
@ -926,11 +980,7 @@ struct DpAttachment
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpAttachment() noexcept
|
~DpAttachment() 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).
|
||||||
*/
|
*/
|
||||||
@ -941,14 +991,24 @@ struct DpAttachment
|
|||||||
DpAttachment & operator = (DpAttachment && o) noexcept
|
DpAttachment & operator = (DpAttachment && 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.
|
||||||
*/
|
*/
|
||||||
@ -1011,11 +1071,7 @@ struct DpSticker
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpSticker() noexcept
|
~DpSticker() 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).
|
||||||
*/
|
*/
|
||||||
@ -1026,14 +1082,24 @@ struct DpSticker
|
|||||||
DpSticker & operator = (DpSticker && o) noexcept
|
DpSticker & operator = (DpSticker && 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.
|
||||||
*/
|
*/
|
||||||
@ -1096,11 +1162,7 @@ struct DpStickerPack
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpStickerPack() noexcept
|
~DpStickerPack() 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).
|
||||||
*/
|
*/
|
||||||
@ -1111,14 +1173,24 @@ struct DpStickerPack
|
|||||||
DpStickerPack & operator = (DpStickerPack && o) noexcept
|
DpStickerPack & operator = (DpStickerPack && 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.
|
||||||
*/
|
*/
|
||||||
@ -1181,11 +1253,7 @@ struct DpMessage
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
~DpMessage() noexcept
|
~DpMessage() 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).
|
||||||
*/
|
*/
|
||||||
@ -1196,14 +1264,24 @@ struct DpMessage
|
|||||||
DpMessage & operator = (DpMessage && o) noexcept
|
DpMessage & operator = (DpMessage && 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.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user