75 lines
3.9 KiB
C
75 lines
3.9 KiB
C
/*
|
|
* Copyright (c) 2023 Fancy Code.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
#ifndef CONFIG_H
|
|
#define CONFIG_H
|
|
#include "StatusCode.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
enum CONFIG_CODE
|
|
{
|
|
CONFIG_CODE_PARAM_NOT_EXIST = STATUS_CODE_END,
|
|
CONFIG_CODE_END
|
|
};
|
|
typedef struct v_config VConfig;
|
|
typedef struct v_config
|
|
{
|
|
const StatusCode (*get_int)(VConfig *, const char *, int *);
|
|
const StatusCode (*set_int)(VConfig *, const char *, const int);
|
|
const StatusCode (*get_short)(VConfig *, const char *, short *);
|
|
const StatusCode (*set_short)(VConfig *, const char *, const short);
|
|
const StatusCode (*get_long)(VConfig *, const char *, long *);
|
|
const StatusCode (*set_long)(VConfig *, const char *, const long);
|
|
const StatusCode (*get_llong)(VConfig *, const char *, long long *);
|
|
const StatusCode (*set_llong)(VConfig *, const char *, const long long);
|
|
const StatusCode (*get_char)(VConfig *, const char *, char *);
|
|
const StatusCode (*set_char)(VConfig *, const char *, const char);
|
|
const StatusCode (*get_bool)(VConfig *, const char *, bool *);
|
|
const StatusCode (*set_bool)(VConfig *, const char *, const bool);
|
|
const StatusCode (*get_float)(VConfig *, const char *, float *);
|
|
const StatusCode (*set_float)(VConfig *, const char *, const float);
|
|
const StatusCode (*get_double)(VConfig *, const char *, double *);
|
|
const StatusCode (*set_double)(VConfig *, const char *, const double);
|
|
const StatusCode (*get_string)(VConfig *, const char *, const char **);
|
|
const StatusCode (*set_string)(VConfig *, const char *, const char *);
|
|
const StatusCode (*save)(VConfig *);
|
|
} VConfig;
|
|
const StatusCode ConfigInit(void);
|
|
const StatusCode ConfigUnInit(void);
|
|
VConfig *OpenConfigFile(const char *fileName);
|
|
const StatusCode ConfigSaveFile(VConfig *cfg);
|
|
void CloseConfigFile(VConfig *cfg);
|
|
const StatusCode ConfigGetInt(VConfig *cfg, const char *name, int *value);
|
|
const StatusCode ConfigSetInt(VConfig *cfg, const char *name, const int value);
|
|
const StatusCode ConfigGetShort(VConfig *cfg, const char *name, short *value);
|
|
const StatusCode ConfigSetShort(VConfig *cfg, const char *name, const short value);
|
|
const StatusCode ConfigGetLong(VConfig *cfg, const char *name, long *value);
|
|
const StatusCode ConfigSetLong(VConfig *cfg, const char *name, const long value);
|
|
const StatusCode ConfigGetLLong(VConfig *cfg, const char *name, long long *value);
|
|
const StatusCode ConfigSetLLong(VConfig *cfg, const char *name, const long long value);
|
|
const StatusCode ConfigGetChar(VConfig *cfg, const char *name, char *value);
|
|
const StatusCode ConfigSetChar(VConfig *cfg, const char *name, const char value);
|
|
const StatusCode ConfigGetBool(VConfig *cfg, const char *name, bool *value);
|
|
const StatusCode ConfigSetBool(VConfig *cfg, const char *name, const bool value);
|
|
const StatusCode ConfigGetFloat(VConfig *cfg, const char *name, float *value);
|
|
const StatusCode ConfigSetFloat(VConfig *cfg, const char *name, const float value);
|
|
const StatusCode ConfigGetDouble(VConfig *cfg, const char *name, double *value);
|
|
const StatusCode ConfigSetDouble(VConfig *cfg, const char *name, const double value);
|
|
const StatusCode ConfigGetString(VConfig *cfg, const char *name, const char **value);
|
|
const StatusCode ConfigSetString(VConfig *cfg, const char *name, const char *value);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif |