/* * 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. */ #include "IConfigBase.h" #include "ConfigBaseImpl.h" #include "ILog.h" #include bool IConfigBase::OpenConfigFile(void) { return false; } void IConfigBase::CloseConfigFile(void) { } StatusCode IConfigBase::ConfigSaveFile(void) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetInt(const char *name, int *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetInt(const char *name, const int value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetShort(const char *name, short *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetShort(const char *name, const short value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetLong(const char *name, long *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetLong(const char *name, const long value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetLLong(const char *name, long long *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetLLong(const char *name, const long long value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetChar(const char *name, char *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetChar(const char *name, const char value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetBool(const char *name, bool *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetBool(const char *name, const bool value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetFloat(const char *name, float *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetFloat(const char *name, const float value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetDouble(const char *name, double *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetDouble(const char *name, const double value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigGetString(const char *name, const char **value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } StatusCode IConfigBase::ConfigSetString(const char *name, const char *value) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } static const char *CONFIG_BASE_NAME = "config_base"; const char *GetConfigBaseModuleName(void) { return CONFIG_BASE_NAME; } std::shared_ptr *NewConfigBase(const char *fileName) { LogInfo("Create the config base object.\n"); ConfigBase *impl = (ConfigBase *)malloc(sizeof(ConfigBase)); if (nullptr == impl) { LogError("NewConfigBase::malloc failed.\n"); return nullptr; } ConfigBase tmp; memcpy((void *)impl, (void *)&tmp, sizeof(ConfigBase)); impl->mHeader.mCheckName = CONFIG_BASE_NAME; impl->mIConfigBase = std::make_shared(fileName); return (std::shared_ptr *)(((char *)impl) + sizeof(IConfigBaseHeader)); }