100 lines
3.1 KiB
C
100 lines
3.1 KiB
C
/****************************************************************************
|
|
* This file is part of the project AqHome.
|
|
* AqHome (c) by 2024 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 <aqhome/api.h>
|
|
|
|
#include <gwenhywfar/tree2.h>
|
|
#include <gwenhywfar/buffer.h>
|
|
|
|
|
|
#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_LIB_DEFS(AQH_VARS, AQH_Vars, AQHOME_API);
|
|
|
|
|
|
AQHOME_API AQH_VARS_DATATYPE AQH_Vars_DataTypeFromString(const char *s);
|
|
AQHOME_API const char *AQH_Vars_DataTypeToString(AQH_VARS_DATATYPE dt);
|
|
|
|
AQHOME_API AQH_VARS *AQH_Vars_CreateGroup(const char *s);
|
|
AQHOME_API AQH_VARS *AQH_Vars_CreateVariable(const char *s);
|
|
AQHOME_API AQH_VARS *AQH_Vars_CreateStringValue(char *s);
|
|
AQHOME_API AQH_VARS *AQH_Vars_CreateIntValue(int d);
|
|
AQHOME_API AQH_VARS *AQH_Vars_CreateDoubleValue(double d);
|
|
|
|
AQHOME_API AQH_VARS *AQH_Vars_dup(const AQH_VARS *vt);
|
|
|
|
AQHOME_API void AQH_Vars_free(AQH_VARS *vt);
|
|
|
|
|
|
AQHOME_API AQH_VARS_DATATYPE AQH_Vars_GetDataType(const AQH_VARS *vt);
|
|
AQHOME_API uint32_t AQH_Vars_GetFlags(const AQH_VARS *vt);
|
|
|
|
AQHOME_API const char *AQH_Vars_GetStringData(const AQH_VARS *vt, const char *defValue);
|
|
AQHOME_API void AQH_Vars_SetStringData(AQH_VARS *vt, char *s);
|
|
|
|
AQHOME_API int AQH_Vars_GetIntData(const AQH_VARS *vt, int defValue);
|
|
AQHOME_API void AQH_Vars_SetIntData(AQH_VARS *vt, int d);
|
|
|
|
AQHOME_API double AQH_Vars_GetDoubleData(const AQH_VARS *vt, double defValue);
|
|
AQHOME_API void AQH_Vars_SetDoubleData(AQH_VARS *vt, double d);
|
|
|
|
|
|
AQHOME_API AQH_VARS *AQH_Vars_GetFirstChildByType(const AQH_VARS *vt, AQH_VARS_DATATYPE dt);
|
|
AQHOME_API AQH_VARS *AQH_Vars_GetNextByType(const AQH_VARS *vt, AQH_VARS_DATATYPE dt);
|
|
|
|
AQHOME_API void AQH_Vars_Dump(const AQH_VARS *vt, int indent);
|
|
|
|
|
|
|
|
/**
|
|
* @name Functions Using Paths
|
|
*/
|
|
/*@{*/
|
|
AQHOME_API AQH_VARS *AQH_Vars_GetGroup(AQH_VARS *vt, const char *path, uint32_t flags);
|
|
|
|
AQHOME_API int AQH_Vars_SetCharValue(AQH_VARS *vt, uint32_t flags, const char *path, const char *value);
|
|
AQHOME_API const char *AQH_Vars_GetCharValue(AQH_VARS *vt, const char *path, int idx, const char *defaultValue);
|
|
|
|
AQHOME_API int AQH_Vars_SetIntValue(AQH_VARS *vt, uint32_t flags, const char *path, int value);
|
|
AQHOME_API int AQH_Vars_GetIntValue(AQH_VARS *vt, const char *path, int idx, int defaultValue);
|
|
|
|
AQHOME_API int AQH_Vars_SetDoubleValue(AQH_VARS *vt, uint32_t flags, const char *path, double value);
|
|
AQHOME_API double AQH_Vars_GetDoubleValue(AQH_VARS *vt, const char *path, int idx, double defaultValue);
|
|
|
|
AQHOME_API int AQH_Vars_ReplaceVars(AQH_VARS *vars, const char *s, GWEN_BUFFER *dbuf);
|
|
|
|
/*@}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|