kate
plugin.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "application.h" 00020 00021 #include "plugin.h" 00022 #include "plugin.moc" 00023 00024 #include <kparts/componentfactory.h> 00025 00026 namespace Kate 00027 { 00028 00029 class PrivatePlugin 00030 { 00031 public: 00032 PrivatePlugin () 00033 { 00034 } 00035 00036 ~PrivatePlugin () 00037 { 00038 } 00039 }; 00040 00041 class PrivatePluginViewInterface 00042 { 00043 public: 00044 PrivatePluginViewInterface () 00045 { 00046 } 00047 00048 ~PrivatePluginViewInterface () 00049 { 00050 } 00051 00052 }; 00053 00054 unsigned int Plugin::globalPluginNumber = 0; 00055 unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0; 00056 00057 Plugin::Plugin( Application *application, const char *name ) : QObject (application, name ) 00058 { 00059 globalPluginNumber++; 00060 myPluginNumber = globalPluginNumber; 00061 } 00062 00063 Plugin::~Plugin() 00064 { 00065 } 00066 00067 unsigned int Plugin::pluginNumber () const 00068 { 00069 return myPluginNumber; 00070 } 00071 00072 Application *Plugin::application () const 00073 { 00074 return Kate::application(); 00075 } 00076 00077 PluginViewInterface::PluginViewInterface() 00078 { 00079 globalPluginViewInterfaceNumber++; 00080 myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber; 00081 } 00082 00083 PluginViewInterface::~PluginViewInterface() 00084 { 00085 } 00086 00087 unsigned int PluginViewInterface::pluginViewInterfaceNumber () const 00088 { 00089 return myPluginViewInterfaceNumber; 00090 } 00091 00092 Plugin *createPlugin ( const char* libname, Application *application, const char *name, const QStringList &args ) 00093 { 00094 return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, application, name, args); 00095 } 00096 00097 PluginViewInterface *pluginViewInterface (Plugin *plugin) 00098 { 00099 if (!plugin) 00100 return 0; 00101 00102 return static_cast<PluginViewInterface*>(plugin->qt_cast("Kate::PluginViewInterface")); 00103 } 00104 00105 } 00106