stringlist.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003  -------------------
00004  cvs         : $Id$
00005  begin       : Thu Apr 03 2003
00006  copyright   : (C) 2003 by Martin Preuss
00007  email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 #ifndef GWENHYWFAR_STRINGLIST_H
00029 #define GWENHYWFAR_STRINGLIST_H
00030 
00031 #include <gwenhywfar/gwenhywfarapi.h>
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 
00039 typedef enum {
00041   GWEN_StringList_SortModeNoCase=0,
00043   GWEN_StringList_SortModeCase,
00046   GWEN_StringList_SortModeInt
00047 } GWEN_STRINGLIST_SORT_MODE;
00048 
00049 
00050 typedef struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY;
00051 
00052 
00053 typedef struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST;
00054 
00055 
00056 GWENHYWFAR_API GWEN_STRINGLIST *GWEN_StringList_new(void);
00057 
00058 GWENHYWFAR_API GWEN_STRINGLIST *GWEN_StringList_fromTabString(const char *s, int checkDup);
00059 
00060 GWENHYWFAR_API void GWEN_StringList_free(GWEN_STRINGLIST *sl);
00061 GWENHYWFAR_API
00062   GWEN_STRINGLIST *GWEN_StringList_dup(const GWEN_STRINGLIST *sl);
00063 GWENHYWFAR_API void GWEN_StringList_Clear(GWEN_STRINGLIST *sl);
00064 
00066 GWENHYWFAR_API
00067   unsigned int GWEN_StringList_Count(const GWEN_STRINGLIST *sl);
00068 
00069 GWENHYWFAR_API GWEN_STRINGLISTENTRY *GWEN_StringListEntry_new(const char *s,
00070                                                               int take);
00071 GWENHYWFAR_API void GWEN_StringListEntry_ReplaceString(GWEN_STRINGLISTENTRY *e,
00072                                                        const char *s,
00073                                                        int take);
00074 GWENHYWFAR_API void GWEN_StringListEntry_free(GWEN_STRINGLISTENTRY *sl);
00075 GWENHYWFAR_API void GWEN_StringList_AppendEntry(GWEN_STRINGLIST *sl,
00076                                                 GWEN_STRINGLISTENTRY *se);
00077 GWENHYWFAR_API void GWEN_StringList_RemoveEntry(GWEN_STRINGLIST *sl,
00078                                                 GWEN_STRINGLISTENTRY *se);
00079 GWENHYWFAR_API
00080   GWEN_STRINGLISTENTRY *GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl);
00081 GWENHYWFAR_API
00082   GWEN_STRINGLISTENTRY *GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se);
00083 
00084 GWENHYWFAR_API
00085   const char *GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se);
00086 
00087 GWENHYWFAR_API
00088   void GWEN_StringListEntry_SetData(GWEN_STRINGLISTENTRY *se,
00089                                     const char *s);
00090 
00097 GWENHYWFAR_API
00098 void GWEN_StringList_SetSenseCase(GWEN_STRINGLIST *sl, int i);
00099 
00107 GWENHYWFAR_API
00108 void GWEN_StringList_SetIgnoreRefCount(GWEN_STRINGLIST *sl, int i);
00109 
00117 GWENHYWFAR_API int GWEN_StringList_AppendString(GWEN_STRINGLIST *sl,
00118                                                 const char *s,
00119                                                 int take,
00120                                                 int checkDouble);
00121 
00129 GWENHYWFAR_API int GWEN_StringList_InsertString(GWEN_STRINGLIST *sl,
00130                                                 const char *s,
00131                                                 int take,
00132                                                 int checkDouble);
00133 
00138 GWENHYWFAR_API int GWEN_StringList_RemoveString(GWEN_STRINGLIST *sl,
00139                                                 const char *s);
00140 
00146 GWENHYWFAR_API int GWEN_StringList_HasString(const GWEN_STRINGLIST *sl,
00147                                              const char *s);
00148 
00154 GWENHYWFAR_API int GWEN_StringList_GetStringPos(const GWEN_STRINGLIST *sl, const char *s);
00155 
00156 
00168 GWENHYWFAR_API
00169 void *GWEN_StringList_ForEach(const GWEN_STRINGLIST *l, 
00170                               void *(*func)(const char *s, void *u), 
00171                               void *user_data);
00172 
00174 GWENHYWFAR_API
00175 const char *GWEN_StringList_FirstString(const GWEN_STRINGLIST *l);
00176 
00177 GWENHYWFAR_API
00178 const char *GWEN_StringList_StringAt(const GWEN_STRINGLIST *l, int idx);
00179 
00180 
00192 GWENHYWFAR_API
00193 void GWEN_StringList_Sort(GWEN_STRINGLIST *l,
00194                           int ascending,
00195                           GWEN_STRINGLIST_SORT_MODE sortMode);
00196 
00197 GWENHYWFAR_API
00198 GWEN_STRINGLIST *GWEN_StringList_fromString(const char *str, const char *delimiters, int checkDouble);
00199 
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203 
00204 #endif
00205 
00206