Ananas Library 0.9.5
aextensionplugin.h
1/****************************************************************************
2** $Id: aextensionplugin.h,v 1.4 2006/08/23 07:55:12 app Exp $
3**
4** Extension plugin object header file of
5** Ananas application library
6**
7** Created : 20031201
8**
9** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
11**
12** This file is part of the Designer application of the Ananas
13** automation accounting system.
14**
15** This file may be distributed and/or modified under the terms of the
16** GNU General Public License version 2 as published by the Free Software
17** Foundation and appearing in the file LICENSE.GPL included in the
18** packaging of this file.
19**
20** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22**
23** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
24** See http://www.leaderit.ru/gpl/ for GPL licensing information.
25**
26** Contact org@leaderit.ru if any conditions of this licensing are
27** not clear to you.
28**
29**********************************************************************/
30
31#ifndef AEXTENSIONPLUGIN_H
32#define AEXTENSIONPLUGIN_H
33
34#ifndef QT_H
35#include "qgplugin.h"
36#include "qstringlist.h"
37#endif // QT_H
38#include "ananasglobal.h"
39#include <qobject.h>
40
41#ifndef QT_NO_COMPONENT
42
43class AExtension;
45
46//#define A_EXPORT_PLUGIN(pluginobjectname) typedef AExtensionPlugin<pluginobjectname> pluginobjectname##Plugin; Q_EXPORT_PLUGIN(pluginobjectname)
47#define A_EXPORT_PLUGIN(pluginobjectname) Q_EXPORT_PLUGIN(pluginobjectname)
48
57class ANANAS_EXPORT AExtensionPluginBase : public QGPlugin
58{
59 Q_OBJECT
60public:
61
64 virtual QStringList keys() const = 0;
65 virtual AExtension *create( const QString &key ) = 0;
66
67private:
69};
70
95template<class type>
96class ANANAS_EXPORT AExtensionPlugin : public AExtensionPluginBase
97{
98// Q_OBJECT
99public:
100
102 {
103 type o;
104 extName = o.name();
105 };
107 QStringList keys() const
108 {
109 QStringList l;
110 l << extName;
111 return l;
112 };
113 AExtension *create( const QString &key )
114 {
115 if (key == extName) return new type();
116 return 0;
117 };
118private:
119 QString extName;
120};
121
122#endif // QT_NO_COMPONENT
123#endif //AEXTENSIONPLUGIN_H
Базовый класс в иерархии классов для работы с расширениями. Наследует QGPlugin. .
Definition aextensionplugin.h:58
Definition aextensionplugin.cpp:56
Базовый класс для создания собственных расширений. Наследует AExtensionPluginBase .
Definition aextensionplugin.h:97
AExtension * create(const QString &key)
Definition aextensionplugin.h:113
QStringList keys() const
Definition aextensionplugin.h:107
Definition aextension.h:46