source: protocols/yahoo/yahoo_list.h @ df618475

Last change on this file since df618475 was b7d3cc34, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-11-06T18:23:18Z

Initial repository (0.99 release tree)

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 * yahoo_list.h: linked list routines
3 *
4 * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
5 * Other code copyright Meredydd Luff <meredydd AT everybuddy.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 *
21 */
22
23/*
24 * This is a replacement for the GList.  It only provides functions that
25 * we use in Ayttm.  Thanks to Meredyyd from everybuddy dev for doing
26 * most of it.
27 */
28
29#ifndef __YLIST_H__
30#define __YLIST_H__
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36typedef struct _YList {
37        struct _YList *next;
38        struct _YList *prev;
39        void *data;
40} YList;
41
42typedef int (*YListCompFunc) (const void *, const void *);
43typedef void (*YListFunc) (void *, void *);
44
45YList *y_list_append(YList * list, void *data);
46YList *y_list_prepend(YList * list, void *data);
47YList *y_list_remove_link(YList * list, const YList * link);
48YList *y_list_remove(YList * list, void *data);
49
50YList *y_list_insert_sorted(YList * list, void * data, YListCompFunc comp);
51
52YList *y_list_copy(YList * list);
53
54YList *y_list_concat(YList * list, YList * add);
55
56YList *y_list_find(YList * list, const void *data);
57YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp);
58
59YList *y_list_nth(YList * list, int n);
60
61void y_list_foreach(YList * list, YListFunc fn, void *user_data);
62
63void y_list_free_1(YList * list);
64void y_list_free(YList * list);
65int  y_list_length(const YList * list);
66int  y_list_empty(const YList * list);
67int  y_list_singleton(const YList * list);
68
69#define y_list_next(list)       list->next
70
71#ifdef __cplusplus
72}
73#endif
74#endif
Note: See TracBrowser for help on using the repository browser.