gwenhywfar 4.0.3
|
#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/misc.h>
#include "stringlist_p.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include <string.h>
Go to the source code of this file.
#define DISABLE_DEBUGLOG |
Definition at line 30 of file stringlist.c.
static int GWEN_StringList__compar_asc_case | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 507 of file stringlist.c.
Referenced by GWEN_StringList_Sort().
static int GWEN_StringList__compar_asc_int | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 524 of file stringlist.c.
Referenced by GWEN_StringList_Sort().
static int GWEN_StringList__compar_asc_nocase | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 491 of file stringlist.c.
Referenced by GWEN_StringList_Sort().
static int GWEN_StringList__compar_desc_case | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 515 of file stringlist.c.
Referenced by GWEN_StringList_Sort().
static int GWEN_StringList__compar_desc_int | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 533 of file stringlist.c.
Referenced by GWEN_StringList_Sort().
static int GWEN_StringList__compar_desc_nocase | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 499 of file stringlist.c.
Referenced by GWEN_StringList_Sort().
void GWEN_StringList_AppendEntry | ( | GWEN_STRINGLIST * | sl, |
GWEN_STRINGLISTENTRY * | se | ||
) |
Definition at line 128 of file stringlist.c.
Referenced by GWEN_StringList_AppendString(), and GWEN_StringList_dup().
int GWEN_StringList_AppendString | ( | GWEN_STRINGLIST * | sl, |
const char * | s, | ||
int | take, | ||
int | checkDouble | ||
) |
Appends a string.
take | if true then the StringList takes over ownership of the string |
checkDouble | if true the the string will only be appended if it does not already exist |
Definition at line 229 of file stringlist.c.
References GWEN_StringList_AppendEntry(), and GWEN_StringListEntry_new().
Referenced by FOX16_HtmlLabel::addMediaPath(), Gtk2Gui_WComboBox_SetCharProperty(), GWEN_Dialog_AddMediaPath(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_GetAllEntries(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Gui_CGui_SetPasswordStatus(), GWEN_I18N_SetLocale(), GWEN_MDigest__HashFileTree(), GWEN_MsgEngine__ListGroup(), GWEN_MsgEngine__ShowGroup(), GWEN_PathManager_GetPaths(), GWEN_StringList_fromString(), GWEN_StringList_fromTabString(), GWEN_SyncIo_Buffered_ReadLinesToStringList(), and HtmlCtx_AddMediaPath().
void GWEN_StringList_Clear | ( | GWEN_STRINGLIST * | sl | ) |
Definition at line 214 of file stringlist.c.
References GWEN_StringListEntry_free().
Referenced by Gtk2Gui_WComboBox_SetCharProperty(), Gtk2Gui_WComboBox_SetIntProperty(), and GWEN_I18N_SetLocale().
unsigned int GWEN_StringList_Count | ( | const GWEN_STRINGLIST * | sl | ) |
Returns the number of elements in this list.
Definition at line 371 of file stringlist.c.
Referenced by GWEN_Directory_GetMatchingFilesRecursively(), GWEN_I18N_ModuleInit(), GWEN_MDigest_CheckFileTree(), GWEN_PathManager_GetPaths(), GWEN_StringList_fromString(), and print_paths().
GWEN_STRINGLIST* GWEN_StringList_dup | ( | const GWEN_STRINGLIST * | sl | ) |
Definition at line 438 of file stringlist.c.
References GWEN_StringList_AppendEntry(), GWEN_StringList_new(), and GWEN_StringListEntry_new().
GWEN_STRINGLISTENTRY* GWEN_StringList_FirstEntry | ( | const GWEN_STRINGLIST * | sl | ) |
Definition at line 351 of file stringlist.c.
Referenced by CocoaGui_WTextBrowser_SetCharProperty(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_ModuleInit(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_LoadPluginDescrsByType(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__ListElement(), GWEN_MsgEngine__ShowElement(), GWEN_PluginDescription_GetLongDescrByFormat(), GWEN_PluginManager_GetPluginDescrs(), GWEN_PluginManager_LoadPlugin(), GWEN_StringList_ForEach(), GWEN_XMLNode_GetLocalizedCharValue(), FOX16_GuiDialog::setupTree(), and FOX16_HtmlLabel::updateHtml().
const char* GWEN_StringList_FirstString | ( | const GWEN_STRINGLIST * | l | ) |
Returns the first string in this list.
Definition at line 482 of file stringlist.c.
Referenced by GWEN_I18N_ModuleInit().
void* GWEN_StringList_ForEach | ( | const GWEN_STRINGLIST * | l, |
void *(*)(const char *s, void *u) | func, | ||
void * | user_data | ||
) |
Traverses the list, calling the callback function 'func' on each list element. Traversal will stop when 'func' returns a non-NULL value, and the routine will return with that value. Otherwise the routine will return NULL.
l | The list to traverse. |
func | The function to be called with each list element. |
user_data | A pointer passed on to the function 'func'. |
Definition at line 458 of file stringlist.c.
References GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), and GWEN_StringListEntry_Next().
Referenced by print_paths().
void GWEN_StringList_free | ( | GWEN_STRINGLIST * | sl | ) |
Definition at line 57 of file stringlist.c.
References GWEN_FREE_OBJECT, and GWEN_StringListEntry_free().
Referenced by Gtk2Gui_WComboBox_FreeData(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_ModuleInit(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Dialog_free(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Gui_CGui_FreeData(), GWEN_I18N_ModuleFini(), GWEN_I18N_ModuleInit(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine_ListMessage(), GWEN_MsgEngine_ShowMessage(), GWEN_PathManager_GetPaths(), GWEN_PluginManager_GetPluginDescrs(), GWEN_PluginManager_LoadPlugin(), GWEN_StringList_fromString(), GWEN_SyncIo_Tls_Prepare(), HtmlCtx_FreeData(), and FOX16_HtmlLabel::~FOX16_HtmlLabel().
GWEN_STRINGLIST* GWEN_StringList_fromString | ( | const char * | str, |
const char * | delimiters, | ||
int | checkDouble | ||
) |
Definition at line 637 of file stringlist.c.
References GWEN_StringList_AppendString(), GWEN_StringList_Count(), GWEN_StringList_free(), GWEN_StringList_new(), and NULL.
GWEN_STRINGLIST* GWEN_StringList_fromTabString | ( | const char * | s, |
int | checkDup | ||
) |
Definition at line 150 of file stringlist.c.
References GWEN_StringList_AppendString(), and GWEN_StringList_new().
int GWEN_StringList_GetStringPos | ( | const GWEN_STRINGLIST * | sl, |
const char * | s | ||
) |
Returns the position of the given string within the stringlist.
Definition at line 406 of file stringlist.c.
int GWEN_StringList_HasString | ( | const GWEN_STRINGLIST * | sl, |
const char * | s | ||
) |
Checks whether the given string already exists within in the string list.
Definition at line 378 of file stringlist.c.
Referenced by GWEN_Gui_CGui_GetPassword().
int GWEN_StringList_InsertString | ( | GWEN_STRINGLIST * | sl, |
const char * | s, | ||
int | take, | ||
int | checkDouble | ||
) |
Inserts a string.
take | if true then the StringList takes over ownership of the string |
checkDouble | if true the the string will only be appended if it does not already exist |
Definition at line 268 of file stringlist.c.
References GWEN_StringListEntry_new().
GWEN_STRINGLIST* GWEN_StringList_new | ( | ) |
Definition at line 46 of file stringlist.c.
References GWEN_NEW_OBJECT.
Referenced by FOX16_HtmlLabel::FOX16_HtmlLabel(), Gtk2Gui_WComboBox_Setup(), GWEN_Dialog_new(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Gui_CGui_new(), GWEN_I18N_ModuleInit(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine_ListMessage(), GWEN_MsgEngine_ShowMessage(), GWEN_PathManager_GetPaths(), GWEN_StringList_dup(), GWEN_StringList_fromString(), GWEN_StringList_fromTabString(), and HtmlCtx_new().
void GWEN_StringList_RemoveEntry | ( | GWEN_STRINGLIST * | sl, |
GWEN_STRINGLISTENTRY * | se | ||
) |
Definition at line 185 of file stringlist.c.
Referenced by GWEN_StringList_RemoveString().
GWENHYWFAR_API int GWEN_StringList_RemoveString | ( | GWEN_STRINGLIST * | sl, |
const char * | s | ||
) |
Removes a given string from the stringlist.
Definition at line 307 of file stringlist.c.
References GWEN_StringList_RemoveEntry().
Referenced by GWEN_Gui_CGui_GetPassword(), GWEN_Gui_CGui_SetPasswordStatus(), and GWEN_MDigest_CheckFileTree().
void GWEN_StringList_SetIgnoreRefCount | ( | GWEN_STRINGLIST * | sl, |
int | i | ||
) |
Normally this group of functions ignores reference counters on stringlist entries when removing a string via GWEN_StringList_RemoveString. You can change this behaviour here.
sl | string list |
i | if 0 then reference counters are honoured |
Definition at line 80 of file stringlist.c.
void GWEN_StringList_SetSenseCase | ( | GWEN_STRINGLIST * | sl, |
int | i | ||
) |
Normally this group of functions ignores cases when comparing two strings. You can change this behaviour here.
sl | string list |
i | if 0 then cases are ignored |
Definition at line 73 of file stringlist.c.
void GWEN_StringList_Sort | ( | GWEN_STRINGLIST * | l, |
int | ascending, | ||
GWEN_STRINGLIST_SORT_MODE | sortMode | ||
) |
Sorts this list. Internally this uses qsort(3), so the sorting should be reasonably fast even for large lists.
l | The list to sort. |
ascending | If non-zero, the list is sorted ascending, i.e. smallest string first, according to strcmp(3) rules. If zero, the list is sorted descending. |
sortMode | See GWEN_StringList_SortModeNoCase and following |
Definition at line 544 of file stringlist.c.
References DBG_ERROR, GWEN_LOGDOMAIN, GWEN_StringList__compar_asc_case(), GWEN_StringList__compar_asc_int(), GWEN_StringList__compar_asc_nocase(), GWEN_StringList__compar_desc_case(), GWEN_StringList__compar_desc_int(), GWEN_StringList__compar_desc_nocase(), GWEN_StringList_SortModeCase, GWEN_StringList_SortModeInt, and GWEN_StringList_SortModeNoCase.
const char* GWEN_StringList_StringAt | ( | const GWEN_STRINGLIST * | sl, |
int | idx | ||
) |
Definition at line 622 of file stringlist.c.
Referenced by Gtk2Gui_WComboBox_GetCharProperty().
const char* GWEN_StringListEntry_Data | ( | const GWEN_STRINGLISTENTRY * | se | ) |
Definition at line 365 of file stringlist.c.
Referenced by CocoaGui_WTextBrowser_SetCharProperty(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_ModuleInit(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_LoadPluginDescrsByType(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__ListElement(), GWEN_MsgEngine__ShowElement(), GWEN_PluginDescription_GetLongDescrByFormat(), GWEN_PluginManager_GetPluginDescrs(), GWEN_PluginManager_LoadPlugin(), GWEN_StringList_ForEach(), GWEN_XMLNode_GetLocalizedCharValue(), FOX16_GuiDialog::setupTree(), and FOX16_HtmlLabel::updateHtml().
void GWEN_StringListEntry_free | ( | GWEN_STRINGLISTENTRY * | sl | ) |
Definition at line 118 of file stringlist.c.
References GWEN_FREE_OBJECT.
Referenced by GWEN_StringList_Clear(), and GWEN_StringList_free().
GWEN_STRINGLISTENTRY* GWEN_StringListEntry_new | ( | const char * | s, |
int | take | ||
) |
Definition at line 87 of file stringlist.c.
References GWEN_NEW_OBJECT.
Referenced by GWEN_StringList_AppendString(), GWEN_StringList_dup(), and GWEN_StringList_InsertString().
GWEN_STRINGLISTENTRY* GWEN_StringListEntry_Next | ( | const GWEN_STRINGLISTENTRY * | se | ) |
Definition at line 358 of file stringlist.c.
Referenced by GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_ModuleInit(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_LoadPluginDescrsByType(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__ListElement(), GWEN_MsgEngine__ShowElement(), GWEN_PluginDescription_GetLongDescrByFormat(), GWEN_PluginManager_GetPluginDescrs(), GWEN_PluginManager_LoadPlugin(), GWEN_StringList_ForEach(), GWEN_XMLNode_GetLocalizedCharValue(), FOX16_GuiDialog::setupTree(), and FOX16_HtmlLabel::updateHtml().
void GWEN_StringListEntry_ReplaceString | ( | GWEN_STRINGLISTENTRY * | e, |
const char * | s, | ||
int | take | ||
) |
Definition at line 104 of file stringlist.c.