mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-27 10:14:32 +00:00
58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
/*
|
|
* Copyright (C) 2018-2019 QuasarApp.
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
#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);
|
|
}
|
|
|
|
bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const {
|
|
if (info.fullPath().contains(ignoreLabel)) {
|
|
QuasarAppUtils::Params::verboseLog(info.fullPath() + " ignored by filter" + ignoreLabel);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
const IgnoreData* IgnoreRule::isIgnore(const LibInfo &info) const {
|
|
|
|
for (auto &ignore : _data) {
|
|
|
|
bool checkPlatform = ((ignore.platform & info.getPlatform()) == info.getPlatform()) || ignore.platform == UnknownPlatform;
|
|
bool checkPriority = (ignore.prority <= info.getPriority()) || ignore.prority == NotFile;
|
|
bool checkEnvirement = !ignore.enfirement.size() || ignore.enfirement.inThisEnvirement(info.fullPath());
|
|
|
|
if (checkPlatform && checkPriority && checkEnvirement && check(info, ignore.label)) {
|
|
return &ignore;
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
IgnoreData::IgnoreData(const QString &label) {
|
|
this->label = label;
|
|
}
|