File indexing completed on 2025-03-23 06:47:21
0001 /* 0002 SPDX-FileCopyrightText: 2012 Vishesh Handa <me@vhanda.in> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef _KFILEMETADATA_EXTRACTORCOLLECTION_H 0008 #define _KFILEMETADATA_EXTRACTORCOLLECTION_H 0009 0010 #include "extractor.h" 0011 #include "kfilemetadata_export.h" 0012 0013 #include <memory> 0014 0015 namespace KFileMetaData 0016 { 0017 class ExtractorCollectionPrivate; 0018 /** 0019 * \class ExtractorCollection extractorcollection.h <KFileMetaData/ExtractorCollection> 0020 * 0021 * \brief The ExtractorCollection is a helper class which internally 0022 * loads all the extractor plugins. It can be used to fetch a certain 0023 * subset of these plugins based on a given mimetype. 0024 * 0025 * Once the appropriate plugins have been fetched, an ExtractionResult 0026 * should be created and passed to the plugin's extract function. 0027 * 0028 * \author Vishesh Handa <me@vhanda.in> 0029 */ 0030 class KFILEMETADATA_EXPORT ExtractorCollection 0031 { 0032 public: 0033 explicit ExtractorCollection(); 0034 virtual ~ExtractorCollection(); 0035 0036 /** 0037 * Fetch the extractors which can be used to extract 0038 * data for the respective file with the given mimetype. 0039 * 0040 * If no match is found then the best matching plugins 0041 * are returned, determined by mimetype inheritance. 0042 * 0043 * \sa QMimeType::allAncestors 0044 */ 0045 QList<Extractor*> fetchExtractors(const QString& mimetype) const; 0046 0047 private: 0048 friend class ExtractorCollectionTest; 0049 // exported for ExtractorCollectionTest 0050 QList<Extractor*> allExtractors(); 0051 0052 const std::unique_ptr<ExtractorCollectionPrivate> d; 0053 }; 0054 } 0055 0056 #endif