File indexing completed on 2024-05-19 04:23:35
0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org> 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef CATEGORYMATCHER_H 0007 #define CATEGORYMATCHER_H 0008 0009 #include <DB/ImageInfoPtr.h> 0010 #include <kpabase/StringSet.h> 0011 0012 #include <QMap> 0013 0014 namespace DB 0015 { 0016 class ImageInfo; 0017 0018 using Utilities::StringSet; 0019 0020 /** 0021 \brief Base class for components of the image searching frame work. 0022 0023 The matcher component must implement \ref eval which tells if the given 0024 image is matched by this component. 0025 0026 If the over all search contains a "No other" part (as in Jesper and no 0027 other people", then we need to collect items of the category items seen. This, 0028 however, is rather expensive, so this collection is only turned on in 0029 that case. 0030 0031 */ 0032 class CategoryMatcher 0033 { 0034 public: 0035 CategoryMatcher(); 0036 virtual ~CategoryMatcher() { } 0037 virtual void debug(int level) const = 0; 0038 0039 virtual bool eval(ImageInfoPtr, QMap<QString, StringSet> &alreadyMatched) = 0; 0040 virtual void setShouldCreateMatchedSet(bool); 0041 0042 protected: 0043 QString spaces(int level) const; 0044 0045 bool m_shouldPrepareMatchedSet; 0046 }; 0047 0048 } 0049 0050 #endif /* CATEGORYMATCHER_H */ 0051 0052 // vi:expandtab:tabstop=4 shiftwidth=4: