/usr/include/kfilemetadata/extractorplugin.h is in libkfilemetadata-dev 4:4.14.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | /*
<one line to give the library's name and an idea of what it does.>
Copyright (C) 2012 Vishesh Handa <me@vhanda.in>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _KFILEMETADATA_EXTRACTOR_H
#define _KFILEMETADATA_EXTRACTOR_H
#include <QStringList>
#include <QDateTime>
#include "kfilemetadata_export.h"
#include "extractionresult.h"
#include <KService>
#include <QStringList>
namespace KFileMetaData
{
/**
* \class ExtractorPlugin extractorplugin.h
*
* \brief The ExtractorPlugin is the base class for all file metadata
* extractors. It is responsible for extracting the metadata in a file.
*
* Plugins should derive from this class and implement the mimetypes
* and extract method.
*
* All Plugins should be synchronous and blocking.
*
* \author Vishesh Handa <me@vhanda.in>
*/
class KFILEMETADATA_EXPORT ExtractorPlugin : public QObject
{
Q_OBJECT
public:
ExtractorPlugin(QObject* parent);
virtual ~ExtractorPlugin();
/**
* Provide a list of mimetypes which are supported by this plugin.
* Only files with those mimetypes will be provided to the plugin via
* the extract function.
*
* This can also contains partial mimetypes like "text/", in that case
* this plugin will be chosen only if a better plugin does not exist.
*
* \return A StringList containing the mimetypes.
* \sa extract
*/
virtual QStringList mimetypes() const = 0;
/**
* The main function of the plugin that is responsible for extracting
* the data and filling up the ExtractionResult
*
* The \p result provides the input url and mimetype which
* can be used to identify the file.
*
* This function is synchronous and should be reentrant as it
* can be called by multiple threads.
*/
virtual void extract(ExtractionResult* result) = 0;
//
// Helper functions
//
/**
* Tries to extract a valid date time from the string provided.
*/
static QDateTime dateTimeFromString(const QString& dateString);
/**
* Tries to split the string into names. It cleans up any superflous words
* and removes extra junk such as curly braces
*/
static QStringList contactsFromString(const QString& string);
private:
class Private;
Private* d;
};
}
/**
* Export a file extractor.
*
* \param classname The name of the subclass to export
* \param libname The name of the library which should export the extractor
*/
#define KFILEMETADATA_EXPORT_EXTRACTOR( classname, libname ) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory(#libname))
#endif // _KFILEMETADATA_EXTRACTOR_H
|