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 #ifndef QDATASCHEMADRIVERPLUGIN_H
00031 #define QDATASCHEMADRIVERPLUGIN_H
00032 #include <qdataschemaglobal.h>
00033
00034 #if QT_VERSION<0x040000
00035 #ifndef QT_H
00036 #include "qgplugin.h"
00037
00038 #endif // QT_H
00039 #else
00040 #include <QtPlugin>
00041 #endif
00042 #include "qdataschemaglobal.h"
00043 #include <qobject.h>
00044
00045 #ifndef QT_NO_COMPONENT
00046
00047 class QDataSchemaDriver;
00048 class QDataSchemaDriverPluginPrivate;
00049
00050
00051 #define QDATASCHEMADRIVER_EXPORT_PLUGIN(pluginobjectname) Q_EXPORT_PLUGIN(pluginobjectname)
00052
00060 class LIB_EXPORT QDataSchemaDriverPluginBase : public QGPlugin
00061 {
00062 Q_OBJECT
00063 public:
00064
00065 QDataSchemaDriverPluginBase();
00066 ~QDataSchemaDriverPluginBase();
00067 virtual QStringList keys() const = 0;
00068 virtual QDataSchemaDriver *create( const QString &key ) = 0;
00069
00070 private:
00071 QDataSchemaDriverPluginPrivate *d;
00072 };
00073
00074
00075 template<class type>
00076 class QDataSchemaDriverPlugin : public QDataSchemaDriverPluginBase
00077 {
00078
00079 public:
00080
00081 QDataSchemaDriverPlugin()
00082 {
00083 type o;
00084 extName = o.name();
00085 };
00086 ~QDataSchemaDriverPlugin(){};
00087 QStringList keys() const
00088 {
00089 QStringList l;
00090 l << extName;
00091 return l;
00092 };
00093 QDataSchemaDriver *create( const QString &key )
00094 {
00095 if (key == extName) return new type();
00096 return 0;
00097 };
00098 private:
00099 QString extName;
00100 };
00101
00102 #endif // QT_NO_COMPONENT
00103 #endif //QDATASCHEMADRIVERPLUGIN_H
00104