D-Bus
1.4.10
|
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include <dbus/dbus-sysdeps.h> 00031 00032 DBUS_BEGIN_DECLS 00033 00034 struct DBusList 00035 { 00036 DBusList *prev; 00037 DBusList *next; 00038 void *data; 00039 }; 00040 dbus_bool_t _dbus_list_append (DBusList **list, 00041 void *data); 00042 dbus_bool_t _dbus_list_prepend (DBusList **list, 00043 void *data); 00044 dbus_bool_t _dbus_list_insert_before (DBusList **list, 00045 DBusList *before_this_link, 00046 void *data); 00047 dbus_bool_t _dbus_list_insert_after (DBusList **list, 00048 DBusList *after_this_link, 00049 void *data); 00050 void _dbus_list_insert_before_link (DBusList **list, 00051 DBusList *before_this_link, 00052 DBusList *link); 00053 void _dbus_list_insert_after_link (DBusList **list, 00054 DBusList *after_this_link, 00055 DBusList *link); 00056 dbus_bool_t _dbus_list_remove (DBusList **list, 00057 void *data); 00058 dbus_bool_t _dbus_list_remove_last (DBusList **list, 00059 void *data); 00060 void _dbus_list_remove_link (DBusList **list, 00061 DBusList *link); 00062 DBusList* _dbus_list_find_last (DBusList **list, 00063 void *data); 00064 void _dbus_list_clear (DBusList **list); 00065 DBusList* _dbus_list_get_first_link (DBusList **list); 00066 DBusList* _dbus_list_get_last_link (DBusList **list); 00067 void* _dbus_list_get_last (DBusList **list); 00068 void* _dbus_list_get_first (DBusList **list); 00069 void* _dbus_list_pop_first (DBusList **list); 00070 void* _dbus_list_pop_last (DBusList **list); 00071 DBusList* _dbus_list_pop_first_link (DBusList **list); 00072 DBusList* _dbus_list_pop_last_link (DBusList **list); 00073 dbus_bool_t _dbus_list_copy (DBusList **list, 00074 DBusList **dest); 00075 int _dbus_list_get_length (DBusList **list); 00076 DBusList* _dbus_list_alloc_link (void *data); 00077 void _dbus_list_free_link (DBusList *link); 00078 void _dbus_list_unlink (DBusList **list, 00079 DBusList *link); 00080 void _dbus_list_append_link (DBusList **list, 00081 DBusList *link); 00082 void _dbus_list_prepend_link (DBusList **list, 00083 DBusList *link); 00084 dbus_bool_t _dbus_list_length_is_one (DBusList **list); 00085 00086 00087 00088 00089 void _dbus_list_foreach (DBusList **list, 00090 DBusForeachFunction function, 00091 void *data); 00092 00093 #define _dbus_list_get_next_link(list, link) ((link)->next == *(list) ? NULL : (link)->next) 00094 #define _dbus_list_get_prev_link(list, link) ((link) == *(list) ? NULL : (link)->prev) 00095 00096 DBUS_END_DECLS 00097 00098 #endif /* DBUS_LIST_H */