X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/2ca993e82fb37b597a3c73ecd1586a139a6579c5..3d1f044b704633e2e541231cd17ae9ecf9ad5c7a:/icuSources/common/hash.h?ds=inline diff --git a/icuSources/common/hash.h b/icuSources/common/hash.h index 80f9e14a..f02cb708 100644 --- a/icuSources/common/hash.h +++ b/icuSources/common/hash.h @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** -* Copyright (C) 1997-2016, International Business Machines +* Copyright (C) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * Date Name Description @@ -39,7 +41,7 @@ public: * @param ignoreKeyCase If true, keys are case insensitive. * @param status Error code */ - Hashtable(UBool ignoreKeyCase, UErrorCode& status); + inline Hashtable(UBool ignoreKeyCase, UErrorCode& status); /** * Construct a hashtable @@ -47,7 +49,7 @@ public: * @param size initial size allocation * @param status Error code */ - Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status); + inline Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status); /** * Construct a hashtable @@ -55,57 +57,57 @@ public: * @param valueComp Comparator for comparing the values * @param status Error code */ - Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); + inline Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); /** * Construct a hashtable * @param status Error code */ - Hashtable(UErrorCode& status); + inline Hashtable(UErrorCode& status); /** * Construct a hashtable, _disregarding any error_. Use this constructor * with caution. */ - Hashtable(); + inline Hashtable(); /** * Non-virtual destructor; make this virtual if Hashtable is subclassed * in the future. */ - ~Hashtable(); + inline ~Hashtable(); - UObjectDeleter *setValueDeleter(UObjectDeleter *fn); + inline UObjectDeleter *setValueDeleter(UObjectDeleter *fn); - int32_t count() const; + inline int32_t count() const; - void* put(const UnicodeString& key, void* value, UErrorCode& status); + inline void* put(const UnicodeString& key, void* value, UErrorCode& status); - int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status); + inline int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status); - void* get(const UnicodeString& key) const; - - int32_t geti(const UnicodeString& key) const; - - void* remove(const UnicodeString& key); + inline void* get(const UnicodeString& key) const; - int32_t removei(const UnicodeString& key); + inline int32_t geti(const UnicodeString& key) const; - void removeAll(void); + inline void* remove(const UnicodeString& key); - const UHashElement* find(const UnicodeString& key) const; + inline int32_t removei(const UnicodeString& key); + + inline void removeAll(void); + + inline 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* setKeyComparator(UKeyComparator*keyComp); - - UValueComparator* setValueComparator(UValueComparator* valueComp); + inline const UHashElement* nextElement(int32_t& pos) const; + + inline UKeyComparator* setKeyComparator(UKeyComparator*keyComp); - UBool equals(const Hashtable& that) const; + inline UValueComparator* setValueComparator(UValueComparator* valueComp); + + inline UBool equals(const Hashtable& that) const; private: Hashtable(const Hashtable &other); // forbid copying of this class Hashtable &operator=(const Hashtable &other); // forbid copying of this class @@ -115,7 +117,7 @@ private: * Implementation ********************************************************************/ -inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp, +inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status) { if (U_FAILURE(status)) { return; @@ -127,7 +129,7 @@ inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp, } } -inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp, +inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, int32_t size, UErrorCode& status) { if (U_FAILURE(status)) { return; @@ -139,7 +141,7 @@ inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp, } } -inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, +inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status) : hash(0) { init( uhash_hashUnicodeString, keyComp, valueComp, status); } @@ -232,7 +234,7 @@ inline void Hashtable::removeAll(void) { inline UKeyComparator* Hashtable::setKeyComparator(UKeyComparator*keyComp){ return uhash_setKeyComparator(hash, keyComp); } - + inline UValueComparator* Hashtable::setValueComparator(UValueComparator* valueComp){ return uhash_setValueComparator(hash, valueComp); }