author | zecke <zecke> | 2004-05-28 14:19:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-28 14:19:47 (UTC) |
commit | 8db08a3d320e48924d0ccd78d2bd177e316fff90 (patch) (unidiff) | |
tree | d748e7a6e92f1bc18c1a8935b6a1f12ece4c892c | |
parent | 130d8d2699232848ff2a89a1ab563f924ca39f4f (diff) | |
download | opie-8db08a3d320e48924d0ccd78d2bd177e316fff90.zip opie-8db08a3d320e48924d0ccd78d2bd177e316fff90.tar.gz opie-8db08a3d320e48924d0ccd78d2bd177e316fff90.tar.bz2 |
Show OPluginLoader usage... forgot to commit it.
No wonder why Harlekin didn't find it
-rw-r--r-- | libopie2/examples/opiecore/oplugins/oplugins.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libopie2/examples/opiecore/oplugins/oplugins.cpp b/libopie2/examples/opiecore/oplugins/oplugins.cpp index 4aa2da5..26623be 100644 --- a/libopie2/examples/opiecore/oplugins/oplugins.cpp +++ b/libopie2/examples/opiecore/oplugins/oplugins.cpp | |||
@@ -1,37 +1,47 @@ | |||
1 | /* | 1 | /* |
2 | * You may copy, modify and or distribute without any limitation | 2 | * You may copy, modify and or distribute without any limitation |
3 | */ | 3 | */ |
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | #include <opie2/opluginloader.h> | 5 | #include <opie2/opluginloader.h> |
6 | 6 | ||
7 | #include <opie2/todayplugininterface.h> | 7 | #include <opie2/todayplugininterface.h> |
8 | 8 | ||
9 | using Opie::Core::OPluginItem; | 9 | using Opie::Core::OPluginItem; |
10 | using Opie::Core::OGenericPluginLoader; | 10 | using Opie::Core::OGenericPluginLoader; |
11 | using Opie::Core::OPluginLoader; | ||
11 | 12 | ||
12 | void debugLst( const OPluginItem::List& lst ) { | 13 | void debugLst( const OPluginItem::List& lst ) { |
13 | for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) | 14 | for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) |
14 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; | 15 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; |
15 | } | 16 | } |
16 | 17 | ||
17 | 18 | ||
18 | int main( void ) { | 19 | int main( void ) { |
19 | OGenericPluginLoader loader( "today", true ); | 20 | OGenericPluginLoader loader( "today", true ); |
20 | loader.setAutoDelete( true ); | 21 | loader.setAutoDelete( true ); |
21 | 22 | ||
22 | odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl; | 23 | odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl; |
23 | 24 | ||
24 | OPluginItem::List lst = loader.allAvailable( true ); | 25 | OPluginItem::List lst = loader.allAvailable( true ); |
25 | debugLst( lst ); | 26 | debugLst( lst ); |
26 | 27 | ||
27 | lst = loader.filtered( true ); | 28 | lst = loader.filtered( true ); |
28 | debugLst( lst ); | 29 | debugLst( lst ); |
29 | 30 | ||
30 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 31 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
31 | QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface ); | 32 | QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface ); |
32 | } | 33 | } |
34 | |||
35 | OPluginLoader loader2("today",true); | ||
36 | OPluginItem::List lst2 = loader2.allAvailable( true ); | ||
37 | debugLst( lst2 ); | ||
38 | |||
39 | for( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ | ||
40 | TodayPluginInterface* iface = loader2.load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | ||
41 | } | ||
42 | |||
33 | 43 | ||
34 | /* | 44 | /* |
35 | * now it's autodelete so cleaned up for us | 45 | * now it's autodelete so cleaned up for us |
36 | */ | 46 | */ |
37 | } | 47 | } |