Add iterators natives

This commit is contained in:
Arkshine
2014-05-03 23:21:56 +02:00
parent b6cd247d12
commit 9ac3763267
8 changed files with 437 additions and 28 deletions

View File

@@ -3,6 +3,7 @@
#include "amxmodx.h"
#include "sm_stringhashmap.h"
#include "sm_memtable.h"
#include "CVector.h"
using namespace SourceMod;
@@ -135,6 +136,22 @@ struct CellTrie
StringHashMap<Entry> map;
};
struct TrieSnapshot
{
TrieSnapshot()
: strings(128)
{ }
size_t mem_usage()
{
return length * sizeof(int) + strings.GetMemTable()->GetMemUsage();
}
size_t length;
ke::AutoArray<int> keys;
BaseStringTable strings;
};
template <typename T>
class TrieHandles
{
@@ -208,6 +225,7 @@ public:
extern TrieHandles<CellTrie> g_TrieHandles;
extern TrieHandles<TrieSnapshot> g_TrieSnapshotHandles;
extern AMX_NATIVE_INFO trie_Natives[];
#endif