qdataschemadriverplugin.h

00001 /****************************************************************************
00002 ** $Id: qdataschemadriverplugin.h,v 1.1 2006/02/22 19:26:55 leader Exp $
00003 **
00004 ** QT Data schema driver plugin object header file of
00005 **
00006 ** Created : 20031201
00007 **
00008 ** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
00009 ** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
00010 **
00011 ** This file is part of the Designer application of the Ananas
00012 ** automation accounting system.
00013 **
00014 ** This file may be distributed and/or modified under the terms of the
00015 ** GNU General Public License version 2 as published by the Free Software
00016 ** Foundation and appearing in the file LICENSE.GPL included in the
00017 ** packaging of this file.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
00023 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
00024 **
00025 ** Contact org@leaderit.ru if any conditions of this licensing are
00026 ** not clear to you.
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 //#define TE_EXPORT_PLUGIN(pluginobjectname) typedef TEPlugin<pluginobjectname> pluginobjectname##Plugin; Q_EXPORT_PLUGIN(pluginobjectname)
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 //    Q_OBJECT
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 

Документация по Библиотека QT для работы со схемой базы данных.. Последние изменения: Wed Feb 21 09:36:10 2007. Создано системой  doxygen 1.5.1