From 0f52f6931b55cb3654d89277a8b2c5e459bd0633 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 25 Aug 2013 12:21:15 -0700 Subject: [PATCH] Switch ADTFactory/IBasicTrie off KTrie (bug 5884 part 17, r=ds). --- core/ADTFactory.cpp | 14 ++++++-------- core/ADTFactory.h | 6 +++--- public/IADTFactory.h | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/core/ADTFactory.cpp b/core/ADTFactory.cpp index 0726504fb..cd761b6ad 100644 --- a/core/ADTFactory.cpp +++ b/core/ADTFactory.cpp @@ -1,5 +1,5 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ============================================================================= * SourceMod * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. @@ -57,32 +57,30 @@ IBasicTrie *ADTFactory::CreateBasicTrie() BaseTrie::BaseTrie() { - m_pTrie = sm_trie_create(); } BaseTrie::~BaseTrie() { - sm_trie_destroy(m_pTrie); } 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) { - return sm_trie_retrieve(m_pTrie, key, value); + return map_.retrieve(key, value); } bool BaseTrie::Delete(const char *key) { - return sm_trie_delete(m_pTrie, key); + return map_.remove(key); } void BaseTrie::Clear() { - sm_trie_clear(m_pTrie); + map_.clear(); } void BaseTrie::Destroy() @@ -92,5 +90,5 @@ void BaseTrie::Destroy() bool BaseTrie::Replace(const char *key, void *value) { - return sm_trie_replace(m_pTrie, key, value); + return map_.replace(key, value); } diff --git a/core/ADTFactory.h b/core/ADTFactory.h index 31bff041b..8ef3d6a1c 100644 --- a/core/ADTFactory.h +++ b/core/ADTFactory.h @@ -1,5 +1,5 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ============================================================================= * SourceMod * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. @@ -34,7 +34,7 @@ #include #include "sm_globals.h" -#include "sm_trie.h" +#include using namespace SourceMod; @@ -50,7 +50,7 @@ public: virtual void Clear(); virtual void Destroy(); private: - Trie *m_pTrie; + StringHashMap map_; }; class ADTFactory : diff --git a/public/IADTFactory.h b/public/IADTFactory.h index 347eba3f8..877fa2739 100644 --- a/public/IADTFactory.h +++ b/public/IADTFactory.h @@ -45,7 +45,7 @@ namespace SourceMod { /** - * @brief A "Trie" data type. + * @brief A hash table data type. */ class IBasicTrie {