00001 /* 00002 * You may copy, modify and or distribute without any limitation 00003 */ 00004 #include <opie2/odebug.h> 00005 #include <opie2/opluginloader.h> 00006 00007 #include <opie2/todayplugininterface.h> 00008 00009 using Opie::Core::OPluginItem; 00010 using Opie::Core::OGenericPluginLoader; 00011 using Opie::Core::OPluginLoader; 00012 00013 void debugLst( const OPluginItem::List& lst ) { 00014 for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) 00015 odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; 00016 } 00017 00018 00019 int main( void ) { 00020 OGenericPluginLoader loader( "today", true ); 00021 loader.setAutoDelete( true ); 00022 00023 odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl; 00024 00025 OPluginItem::List lst = loader.allAvailable( true ); 00026 debugLst( lst ); 00027 00028 lst = loader.filtered( true ); 00029 debugLst( lst ); 00030 00031 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { 00032 QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface ); 00033 } 00034 00035 OPluginLoader loader2("today",true); 00036 OPluginItem::List lst2 = loader2.allAvailable( true ); 00037 debugLst( lst2 ); 00038 00039 for( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ 00040 TodayPluginInterface* iface = loader2.load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); 00041 } 00042 00043 00044 /* 00045 * now it's autodelete so cleaned up for us 00046 */ 00047 }
1.4.2