D-Bus  1.4.10
dbus-hash.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-hash.h Generic hash table utility (internal to D-Bus implementation)
3  *
4  * Copyright (C) 2002 Red Hat, Inc.
5  *
6  * Licensed under the Academic Free License version 2.1
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 #ifndef DBUS_HASH_H
25 #define DBUS_HASH_H
26 
27 #ifdef HAVE_STDINT_H
28 #include <stdint.h>
29 #endif
30 
31 #ifdef HAVE_INTTYPES_H
32 #include <inttypes.h>
33 #endif
34 
35 #include <dbus/dbus-memory.h>
36 #include <dbus/dbus-types.h>
37 #include <dbus/dbus-sysdeps.h>
38 
40 
50 {
51  void *dummy1;
52  void *dummy2;
53  void *dummy3;
54  void *dummy4;
55  int dummy5;
56  int dummy6;
57 };
58 
60 typedef struct DBusHashIter DBusHashIter;
61 
62 /* Allowing an arbitrary function as with GLib
63  * would be nicer for a public API, but for
64  * an internal API this saves typing, we can add
65  * more whenever we feel like it.
66  */
67 typedef enum
68 {
74 } DBusHashType;
75 
77  DBusFreeFunction key_free_function,
78  DBusFreeFunction value_free_function);
83  DBusHashIter *iter);
88  void *value);
91 const char* _dbus_hash_iter_get_two_strings_key (DBusHashIter *iter);
94  void *key,
95  dbus_bool_t create_if_not_found,
96  DBusHashIter *iter);
98  const char *key);
99 void* _dbus_hash_table_lookup_two_strings (DBusHashTable *table,
100  const char *key);
102  int key);
103 void* _dbus_hash_table_lookup_pointer (DBusHashTable *table,
104  void *key);
106  uintptr_t key);
108  const char *key);
109 dbus_bool_t _dbus_hash_table_remove_two_strings (DBusHashTable *table,
110  const char *key);
112  int key);
113 dbus_bool_t _dbus_hash_table_remove_pointer (DBusHashTable *table,
114  void *key);
116  uintptr_t key);
118  char *key,
119  void *value);
120 dbus_bool_t _dbus_hash_table_insert_two_strings (DBusHashTable *table,
121  char *key,
122  void *value);
124  int key,
125  void *value);
126 dbus_bool_t _dbus_hash_table_insert_pointer (DBusHashTable *table,
127  void *key,
128  void *value);
130  uintptr_t key,
131  void *value);
133 
134 /* Preallocation */
135 
138 
141  DBusPreallocatedHash *preallocated);
143  DBusPreallocatedHash *preallocated,
144  char *key,
145  void *value);
146 
150 
151 #endif /* DBUS_HASH_H */