1 /*
    2  * << Haru Free PDF Library >> -- hpdf_list.h
    3  *
    4  * URL: http://libharu.org
    5  *
    6  * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
    7  * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
    8  *
    9  * Permission to use, copy, modify, distribute and sell this software
   10  * and its documentation for any purpose is hereby granted without fee,
   11  * provided that the above copyright notice appear in all copies and
   12  * that both that copyright notice and this permission notice appear
   13  * in supporting documentation.
   14  * It is provided "as is" without express or implied warranty.
   15  *
   16  */
   17 
   18 #ifndef _HPDF_LIST_H
   19 #define _HPDF_LIST_H
   20 
   21 #include "hpdf_error.h"
   22 #include "hpdf_mmgr.h"
   23 
   24 #ifdef __cplusplus
   25 extern "C" {
   26 #endif
   27 
   28 typedef struct _HPDF_List_Rec  *HPDF_List;
   29 
   30 typedef struct _HPDF_List_Rec {
   31       HPDF_MMgr       mmgr;
   32       HPDF_Error      error;
   33       HPDF_UINT       block_siz;
   34       HPDF_UINT       items_per_block;
   35       HPDF_UINT       count;
   36       void            **obj;
   37 } HPDF_List_Rec;
   38 
   39 
   40 HPDF_List
   41 HPDF_List_New  (HPDF_MMgr  mmgr,
   42                 HPDF_UINT  items_per_block);
   43 
   44 
   45 void
   46 HPDF_List_Free  (HPDF_List  list);
   47 
   48 
   49 HPDF_STATUS
   50 HPDF_List_Add  (HPDF_List  list,
   51                 void       *item);
   52 
   53 
   54 HPDF_STATUS
   55 HPDF_List_Insert  (HPDF_List  list,
   56                    void       *target,
   57                    void       *item);
   58 
   59 
   60 HPDF_STATUS
   61 HPDF_List_Remove  (HPDF_List  list,
   62                    void       *item);
   63 
   64 
   65 void*
   66 HPDF_List_RemoveByIndex  (HPDF_List  list,
   67                           HPDF_UINT  index);
   68 
   69 
   70 void*
   71 HPDF_List_ItemAt  (HPDF_List  list,
   72                    HPDF_UINT  index);
   73 
   74 
   75 HPDF_INT32
   76 HPDF_List_Find  (HPDF_List  list,
   77                  void       *item);
   78 
   79 
   80 void
   81 HPDF_List_Clear  (HPDF_List  list);
   82 
   83 #ifdef __cplusplus
   84 }
   85 #endif /* __cplusplus */
   86 
   87 #endif /* _HPDF_LIST_H */
   88