00001 /* hbcistringlist.h 00002 * 00003 * Some helper functions for string list manipulation in 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 HBCISTRINGLIST_H 00028 #define HBCISTRINGLIST_H 00029 00034 #ifdef __cplusplus 00035 #include <string> 00036 #include <list> 00037 using namespace std; 00038 00039 typedef list<string> list_string; 00040 typedef list<string>::const_iterator list_string_iter; 00041 00042 extern "C" { 00043 00044 #else /* __cplusplus */ 00045 typedef struct list_string list_string; 00046 typedef struct list_string_iter list_string_iter; 00047 #endif /* __cplusplus */ 00048 00049 extern void list_string_delete(list_string *l); 00050 extern void list_string_iter_delete(list_string_iter *l); 00051 extern int list_string_size(const list_string *l); 00052 extern list_string_iter* list_string_begin(const list_string *l); 00053 extern list_string_iter* list_string_end(const list_string *l); 00054 extern const char* list_string_iter_get(const list_string_iter *l); 00055 extern void list_string_iter_next(list_string_iter *l); 00056 extern int list_string_iter_equal(const list_string_iter *l1, 00057 const list_string_iter *l2); 00059 typedef void *(*list_string_cb) (const char *string, 00060 void *user_data); 00072 extern void *list_string_foreach (const list_string *list, 00073 list_string_cb func, 00074 void *user_data); 00075 /* Returns a char* of all list entries concatenated together, with 00076 * no separation in between. 00077 * 00078 * The returned pointer will be owned by the caller and has to be 00079 * free'd when no longer in use.*/ 00080 extern char *list_string_concat (const list_string *list); 00081 /* Returns a char* of all list entries concatenated together, with 00082 * the string 'delim' in between each single list element. 00083 * 00084 * The returned pointer will be owned by the caller and has to be 00085 * free'd when no longer in use.*/ 00086 extern char *list_string_concat_delim (const list_string *list, 00087 const char *delim); 00088 00089 #ifdef __cplusplus 00090 } 00091 #endif 00092 00093 #endif