00001 /* listwrappers.h 00002 * 00003 * Some helper functions for STL-list manipulation from C. 00004 * 00005 * Copyright (C) 2002 Christian Stimming 00006 */ 00007 00008 /*************************************************************************** 00009 * * 00010 * This library is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU Lesser General Public * 00012 * License as published by the Free Software Foundation; either * 00013 * version 2.1 of the License, or (at your option) any later version. * 00014 * * 00015 * This library is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00018 * Lesser General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU Lesser General Public * 00021 * License along with this library; if not, write to the Free Software * 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00023 * MA 02111-1307 USA * 00024 * * 00025 ***************************************************************************/ 00026 00027 #ifndef LISTWRAPPERS_H 00028 #define LISTWRAPPERS_H 00029 00034 #ifdef __cplusplus 00035 #include <list> 00036 using namespace std; 00037 00038 typedef std::list<int> list_int; 00039 typedef std::list<int>::const_iterator list_int_iter; 00040 extern "C" { 00041 #else /* __cplusplus */ 00042 typedef struct list_int list_int; 00043 typedef struct list_int_iter list_int_iter; 00044 #endif /* __cplusplus */ 00045 00050 extern void list_int_delete(list_int *l); 00051 extern void list_int_iter_delete(list_int_iter *l); 00052 extern int list_int_size(const list_int *l); 00053 extern list_int_iter* list_int_begin(const list_int *l); 00054 extern list_int_iter* list_int_end(const list_int *l); 00055 extern int list_int_iter_get(const list_int_iter *l); 00056 extern void list_int_iter_next(list_int_iter *l); 00057 extern int list_int_iter_equal(const list_int_iter *l1, 00058 const list_int_iter *l2); 00060 typedef void *(*list_int_cb) (int value, 00061 void *user_data); 00073 extern void *list_int_foreach (const list_int *list, 00074 list_int_cb func, 00075 void *user_data); 00078 #ifdef __cplusplus 00079 } 00080 #endif 00081 00082 #endif