libcdio
0.82
|
00001 /* 00002 $Id: ds.h,v 1.5 2008/03/25 15:59:09 karl Exp $ 00003 00004 Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org> 00005 Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org> 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00028 00029 #ifndef __CDIO_DS_H__ 00030 #define __CDIO_DS_H__ 00031 00032 #include <cdio/types.h> 00033 00035 typedef struct _CdioList CdioList_t; 00036 typedef struct _CdioListNode CdioListNode_t; 00037 00038 typedef int (*_cdio_list_cmp_func_t) (void *p_data1, void *p_data2); 00039 typedef int (*_cdio_list_iterfunc_t) (void *p_data, void *p_user_data); 00040 00043 #define CdioList CdioList_t 00044 #define CdioListNode CdioListNode_t 00045 #define _cdio_list_cmp_func _cdio_list_cmp_func_t 00046 #define _cdio_list_iterfunc _cdio_list_iterfunc_t 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif /* __cplusplus */ 00051 00053 CdioList_t *_cdio_list_new (void); 00054 00055 void _cdio_list_free (CdioList_t *p_list, int free_data); 00056 00057 unsigned _cdio_list_length (const CdioList_t *list); 00058 00059 void _cdio_list_prepend (CdioList_t *p_list, void *p_data); 00060 00061 void _cdio_list_append (CdioList_t *p_list, void *p_data); 00062 00063 void _cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func, 00064 void *p_user_data); 00065 00066 CdioListNode_t *_cdio_list_find (CdioList_t *p_list, 00067 _cdio_list_iterfunc_t cmp_func, 00068 void *p_user_data); 00069 00070 #define _CDIO_LIST_FOREACH(node, list) \ 00071 for (node = _cdio_list_begin (list); node; node = _cdio_list_node_next (node)) 00072 00075 CdioListNode_t *_cdio_list_begin (const CdioList_t *p_list); 00076 00077 CdioListNode_t *_cdio_list_end (CdioList_t *p_list); 00078 00079 CdioListNode_t *_cdio_list_node_next (CdioListNode_t *p_node); 00080 00081 void _cdio_list_node_free (CdioListNode_t *p_node, int i_free_data); 00082 00083 void *_cdio_list_node_data (CdioListNode_t *p_node); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif /* __cplusplus */ 00088 00089 #endif /* __CDIO_DS_H__ */ 00090 00091 /* 00092 * Local variables: 00093 * c-file-style: "gnu" 00094 * tab-width: 8 00095 * indent-tabs-mode: nil 00096 * End: 00097 */ 00098