1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-31 09:57:14 +01:00
SqMod/module/Library/Utils/Dictionary.cpp
Sandu Liviu Catalin 323dc3ad1b Implement dictionary type.
Basically a fast (hybrid) contiguous hash map.
2021-07-04 03:34:33 +03:00

36 lines
1.4 KiB
C++

// ------------------------------------------------------------------------------------------------
#include "Library/Utils/Dictionary.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQMOD_DECL_TYPENAME(SqDictionaryTn, _SC("SqDictionary"))
// ================================================================================================
void Register_Dictionary(HSQUIRRELVM vm, Table & ns)
{
ns.Bind(_SC("Dictionary"),
Class< SqDictionary >(vm, SqDictionaryTn::Str)
// Constructors
.Ctor()
.Ctor< SQInteger >()
// Meta-methods
.SquirrelFunc(_SC("_typename"), &SqDictionaryTn::Fn)
// Properties
.Prop(_SC("Empty"), &SqDictionary::Empty)
.Prop(_SC("Size"), &SqDictionary::Size)
// Member Methods
.Func(_SC("Get"), &SqDictionary::Get)
.Func(_SC("Set"), &SqDictionary::Set)
.Func(_SC("Clear"), &SqDictionary::Clear)
.Func(_SC("Erase"), &SqDictionary::Erase)
.CbFunc(_SC("Each"), &SqDictionary::Each)
.CbFunc(_SC("EachWith"), &SqDictionary::EachWith)
.CbFunc(_SC("While"), &SqDictionary::While)
.CbFunc(_SC("WhileWith"), &SqDictionary::WhileWith)
);
}
} // Namespace:: SqMod