ghash.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*
  18. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  19. * file for a list of people on the GLib Team. See the ChangeLog
  20. * files for a list of changes. These files are distributed with
  21. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  22. */
  23. #ifndef __G_HASH_H__
  24. #define __G_HASH_H__
  25. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  26. #error "Only <glib.h> can be included directly."
  27. #endif
  28. #include <glib/gtypes.h>
  29. #include <glib/glist.h>
  30. G_BEGIN_DECLS
  31. typedef struct _GHashTable GHashTable;
  32. typedef gboolean (*GHRFunc) (gpointer key,
  33. gpointer value,
  34. gpointer user_data);
  35. typedef struct _GHashTableIter GHashTableIter;
  36. struct _GHashTableIter
  37. {
  38. /*< private >*/
  39. gpointer dummy1;
  40. gpointer dummy2;
  41. gpointer dummy3;
  42. int dummy4;
  43. gboolean dummy5;
  44. gpointer dummy6;
  45. };
  46. GLIB_AVAILABLE_IN_ALL
  47. GHashTable* g_hash_table_new (GHashFunc hash_func,
  48. GEqualFunc key_equal_func);
  49. GLIB_AVAILABLE_IN_ALL
  50. GHashTable* g_hash_table_new_full (GHashFunc hash_func,
  51. GEqualFunc key_equal_func,
  52. GDestroyNotify key_destroy_func,
  53. GDestroyNotify value_destroy_func);
  54. GLIB_AVAILABLE_IN_ALL
  55. void g_hash_table_destroy (GHashTable *hash_table);
  56. GLIB_AVAILABLE_IN_ALL
  57. gboolean g_hash_table_insert (GHashTable *hash_table,
  58. gpointer key,
  59. gpointer value);
  60. GLIB_AVAILABLE_IN_ALL
  61. gboolean g_hash_table_replace (GHashTable *hash_table,
  62. gpointer key,
  63. gpointer value);
  64. GLIB_AVAILABLE_IN_ALL
  65. gboolean g_hash_table_add (GHashTable *hash_table,
  66. gpointer key);
  67. GLIB_AVAILABLE_IN_ALL
  68. gboolean g_hash_table_remove (GHashTable *hash_table,
  69. gconstpointer key);
  70. GLIB_AVAILABLE_IN_ALL
  71. void g_hash_table_remove_all (GHashTable *hash_table);
  72. GLIB_AVAILABLE_IN_ALL
  73. gboolean g_hash_table_steal (GHashTable *hash_table,
  74. gconstpointer key);
  75. GLIB_AVAILABLE_IN_ALL
  76. void g_hash_table_steal_all (GHashTable *hash_table);
  77. GLIB_AVAILABLE_IN_ALL
  78. gpointer g_hash_table_lookup (GHashTable *hash_table,
  79. gconstpointer key);
  80. GLIB_AVAILABLE_IN_ALL
  81. gboolean g_hash_table_contains (GHashTable *hash_table,
  82. gconstpointer key);
  83. GLIB_AVAILABLE_IN_ALL
  84. gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
  85. gconstpointer lookup_key,
  86. gpointer *orig_key,
  87. gpointer *value);
  88. GLIB_AVAILABLE_IN_ALL
  89. void g_hash_table_foreach (GHashTable *hash_table,
  90. GHFunc func,
  91. gpointer user_data);
  92. GLIB_AVAILABLE_IN_ALL
  93. gpointer g_hash_table_find (GHashTable *hash_table,
  94. GHRFunc predicate,
  95. gpointer user_data);
  96. GLIB_AVAILABLE_IN_ALL
  97. guint g_hash_table_foreach_remove (GHashTable *hash_table,
  98. GHRFunc func,
  99. gpointer user_data);
  100. GLIB_AVAILABLE_IN_ALL
  101. guint g_hash_table_foreach_steal (GHashTable *hash_table,
  102. GHRFunc func,
  103. gpointer user_data);
  104. GLIB_AVAILABLE_IN_ALL
  105. guint g_hash_table_size (GHashTable *hash_table);
  106. GLIB_AVAILABLE_IN_ALL
  107. GList * g_hash_table_get_keys (GHashTable *hash_table);
  108. GLIB_AVAILABLE_IN_ALL
  109. GList * g_hash_table_get_values (GHashTable *hash_table);
  110. GLIB_AVAILABLE_IN_2_40
  111. gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table,
  112. guint *length);
  113. GLIB_AVAILABLE_IN_ALL
  114. void g_hash_table_iter_init (GHashTableIter *iter,
  115. GHashTable *hash_table);
  116. GLIB_AVAILABLE_IN_ALL
  117. gboolean g_hash_table_iter_next (GHashTableIter *iter,
  118. gpointer *key,
  119. gpointer *value);
  120. GLIB_AVAILABLE_IN_ALL
  121. GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter);
  122. GLIB_AVAILABLE_IN_ALL
  123. void g_hash_table_iter_remove (GHashTableIter *iter);
  124. GLIB_AVAILABLE_IN_2_30
  125. void g_hash_table_iter_replace (GHashTableIter *iter,
  126. gpointer value);
  127. GLIB_AVAILABLE_IN_ALL
  128. void g_hash_table_iter_steal (GHashTableIter *iter);
  129. GLIB_AVAILABLE_IN_ALL
  130. GHashTable* g_hash_table_ref (GHashTable *hash_table);
  131. GLIB_AVAILABLE_IN_ALL
  132. void g_hash_table_unref (GHashTable *hash_table);
  133. #ifndef G_DISABLE_DEPRECATED
  134. #define g_hash_table_freeze(hash_table) ((void)0)
  135. #define g_hash_table_thaw(hash_table) ((void)0)
  136. #endif
  137. /* Hash Functions
  138. */
  139. GLIB_AVAILABLE_IN_ALL
  140. gboolean g_str_equal (gconstpointer v1,
  141. gconstpointer v2);
  142. GLIB_AVAILABLE_IN_ALL
  143. guint g_str_hash (gconstpointer v);
  144. GLIB_AVAILABLE_IN_ALL
  145. gboolean g_int_equal (gconstpointer v1,
  146. gconstpointer v2);
  147. GLIB_AVAILABLE_IN_ALL
  148. guint g_int_hash (gconstpointer v);
  149. GLIB_AVAILABLE_IN_ALL
  150. gboolean g_int64_equal (gconstpointer v1,
  151. gconstpointer v2);
  152. GLIB_AVAILABLE_IN_ALL
  153. guint g_int64_hash (gconstpointer v);
  154. GLIB_AVAILABLE_IN_ALL
  155. gboolean g_double_equal (gconstpointer v1,
  156. gconstpointer v2);
  157. GLIB_AVAILABLE_IN_ALL
  158. guint g_double_hash (gconstpointer v);
  159. GLIB_AVAILABLE_IN_ALL
  160. guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
  161. GLIB_AVAILABLE_IN_ALL
  162. gboolean g_direct_equal (gconstpointer v1,
  163. gconstpointer v2) G_GNUC_CONST;
  164. G_END_DECLS
  165. #endif /* __G_HASH_H__ */