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

Implement the pure typename meta-methods in AES type using the standard method.

This commit is contained in:
Sandu Liviu Catalin 2016-11-15 21:41:46 +02:00
parent f18d4c948a
commit 847222685b
2 changed files with 4 additions and 14 deletions

View File

@ -10,12 +10,7 @@
namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQInteger AES256::Typename(HSQUIRRELVM vm)
{
static const SQChar name[] = _SC("SqAES256");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
SQMODE_DECL_TYPENAME(Typename, _SC("SqAES256"))
// ------------------------------------------------------------------------------------------------
AES256::AES256()
@ -138,13 +133,13 @@ String AES256::Decrypt(CSStr data)
// ================================================================================================
void Register_AES(HSQUIRRELVM vm)
{
RootTable(vm).Bind("SqAES256", Class< AES256 >(vm, "SqAES256")
RootTable(vm).Bind(Typename::Str, Class< AES256 >(vm, Typename::Str)
// Constructors
.Ctor()
.Ctor< CSStr >()
// Meta-methods
.Func(_SC("_cmp"), &AES256::Cmp)
.SquirrelFunc(_SC("_typename"), &AES256::Typename)
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
.Func(_SC("cmp"), &AES256::Cmp)
.Func(_SC("_tostring"), &AES256::ToString)
/* Properties */
.Prop(_SC("Key"), &AES256::GetKey)

View File

@ -62,11 +62,6 @@ public:
*/
CSStr ToString() const;
/* --------------------------------------------------------------------------------------------
* Used by the script engine to retrieve the name from instances of this type.
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated key.
*/