| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "CLocalConfigurationFixedExtension.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Config { |
| 27 |
|
| 28 |
|
| 29 |
CLocalConfigurationFixedExtension::CLocalConfigurationFixedExtension(CConfigurationGroup *configGroup, qint64 configID) |
| 30 |
: CConfigurationBase(configGroup,configID) { |
| 31 |
} |
| 32 |
|
| 33 |
CLocalConfigurationFixedExtension::CLocalConfigurationFixedExtension(CConfigurationBase *previousConfiguration, qint64 configID) |
| 34 |
: CConfigurationBase(previousConfiguration,configID) { |
| 35 |
} |
| 36 |
|
| 37 |
CLocalConfigurationFixedExtension::~CLocalConfigurationFixedExtension() { |
| 38 |
} |
| 39 |
|
| 40 |
CLocalConfigurationFixedExtension *CLocalConfigurationFixedExtension::addConfiguration(CConfigurationBase *configuration) { |
| 41 |
remConfigList.append(configuration); |
| 42 |
return this; |
| 43 |
} |
| 44 |
|
| 45 |
CLocalConfigurationFixedExtension *CLocalConfigurationFixedExtension::addConfigurationList(const QLinkedList<CConfigurationBase *> &configList) { |
| 46 |
remConfigList += configList; |
| 47 |
return this; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
CLocalConfigurationFixedExtension *CLocalConfigurationFixedExtension::addCollectedConfigurations(CConfigurationBase *collectFromConfiguration) { |
| 52 |
if (collectFromConfiguration) { |
| 53 |
collectFromConfiguration->appendConfigurationsToList(&remConfigList); |
| 54 |
} |
| 55 |
return this; |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
qint64 CLocalConfigurationFixedExtension::getConfigurationLevel() { |
| 60 |
return remConfigList.count(); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
CConfigData *CLocalConfigurationFixedExtension::getRelatedConfigChange(const QString &configName, bool defaultCompensation) { |
| 65 |
return CConfigurationBase::getRelatedConfigChange(configName,defaultCompensation); |
| 66 |
} |
| 67 |
|
| 68 |
CConfigData *CLocalConfigurationFixedExtension::getRelatedConfigChange(qint64 configIndex, bool defaultCompensation) { |
| 69 |
CConfigData *data = 0; |
| 70 |
data = getLastConfigChange(configIndex,false); |
| 71 |
for (QLinkedList<CConfigurationBase *>::const_iterator it = remConfigList.constBegin(); it != remConfigList.constEnd() && !data; ++it) { |
| 72 |
CConfigurationBase *nextConf = (*it); |
| 73 |
data = nextConf->getLastConfigChange(configIndex,false); |
| 74 |
} |
| 75 |
if (!data) { |
| 76 |
if (conGroup) { |
| 77 |
data = conGroup->getConfigDefaultData(configIndex); |
| 78 |
} |
| 79 |
} |
| 80 |
return data; |
| 81 |
} |
| 82 |
|
| 83 |
QLinkedList<CConfigurationBase *> CLocalConfigurationFixedExtension::getAdditionalConfigurationList() { |
| 84 |
return remConfigList; |
| 85 |
} |
| 86 |
|
| 87 |
CConfigurationBase *CLocalConfigurationFixedExtension::appendConfigurationsToList(QLinkedList<CConfigurationBase *> *configurationList) { |
| 88 |
CConfigurationBase::appendConfigurationsToList(configurationList); |
| 89 |
if (configurationList) { |
| 90 |
*configurationList += remConfigList; |
| 91 |
} |
| 92 |
return this; |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
}; // end namespace Config |
| 97 |
|
| 98 |
}; // end namespace Konclude |