Debian Codegraph @

Source/Config/CConfigDescription.cpp

raw
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 "CConfigDescription.h"
22
23
24 namespace Konclude {
25
26 namespace Config {
27
28
29 CConfigDescription::CConfigDescription(const QString &name, const QString &description, CConfigType *takeConfigType) {
30 type = takeConfigType;
31 configProperty = name;
32 propertyDescription = description;
33 configPropertyID = 0;
34
35 stringConvertable = false;
36 integerConvertable = false;
37 booleanConvertable = false;
38 stringListConvertable = false;
39 doubleConvertable = false;
40 if (dynamic_cast<CConvertStringConfigType *>(type)) {
41 stringConvertable = true;
42 }
43 if (dynamic_cast<CConvertIntegerConfigType *>(type)) {
44 integerConvertable = true;
45 }
46 if (dynamic_cast<CConvertBooleanConfigType *>(type)) {
47 booleanConvertable = true;
48 }
49 if (dynamic_cast<CConvertDoubleConfigType *>(type)) {
50 doubleConvertable = true;
51 }
52 if (dynamic_cast<CConvertStringListConfigType *>(type)) {
53 stringListConvertable = true;
54 }
55 }
56
57
58 CConfigDescription::~CConfigDescription() {
59 delete type;
60 }
61
62
63 bool CConfigDescription::supportsStringConvertion() {
64 return stringConvertable;
65 }
66
67 bool CConfigDescription::supportsIntegerConvertion() {
68 return integerConvertable;
69 }
70
71 bool CConfigDescription::supportsBooleanConvertion() {
72 return booleanConvertable;
73 }
74
75 bool CConfigDescription::supportsStringListConvertion() {
76 return stringListConvertable;
77 }
78
79 bool CConfigDescription::supportsDoubleConvertion() {
80 return doubleConvertable;
81 }
82
83 CConfigType *CConfigDescription::getConfigType() {
84 return type;
85 }
86
87 CConfigDescription *CConfigDescription::setConfigType(CConfigType *takeConfigType) {
88 type = takeConfigType;
89 return this;
90 }
91
92 CConfigDescription *CConfigDescription::setConfigName(const QString &name) {
93 configProperty = name;
94 return this;
95 }
96
97 CConfigDescription *CConfigDescription::setConfigDescription(const QString &description) {
98 propertyDescription = description;
99 return this;
100 }
101
102 CConfigDescription *CConfigDescription::setConfigID(qint64 id) {
103 configPropertyID = id;
104 return this;
105 }
106
107
108 QString CConfigDescription::getConfigName() {
109 return configProperty;
110 }
111
112 QString CConfigDescription::getConfigDescription() {
113 return propertyDescription;
114 }
115
116 qint64 CConfigDescription::getConfigID() {
117 return configPropertyID;
118 }
119
120
121 }; // end namespace Config
122
123 }; // end namespace Konclude