qdataschemadriverplugin.h

00001 /****************************************************************************
00002 ** $Id: qdataschemadriverplugin.h,v 1.2 2007/02/25 18:05:57 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 #include <qdataschemaglobal.h>
00033 
00034 #if QT_VERSION<0x040000
00035     #ifndef QT_H
00036     #include "qgplugin.h"
00037 //    #include "qstringlist.h"
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 //#define TE_EXPORT_PLUGIN(pluginobjectname) typedef TEPlugin<pluginobjectname> pluginobjectname##Plugin; Q_EXPORT_PLUGIN(pluginobjectname)
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 //    Q_OBJECT
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 

Документация по Библиотека QT для работы со схемой базы данных.. Последние изменения: Sun Aug 26 05:37:08 2007. Создано системой  doxygen 1.5.1