]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/hash.h
ICU-551.51.4.tar.gz
[apple/icu.git] / icuSources / common / hash.h
index 375499bf1b876dc5e89a6c7bb7557ddb7e3e400a..ab5fbf6c73c01c236508994a1db3fd100182db04 100644 (file)
@@ -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);
 }