From bef62c33927e204546e35aced34c0d643b05e6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=80=80?= <3213487792@qq.com> Date: Sat, 27 Jul 2024 09:07:07 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20utils/Co?= =?UTF-8?q?nfigBase/ConfigBaseImpl.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/ConfigBase/ConfigBaseImpl.h | 53 ------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 utils/ConfigBase/ConfigBaseImpl.h diff --git a/utils/ConfigBase/ConfigBaseImpl.h b/utils/ConfigBase/ConfigBaseImpl.h deleted file mode 100644 index e5ac3ae0..00000000 --- a/utils/ConfigBase/ConfigBaseImpl.h +++ /dev/null @@ -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 //This is the header file of the libconfig library, which provides an API for handling configuration files. -#include //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. \ No newline at end of file