Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_ghash.h')
-rw-r--r--source/blender/blenlib/BLI_ghash.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 11dee5df57d..d2f2bcc95e4 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -37,6 +37,7 @@
struct GHash;
typedef struct GHash GHash;
+typedef struct GHashIterator GHashIterator;
typedef unsigned int (*GHashHashFP) (void *key);
typedef int (*GHashCmpFP) (void *a, void *b);
@@ -50,6 +51,59 @@ void BLI_ghash_insert (GHash *gh, void *key, void *val);
void* BLI_ghash_lookup (GHash *gh, void *key);
int BLI_ghash_haskey (GHash *gh, void *key);
+int BLI_ghash_size (GHash *gh);
+
+/* *** */
+
+ /**
+ * Create a new GHashIterator. The hash table must not be mutated
+ * while the iterator is in use, and the iterator will step exactly
+ * BLI_ghash_size(gh) times before becoming done.
+ *
+ * @param gh The GHash to iterate over.
+ * @return Pointer to a new DynStr.
+ */
+GHashIterator* BLI_ghashIterator_new (GHash *gh);
+ /**
+ * Free a GHashIterator.
+ *
+ * @param ghi The iterator to free.
+ */
+void BLI_ghashIterator_free (GHashIterator *ghi);
+
+ /**
+ * Retrieve the key from an iterator.
+ *
+ * @param ghi The iterator.
+ * @return The key at the current index, or NULL if the
+ * iterator is done.
+ */
+void* BLI_ghashIterator_getKey (GHashIterator *ghi);
+ /**
+ * Retrieve the value from an iterator.
+ *
+ * @param ghi The iterator.
+ * @return The value at the current index, or NULL if the
+ * iterator is done.
+ */
+void* BLI_ghashIterator_getValue (GHashIterator *ghi);
+ /**
+ * Steps the iterator to the next index.
+ *
+ * @param ghi The iterator.
+ */
+void BLI_ghashIterator_step (GHashIterator *ghi);
+ /**
+ * Determine if an iterator is done (has reached the end of
+ * the hash table).
+ *
+ * @param ghi The iterator.
+ * @return True if done, False otherwise.
+ */
+int BLI_ghashIterator_isDone (GHashIterator *ghi);
+
+/* *** */
+
unsigned int BLI_ghashutil_ptrhash (void *key);
int BLI_ghashutil_ptrcmp (void *a, void *b);