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