Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

dbus-hash.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */ 00002 /* dbus-hash.h Generic hash table utility (internal to D-BUS implementation) 00003 * 00004 * Copyright (C) 2002 Red Hat, Inc. 00005 * 00006 * Licensed under the Academic Free License version 2.1 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 00035 struct DBusHashIter 00036 { 00037 void *dummy1; 00038 void *dummy2; 00039 void *dummy3; 00040 void *dummy4; 00041 int dummy5; 00042 int dummy6; 00043 }; 00044 00045 typedef struct DBusHashTable DBusHashTable; 00046 typedef struct DBusHashIter DBusHashIter; 00047 00048 /* Allowing an arbitrary function as with GLib 00049 * would be nicer for a public API, but for 00050 * an internal API this saves typing, we can add 00051 * more whenever we feel like it. 00052 */ 00053 typedef enum 00054 { 00055 DBUS_HASH_STRING, 00056 DBUS_HASH_TWO_STRINGS, 00057 DBUS_HASH_INT, 00058 DBUS_HASH_POINTER, 00059 DBUS_HASH_ULONG 00060 } DBusHashType; 00061 DBusHashTable* _dbus_hash_table_new (DBusHashType type, 00062 DBusFreeFunction key_free_function, 00063 DBusFreeFunction value_free_function); 00064 DBusHashTable* _dbus_hash_table_ref (DBusHashTable *table); 00065 void _dbus_hash_table_unref (DBusHashTable *table); 00066 void _dbus_hash_iter_init (DBusHashTable *table, 00067 DBusHashIter *iter); 00068 dbus_bool_t _dbus_hash_iter_next (DBusHashIter *iter); 00069 void _dbus_hash_iter_remove_entry (DBusHashIter *iter); 00070 void* _dbus_hash_iter_get_value (DBusHashIter *iter); 00071 void _dbus_hash_iter_set_value (DBusHashIter *iter, 00072 void *value); 00073 int _dbus_hash_iter_get_int_key (DBusHashIter *iter); 00074 const char* _dbus_hash_iter_get_string_key (DBusHashIter *iter); 00075 const char* _dbus_hash_iter_get_two_strings_key (DBusHashIter *iter); 00076 unsigned long _dbus_hash_iter_get_ulong_key (DBusHashIter *iter); 00077 dbus_bool_t _dbus_hash_iter_lookup (DBusHashTable *table, 00078 void *key, 00079 dbus_bool_t create_if_not_found, 00080 DBusHashIter *iter); 00081 void* _dbus_hash_table_lookup_string (DBusHashTable *table, 00082 const char *key); 00083 void* _dbus_hash_table_lookup_two_strings (DBusHashTable *table, 00084 const char *key); 00085 void* _dbus_hash_table_lookup_int (DBusHashTable *table, 00086 int key); 00087 void* _dbus_hash_table_lookup_pointer (DBusHashTable *table, 00088 void *key); 00089 void* _dbus_hash_table_lookup_ulong (DBusHashTable *table, 00090 unsigned long key); 00091 dbus_bool_t _dbus_hash_table_remove_string (DBusHashTable *table, 00092 const char *key); 00093 dbus_bool_t _dbus_hash_table_remove_two_strings (DBusHashTable *table, 00094 const char *key); 00095 dbus_bool_t _dbus_hash_table_remove_int (DBusHashTable *table, 00096 int key); 00097 dbus_bool_t _dbus_hash_table_remove_pointer (DBusHashTable *table, 00098 void *key); 00099 dbus_bool_t _dbus_hash_table_remove_ulong (DBusHashTable *table, 00100 unsigned long key); 00101 dbus_bool_t _dbus_hash_table_insert_string (DBusHashTable *table, 00102 char *key, 00103 void *value); 00104 dbus_bool_t _dbus_hash_table_insert_two_strings (DBusHashTable *table, 00105 char *key, 00106 void *value); 00107 dbus_bool_t _dbus_hash_table_insert_int (DBusHashTable *table, 00108 int key, 00109 void *value); 00110 dbus_bool_t _dbus_hash_table_insert_pointer (DBusHashTable *table, 00111 void *key, 00112 void *value); 00113 dbus_bool_t _dbus_hash_table_insert_ulong (DBusHashTable *table, 00114 unsigned long key, 00115 void *value); 00116 int _dbus_hash_table_get_n_entries (DBusHashTable *table); 00117 00118 /* Preallocation */ 00119 typedef struct DBusPreallocatedHash DBusPreallocatedHash; 00120 00121 DBusPreallocatedHash *_dbus_hash_table_preallocate_entry (DBusHashTable *table); 00122 void _dbus_hash_table_free_preallocated_entry (DBusHashTable *table, 00123 DBusPreallocatedHash *preallocated); 00124 void _dbus_hash_table_insert_string_preallocated (DBusHashTable *table, 00125 DBusPreallocatedHash *preallocated, 00126 char *key, 00127 void *value); 00128 00129 00130 DBUS_END_DECLS; 00131 00132 #endif /* DBUS_HASH_H */

Generated on Mon Aug 16 17:40:08 2004 for D-BUS by doxygen 1.3.8