LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
iinfo.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <memory>
12#include <QString>
13#include <QStringList>
14#include <QtPlugin>
15#include "structures.h"
16
17class ICoreProxy;
18typedef std::shared_ptr<ICoreProxy> ICoreProxy_ptr;
19
47class Q_DECL_EXPORT IInfo
48{
49public:
67 virtual void Init (ICoreProxy_ptr proxy) = 0;
68
77 virtual void SecondInit () = 0;
78
93 virtual QByteArray GetUniqueID () const = 0;
94
107 virtual QString GetName () const = 0;
108
120 virtual QString GetInfo () const = 0;
121
139 virtual QStringList Provides () const
140 {
141 return QStringList ();
142 }
143
167 virtual QStringList Needs () const
168 {
169 return QStringList ();
170 }
171
194 virtual QStringList Uses () const
195 {
196 return QStringList ();
197 }
198
215 virtual void SetProvider (QObject* object,
216 const QString& feature)
217 {
218 Q_UNUSED (object);
219 Q_UNUSED (feature);
220 }
221
232 virtual void Release () = 0;
233
246 virtual QIcon GetIcon () const = 0;
247
250 virtual ~IInfo () {}
251
252 // implementation details
253 virtual void SetProxy (ICoreProxy_ptr) = 0;
254 virtual const ICoreProxy_ptr& GetProxy () = 0;
255 virtual void SetPluginInstance (QObject*) = 0;
256};
257
258Q_DECLARE_INTERFACE (IInfo, "org.Deviant.LeechCraft.IInfo/1.0")
259
260#define CURRENT_API_LEVEL 21
261
262#define LC_EXPORT_PLUGIN(file,klass) \
263 ICoreProxy_ptr klass::S_Proxy_; \
264 QObject* klass::S_Plugin_; \
265 const ICoreProxy_ptr& GetProxyHolder () { return klass::S_Proxy_; } \
266 QObject* GetPluginInstance () { return klass::S_Plugin_; } \
267 \
268 extern "C"\
269 {\
270 Q_DECL_EXPORT quint64 GetAPILevels () { return CURRENT_API_LEVEL; } \
271 }
272
274
276
277#ifdef __clang__
278#define LC_PUSH_OVERRIDE_WARNING \
279 _Pragma("clang diagnostic push") \
280 _Pragma("clang diagnostic ignored \"-Winconsistent-missing-override\"")
281#define LC_POP_OVERRIDE_WARNING \
282 _Pragma("clang diagnostic pop")
283#else
284#define LC_PUSH_OVERRIDE_WARNING
285#define LC_POP_OVERRIDE_WARNING
286#endif
287
288#define DEFINE_PROXY \
289 static ICoreProxy_ptr S_Proxy_; \
290 static QObject *S_Plugin_; \
291 LC_PUSH_OVERRIDE_WARNING \
292 void SetProxy (ICoreProxy_ptr proxy) { S_Proxy_ = std::move (proxy); } \
293 const ICoreProxy_ptr& GetProxy () { return S_Proxy_; } \
294 void SetPluginInstance (QObject *instance) { S_Plugin_ = instance; } \
295 LC_POP_OVERRIDE_WARNING \
296 friend const ICoreProxy_ptr& ::GetProxyHolder (); \
297 friend QObject* ::GetPluginInstance ();
298
299#define LC_PLUGIN_METADATA(id) \
300 Q_PLUGIN_METADATA (IID id) \
301 DEFINE_PROXY
Proxy class for the communication with LeechCraft.
Definition icoreproxy.h:47
Required interface for every plugin.
Definition iinfo.h:48
virtual void SetProxy(ICoreProxy_ptr)=0
virtual QString GetInfo() const =0
Returns the information string about the plugin.
virtual void SetProvider(QObject *object, const QString &feature)
Sets the provider plugin for a given feature.
Definition iinfo.h:215
virtual void SetPluginInstance(QObject *)=0
virtual ~IInfo()
Virtual destructor.
Definition iinfo.h:250
virtual QIcon GetIcon() const =0
Returns the plugin icon.
virtual QByteArray GetUniqueID() const =0
Returns the unique ID of the plugin.
virtual void Init(ICoreProxy_ptr proxy)=0
Initializes the plugin.
virtual QStringList Needs() const
Returns the list of needed features.
Definition iinfo.h:167
virtual const ICoreProxy_ptr & GetProxy()=0
virtual QString GetName() const =0
Returns the name of the plugin.
virtual void Release()=0
Destroys the plugin.
virtual void SecondInit()=0
Performs second stage of initialization.
virtual QStringList Provides() const
Returns the list of provided features.
Definition iinfo.h:139
virtual QStringList Uses() const
Returns the list of used features.
Definition iinfo.h:194
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Definition icoreproxy.h:181
QObject * GetPluginInstance()
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Definition iinfo.h:18
const ICoreProxy_ptr & GetProxyHolder()