mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
57 lines
2.5 KiB
C++
57 lines
2.5 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 I_CONFIG_BASE_H
|
|
#define I_CONFIG_BASE_H
|
|
#include "StatusCode.h"
|
|
#include <memory>
|
|
class IConfigBase
|
|
{
|
|
public:
|
|
IConfigBase() = default;
|
|
virtual ~IConfigBase() = default;
|
|
virtual void OpenConfigFile(void);
|
|
virtual void CloseConfigFile(void);
|
|
virtual StatusCode ConfigSaveFile(void);
|
|
virtual StatusCode ConfigGetInt(const char *name, int *value);
|
|
virtual StatusCode ConfigSetInt(const char *name, const int value);
|
|
virtual StatusCode ConfigGetShort(const char *name, short *value);
|
|
virtual StatusCode ConfigSetShort(const char *name, const short value);
|
|
virtual StatusCode ConfigGetLong(const char *name, long *value);
|
|
virtual StatusCode ConfigSetLong(const char *name, const long value);
|
|
virtual StatusCode ConfigGetLLong(const char *name, long long *value);
|
|
virtual StatusCode ConfigSetLLong(const char *name, const long long value);
|
|
virtual StatusCode ConfigGetChar(const char *name, char *value);
|
|
virtual StatusCode ConfigSetChar(const char *name, const char value);
|
|
virtual StatusCode ConfigGetBool(const char *name, bool *value);
|
|
virtual StatusCode ConfigSetBool(const char *name, const bool value);
|
|
virtual StatusCode ConfigGetFloat(const char *name, float *value);
|
|
virtual StatusCode ConfigSetFloat(const char *name, const float value);
|
|
virtual StatusCode ConfigGetDouble(const char *name, double *value);
|
|
virtual StatusCode ConfigSetDouble(const char *name, const double value);
|
|
virtual StatusCode ConfigGetString(const char *name, const char **value);
|
|
virtual StatusCode ConfigSetString(const char *name, const char *value);
|
|
};
|
|
typedef struct i_config_base_header
|
|
{
|
|
const char *mCheckName;
|
|
} IConfigBaseHeader;
|
|
typedef struct config_base
|
|
{
|
|
IConfigBaseHeader mHeader;
|
|
std::shared_ptr<IConfigBase> mIConfigBase;
|
|
} ConfigBase;
|
|
const char *GetConfigBaseModuleName(void);
|
|
std::shared_ptr<IConfigBase> *NewConfigBase(const char *fileName);
|
|
#endif |