kexidbmodule.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 * kexidbmodule.cpp 00003 * This file is part of the KDE project 00004 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; see the file COPYING. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #include "kexidbmodule.h" 00021 #include "kexidbdrivermanager.h" 00022 #include "kexidbconnection.h" 00023 00024 //#include <api/object.h> 00025 //#include <api/variant.h> 00026 #include <main/manager.h> 00027 00028 #include <kdebug.h> 00029 00030 // The as version() published versionnumber of this kross-module. 00031 #define KROSS_KEXIDB_VERSION 1 00032 00033 extern "C" 00034 { 00039 Kross::Api::Object* KDE_EXPORT init_module(Kross::Api::Manager* manager) 00040 { 00041 return new Kross::KexiDB::KexiDBModule(manager); 00042 } 00043 } 00044 00045 using namespace Kross::KexiDB; 00046 00047 KexiDBModule::KexiDBModule(Kross::Api::Manager* /*manager*/) 00048 : Kross::Api::Module("KexiDB") 00049 //, m_manager(manager) 00050 { 00051 //kdDebug() << "Kross::KexiDB::KexiDBModule Ctor" << endl; 00052 addChild( "version", new Kross::Api::Variant(KROSS_KEXIDB_VERSION) ); 00053 addChild( new KexiDBDriverManager() ); 00054 } 00055 00056 KexiDBModule::~KexiDBModule() 00057 { 00058 //kdDebug() << "Kross::KexiDB::KexiDBModule Dtor" << endl; 00059 } 00060 00061 const QString KexiDBModule::getClassName() const 00062 { 00063 return "Kross::KexiDB::KexiDBModule"; 00064 } 00065 00066 Kross::Api::Object::Ptr KexiDBModule::get(const QString& name, void* p) 00067 { 00068 if(name == "KexiDBConnection") { 00069 ::KexiDB::Connection* connection = (::KexiDB::Connection*)p; 00070 if(connection) 00071 return new KexiDBConnection(connection); 00072 } 00073 return 0; 00074 }
