1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-20 19:57:12 +01:00

Adjust the Object entity methods to use the new method of receiving formatted strings.

This commit is contained in:
Sandu Liviu Catalin 2016-11-16 14:48:48 +02:00
parent e1fd4e1ee2
commit 3fbba9f3e2
2 changed files with 23 additions and 3 deletions

View File

@ -64,9 +64,23 @@ const String & CObject::GetTag() const
}
// ------------------------------------------------------------------------------------------------
void CObject::SetTag(CSStr tag)
void CObject::SetTag(const StackStrF & tag)
{
m_Tag.assign(tag);
if (tag.mLen > 0)
{
m_Tag.assign(tag.mPtr, tag.mLen);
}
else
{
m_Tag.clear();
}
}
// ------------------------------------------------------------------------------------------------
CObject & CObject::ApplyTag(StackStrF & tag)
{
SetTag(tag);
return *this;
}
// ------------------------------------------------------------------------------------------------
@ -888,6 +902,7 @@ void Register_CObject(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CObject::IsActive)
// Core Methods
.Func(_SC("Bind"), &CObject::BindEvent)
.FmtFunc(_SC("SetTag"), &CObject::ApplyTag)
.Func(_SC("CustomEvent"), &CObject::CustomEvent)
// Core Overloads
.Overload< bool (CObject::*)(void) >(_SC("Destroy"), &CObject::Destroy)

View File

@ -156,7 +156,12 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
void SetTag(CSStr tag);
void SetTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CObject & ApplyTag(StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.