00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
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
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