gwenhywfar
4.3.3
|
#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/path.h>
#include <gwenhywfar/fastbuffer.h>
#include <gwenhywfar/types.h>
#include <stdio.h>
Go to the source code of this file.
Typedefs | |
typedef struct GWEN_DB_NODE | GWEN_DB_NODE |
Functions | |
Constructing, Destructing, Copying | |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_Group_new (const char *name) |
GWENHYWFAR_API void | GWEN_DB_Group_free (GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_Group_dup (const GWEN_DB_NODE *n) |
Variable Getter and Setter | |
These getter functions check for the existence of the given variable and return the value specified by an index. Under the following circumstances the also given default value will be returned:
The setter functions either replace an existing variable, create a missing variable, add a value or return an error if the variable does not exist (see description of the flags). All setter functions make deep copies of the given values, so you may free the params after calling the setter function. All getter functions return a const pointer to the variable's retrieved value. All setter functions return Zero if ok and Nonzero on error. This module knows about the following types (see GWEN_DB_VALUETYPE):
| |
GWENHYWFAR_API const char * | GWEN_DB_GetCharValue (GWEN_DB_NODE *n, const char *path, int idx, const char *defVal) |
GWENHYWFAR_API int | GWEN_DB_SetCharValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val) |
GWENHYWFAR_API int | GWEN_DB_AddCharValue (GWEN_DB_NODE *n, const char *path, const char *val, int senseCase, int check) |
GWENHYWFAR_API int | GWEN_DB_RemoveCharValue (GWEN_DB_NODE *n, const char *path, const char *val, int senseCase) |
GWENHYWFAR_API int | GWEN_DB_GetIntValue (GWEN_DB_NODE *n, const char *path, int idx, int defVal) |
GWENHYWFAR_API int | GWEN_DB_SetIntValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, int val) |
GWENHYWFAR_API const void * | GWEN_DB_GetBinValue (GWEN_DB_NODE *n, const char *path, int idx, const void *defVal, unsigned int defValSize, unsigned int *returnValueSize) |
GWENHYWFAR_API int | GWEN_DB_SetBinValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, const void *val, unsigned int valSize) |
GWENHYWFAR_API void * | GWEN_DB_GetPtrValue (GWEN_DB_NODE *n, const char *path, int idx, void *defVal) |
GWENHYWFAR_API int | GWEN_DB_SetPtrValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, void *val) |
Group Handling | |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetGroup (GWEN_DB_NODE *n, uint32_t flags, const char *path) |
GWENHYWFAR_API const char * | GWEN_DB_GroupName (GWEN_DB_NODE *n) |
GWENHYWFAR_API void | GWEN_DB_GroupRename (GWEN_DB_NODE *n, const char *newname) |
GWENHYWFAR_API int | GWEN_DB_AddGroup (GWEN_DB_NODE *parent, GWEN_DB_NODE *node) |
GWENHYWFAR_API int | GWEN_DB_InsertGroup (GWEN_DB_NODE *parent, GWEN_DB_NODE *node) |
GWENHYWFAR_API int | GWEN_DB_AddGroupChildren (GWEN_DB_NODE *n, GWEN_DB_NODE *nn) |
GWENHYWFAR_API void | GWEN_DB_UnlinkGroup (GWEN_DB_NODE *n) |
GWENHYWFAR_API int | GWEN_DB_DeleteGroup (GWEN_DB_NODE *n, const char *path) |
GWENHYWFAR_API int | GWEN_DB_ClearGroup (GWEN_DB_NODE *n, const char *path) |
GWENHYWFAR_API int | GWEN_DB_IsGroup (const GWEN_DB_NODE *n) |
GWENHYWFAR_API uint32_t | GWEN_DB_GetNodeFlags (const GWEN_DB_NODE *n) |
GWENHYWFAR_API void | GWEN_DB_SetNodeFlags (GWEN_DB_NODE *n, uint32_t flags) |
GWENHYWFAR_API void | GWEN_DB_ModifyBranchFlagsUp (GWEN_DB_NODE *n, uint32_t newflags, uint32_t mask) |
GWENHYWFAR_API void | GWEN_DB_ModifyBranchFlagsDown (GWEN_DB_NODE *n, uint32_t newflags, uint32_t mask) |
Reading and Writing From/To IO Layers | |
These functions read or write a DB from/to GWEN_IO_LAYER. This allows to use any source or target supported by GWEN_IO_LAYER for data storage (these are currently sockets, files and memory buffers). The flags determine how to read/write the data (e.g. if sub-groups are to be written etc). | |
GWENHYWFAR_API int | GWEN_DB_ReadFromFastBuffer (GWEN_DB_NODE *n, GWEN_FAST_BUFFER *fb, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_ReadFromIo (GWEN_DB_NODE *n, GWEN_SYNCIO *sio, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_ReadFile (GWEN_DB_NODE *n, const char *fname, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_ReadFromString (GWEN_DB_NODE *n, const char *str, int len, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_WriteToFastBuffer (GWEN_DB_NODE *node, GWEN_FAST_BUFFER *fb, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_WriteToIo (GWEN_DB_NODE *node, GWEN_SYNCIO *sio, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_WriteFile (GWEN_DB_NODE *n, const char *fname, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_WriteToBuffer (GWEN_DB_NODE *n, GWEN_BUFFER *buf, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_ReadFileAs (GWEN_DB_NODE *n, const char *fname, const char *type, GWEN_DB_NODE *params, uint32_t dbflags) |
GWENHYWFAR_API int | GWEN_DB_WriteFileAs (GWEN_DB_NODE *n, const char *fname, const char *type, GWEN_DB_NODE *params, uint32_t dbflags) |
Iterating Through Variables and variable handling | |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetFirstVar (GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetNextVar (GWEN_DB_NODE *n) |
GWENHYWFAR_API const char * | GWEN_DB_VariableName (GWEN_DB_NODE *n) |
GWENHYWFAR_API void | GWEN_DB_VariableRename (GWEN_DB_NODE *n, const char *newname) |
GWENHYWFAR_API void * | GWEN_DB_Variables_Foreach (GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data) |
GWENHYWFAR_API unsigned int | GWEN_DB_Variables_Count (const GWEN_DB_NODE *node) |
GWENHYWFAR_API GWEN_DB_NODE_TYPE | GWEN_DB_GetVariableType (GWEN_DB_NODE *n, const char *p) |
GWENHYWFAR_API int | GWEN_DB_DeleteVar (GWEN_DB_NODE *n, const char *path) |
GWENHYWFAR_API int | GWEN_DB_VariableExists (GWEN_DB_NODE *n, const char *path) |
GWENHYWFAR_API int | GWEN_DB_ValueExists (GWEN_DB_NODE *n, const char *path, unsigned int idx) |
GWENHYWFAR_API int | GWEN_DB_IsVariable (const GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_FindFirstVar (GWEN_DB_NODE *n, const char *name) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_FindNextVar (GWEN_DB_NODE *n, const char *name) |
Iterating Through Values and value handling | |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetFirstValue (GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetNextValue (GWEN_DB_NODE *n) |
GWENHYWFAR_API void * | GWEN_DB_Values_Foreach (GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data) |
GWENHYWFAR_API unsigned int | GWEN_DB_Values_Count (const GWEN_DB_NODE *node) |
GWENHYWFAR_API GWEN_DB_NODE_TYPE | GWEN_DB_GetValueType (GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE_TYPE | GWEN_DB_GetValueTypeByPath (GWEN_DB_NODE *n, const char *p, unsigned int i) |
GWENHYWFAR_API const char * | GWEN_DB_GetCharValueFromNode (const GWEN_DB_NODE *n) |
GWENHYWFAR_API int | GWEN_DB_SetCharValueInNode (GWEN_DB_NODE *n, const char *s) |
GWENHYWFAR_API int | GWEN_DB_GetIntValueFromNode (const GWEN_DB_NODE *n) |
GWENHYWFAR_API const void * | GWEN_DB_GetBinValueFromNode (const GWEN_DB_NODE *n, unsigned int *size) |
GWENHYWFAR_API int | GWEN_DB_IsValue (const GWEN_DB_NODE *n) |
Debugging | |
These functions are for debugging purposes only. You should NOT consider them part of the API. | |
GWENHYWFAR_API void | GWEN_DB_Dump (GWEN_DB_NODE *n, int insert) |
Iterating Through Groups | |
typedef void *(* | GWEN_DB_NODES_CB )(GWEN_DB_NODE *node, void *user_data) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetFirstGroup (GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetNextGroup (GWEN_DB_NODE *n) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_FindFirstGroup (GWEN_DB_NODE *n, const char *name) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_FindNextGroup (GWEN_DB_NODE *n, const char *name) |
GWENHYWFAR_API void * | GWEN_DB_Groups_Foreach (GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data) |
GWENHYWFAR_API unsigned int | GWEN_DB_Groups_Count (const GWEN_DB_NODE *node) |
GWENHYWFAR_API GWEN_DB_NODE * | GWEN_DB_GetParentGroup (GWEN_DB_NODE *n) |
Definition in file db.h.