20 */ |
20 */ |
21 |
21 |
22 #ifndef XQPLUGINLOADER_H |
22 #ifndef XQPLUGINLOADER_H |
23 #define XQPLUGINLOADER_H |
23 #define XQPLUGINLOADER_H |
24 |
24 |
25 //Incudes |
|
26 #include <QtGlobal> |
25 #include <QtGlobal> |
27 #include <QObject> |
26 #include <QObject> |
28 #include <QList> |
27 #include <QList> |
29 #include <QString> |
28 #include <QString> |
30 //Forward class declarations |
29 |
31 class XQPluginInfo; |
30 class XQPluginInfo; |
32 class XQPluginLoaderPrivate; |
31 class XQPluginLoaderPrivate; |
33 |
32 |
34 #ifdef BUILD_XQPLUGINS_DLL |
33 #ifdef BUILD_XQPLUGINS_DLL |
35 #define DLL_EXPORT Q_DECL_EXPORT |
34 #define DLL_EXPORT Q_DECL_EXPORT |
36 #else |
35 #else |
37 #define DLL_EXPORT Q_DECL_IMPORT |
36 #define DLL_EXPORT Q_DECL_IMPORT |
38 #endif |
37 #endif |
39 |
38 |
40 |
|
41 //Class declaration |
|
42 class DLL_EXPORT XQPluginLoader : public QObject |
39 class DLL_EXPORT XQPluginLoader : public QObject |
43 { |
40 { |
44 public: |
41 public: |
45 /** |
42 |
46 * Constructor |
|
47 * @param parent - address of class instance parent |
|
48 */ |
|
49 XQPluginLoader(QObject* parent = 0); |
43 XQPluginLoader(QObject* parent = 0); |
50 |
44 |
51 /** |
|
52 * Constructor |
|
53 * @param uid - UID of plugin that should be loaded |
|
54 * @param parent - address of class instance parent |
|
55 */ |
|
56 XQPluginLoader(int uid, QObject* parent = 0); |
45 XQPluginLoader(int uid, QObject* parent = 0); |
57 |
46 |
58 /** |
|
59 * Destructor |
|
60 */ |
|
61 virtual ~XQPluginLoader(); |
47 virtual ~XQPluginLoader(); |
62 |
48 |
63 /** |
|
64 * List available plugins which implement requested interface. |
|
65 * Function resolve plugins using interface name |
|
66 * @param interfaceName - requested interface name |
|
67 * @param impls - destination list where resolved plugins info will be stored |
|
68 * @return true on success, false on any error |
|
69 */ |
|
70 static bool listImplementations(const QString &interfaceName, |
49 static bool listImplementations(const QString &interfaceName, |
71 QList<XQPluginInfo > &impls); |
50 QList<XQPluginInfo > &impls); |
72 |
51 |
73 |
|
74 /** |
|
75 * Function return UID of requested plugin |
|
76 */ |
|
77 int uid()const; |
52 int uid()const; |
78 |
53 |
79 |
|
80 /** |
|
81 * Function return pointer to plugin root-component instance |
|
82 * @return instance address on success, 0 otherwise |
|
83 */ |
|
84 QObject* instance(); |
54 QObject* instance(); |
85 |
55 |
86 /** |
|
87 * Function return information if plugin have been loaded |
|
88 * @return true if plugin have been loaded, false otherwise |
|
89 */ |
|
90 bool isLoaded() const; |
56 bool isLoaded() const; |
91 |
57 |
92 /** |
|
93 * Function load requested plugin |
|
94 * @return true on success, false otherwise |
|
95 */ |
|
96 bool load(); |
58 bool load(); |
97 |
59 |
98 |
|
99 /** |
|
100 * Function unload plugin |
|
101 * @return true on success, false otherwise |
|
102 */ |
|
103 bool unload(); |
60 bool unload(); |
104 |
61 |
105 /** |
|
106 * |
|
107 */ |
|
108 void setUid ( int uid ); |
62 void setUid ( int uid ); |
109 |
63 |
110 /** |
|
111 * |
|
112 */ |
|
113 QString errorString () const; |
64 QString errorString () const; |
114 |
65 |
115 private: |
66 private: |
116 /** |
67 /** |
117 * Private extended plugin loader implementation. |
68 * Private extended plugin loader implementation. |