gwenhywfar 5.10.1
Macros | Functions
path.c File Reference
#include "path.h"
#include "gwenhywfar/debug.h"
#include "gwenhywfar/misc.h"
#include "gwenhywfar/text.h"
#include "gwenhywfar/stringlist.h"
#include <ctype.h>
Include dependency graph for path.c:

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)
 

Macro Definition Documentation

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 29 of file path.c.

Function Documentation

◆ _getPathBetween()

void _getPathBetween ( const char *  path1,
const char *  path2,
GWEN_BUFFER diffBuf 
)
static

◆ GWEN_Path_AppendPathElement()

void * GWEN_Path_AppendPathElement ( const char *  entry,
void *  data,
unsigned int  flags 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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().

Here is the call graph for this function:

◆ GWEN_Path_GetPathBetween()

int GWEN_Path_GetPathBetween ( const char *  path1,
const char *  path2,
GWEN_BUFFER diffBuf 
)

◆ GWEN_Path_Handle()

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.

Returns
0 on error, !=0 otherwise

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_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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Path_HandleWithIdx()

void * GWEN_Path_HandleWithIdx ( const char *  path,
void *  data,
uint32_t  flags,
GWEN_PATHIDXHANDLERPTR  elementFunction 
)