1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 20:27:13 +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 { namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQInteger AES256::Typename(HSQUIRRELVM vm) SQMODE_DECL_TYPENAME(Typename, _SC("SqAES256"))
{
static const SQChar name[] = _SC("SqAES256");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AES256::AES256() AES256::AES256()
@ -138,13 +133,13 @@ String AES256::Decrypt(CSStr data)
// ================================================================================================ // ================================================================================================
void Register_AES(HSQUIRRELVM vm) void Register_AES(HSQUIRRELVM vm)
{ {
RootTable(vm).Bind("SqAES256", Class< AES256 >(vm, "SqAES256") RootTable(vm).Bind(Typename::Str, Class< AES256 >(vm, Typename::Str)
// Constructors // Constructors
.Ctor() .Ctor()
.Ctor< CSStr >() .Ctor< CSStr >()
// Meta-methods // Meta-methods
.Func(_SC("_cmp"), &AES256::Cmp) .SquirrelFunc(_SC("_typename"), &Typename::Fn)
.SquirrelFunc(_SC("_typename"), &AES256::Typename) .Func(_SC("cmp"), &AES256::Cmp)
.Func(_SC("_tostring"), &AES256::ToString) .Func(_SC("_tostring"), &AES256::ToString)
/* Properties */ /* Properties */
.Prop(_SC("Key"), &AES256::GetKey) .Prop(_SC("Key"), &AES256::GetKey)

View File

@ -62,11 +62,6 @@ public:
*/ */
CSStr ToString() const; 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. * Retrieve the associated key.
*/ */