00001 /* 00002 * libkarmaclient - A C Library to the Karmasphere Reputation Server 00003 * Copyright (C) 2006 Karmasphere <http://www.karmasphere.com/> 00004 * - Shevek <shevek@karmasphere.com> 00005 * - Dave Stewart <dave.stewart@karmasphere.com> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library 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 GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00032 #ifndef INC_KS_ARRAY_H 00033 #define INC_KS_ARRAY_H 00034 00035 #include "ks_common.h" 00036 #include "ks_malloc.h" 00037 00041 typedef 00042 struct _ks_array_t { 00043 ks_base_t base; 00044 int size; 00045 int length; 00046 ks_base_t **data; 00047 } ks_array_t; 00048 00058 typedef int (*ks_array_compar)(const ks_base_t *a, const ks_base_t *b); 00059 00060 ks_type_t *ks_array_type(void); 00061 ks_array_t *ks_array_new(void); 00062 void ks_array_init(ks_array_t *); 00063 void ks_array_free(ks_array_t *); 00064 void ks_array_fini(ks_array_t *); 00065 00066 void ks_array_extend(ks_array_t *, int); 00067 void ks_array_set(ks_array_t *, int, ks_base_t *); 00068 ks_base_t *ks_array_get(ks_array_t *, int); 00069 void ks_array_add(ks_array_t *, ks_base_t *); 00070 void ks_array_remove(ks_array_t *, int); 00071 00072 void ks_array_sort(ks_array_t *, ks_array_compar); 00073 00074 int ks_array_length(ks_array_t *); 00075 00076 #endif
1.5.1