00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUS_HASH_H
00025 #define DBUS_HASH_H
00026
00027 #include <dbus/dbus-memory.h>
00028 #include <dbus/dbus-types.h>
00029
00030 DBUS_BEGIN_DECLS
00031
00040 struct DBusHashIter
00041 {
00042 void *dummy1;
00043 void *dummy2;
00044 void *dummy3;
00045 void *dummy4;
00046 int dummy5;
00047 int dummy6;
00048 };
00049
00050 typedef struct DBusHashTable DBusHashTable;
00051 typedef struct DBusHashIter DBusHashIter;
00052
00053
00054
00055
00056
00057
00058 typedef enum
00059 {
00060 DBUS_HASH_STRING,
00061 DBUS_HASH_TWO_STRINGS,
00062 DBUS_HASH_INT,
00063 DBUS_HASH_POINTER,
00064 DBUS_HASH_ULONG
00065 } DBusHashType;
00066
00067 DBusHashTable* _dbus_hash_table_new (DBusHashType type,
00068 DBusFreeFunction key_free_function,
00069 DBusFreeFunction value_free_function);
00070 DBusHashTable* _dbus_hash_table_ref (DBusHashTable *table);
00071 void _dbus_hash_table_unref (DBusHashTable *table);
00072 void _dbus_hash_table_remove_all (DBusHashTable *table);
00073 void _dbus_hash_iter_init (DBusHashTable *table,
00074 DBusHashIter *iter);
00075 dbus_bool_t _dbus_hash_iter_next (DBusHashIter *iter);
00076 void _dbus_hash_iter_remove_entry (DBusHashIter *iter);
00077 void* _dbus_hash_iter_get_value (DBusHashIter *iter);
00078 void _dbus_hash_iter_set_value (DBusHashIter *iter,
00079 void *value);
00080 int _dbus_hash_iter_get_int_key (DBusHashIter *iter);
00081 const char* _dbus_hash_iter_get_string_key (DBusHashIter *iter);
00082 const char* _dbus_hash_iter_get_two_strings_key (DBusHashIter *iter);
00083 unsigned long _dbus_hash_iter_get_ulong_key (DBusHashIter *iter);
00084 dbus_bool_t _dbus_hash_iter_lookup (DBusHashTable *table,
00085 void *key,
00086 dbus_bool_t create_if_not_found,
00087 DBusHashIter *iter);
00088 void* _dbus_hash_table_lookup_string (DBusHashTable *table,
00089 const char *key);
00090 void* _dbus_hash_table_lookup_two_strings (DBusHashTable *table,
00091 const char *key);
00092 void* _dbus_hash_table_lookup_int (DBusHashTable *table,
00093 int key);
00094 void* _dbus_hash_table_lookup_pointer (DBusHashTable *table,
00095 void *key);
00096 void* _dbus_hash_table_lookup_ulong (DBusHashTable *table,
00097 unsigned long key);
00098 dbus_bool_t _dbus_hash_table_remove_string (DBusHashTable *table,
00099 const char *key);
00100 dbus_bool_t _dbus_hash_table_remove_two_strings (DBusHashTable *table,
00101 const char *key);
00102 dbus_bool_t _dbus_hash_table_remove_int (DBusHashTable *table,
00103 int key);
00104 dbus_bool_t _dbus_hash_table_remove_pointer (DBusHashTable *table,
00105 void *key);
00106 dbus_bool_t _dbus_hash_table_remove_ulong (DBusHashTable *table,
00107 unsigned long key);
00108 dbus_bool_t _dbus_hash_table_insert_string (DBusHashTable *table,
00109 char *key,
00110 void *value);
00111 dbus_bool_t _dbus_hash_table_insert_two_strings (DBusHashTable *table,
00112 char *key,
00113 void *value);
00114 dbus_bool_t _dbus_hash_table_insert_int (DBusHashTable *table,
00115 int key,
00116 void *value);
00117 dbus_bool_t _dbus_hash_table_insert_pointer (DBusHashTable *table,
00118 void *key,
00119 void *value);
00120 dbus_bool_t _dbus_hash_table_insert_ulong (DBusHashTable *table,
00121 unsigned long key,
00122 void *value);
00123 int _dbus_hash_table_get_n_entries (DBusHashTable *table);
00124
00125
00126
00128 typedef struct DBusPreallocatedHash DBusPreallocatedHash;
00129
00130 DBusPreallocatedHash *_dbus_hash_table_preallocate_entry (DBusHashTable *table);
00131 void _dbus_hash_table_free_preallocated_entry (DBusHashTable *table,
00132 DBusPreallocatedHash *preallocated);
00133 void _dbus_hash_table_insert_string_preallocated (DBusHashTable *table,
00134 DBusPreallocatedHash *preallocated,
00135 char *key,
00136 void *value);
00137
00140 DBUS_END_DECLS
00141
00142 #endif