The idea of not using const was to reduce copy operations. However, it is not very intuitive to know when and which arguments are const so to simplify working with this new module and make it as close as possible to GWEN_DB we use const now as in GWEN_DB. At least AQH_Vars_SetStringData() still doesn't use const so if the need arises to avoid copying we can.
72 lines
1.9 KiB
C
72 lines
1.9 KiB
C
/****************************************************************************
|
|
* 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 <gwenhywfar/tree2.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_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);
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|