X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..a0b4f637ba1a6c3c5651b61a69303b029bacf7d3:/icuSources/common/hash.h diff --git a/icuSources/common/hash.h b/icuSources/common/hash.h index 375499bf..ab5fbf6c 100644 --- a/icuSources/common/hash.h +++ b/icuSources/common/hash.h @@ -1,6 +1,6 @@ /* ****************************************************************************** -* Copyright (C) 1997-2006, International Business Machines +* Copyright (C) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * Date Name Description @@ -13,6 +13,7 @@ #include "unicode/unistr.h" #include "unicode/uobject.h" +#include "cmemory.h" #include "uhash.h" U_NAMESPACE_BEGIN @@ -40,8 +41,8 @@ public: /** * Construct a hashtable - * @param keyComp Compartor for comparing the keys - * @param valueComp Compartor for comparing the values + * @param keyComp Comparator for comparing the keys + * @param valueComp Comparator for comparing the values * @param status Error code */ Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); @@ -84,11 +85,15 @@ public: const UHashElement* find(const UnicodeString& key) const; + /** + * @param pos - must be UHASH_FIRST on first call, and untouched afterwards. + * @see uhash_nextElement + */ const UHashElement* nextElement(int32_t& pos) const; - UKeyComparator* setKeyCompartor(UKeyComparator*keyComp); + UKeyComparator* setKeyComparator(UKeyComparator*keyComp); - UValueComparator* setValueCompartor(UValueComparator* valueComp); + UValueComparator* setValueComparator(UValueComparator* valueComp); UBool equals(const Hashtable& that) const; private: @@ -108,7 +113,7 @@ inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp, uhash_init(&hashObj, keyHash, keyComp, valueComp, &status); if (U_SUCCESS(status)) { hash = &hashObj; - uhash_setKeyDeleter(hash, uhash_deleteUnicodeString); + uhash_setKeyDeleter(hash, uprv_deleteUObject); } } @@ -190,11 +195,11 @@ inline void Hashtable::removeAll(void) { uhash_removeAll(hash); } -inline UKeyComparator* Hashtable::setKeyCompartor(UKeyComparator*keyComp){ +inline UKeyComparator* Hashtable::setKeyComparator(UKeyComparator*keyComp){ return uhash_setKeyComparator(hash, keyComp); } -inline UValueComparator* Hashtable::setValueCompartor(UValueComparator* valueComp){ +inline UValueComparator* Hashtable::setValueComparator(UValueComparator* valueComp){ return uhash_setValueComparator(hash, valueComp); }