teplugin.h

00001 /****************************************************************************
00002 ** $Id: teplugin.h,v 1.3 2006/04/29 10:15:47 red75 Exp $
00003 **
00004 ** Extension plugin object header file of
00005 ** Ananas application library
00006 **
00007 ** Created : 20031201
00008 **
00009 ** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
00010 ** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
00011 **
00012 ** This file is part of the Designer application of the Ananas
00013 ** automation accounting system.
00014 **
00015 ** This file may be distributed and/or modified under the terms of the
00016 ** GNU General Public License version 2 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.GPL included in the
00018 ** packaging of this file.
00019 **
00020 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00021 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00022 **
00023 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
00024 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
00025 **
00026 ** Contact org@leaderit.ru if any conditions of this licensing are
00027 ** not clear to you.
00028 **
00029 **********************************************************************/
00030 
00031 #ifndef TEPLUGIN_H
00032 #define TEPLUGIN_H
00033 
00034 #ifndef QT_H
00035 #include "qgplugin.h"
00036 #include "qstringlist.h"
00037 #endif // QT_H
00038 #include "teglobal.h"
00039 #include <qobject.h>
00040 
00041 #ifndef QT_NO_COMPONENT
00042 
00043 class TEBase;
00044 class TEPluginPrivate;
00045 
00046 //#define TE_EXPORT_PLUGIN(pluginobjectname) typedef TEPlugin<pluginobjectname> pluginobjectname##Plugin; Q_EXPORT_PLUGIN(pluginobjectname)
00047 #define TE_EXPORT_PLUGIN(pluginobjectname) Q_EXPORT_PLUGIN(pluginobjectname)
00048 
00056 class  LIB_EXPORT TEPluginBase : public QGPlugin
00057 {
00058     Q_OBJECT
00059 public:
00060 
00061     TEPluginBase();
00062     ~TEPluginBase();
00063     virtual QStringList keys() const = 0;
00064     virtual TEBase *create( const QString &key ) = 0;
00065 
00066 private:
00067     TEPluginPrivate *d;
00068 };
00069 
00070 
00071 template<class Type>
00072 class TEPlugin : public TEPluginBase
00073 {
00074 //    Q_OBJECT
00075 public:
00076 
00077     TEPlugin()
00078     { 
00079             Type o;
00080             extName = o.name();
00081     };
00082     ~TEPlugin(){};
00083     QStringList keys() const 
00084     {
00085       QStringList l;
00086       l << extName;
00087       return l;
00088     };
00089     TEBase *create( const QString &key ) 
00090     {
00091       if (key == extName) return new Type();
00092       return 0;
00093     };
00094 private:
00095     QString extName;
00096 };
00097 
00098 #endif // QT_NO_COMPONENT
00099 #endif //TEPLUGIN_H

Документация по Общая библиотека для работы с торговым оборудованием.. Последние изменения: Sun Jul 2 23:37:24 2006. Создано системой  doxygen 1.4.7