From f72a4fb41e5d7db3623fd991ae58bb2595b17058 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 31 Aug 2021 14:35:16 -0600 Subject: [PATCH] removed filter distance --- openbr/plugins/distance/filter.cpp | 55 ------------------------------------------------------- 1 file changed, 0 insertions(+), 55 deletions(-) delete mode 100644 openbr/plugins/distance/filter.cpp diff --git a/openbr/plugins/distance/filter.cpp b/openbr/plugins/distance/filter.cpp deleted file mode 100644 index 3570289..0000000 --- a/openbr/plugins/distance/filter.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright 2012 The MITRE Corporation * - * * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -namespace br -{ - -/*! - * \ingroup distances - * \brief Checks target metadata against filters. - * \author Josh Klontz \cite jklontz - */ -class FilterDistance : public UntrainableDistance -{ - Q_OBJECT - - float compare(const Template &a, const Template &b) const - { - (void) b; // Query template isn't checked - foreach (const QString &key, Globals->filters.keys()) { - bool keep = false; - const QString metadata = a.file.get(key, ""); - if (Globals->filters[key].isEmpty()) continue; - if (metadata.isEmpty()) return -std::numeric_limits::max(); - foreach (const QString &value, Globals->filters[key]) { - if (metadata == value) { - keep = true; - break; - } - } - if (!keep) return -std::numeric_limits::max(); - } - return 0; - } -}; - -BR_REGISTER(Distance, FilterDistance) - -} // namespace br - -#include "distance/filter.moc" -- libgit2 0.21.4