Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: source/common/uhash.h

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/common/udata.cpp ('k') | source/common/uhash.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/uhash.h
diff --git a/source/common/uhash.h b/source/common/uhash.h
index ec4c630dc7d9ddaeb9e82cd096f01d16213ac716..1761dd0a2e9209deee5d87587b4afeb1c554d937 100644
--- a/source/common/uhash.h
+++ b/source/common/uhash.h
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 1997-2011, International Business Machines
+* Copyright (C) 1997-2015, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* Date Name Description
@@ -16,6 +16,7 @@
#include "unicode/utypes.h"
#include "cmemory.h"
#include "uelement.h"
+#include "unicode/localpointer.h"
/**
* UHashtable stores key-value pairs and does moderately fast lookup
@@ -57,10 +58,13 @@
* hashcode. During iteration an element may be deleted by calling
* uhash_removeElement(); iteration may safely continue thereafter.
* The uhash_remove() function may also be safely called in
- * mid-iteration. However, if uhash_put() is called during iteration
- * then the iteration will be out of sync. Under no circumstances
- * should the UHashElement returned by uhash_nextElement be modified
- * directly.
+ * mid-iteration. If uhash_put() is called during iteration,
+ * the iteration is still guaranteed to terminate reasonably, but
+ * there is no guarantee that every element will be returned or that
+ * some won't be returned more than once.
+ *
+ * Under no circumstances should the UHashElement returned by
+ * uhash_nextElement be modified directly.
*
* By default, the hashtable grows when necessary, but never shrinks,
* even if all items are removed. For most applications this is
@@ -485,6 +489,13 @@ U_CAPI const UHashElement* U_EXPORT2
uhash_find(const UHashtable *hash, const void* key);
/**
+ * \def UHASH_FIRST
+ * Constant for use with uhash_nextElement
+ * @see uhash_nextElement
+ */
+#define UHASH_FIRST (-1)
+
+/**
* Iterate through the elements of a UHashtable. The caller must not
* modify the returned object. However, uhash_removeElement() may be
* called during iteration to remove an element from the table.
@@ -492,7 +503,7 @@ uhash_find(const UHashtable *hash, const void* key);
* called during iteration the iteration will then be out of sync and
* should be restarted.
* @param hash The target UHashtable.
- * @param pos This should be set to -1 initially, and left untouched
+ * @param pos This should be set to UHASH_FIRST initially, and left untouched
* thereafter.
* @return a hash element, or NULL if no further key-value pairs
* exist in the table.
@@ -663,4 +674,24 @@ uhash_deleteHashtable(void *obj);
U_CAPI UBool U_EXPORT2
uhash_equals(const UHashtable* hash1, const UHashtable* hash2);
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUResourceBundlePointer
+ * "Smart pointer" class, closes a UResourceBundle via ures_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUHashtablePointer, UHashtable, uhash_close);
+
+U_NAMESPACE_END
+
+#endif
+
#endif
« no previous file with comments | « source/common/udata.cpp ('k') | source/common/uhash.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698