1 /*
2  * %kadu copyright begin%
3  * Copyright 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
4  * %kadu copyright end%
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include <QtCore/QObject>
23 #include <QtCore/QPointer>
24 #include <injeqt/injeqt.h>
25 
26 class Configuration;
27 class PluginMetadata;
28 class VersionService;
29 
30 /**
31  * @addtogroup Plugin
32  * @{
33  */
34 
35 /**
36  * @class PluginMetadataReader
37  * @short Reads PluginMetadata instance from .desc file.
38  */
39 class PluginMetadataReader : public QObject
40 {
41 	Q_OBJECT
42 
43 public:
44 	Q_INVOKABLE explicit PluginMetadataReader(QObject *parent = nullptr) noexcept;
45 	virtual ~PluginMetadataReader() noexcept;
46 
47 	/**
48 	 * @short Reads PluginMetadata instance from .desc file.
49 	 * @param name name of plugin do read data
50 	 * @param filePath path to .desc file to read data from
51 	 * @throws PluginMetadataReaderException
52 	 *
53 	 * If file \p filePath can not be read, a PluginMetadataReaderException exception is thrown.
54 	 */
55 	PluginMetadata readPluginMetadata(const QString &pluginName, const QString &filePath) noexcept(false);
56 
57 private:
58 	QPointer<Configuration> m_configuration;
59 	QPointer<VersionService> m_versionService;
60 
61 private slots:
62 	INJEQT_SET void setConfiguration(Configuration *configuration);
63 	INJEQT_SET void setVersionService(VersionService *versionService);
64 
65 };
66 
67 /**
68  * @}
69  */
70