Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_array.h

Go to the documentation of this file.
00001 /* 00002 * $Id: gi_array.h,v 1.1.2.5 2004/04/26 03:21:51 jasta Exp $ 00003 * 00004 * Copyright (C) 2004 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __GI_ARRAY_H 00018 #define __GI_ARRAY_H 00019 00020 /*****************************************************************************/ 00021 00029 /*****************************************************************************/ 00030 00031 #include "gi_buffer.h" 00032 00033 /*****************************************************************************/ 00034 00038 typedef struct 00039 { 00046 GiBuffer buf; 00047 00052 size_t nmemb; 00053 00057 size_t elemsize; 00058 } GiArray; 00059 00060 /*****************************************************************************/ 00061 00066 #define GI_ARRAY_HEAD(array) gi_buffer_head(&((array)->buf)) 00067 #define gi_array_head(array) GI_ARRAY_HEAD(array) 00068 #define gi_array_length(array) ((array)->nmemb) 00069 00070 /*****************************************************************************/ 00071 00072 typedef void (*GiArrayForeachFn) (void *data, void *udata); 00073 #define GI_ARRAY_FOREACH(foreachfn) ((GiArrayForeachFn)(foreachfn)) 00074 00075 /*****************************************************************************/ 00076 00077 EXTERN_C_BEGIN 00078 00079 /*****************************************************************************/ 00080 00084 LIBGIFT_EXPORT 00085 void gi_array_init (GiArray *array, size_t elemsize); 00086 00090 LIBGIFT_EXPORT 00091 void gi_array_finish (GiArray *array); 00092 00097 LIBGIFT_EXPORT 00098 GiArray *gi_array_new (size_t elemsize); 00099 00104 LIBGIFT_EXPORT 00105 void gi_array_free (GiArray *array); 00106 00107 /*****************************************************************************/ 00108 00113 LIBGIFT_EXPORT 00114 GiArray *gi_array_copy (GiArray *array); 00115 00116 /*****************************************************************************/ 00117 00134 LIBGIFT_EXPORT 00135 bool gi_array_index (GiArray *array, void *buf, size_t index); 00136 00137 /*****************************************************************************/ 00138 00143 LIBGIFT_EXPORT 00144 bool gi_array_push (GiArray *array, const void *buf); 00145 00149 LIBGIFT_EXPORT 00150 bool gi_array_pop (GiArray *array, void *buf); 00151 00152 /*****************************************************************************/ 00153 00158 LIBGIFT_EXPORT 00159 bool gi_array_unshift (GiArray *array, const void *buf); 00160 00165 LIBGIFT_EXPORT 00166 bool gi_array_shift (GiArray *array, void *buf); 00167 00168 /*****************************************************************************/ 00169 00201 LIBGIFT_EXPORT 00202 bool gi_array_splice (GiArray *array, 00203 void *removed, size_t offset, size_t length, 00204 const void *inserted, size_t nmemb); 00205 00206 /*****************************************************************************/ 00207 00208 LIBGIFT_EXPORT 00209 void gi_array_foreach (GiArray *array, GiArrayForeachFn foreachfn, 00210 const void *udata); 00211 00212 /*****************************************************************************/ 00213 00214 EXTERN_C_END 00215 00216 /*****************************************************************************/ 00217 00218 #endif /* __GI_ARRAY_H */

Generated on Sun Aug 22 07:56:39 2004 by doxygen 1.3.7