| 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 |
#ifndef KONCLUDE_REASONER_QUERY_CSTRINGSRESULT_CPP |
| 22 |
#define KONCLUDE_REASONER_QUERY_CSTRINGSRESULT_CPP |
| 23 |
|
| 24 |
|
| 25 |
#include "CStringsResult.h" |
| 26 |
|
| 27 |
|
| 28 |
namespace Konclude { |
| 29 |
|
| 30 |
namespace Reasoner { |
| 31 |
|
| 32 |
namespace Query { |
| 33 |
|
| 34 |
|
| 35 |
template<class T> |
| 36 |
CStringsResult<T>::CStringsResult() { |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
template<class T> |
| 41 |
QString CStringsResult<T>::getQueryResultString() { |
| 42 |
return QString(); |
| 43 |
} |
| 44 |
|
| 45 |
template<class T> |
| 46 |
bool CStringsResult<T>::isResultEquivalentTo(CQueryResult *otherQueryResult) { |
| 47 |
T* stringsResult = dynamic_cast<T*>(otherQueryResult); |
| 48 |
if (stringsResult) { |
| 49 |
if (mStringSet.count() == stringsResult->mStringSet.count()) { |
| 50 |
for (QSet<QString>::const_iterator it = mStringSet.constBegin(), itEnd = mStringSet.constEnd(); it != itEnd; ++it) { |
| 51 |
const QString& stringString(*it); |
| 52 |
if (!stringsResult->mStringSet.contains(stringString)) { |
| 53 |
return false; |
| 54 |
} |
| 55 |
} |
| 56 |
return true; |
| 57 |
} |
| 58 |
} |
| 59 |
return false; |
| 60 |
} |
| 61 |
|
| 62 |
template<class T> |
| 63 |
T* CStringsResult<T>::addString(const QString &stringName) { |
| 64 |
mStringSet.insert(stringName); |
| 65 |
return (T*)this; |
| 66 |
} |
| 67 |
|
| 68 |
template<class T> |
| 69 |
QSet<QString>* CStringsResult<T>::getStringsSet() { |
| 70 |
return &mStringSet; |
| 71 |
} |
| 72 |
|
| 73 |
}; // end namespace Query |
| 74 |
|
| 75 |
}; // end namespace Reasoner |
| 76 |
|
| 77 |
}; // end namespace Konclude |
| 78 |
|
| 79 |
#endif // KONCLUDE_REASONER_QUERY_CSTRINGSRESULT_CPP |