|
gwenhywfar 5.14.1
|
#include "path.h"#include "gwenhywfar/debug.h"#include "gwenhywfar/misc.h"#include "gwenhywfar/text.h"#include "gwenhywfar/stringlist.h"#include <ctype.h>
Go to the source code of this file.
Macros | |
| #define | DISABLE_DEBUGLOG |
Functions | |
| static void | _getPathBetween (const char *path1, const char *path2, GWEN_BUFFER *diffBuf) |
| static void * | GWEN_Path_AppendPathElement (const char *entry, void *data, unsigned int flags) |
| int | GWEN_Path_Convert (const char *path, GWEN_BUFFER *buffer, uint32_t flags) |
| int | GWEN_Path_GetPathBetween (const char *path1, const char *path2, GWEN_BUFFER *diffBuf) |
| void * | GWEN_Path_Handle (const char *path, void *data, uint32_t flags, GWEN_PATHHANDLERPTR elementFunction) |
| void * | GWEN_Path_HandleWithIdx (const char *path, void *data, uint32_t flags, GWEN_PATHIDXHANDLERPTR elementFunction) |
|
static |
Definition at line 465 of file path.c.
References GWEN_Buffer_AppendString(), GWEN_Buffer_GetUsedBytes(), GWEN_StringList_Count(), GWEN_StringList_FirstEntry(), GWEN_StringList_free(), GWEN_StringList_fromString2(), GWEN_StringList_RemoveCommonFirstEntries(), GWEN_StringListEntry_Data(), GWEN_StringListEntry_Next(), GWEN_TEXT_FLAGS_CHECK_BACKSLASH, and GWEN_TEXT_FLAGS_DEL_QUOTES.
Referenced by GWEN_Path_GetPathBetween().


|
static |
Definition at line 392 of file path.c.
References GWEN_Buffer_AllocRoom(), GWEN_Buffer_AppendByte(), GWEN_Buffer_AppendString(), GWEN_Buffer_GetPosPointer(), GWEN_PATH_FLAGS_LAST, and GWEN_PATH_FLAGS_VARIABLE.
Referenced by GWEN_Path_Convert().


| int GWEN_Path_Convert | ( | const char * | path, |
| GWEN_BUFFER * | buffer, | ||
| uint32_t | flags ) |
Converts the given path according to the given flags. You can use this function to escape, unescape or simply store all path elements within a buffer. The converted path will simply be appended to the given buffer (without any leading slash).
Definition at line 409 of file path.c.
References GWEN_Path_AppendPathElement(), and GWEN_Path_Handle().

| int GWEN_Path_GetPathBetween | ( | const char * | path1, |
| const char * | path2, | ||
| GWEN_BUFFER * | diffBuf ) |
Definition at line 427 of file path.c.
References _getPathBetween(), DBG_INFO, GWEN_Buffer_AppendString(), GWEN_LOGDOMAIN, GWEN_StringList_Count(), GWEN_StringList_free(), GWEN_StringList_fromString2(), GWEN_TEXT_FLAGS_CHECK_BACKSLASH, and GWEN_TEXT_FLAGS_DEL_QUOTES.
Referenced by GWB_Builder_AddFileNameToBuffer(), and GWB_Builder_AddRelativeFolderToBuffer().


| void * GWEN_Path_Handle | ( | const char * | path, |
| void * | data, | ||
| uint32_t | flags, | ||
| GWEN_PATHHANDLERPTR | elementFunction ) |
This function works on a path according to the given flags. For every element the given function is called. A path consists of multiple elements separated by a slash ("/"), e.g. "first/second/element". This function is used by the DB module but may also be used for any type of path handling (like creating all directories along a given path). This function simply calls the given function for any element as long as that function returns a non-zero value or the path ends. The type of the returned value completely depends on the function called.
Definition at line 60 of file path.c.
References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AppendByte(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_Buffer_Reset(), GWEN_Buffer_SetStep(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_CHECKROOT, GWEN_PATH_FLAGS_CONVERT_LAST, GWEN_PATH_FLAGS_ESCAPE, GWEN_PATH_FLAGS_INTERNAL, GWEN_PATH_FLAGS_LAST, GWEN_PATH_FLAGS_ROOT, GWEN_PATH_FLAGS_TOLERANT_ESCAPE, GWEN_PATH_FLAGS_UNESCAPE, GWEN_PATH_FLAGS_VARIABLE, GWEN_Text_EscapeToBuffer(), GWEN_Text_EscapeToBufferTolerant(), GWEN_Text_UnescapeToBuffer(), and GWEN_Text_UnescapeToBufferTolerant().
Referenced by GWEN_Directory_GetPath(), and GWEN_Path_Convert().


| void * GWEN_Path_HandleWithIdx | ( | const char * | path, |
| void * | data, | ||
| uint32_t | flags, | ||
| GWEN_PATHIDXHANDLERPTR | elementFunction ) |
Definition at line 210 of file path.c.
References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AppendByte(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_Buffer_Reset(), GWEN_Buffer_SetStep(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_CHECKROOT, GWEN_PATH_FLAGS_CONVERT_LAST, GWEN_PATH_FLAGS_ESCAPE, GWEN_PATH_FLAGS_INTERNAL, GWEN_PATH_FLAGS_LAST, GWEN_PATH_FLAGS_NO_IDX, GWEN_PATH_FLAGS_ROOT, GWEN_PATH_FLAGS_TOLERANT_ESCAPE, GWEN_PATH_FLAGS_UNESCAPE, GWEN_PATH_FLAGS_VARIABLE, GWEN_Text_EscapeToBuffer(), GWEN_Text_EscapeToBufferTolerant(), GWEN_Text_UnescapeToBuffer(), and GWEN_Text_UnescapeToBufferTolerant().
Referenced by GWEN_DB_GetNode(), GWEN_JsonElement_GetElementByPath(), GWEN_XmlCommanderLibXml_GetXmlNode(), and GWEN_XMLNode_GetNodeByXPath().

