aqhome-react, aqhome: added units/functions for handling local variables.

This commit is contained in:
Martin Preuss
2024-05-12 17:31:31 +02:00
parent 516ac4e34e
commit 7ce34b0500
13 changed files with 402 additions and 33 deletions

View File

@@ -9,6 +9,7 @@
#ifndef AQH_VARS_H
#define AQH_VARS_H
#include <aqhome/api.h>
#include <gwenhywfar/tree2.h>
@@ -30,43 +31,53 @@ typedef enum {
typedef struct AQH_VARS AQH_VARS;
GWEN_TREE2_FUNCTION_DEFS(AQH_VARS, AQH_Vars);
GWEN_TREE2_FUNCTION_LIB_DEFS(AQH_VARS, AQH_Vars, AQHOME_API);
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);
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);
void AQH_Vars_free(AQH_VARS *vt);
AQHOME_API AQH_VARS *AQH_Vars_dup(const AQH_VARS *vt);
AQHOME_API 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);
AQHOME_API AQH_VARS_DATATYPE AQH_Vars_GetDataType(const AQH_VARS *vt);
AQHOME_API 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);
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);
int AQH_Vars_GetIntData(const AQH_VARS *vt, int defValue);
void AQH_Vars_SetIntData(AQH_VARS *vt, int d);
AQHOME_API int AQH_Vars_GetIntData(const AQH_VARS *vt, int defValue);
AQHOME_API 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);
AQHOME_API double AQH_Vars_GetDoubleData(const AQH_VARS *vt, double defValue);
AQHOME_API 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);
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);
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);
/**
* @name Functions Using Paths
*/
/*@{*/
AQHOME_API AQH_VARS *AQH_Vars_GetGroup(AQH_VARS *vt, const char *path, uint32_t flags);
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);
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);
/*@}*/