Switch ADTFactory/IBasicTrie off KTrie (bug 5884 part 17, r=ds).

This commit is contained in:
David Anderson 2013-08-25 12:21:15 -07:00
parent 51dc097266
commit 0f52f6931b
3 changed files with 10 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/** /**
* vim: set ts=4 : * vim: set ts=4 sw=4 tw=99 noet :
* ============================================================================= * =============================================================================
* SourceMod * SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@ -57,32 +57,30 @@ IBasicTrie *ADTFactory::CreateBasicTrie()
BaseTrie::BaseTrie() BaseTrie::BaseTrie()
{ {
m_pTrie = sm_trie_create();
} }
BaseTrie::~BaseTrie() BaseTrie::~BaseTrie()
{ {
sm_trie_destroy(m_pTrie);
} }
bool BaseTrie::Insert(const char *key, void *value) bool BaseTrie::Insert(const char *key, void *value)
{ {
return sm_trie_insert(m_pTrie, key, value); return map_.insert(key, value);
} }
bool BaseTrie::Retrieve(const char *key, void **value) bool BaseTrie::Retrieve(const char *key, void **value)
{ {
return sm_trie_retrieve(m_pTrie, key, value); return map_.retrieve(key, value);
} }
bool BaseTrie::Delete(const char *key) bool BaseTrie::Delete(const char *key)
{ {
return sm_trie_delete(m_pTrie, key); return map_.remove(key);
} }
void BaseTrie::Clear() void BaseTrie::Clear()
{ {
sm_trie_clear(m_pTrie); map_.clear();
} }
void BaseTrie::Destroy() void BaseTrie::Destroy()
@ -92,5 +90,5 @@ void BaseTrie::Destroy()
bool BaseTrie::Replace(const char *key, void *value) bool BaseTrie::Replace(const char *key, void *value)
{ {
return sm_trie_replace(m_pTrie, key, value); return map_.replace(key, value);
} }

View File

@ -1,5 +1,5 @@
/** /**
* vim: set ts=4 : * vim: set ts=4 sw=4 tw=99 noet :
* ============================================================================= * =============================================================================
* SourceMod * SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@ -34,7 +34,7 @@
#include <IADTFactory.h> #include <IADTFactory.h>
#include "sm_globals.h" #include "sm_globals.h"
#include "sm_trie.h" #include <sm_stringhashmap.h>
using namespace SourceMod; using namespace SourceMod;
@ -50,7 +50,7 @@ public:
virtual void Clear(); virtual void Clear();
virtual void Destroy(); virtual void Destroy();
private: private:
Trie *m_pTrie; StringHashMap<void *> map_;
}; };
class ADTFactory : class ADTFactory :

View File

@ -45,7 +45,7 @@
namespace SourceMod namespace SourceMod
{ {
/** /**
* @brief A "Trie" data type. * @brief A hash table data type.
*/ */
class IBasicTrie class IBasicTrie
{ {