/**************************************************************************** * This file is part of the project Gwenhywfar. * Gwenhywfar (c) by 2023 Martin Preuss, all rights reserved. * * The license for this file can be found in the file COPYING which you * should have received along with this file. ****************************************************************************/ #ifndef AQH_VARS_H #define AQH_VARS_H #include #define AQH_VARS_PATHFLAGS_OVERWRITE_VARS 0x0001 #define AQH_VARS_PATHFLAGS_OVERWRITE_GROUPS 0x0002 typedef enum { AQH_Vars_DataType_Unknown=0, AQH_Vars_DataType_Group, AQH_Vars_DataType_Variable, AQH_Vars_DataType_ValueString=100, AQH_Vars_DataType_ValueInt, AQH_Vars_DataType_ValueDouble } AQH_VARS_DATATYPE; typedef struct AQH_VARS AQH_VARS; GWEN_TREE2_FUNCTION_DEFS(AQH_VARS, AQH_Vars); AQH_VARS *AQH_Vars_CreateGroup(const char *s); AQH_VARS *AQH_Vars_CreateVariable(const char *s); AQH_VARS *AQH_Vars_CreateStringValue(char *s); AQH_VARS *AQH_Vars_CreateIntValue(int d); AQH_VARS *AQH_Vars_CreateDoubleValue(double d); void AQH_Vars_free(AQH_VARS *vt); AQH_VARS_DATATYPE AQH_Vars_GetDataType(const AQH_VARS *vt); uint32_t AQH_Vars_GetFlags(const AQH_VARS *vt); const char *AQH_Vars_GetStringData(const AQH_VARS *vt, const char *defValue); void AQH_Vars_SetStringData(AQH_VARS *vt, char *s); int AQH_Vars_GetIntData(const AQH_VARS *vt, int defValue); void AQH_Vars_SetIntData(AQH_VARS *vt, int d); double AQH_Vars_GetDoubleData(const AQH_VARS *vt, double defValue); void AQH_Vars_SetDoubleData(AQH_VARS *vt, double d); AQH_VARS *AQH_Vars_GetFirstChildByType(const AQH_VARS *vt, AQH_VARS_DATATYPE dt); AQH_VARS *AQH_Vars_GetNextByType(const AQH_VARS *vt, AQH_VARS_DATATYPE dt); int AQH_Vars_SetCharValue(AQH_VARS *vt, uint32_t flags, const char *path, const char *value); const char *AQH_Vars_GetCharValue(AQH_VARS *vt, const char *path, int idx, const char *defaultValue); int AQH_Vars_SetIntValue(AQH_VARS *vt, uint32_t flags, const char *path, int value); int AQH_Vars_GetIntValue(AQH_VARS *vt, const char *path, int idx, int defaultValue); int AQH_Vars_SetDoubleValue(AQH_VARS *vt, uint32_t flags, const char *path, double value); double AQH_Vars_GetDoubleValue(AQH_VARS *vt, const char *path, int idx, double defaultValue); #endif