CQtDeployer/Deploy/ignorerule.cpp

50 lines
1.2 KiB
C++
Raw Normal View History

2019-09-22 17:31:18 +03:00
#include "ignorerule.h"
#include <quasarapp.h>
bool IgnoreRule::checkOnlytext(const QString &lib) {
for (auto ignore : _data) {
if (lib.contains(ignore.label)) {
return true;
}
}
return false;
}
IgnoreRule::IgnoreRule() {
}
void IgnoreRule::addRule(const IgnoreData &rule) {
_data.push_back(rule);
}
2019-09-23 10:06:22 +03:00
bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const {
2019-09-22 21:55:04 +03:00
if (info.fullPath().contains(ignoreLabel)) {
QuasarAppUtils::Params::verboseLog(info.fullPath() + " ignored by filter" + ignoreLabel);
return true;
2019-09-22 17:31:18 +03:00
}
2019-09-22 21:55:04 +03:00
return false;
2019-09-22 17:31:18 +03:00
}
2019-09-23 10:06:22 +03:00
bool IgnoreRule::isIgnore(const LibInfo &info) const {
2019-09-22 17:31:18 +03:00
2019-09-22 21:55:04 +03:00
for (auto &ignore : _data) {
2019-09-22 17:31:18 +03:00
2019-09-23 14:26:45 +03:00
bool checkPlatform = ((ignore.platform & info.getPlatform()) == info.getPlatform()) || ignore.platform == UnknownPlatform;
bool checkPriority = ignore.prority >= info.getPriority();
bool checkEnvirement = !ignore.enfirement.size() || ignore.enfirement.inThisEnvirement(info.fullPath());
2019-09-22 21:55:04 +03:00
2019-09-23 10:06:22 +03:00
if (checkPlatform && checkPriority && checkEnvirement) {
return check(info, ignore.label);
2019-09-22 21:55:04 +03:00
}
}
2019-09-22 17:31:18 +03:00
2019-09-23 10:06:22 +03:00
return false;
}
IgnoreData::IgnoreData(const QString &label) {
this->label = label;
2019-09-22 17:31:18 +03:00
}