mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
删除文件 utils/ConfigBase/ConfigBaseImpl.h
This commit is contained in:
parent
f0ff1c2a75
commit
bef62c3392
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* 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_BASE_IMPL_H
|
||||
#define CONFIG_BASE_IMPL_H
|
||||
//Standard header file protection is used to prevent duplicate header files from being included.
|
||||
#include "IConfigBase.h"//This is an interface definition file, and the Config Base Impl class implements all the pure virtual functions declared in this interface.
|
||||
#include <libconfig.h>//This is the header file of the libconfig library, which provides an API for handling configuration files.
|
||||
#include <string>//String processing class in the C++standard library.
|
||||
class ConfigBaseImpl : public IConfigBase//The Config Base Impl class inherits from the FHIR figBase interface, which means it needs to implement all the pure virtual functions declared in the interface.
|
||||
{
|
||||
public:
|
||||
ConfigBaseImpl(const std::string &fileName);
|
||||
virtual ~ConfigBaseImpl() = default;
|
||||
bool OpenConfigFile(void) override;//Open configuration file
|
||||
void CloseConfigFile(void) override;//Close configuration file
|
||||
StatusCode ConfigSaveFile(void) override;//Used to save configuration changes back to a file, but the return type is Status Code
|
||||
StatusCode ConfigGetInt(const char *name, int *value) override;
|
||||
StatusCode ConfigSetInt(const char *name, const int value) override;
|
||||
StatusCode ConfigGetShort(const char *name, short *value) override;
|
||||
StatusCode ConfigSetShort(const char *name, const short value) override;
|
||||
StatusCode ConfigGetLong(const char *name, long *value) override;
|
||||
StatusCode ConfigSetLong(const char *name, const long value) override;
|
||||
StatusCode ConfigGetLLong(const char *name, long long *value) override;
|
||||
StatusCode ConfigSetLLong(const char *name, const long long value) override;
|
||||
StatusCode ConfigGetChar(const char *name, char *value) override;
|
||||
StatusCode ConfigSetChar(const char *name, const char value) override;
|
||||
StatusCode ConfigGetBool(const char *name, bool *value) override;
|
||||
StatusCode ConfigSetBool(const char *name, const bool value) override;
|
||||
StatusCode ConfigGetFloat(const char *name, float *value) override;
|
||||
StatusCode ConfigSetFloat(const char *name, const float value) override;
|
||||
StatusCode ConfigGetDouble(const char *name, double *value) override;
|
||||
StatusCode ConfigSetDouble(const char *name, const double value) override;
|
||||
StatusCode ConfigGetString(const char *name, const char **value) override;
|
||||
StatusCode ConfigSetString(const char *name, const char *value) override;
|
||||
//These functions provide interfaces for obtaining and setting various data types (such as integers, floating-point numbers, strings, etc.) from configuration files. They accept the name of a configuration item and a pointer to the value (for Get functions) or the value itself (for Set functions), and return a Status Code representing the operation result.
|
||||
private:
|
||||
const std::string mFileName;// The path to store configuration files.
|
||||
config_t mCfg;//The confic_t type in the libconfig library is used to represent the internal structure of configuration files.
|
||||
};
|
||||
#endif
|
||||
//In summary, this code defines a class for handling configuration files that provides rich interfaces to read and modify configuration items in the configuration file, achieved through the use of the libconfig library.
|
Loading…
Reference in New Issue
Block a user