1/* -*- c++ -*-
2 Copyright (c) 2008 Tobias Koenig <tokoe@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef AKONADI_PLUGINLOADER_P_H
21#define AKONADI_PLUGINLOADER_P_H
22
23#include "akonadiprivate_export.h"
24
25#include <QtCore/QHash>
26#include <QtCore/QString>
27#include <QtCore/QObject>
28
29class QPluginLoader;
30
31namespace Akonadi {
32
33class AKONADI_TESTS_EXPORT PluginMetaData
34{
35public:
36 PluginMetaData();
37 PluginMetaData(const QString &lib, const QString &name, const QString &comment, const QString &cname);
38
39 QString library;
40 QString nameLabel;
41 QString descriptionLabel;
42 QString className;
43 bool loaded;
44};
45
46class AKONADI_TESTS_EXPORT PluginLoader
47{
48public:
49 ~PluginLoader();
50
51 static PluginLoader *self();
52
53 QStringList names() const;
54
55 QObject *createForName(const QString &name);
56
57 PluginMetaData infoForName(const QString &name) const;
58
59 void scan();
60
61private:
62 PluginLoader();
63
64 static PluginLoader *mSelf;
65 QHash<QString, QPluginLoader *> mPluginLoaders;
66 QHash<QString, PluginMetaData> mPluginInfos;
67};
68
69}
70
71#endif
72