WvStreams
|
00001 /* -*- mode: C; c-file-style: "gnu" -*- */ 00002 /* dbus-list.h Generic linked list utility (internal to D-BUS implementation) 00003 * 00004 * Copyright (C) 2002, 2003 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_LIST_H 00025 #define DBUS_LIST_H 00026 00027 #include <dbus/dbus-internals.h> 00028 #include <dbus/dbus-memory.h> 00029 #include <dbus/dbus-types.h> 00030 00031 DBUS_BEGIN_DECLS 00032 00033 typedef struct DBusList DBusList; 00034 00035 struct DBusList 00036 { 00037 DBusList *prev; 00038 DBusList *next; 00039 void *data; 00040 }; 00041 dbus_bool_t _dbus_list_append (DBusList **list, 00042 void *data); 00043 dbus_bool_t _dbus_list_prepend (DBusList **list, 00044 void *data); 00045 dbus_bool_t _dbus_list_insert_before (DBusList **list, 00046 DBusList *before_this_link, 00047 void *data); 00048 dbus_bool_t _dbus_list_insert_after (DBusList **list, 00049 DBusList *after_this_link, 00050 void *data); 00051 void _dbus_list_insert_before_link (DBusList **list, 00052 DBusList *before_this_link, 00053 DBusList *link); 00054 void _dbus_list_insert_after_link (DBusList **list, 00055 DBusList *after_this_link, 00056 DBusList *link); 00057 dbus_bool_t _dbus_list_remove (DBusList **list, 00058 void *data); 00059 dbus_bool_t _dbus_list_remove_last (DBusList **list, 00060 void *data); 00061 void _dbus_list_remove_link (DBusList **list, 00062 DBusList *link); 00063 DBusList* _dbus_list_find_last (DBusList **list, 00064 void *data); 00065 void _dbus_list_clear (DBusList **list); 00066 DBusList* _dbus_list_get_first_link (DBusList **list); 00067 DBusList* _dbus_list_get_last_link (DBusList **list); 00068 void* _dbus_list_get_last (DBusList **list); 00069 void* _dbus_list_get_first (DBusList **list); 00070 void* _dbus_list_pop_first (DBusList **list); 00071 void* _dbus_list_pop_last (DBusList **list); 00072 DBusList* _dbus_list_pop_first_link (DBusList **list); 00073 DBusList* _dbus_list_pop_last_link (DBusList **list); 00074 dbus_bool_t _dbus_list_copy (DBusList **list, 00075 DBusList **dest); 00076 int _dbus_list_get_length (DBusList **list); 00077 DBusList* _dbus_list_alloc_link (void *data); 00078 void _dbus_list_free_link (DBusList *link); 00079 void _dbus_list_unlink (DBusList **list, 00080 DBusList *link); 00081 void _dbus_list_append_link (DBusList **list, 00082 DBusList *link); 00083 void _dbus_list_prepend_link (DBusList **list, 00084 DBusList *link); 00085 dbus_bool_t _dbus_list_length_is_one (DBusList **list); 00086 00087 00088 00089 00090 void _dbus_list_foreach (DBusList **list, 00091 DBusForeachFunction function, 00092 void *data); 00093 00094 #define _dbus_list_get_next_link(list, link) ((link)->next == *(list) ? NULL : (link)->next) 00095 #define _dbus_list_get_prev_link(list, link) ((link) == *(list) ? NULL : (link)->prev) 00096 00097 DBUS_END_DECLS 00098 00099 #endif /* DBUS_LIST_H */