gwenhywfar  5.1.2
db.h
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Sep 09 2003
3  copyright : (C) 2003-2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 
28 #ifndef GWENHYWFAR_DB_H
29 #define GWENHYWFAR_DB_H
30 
32 #include <gwenhywfar/path.h>
33 #include <gwenhywfar/fastbuffer.h>
34 #include <gwenhywfar/types.h>
35 #include <stdio.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 
102 #define GWEN_DB_LINE_MAXSIZE 1024
103 
119 #define GWEN_DB_FLAGS_ALLOW_EMPTY_STREAM 0x00008000
120 
121 #define GWEN_DB_FLAGS_OVERWRITE_VARS 0x00010000
122 
123 #define GWEN_DB_FLAGS_OVERWRITE_GROUPS 0x00020000
124 
125 #define GWEN_DB_FLAGS_QUOTE_VARNAMES 0x00040000
126 
127 #define GWEN_DB_FLAGS_QUOTE_VALUES 0x00080000
128 
129 #define GWEN_DB_FLAGS_WRITE_SUBGROUPS 0x00100000
130 
131 #define GWEN_DB_FLAGS_DETAILED_GROUPS 0x00200000
132 
134 #define GWEN_DB_FLAGS_INDEND 0x00400000
135 
137 #define GWEN_DB_FLAGS_ADD_GROUP_NEWLINES 0x00800000
138 
140 #define GWEN_DB_FLAGS_USE_COLON 0x01000000
141 
142 #define GWEN_DB_FLAGS_UNTIL_EMPTY_LINE 0x02000000
143 
145 #define GWEN_DB_FLAGS_OMIT_TYPES 0x04000000
146 
147 #define GWEN_DB_FLAGS_APPEND_FILE 0x08000000
148 
149 #define GWEN_DB_FLAGS_ESCAPE_CHARVALUES 0x10000000
150 
152 #define GWEN_DB_FLAGS_UNESCAPE_CHARVALUES 0x10000000
153 
155 #define GWEN_DB_FLAGS_LOCKFILE 0x20000000
156 
160 #define GWEN_DB_FLAGS_INSERT 0x40000000
161 
165 #define GWEN_DB_FLAGS_DOSMODE 0x80000000
166 
168 #define GWEN_DB_FLAGS_DEFAULT \
169  (\
170  GWEN_DB_FLAGS_QUOTE_VALUES | \
171  GWEN_DB_FLAGS_WRITE_SUBGROUPS | \
172  GWEN_DB_FLAGS_DETAILED_GROUPS | \
173  GWEN_DB_FLAGS_INDEND | \
174  GWEN_DB_FLAGS_ADD_GROUP_NEWLINES | \
175  GWEN_DB_FLAGS_ESCAPE_CHARVALUES | \
176  GWEN_DB_FLAGS_UNESCAPE_CHARVALUES\
177  )
178 
179 
182 #define GWEN_DB_FLAGS_COMPACT \
183  (\
184  GWEN_DB_FLAGS_QUOTE_VALUES | \
185  GWEN_DB_FLAGS_WRITE_SUBGROUPS | \
186  GWEN_DB_FLAGS_ESCAPE_CHARVALUES | \
187  GWEN_DB_FLAGS_UNESCAPE_CHARVALUES\
188  )
189 
193 #define GWEN_DB_FLAGS_HTTP \
194  (\
195  GWEN_DB_FLAGS_USE_COLON |\
196  GWEN_DB_FLAGS_UNTIL_EMPTY_LINE |\
197  GWEN_DB_FLAGS_OMIT_TYPES | \
198  GWEN_DB_FLAGS_DOSMODE \
199  )
200 
207 #define GWEN_DB_NODE_FLAGS_DIRTY 0x00000001
208 
209 #define GWEN_DB_NODE_FLAGS_VOLATILE 0x00000002
210 
212 #define GWEN_DB_NODE_FLAGS_INHERIT_HASH_MECHANISM 0x00000004
213 
214 #define GWEN_DB_NODE_FLAGS_SAFE 0x00000008
215 
218 #define GWEN_DB_DEFAULT_LOCK_TIMEOUT 1000
219 
220 
228 typedef struct GWEN_DB_NODE GWEN_DB_NODE;
229 
233 typedef enum {
251 
252 
253 
258 
266 GWEN_DB_NODE *GWEN_DB_Group_new(const char *name);
267 
275 
276 
285 
305 
330 
331 
344 GWEN_DB_NODE *GWEN_DB_FindFirstGroup(GWEN_DB_NODE *n, const char *name);
345 
365 GWEN_DB_NODE *GWEN_DB_FindNextGroup(GWEN_DB_NODE *n, const char *name);
366 
367 
378 typedef void *(*GWEN_DB_NODES_CB)(GWEN_DB_NODE *node, void *user_data);
379 
398  void *user_data);
399 
404 unsigned int GWEN_DB_Groups_Count(const GWEN_DB_NODE *node);
405 
411 
470 const char *GWEN_DB_GetCharValue(GWEN_DB_NODE *n,
471  const char *path,
472  int idx,
473  const char *defVal);
484  uint32_t flags,
485  const char *path,
486  const char *val);
487 
488 
489 
499  uint32_t flags,
500  const char *path,
501  int val);
502 
503 
516  const char *path,
517  const char *val,
518  int senseCase,
519  int check);
520 
521 
533  const char *path,
534  const char *val,
535  int senseCase);
536 
537 
547  const char *path,
548  int idx,
549  int defVal);
550 
561  uint32_t flags,
562  const char *path,
563  int val);
564 
565 
578 const void *GWEN_DB_GetBinValue(GWEN_DB_NODE *n,
579  const char *path,
580  int idx,
581  const void *defVal,
582  unsigned int defValSize,
583  unsigned int *returnValueSize);
584 
597  uint32_t flags,
598  const char *path,
599  const void *val,
600  unsigned int valSize);
601 
602 
612  const char *path,
613  int idx,
614  void *defVal);
615 
627  uint32_t flags,
628  const char *path,
629  void *val);
630 
631 
642 int GWEN_DB_WriteVarValueToBuffer(GWEN_DB_NODE *n, const char *path, int index, GWEN_BUFFER *dstBuf);
643 
644 
653 
665  uint32_t flags,
666  const char *path);
667 
672 const char *GWEN_DB_GroupName(GWEN_DB_NODE *n);
673 
680 void GWEN_DB_GroupRename(GWEN_DB_NODE *n, const char *newname);
681 
697 int GWEN_DB_AddGroup(GWEN_DB_NODE *parent, GWEN_DB_NODE *node);
698 
715 int GWEN_DB_InsertGroup(GWEN_DB_NODE *parent, GWEN_DB_NODE *node);
716 
728 
740 
749  const char *path);
759  const char *path);
760 
768 int GWEN_DB_IsGroup(const GWEN_DB_NODE *n);
769 
782 uint32_t GWEN_DB_GetNodeFlags(const GWEN_DB_NODE *n);
783 
791  uint32_t flags);
792 
803  uint32_t newflags,
804  uint32_t mask);
805 
816  uint32_t newflags,
817  uint32_t mask);
818 
832 
835  GWEN_FAST_BUFFER *fb,
836  uint32_t dbflags);
837 
839 int GWEN_DB_ReadFromIo(GWEN_DB_NODE *n, GWEN_SYNCIO *sio, uint32_t dbflags);
840 
843  const char *fname,
844  uint32_t dbflags);
845 
848  const char *str,
849  int len,
850  uint32_t dbflags);
851 
854  GWEN_FAST_BUFFER *fb,
855  uint32_t dbflags);
856 
859  GWEN_SYNCIO *sio,
860  uint32_t dbflags);
861 
862 
865  const char *fname,
866  uint32_t dbflags);
867 
870  GWEN_BUFFER *buf,
871  uint32_t dbflags);
872 
885  const char *fname,
886  const char *type,
887  GWEN_DB_NODE *params,
888  uint32_t dbflags);
889 
902  const char *fname,
903  const char *type,
904  GWEN_DB_NODE *params,
905  uint32_t dbflags);
906 
907 
922 
923 
947 
953 const char *GWEN_DB_VariableName(GWEN_DB_NODE *n);
954 
955 
957 void GWEN_DB_VariableRename(GWEN_DB_NODE *n, const char *newname);
958 
977  void *user_data);
978 
984 unsigned int GWEN_DB_Variables_Count(const GWEN_DB_NODE *node);
985 
993  const char *p);
994 
1003  const char *path);
1004 
1013  const char *path);
1014 
1024  const char *path,
1025  unsigned int idx);
1026 
1034 int GWEN_DB_IsVariable(const GWEN_DB_NODE *n);
1035 
1036 
1049 GWEN_DB_NODE *GWEN_DB_FindFirstVar(GWEN_DB_NODE *n, const char *name);
1050 
1070 GWEN_DB_NODE *GWEN_DB_FindNextVar(GWEN_DB_NODE *n, const char *name);
1071 
1086 
1105 
1124  void *user_data);
1125 
1130 unsigned int GWEN_DB_Values_Count(const GWEN_DB_NODE *node);
1131 
1138 
1141  const char *p,
1142  unsigned int i);
1143 
1149 const char *GWEN_DB_GetCharValueFromNode(const GWEN_DB_NODE *n);
1150 
1156 int GWEN_DB_SetCharValueInNode(GWEN_DB_NODE *n, const char *s);
1157 
1160 
1162 const void *GWEN_DB_GetBinValueFromNode(const GWEN_DB_NODE *n,
1163  unsigned int *size);
1164 
1165 
1173 int GWEN_DB_IsValue(const GWEN_DB_NODE *n);
1187 
1194 void GWEN_DB_Dump(GWEN_DB_NODE *n, int insert);
1203 
1204 
1210 int GWEN_DB_ReplaceVars(GWEN_DB_NODE *db, const char *s, GWEN_BUFFER *dbuf);
1216 
1217 
1218 #ifdef __cplusplus
1219 }
1220 #endif
1221 
1222 
1223 #endif
1224 
1225 
1226 
GWEN_DB_NODE_TYPE
GWEN_DB_NODE_TYPE
Definition: db.h:232
path.h
GWEN_DB_UnlinkGroup
GWENHYWFAR_API void GWEN_DB_UnlinkGroup(GWEN_DB_NODE *n)
GWEN_DB_IsGroup
GWENHYWFAR_API int GWEN_DB_IsGroup(const GWEN_DB_NODE *n)
GWEN_DB_GetValueTypeByPath
GWENHYWFAR_API GWEN_DB_NODE_TYPE GWEN_DB_GetValueTypeByPath(GWEN_DB_NODE *n, const char *p, unsigned int i)
GWEN_DB_FindFirstGroup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_FindFirstGroup(GWEN_DB_NODE *n, const char *name)
GWEN_DB_SetNodeFlags
GWENHYWFAR_API void GWEN_DB_SetNodeFlags(GWEN_DB_NODE *n, uint32_t flags)
GWEN_SYNCIO
struct GWEN_SYNCIO GWEN_SYNCIO
Definition: syncio.h:39
GWEN_DB_AddGroupChildren
GWENHYWFAR_API int GWEN_DB_AddGroupChildren(GWEN_DB_NODE *n, GWEN_DB_NODE *nn)
GWEN_DB_GetValueType
GWENHYWFAR_API GWEN_DB_NODE_TYPE GWEN_DB_GetValueType(GWEN_DB_NODE *n)
GWEN_DB_NodeType_Var
Definition: db.h:238
GWEN_DB_VariableRename
GWENHYWFAR_API void GWEN_DB_VariableRename(GWEN_DB_NODE *n, const char *newname)
GWEN_DB_Group_free
GWENHYWFAR_API void GWEN_DB_Group_free(GWEN_DB_NODE *n)
GWEN_DB_FindFirstVar
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_FindFirstVar(GWEN_DB_NODE *n, const char *name)
types.h
GWEN_DB_GetIntValue
GWENHYWFAR_API int GWEN_DB_GetIntValue(GWEN_DB_NODE *n, const char *path, int idx, int defVal)
GWEN_DB_GetNextValue
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetNextValue(GWEN_DB_NODE *n)
GWEN_DB_GetNodeFlags
GWENHYWFAR_API uint32_t GWEN_DB_GetNodeFlags(const GWEN_DB_NODE *n)
GWEN_DB_GetCharValueFromNode
const GWENHYWFAR_API char * GWEN_DB_GetCharValueFromNode(const GWEN_DB_NODE *n)
GWEN_DB_NodeType_ValueChar
Definition: db.h:240
GWEN_DB_ModifyBranchFlagsDown
GWENHYWFAR_API void GWEN_DB_ModifyBranchFlagsDown(GWEN_DB_NODE *n, uint32_t newflags, uint32_t mask)
GWEN_DB_SetBinValue
GWENHYWFAR_API int GWEN_DB_SetBinValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const void *val, unsigned int valSize)
GWEN_DB_ReplaceVars
GWENHYWFAR_API int GWEN_DB_ReplaceVars(GWEN_DB_NODE *db, const char *s, GWEN_BUFFER *dbuf)
GWEN_DB_ReadFile
GWENHYWFAR_API int GWEN_DB_ReadFile(GWEN_DB_NODE *n, const char *fname, uint32_t dbflags)
GWEN_DB_Values_Foreach
GWENHYWFAR_API void * GWEN_DB_Values_Foreach(GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data)
GWEN_DB_FindNextGroup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_FindNextGroup(GWEN_DB_NODE *n, const char *name)
GWEN_DB_GetPtrValue
GWENHYWFAR_API void * GWEN_DB_GetPtrValue(GWEN_DB_NODE *n, const char *path, int idx, void *defVal)
GWEN_DB_WriteVarValueToBuffer
GWENHYWFAR_API int GWEN_DB_WriteVarValueToBuffer(GWEN_DB_NODE *n, const char *path, int index, GWEN_BUFFER *dstBuf)
GWEN_DB_IsValue
GWENHYWFAR_API int GWEN_DB_IsValue(const GWEN_DB_NODE *n)
GWEN_DB_SetCharValueInNode
GWENHYWFAR_API int GWEN_DB_SetCharValueInNode(GWEN_DB_NODE *n, const char *s)
GWEN_DB_GroupName
const GWENHYWFAR_API char * GWEN_DB_GroupName(GWEN_DB_NODE *n)
GWEN_DB_Variables_Count
GWENHYWFAR_API unsigned int GWEN_DB_Variables_Count(const GWEN_DB_NODE *node)
GWEN_DB_AddGroup
GWENHYWFAR_API int GWEN_DB_AddGroup(GWEN_DB_NODE *parent, GWEN_DB_NODE *node)
GWEN_FAST_BUFFER
Definition: fastbuffer.h:28
GWEN_DB_SetCharValue
GWENHYWFAR_API int GWEN_DB_SetCharValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
GWEN_DB_GetBinValueFromNode
const GWENHYWFAR_API void * GWEN_DB_GetBinValueFromNode(const GWEN_DB_NODE *n, unsigned int *size)
GWEN_DB_NodeType_ValueBin
Definition: db.h:244
GWEN_DB_VariableName
const GWENHYWFAR_API char * GWEN_DB_VariableName(GWEN_DB_NODE *n)
GWEN_DB_IsVariable
GWENHYWFAR_API int GWEN_DB_IsVariable(const GWEN_DB_NODE *n)
fastbuffer.h
GWEN_DB_NODES_CB
void *(* GWEN_DB_NODES_CB)(GWEN_DB_NODE *node, void *user_data)
Definition: db.h:377
GWEN_DB_GetFirstValue
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetFirstValue(GWEN_DB_NODE *n)
GWEN_DB_SetPtrValue
GWENHYWFAR_API int GWEN_DB_SetPtrValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, void *val)
GWEN_DB_DeleteVar
GWENHYWFAR_API int GWEN_DB_DeleteVar(GWEN_DB_NODE *n, const char *path)
GWEN_DB_InsertGroup
GWENHYWFAR_API int GWEN_DB_InsertGroup(GWEN_DB_NODE *parent, GWEN_DB_NODE *node)
GWEN_DB_VariableExists
GWENHYWFAR_API int GWEN_DB_VariableExists(GWEN_DB_NODE *n, const char *path)
GWEN_DB_GetGroup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetGroup(GWEN_DB_NODE *n, uint32_t flags, const char *path)
GWEN_DB_GetBinValue
const GWENHYWFAR_API void * GWEN_DB_GetBinValue(GWEN_DB_NODE *n, const char *path, int idx, const void *defVal, unsigned int defValSize, unsigned int *returnValueSize)
GWEN_DB_Dump
GWENHYWFAR_API void GWEN_DB_Dump(GWEN_DB_NODE *n, int insert)
GWEN_DB_NodeType_ValueLast
Definition: db.h:248
GWEN_DB_SetCharValueFromInt
int GWEN_DB_SetCharValueFromInt(GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
GWEN_DB_GetFirstVar
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetFirstVar(GWEN_DB_NODE *n)
GWEN_DB_GetCharValue
const GWENHYWFAR_API char * GWEN_DB_GetCharValue(GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
GWEN_DB_DeleteGroup
GWENHYWFAR_API int GWEN_DB_DeleteGroup(GWEN_DB_NODE *n, const char *path)
GWEN_DB_Groups_Count
GWENHYWFAR_API unsigned int GWEN_DB_Groups_Count(const GWEN_DB_NODE *node)
GWEN_DB_Group_new
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_Group_new(const char *name)
GWEN_DB_ReadFromFastBuffer
GWENHYWFAR_API int GWEN_DB_ReadFromFastBuffer(GWEN_DB_NODE *n, GWEN_FAST_BUFFER *fb, uint32_t dbflags)
GWEN_DB_GetFirstGroup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetFirstGroup(GWEN_DB_NODE *n)
GWEN_DB_NodeType_Group
Definition: db.h:236
GWEN_DB_ReadFromString
GWENHYWFAR_API int GWEN_DB_ReadFromString(GWEN_DB_NODE *n, const char *str, int len, uint32_t dbflags)
GWEN_DB_GetIntValueFromNode
GWENHYWFAR_API int GWEN_DB_GetIntValueFromNode(const GWEN_DB_NODE *n)
GWEN_DB_GetParentGroup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetParentGroup(GWEN_DB_NODE *n)
GWEN_DB_GroupRename
GWENHYWFAR_API void GWEN_DB_GroupRename(GWEN_DB_NODE *n, const char *newname)
GWEN_DB_WriteFile
GWENHYWFAR_API int GWEN_DB_WriteFile(GWEN_DB_NODE *n, const char *fname, uint32_t dbflags)
GWEN_DB_GetVariableType
GWENHYWFAR_API GWEN_DB_NODE_TYPE GWEN_DB_GetVariableType(GWEN_DB_NODE *n, const char *p)
GWEN_DB_GetNextGroup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetNextGroup(GWEN_DB_NODE *n)
gwenhywfarapi.h
GWEN_DB_FindNextVar
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_FindNextVar(GWEN_DB_NODE *n, const char *name)
GWEN_DB_WriteToBuffer
GWENHYWFAR_API int GWEN_DB_WriteToBuffer(GWEN_DB_NODE *n, GWEN_BUFFER *buf, uint32_t dbflags)
GWEN_DB_Group_dup
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_Group_dup(const GWEN_DB_NODE *n)
GWEN_DB_ReadFileAs
GWENHYWFAR_API int GWEN_DB_ReadFileAs(GWEN_DB_NODE *n, const char *fname, const char *type, GWEN_DB_NODE *params, uint32_t dbflags)
GWEN_DB_NodeType_Unknown
Definition: db.h:234
GWEN_DB_RemoveCharValue
GWENHYWFAR_API int GWEN_DB_RemoveCharValue(GWEN_DB_NODE *n, const char *path, const char *val, int senseCase)
GWEN_DB_NODE
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:227
GWEN_DB_WriteToFastBuffer
GWENHYWFAR_API int GWEN_DB_WriteToFastBuffer(GWEN_DB_NODE *node, GWEN_FAST_BUFFER *fb, uint32_t dbflags)
GWEN_DB_WriteToIo
GWENHYWFAR_API int GWEN_DB_WriteToIo(GWEN_DB_NODE *node, GWEN_SYNCIO *sio, uint32_t dbflags)
GWEN_DB_AddCharValue
GWENHYWFAR_API int GWEN_DB_AddCharValue(GWEN_DB_NODE *n, const char *path, const char *val, int senseCase, int check)
GWEN_DB_ModifyBranchFlagsUp
GWENHYWFAR_API void GWEN_DB_ModifyBranchFlagsUp(GWEN_DB_NODE *n, uint32_t newflags, uint32_t mask)
GWEN_DB_Groups_Foreach
GWENHYWFAR_API void * GWEN_DB_Groups_Foreach(GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data)
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:66
GWEN_DB_Variables_Foreach
GWENHYWFAR_API void * GWEN_DB_Variables_Foreach(GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data)
GWEN_DB_ReadFromIo
GWENHYWFAR_API int GWEN_DB_ReadFromIo(GWEN_DB_NODE *n, GWEN_SYNCIO *sio, uint32_t dbflags)
GWEN_DB_SetIntValue
GWENHYWFAR_API int GWEN_DB_SetIntValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
GWEN_DB_Values_Count
GWENHYWFAR_API unsigned int GWEN_DB_Values_Count(const GWEN_DB_NODE *node)
GWEN_DB_ValueExists
GWENHYWFAR_API int GWEN_DB_ValueExists(GWEN_DB_NODE *n, const char *path, unsigned int idx)
GWEN_DB_ClearGroup
GWENHYWFAR_API int GWEN_DB_ClearGroup(GWEN_DB_NODE *n, const char *path)
GWEN_DB_GetNextVar
GWENHYWFAR_API GWEN_DB_NODE * GWEN_DB_GetNextVar(GWEN_DB_NODE *n)
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:37
GWEN_DB_NodeType_ValuePtr
Definition: db.h:246
GWEN_DB_NodeType_ValueInt
Definition: db.h:242
GWEN_DB_WriteFileAs
GWENHYWFAR_API int GWEN_DB_WriteFileAs(GWEN_DB_NODE *n, const char *fname, const char *type, GWEN_DB_NODE *params, uint32_t dbflags)