1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-09 01:07:16 +01:00
SqMod/source/Misc/Skin.hpp

219 lines
8.2 KiB
C++
Raw Normal View History

2015-09-30 02:56:11 +02:00
#ifndef _MISC_SKIN_HPP_
#define _MISC_SKIN_HPP_
// ------------------------------------------------------------------------------------------------
#include "Shared.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* Class responsible for managing and interacting with skin models.
*/
2015-09-30 02:56:11 +02:00
class CSkin : public IdentifierStorage< CSkin, SQMOD_SKINID_CAP >
{
public:
/* --------------------------------------------------------------------------------------------
* Helper member for times when a null reference to an instance of this type is needed.
*/
2015-09-30 02:56:11 +02:00
static const CSkin NIL;
/* --------------------------------------------------------------------------------------------
* Default constructor.
*/
2015-09-30 02:56:11 +02:00
CSkin() noexcept;
/* --------------------------------------------------------------------------------------------
* Construct an instance of this type and reference the specified skin.
*/
2015-09-30 02:56:11 +02:00
CSkin(SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* Construct an instance of this type and reference the skin extracted from the specified name.
*/
2015-09-30 02:56:11 +02:00
CSkin(const SQChar * name, SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* Copy constructor.
*/
2015-09-30 02:56:11 +02:00
CSkin(const CSkin & s) noexcept;
/* --------------------------------------------------------------------------------------------
* Move constructor.
*/
2015-09-30 02:56:11 +02:00
CSkin(CSkin && s) noexcept;
/* --------------------------------------------------------------------------------------------
* Destructor.
*/
2015-09-30 02:56:11 +02:00
~CSkin() noexcept;
/* --------------------------------------------------------------------------------------------
* Copy assignment operator.
*/
2015-09-30 02:56:11 +02:00
CSkin & operator = (const CSkin & s) noexcept;
/* --------------------------------------------------------------------------------------------
* Move assignment operator.
*/
2015-09-30 02:56:11 +02:00
CSkin & operator = (CSkin && s) noexcept;
/* --------------------------------------------------------------------------------------------
* Skin identifier assignment operator.
*/
2015-09-30 02:56:11 +02:00
CSkin & operator = (SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* Equality comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator == (const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Inequality comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator != (const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Less than comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator < (const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Greater than comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator > (const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Less than or equal comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator <= (const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Greater than or equal comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator >= (const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Implicit conversion to skin identifier.
*/
2015-09-30 02:56:11 +02:00
operator SQInt32 () const noexcept { return m_ID; }
/* --------------------------------------------------------------------------------------------
* Implicit conversion to boolean.
*/
2015-09-30 02:56:11 +02:00
operator bool () const noexcept { return IsSkinValid(m_ID); }
/* --------------------------------------------------------------------------------------------
* Negation operator.
*/
2015-09-30 02:56:11 +02:00
bool operator ! () const noexcept { return !IsSkinValid(m_ID); }
/* --------------------------------------------------------------------------------------------
* Used by the script to compare two instances of this type.
*/
2015-09-30 02:56:11 +02:00
SQInteger Cmp(const CSkin & s) const noexcept;
/* --------------------------------------------------------------------------------------------
* Convert this type to a string.
*/
2015-09-30 02:56:11 +02:00
const SQChar * ToString() const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier referenced by this instance.
*/
2015-09-30 02:56:11 +02:00
SQInteger GetID() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the identifier referenced by this instance.
*/
2015-09-30 02:56:11 +02:00
void SetID(SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* Set the identifier that this insance should reference and
* get a reference to the instance to chain operations.
*/
2015-09-30 02:56:11 +02:00
CSkin & SetnGet(SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the global tag.
*/
2015-09-30 02:56:11 +02:00
const SQChar * GetGlobalTag() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the global tag.
*/
2015-09-30 02:56:11 +02:00
void SetGlobalTag(const SQChar * tag) const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the global data.
*/
2015-09-30 02:56:11 +02:00
SqObj & GetGlobalData() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the global data.
*/
2015-09-30 02:56:11 +02:00
void SetGlobalData(SqObj & data) const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the local tag.
*/
2015-09-30 02:56:11 +02:00
const SQChar * GetLocalTag() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the local tag.
*/
2015-09-30 02:56:11 +02:00
void SetLocalTag(const SQChar * tag) noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the local data.
*/
2015-09-30 02:56:11 +02:00
SqObj & GetLocalData() noexcept;
/* --------------------------------------------------------------------------------------------
* Change the local data.
*/
2015-09-30 02:56:11 +02:00
void SetLocalData(SqObj & data) noexcept;
/* --------------------------------------------------------------------------------------------
* See whether the referenced skin identifier is valid.
*/
2015-09-30 02:56:11 +02:00
bool IsValid() const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the name of the referenced skin.
*/
2015-09-30 02:56:11 +02:00
const SQChar * GetName() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the identifier of the referenced skin.
*/
2015-09-30 02:56:11 +02:00
void SetName(const SQChar * name) noexcept;
/* --------------------------------------------------------------------------------------------
* Apply the referenced skin identifier to the specified player instance.
*/
2015-09-30 02:56:11 +02:00
void Apply(const Reference< CPlayer > & player) const noexcept;
2015-09-30 02:56:11 +02:00
private:
/* --------------------------------------------------------------------------------------------
* The identifier of the referenced skin.
*/
2015-09-30 02:56:11 +02:00
SQInt32 m_ID;
/* --------------------------------------------------------------------------------------------
* The local tag associated with this instance.
*/
2015-09-30 02:56:11 +02:00
SqTag m_Tag;
/* --------------------------------------------------------------------------------------------
* The local data associated with this instance.
*/
2015-09-30 02:56:11 +02:00
SqObj m_Data;
};
} // Namespace:: SqMod
#endif // _MISC_SKIN_HPP_