# list.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: list.h,v $
    00003                              -------------------
    00004     cvs         : $Id: list.h,v 1.14 2005/02/23 02:16:56 aquamaniac Exp $
    00005     begin       : Sat Nov 15 2003
    00006     copyright   : (C) 2003 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00028
    00029 #ifndef GWENHYWFAR_LIST_H
    00030 #define GWENHYWFAR_LIST_H
    00031
    00032
    00033 #ifdef __cplusplus
    00034 extern "C" {
    00035 #endif
    00036
    00037 #include <gwenhywfar/gwenhywfarapi.h>
    00038 #include <gwenhywfar/inherit.h>
    00039 #include <gwenhywfar/refptr.h>
    00040 /* This is needed for PalmOS, because it define some functions needed */
    00041 #include <string.h>
    00042 #include <stdio.h>
    00043
    00044
    00050
    00055 typedef struct GWEN_LIST GWEN_LIST;
    00056
    00058 typedef void *(*GWEN_LIST_FOREACH_CB)(void *element, void *user_data);
    00059
    00064 typedef struct GWEN_LIST GWEN_CONSTLIST;
    00065
    00067 typedef const void *(*GWEN_CONSTLIST_FOREACH_CB)(const void *element,
    00068                                                  void *user_data);
    00069
    00072 typedef struct GWEN_LIST_ITERATOR GWEN_LIST_ITERATOR;
    00073
    00076 typedef struct GWEN_LIST_ITERATOR GWEN_CONSTLIST_ITERATOR;
    00077
    00078
    00080 GWEN_INHERIT_FUNCTION_LIB_DEFS(GWEN_LIST, GWENHYWFAR_API)
    00081
    00082
    00083
    00084 GWENHYWFAR_API
    00085 GWEN_LIST *GWEN_List_new();
    00086
    00090 GWENHYWFAR_API
    00091 void GWEN_List_free(GWEN_LIST *l);
    00092
    00095 GWENHYWFAR_API
    00096 GWEN_LIST *GWEN_List_dup(const GWEN_LIST *l);
    00097
    00098
    00099 GWENHYWFAR_API
    00100 void GWEN_List_Unshare(GWEN_LIST *l);
    00101
    00102
    00106 GWENHYWFAR_API
    00107 void GWEN_List_Dump(const GWEN_LIST *l, FILE *f, unsigned int indent);
    00108
    00112 GWENHYWFAR_API
    00113 void GWEN_List_PushBack(GWEN_LIST *l, void *p);
    00114
    00118 GWENHYWFAR_API
    00119 void GWEN_List_PushBackRefPtr(GWEN_LIST *l, GWEN_REFPTR *rp);
    00120
    00125 GWENHYWFAR_API
    00126 void GWEN_List_PushFront(GWEN_LIST *l, void *p);
    00127
    00132 GWENHYWFAR_API
    00133 void GWEN_List_PushFrontRefPtr(GWEN_LIST *l, GWEN_REFPTR *rp);
    00134
    00139 GWENHYWFAR_API
    00140 void *GWEN_List_GetFront(const GWEN_LIST *l);
    00141
    00146 GWENHYWFAR_API
    00147 GWEN_REFPTR *GWEN_List_GetFrontRefPtr(const GWEN_LIST *l);
    00148
    00153 GWENHYWFAR_API
    00154 void *GWEN_List_GetBack(const GWEN_LIST *l);
    00155
    00160 GWENHYWFAR_API
    00161 GWEN_REFPTR *GWEN_List_GetBackRefPtr(const GWEN_LIST *l);
    00162
    00167 GWENHYWFAR_API
    00168 void GWEN_List_Erase(GWEN_LIST *l, GWEN_LIST_ITERATOR *it);
    00169
    00175 GWENHYWFAR_API
    00176 unsigned int GWEN_List_GetSize(const GWEN_LIST *l);
    00177
    00178 GWENHYWFAR_API
    00179 GWEN_REFPTR_INFO *GWEN_List_GetRefPtrInfo(const GWEN_LIST *l);
    00180
    00181 GWENHYWFAR_API
    00182 void GWEN_List_SetRefPtrInfo(GWEN_LIST *l, GWEN_REFPTR_INFO *rpi);
    00183
    00188 GWENHYWFAR_API
    00189 void GWEN_List_PopBack(GWEN_LIST *l);
    00190
    00195 GWENHYWFAR_API
    00196 void GWEN_List_PopFront(GWEN_LIST *l);
    00197
    00202 GWENHYWFAR_API
    00203 void GWEN_List_Clear(GWEN_LIST *l);
    00204
    00205
    00218 GWENHYWFAR_API
    00219 void *GWEN_List_ForEach(GWEN_LIST *list, GWEN_LIST_FOREACH_CB func,
    00220                         void *user_data);
    00221
    00223 GWENHYWFAR_API
    00224 GWEN_LIST_ITERATOR *GWEN_List_First(const GWEN_LIST *l);
    00225
    00227 GWENHYWFAR_API
    00228 GWEN_LIST_ITERATOR *GWEN_List_Last(const GWEN_LIST *l);
    00229
    00233 GWENHYWFAR_API
    00234 GWEN_LIST_ITERATOR *GWEN_ListIterator_new(const GWEN_LIST *l);
    00235
    00237 GWENHYWFAR_API
    00238 void GWEN_ListIterator_free(GWEN_LIST_ITERATOR *li);
    00239
    00244 GWENHYWFAR_API
    00245 void *GWEN_ListIterator_Previous(GWEN_LIST_ITERATOR *li);
    00246
    00251 GWENHYWFAR_API
    00252 GWEN_REFPTR *GWEN_ListIterator_PreviousRefPtr(GWEN_LIST_ITERATOR *li);
    00253
    00258 GWENHYWFAR_API
    00259 void *GWEN_ListIterator_Next(GWEN_LIST_ITERATOR *li);
    00260
    00265 GWENHYWFAR_API
    00266 GWEN_REFPTR *GWEN_ListIterator_NextRefPtr(GWEN_LIST_ITERATOR *li);
    00267
    00272 GWENHYWFAR_API
    00273 void *GWEN_ListIterator_Data(GWEN_LIST_ITERATOR *li);
    00274
    00279 GWENHYWFAR_API
    00280 GWEN_REFPTR *GWEN_ListIterator_DataRefPtr(GWEN_LIST_ITERATOR *li);
    00281
    00282 GWENHYWFAR_API
    00283 void GWEN_ListIterator_IncLinkCount(GWEN_LIST_ITERATOR *li);
    00284
    00285 GWENHYWFAR_API
    00286 unsigned int GWEN_ListIterator_GetLinkCount(const GWEN_LIST_ITERATOR *li);
    00287
    00288
    00289
    00290
    00291 GWENHYWFAR_API
    00292 GWEN_CONSTLIST *GWEN_ConstList_new();
    00293
    00294 GWENHYWFAR_API
    00295 void GWEN_ConstList_free(GWEN_CONSTLIST *l);
    00296
    00297 GWENHYWFAR_API
    00298 void GWEN_ConstList_PushBack(GWEN_CONSTLIST *l, const void *p);
    00299
    00300 GWENHYWFAR_API
    00301 void GWEN_ConstList_PushFront(GWEN_CONSTLIST *l, const void *p);
    00302
    00303 GWENHYWFAR_API
    00304 const void *GWEN_ConstList_GetFront(GWEN_CONSTLIST *l);
    00305
    00306 GWENHYWFAR_API
    00307 const void *GWEN_ConstList_GetBack(GWEN_CONSTLIST *l);
    00308
    00309 GWENHYWFAR_API
    00310 unsigned int GWEN_ConstList_GetSize(GWEN_CONSTLIST *l);
    00311
    00312 GWENHYWFAR_API
    00313 void GWEN_ConstList_PopBack(GWEN_CONSTLIST *l);
    00314
    00315 GWENHYWFAR_API
    00316 void GWEN_ConstList_PopFront(GWEN_CONSTLIST *l);
    00317
    00318 GWENHYWFAR_API
    00319 void GWEN_ConstList_Clear(GWEN_CONSTLIST *l);
    00320
    00321 GWENHYWFAR_API
    00322 const void *GWEN_ConstList_ForEach(GWEN_CONSTLIST *l,
    00323                                    GWEN_CONSTLIST_FOREACH_CB fn,
    00324                                    void *user_data);
    00325
    00326 GWENHYWFAR_API
    00327 GWEN_CONSTLIST_ITERATOR *GWEN_ConstList_First(const GWEN_CONSTLIST *l);
    00328
    00329 GWENHYWFAR_API
    00330 GWEN_CONSTLIST_ITERATOR *GWEN_ConstList_Last(const GWEN_CONSTLIST *l);
    00331
    00332 GWENHYWFAR_API
    00333 GWEN_CONSTLIST_ITERATOR *GWEN_ConstListIterator_new(const GWEN_CONSTLIST *l);
    00334
    00335 GWENHYWFAR_API
    00336 void GWEN_ConstListIterator_free(GWEN_CONSTLIST_ITERATOR *li);
    00337
    00338 GWENHYWFAR_API
    00339 const void *GWEN_ConstListIterator_Previous(GWEN_CONSTLIST_ITERATOR *li);
    00340
    00341 GWENHYWFAR_API
    00342 const void *GWEN_ConstListIterator_Next(GWEN_CONSTLIST_ITERATOR *li);
    00343
    00344 GWENHYWFAR_API
    00345 const void *GWEN_ConstListIterator_Data(GWEN_CONSTLIST_ITERATOR *li);
    00346
    00347
    00348  /* defgroup */
    00350
    00351
    00352 #ifdef __cplusplus
    00353 }
    00354 #endif
    00355
    00356
    00357 #endif
    00358
    00359
    00360