summaryrefslogtreecommitdiff
path: root/examples/opiecore/oplugins/oplugins.cpp
Unidiff
Diffstat (limited to 'examples/opiecore/oplugins/oplugins.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opiecore/oplugins/oplugins.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/opiecore/oplugins/oplugins.cpp b/examples/opiecore/oplugins/oplugins.cpp
new file mode 100644
index 0000000..26623be
--- a/dev/null
+++ b/examples/opiecore/oplugins/oplugins.cpp
@@ -0,0 +1,47 @@
1/*
2 * You may copy, modify and or distribute without any limitation
3 */
4#include <opie2/odebug.h>
5#include <opie2/opluginloader.h>
6
7#include <opie2/todayplugininterface.h>
8
9using Opie::Core::OPluginItem;
10using Opie::Core::OGenericPluginLoader;
11using Opie::Core::OPluginLoader;
12
13void debugLst( const OPluginItem::List& lst ) {
14 for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
15 odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl;
16}
17
18
19int main( void ) {
20 OGenericPluginLoader loader( "today", true );
21 loader.setAutoDelete( true );
22
23 odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl;
24
25 OPluginItem::List lst = loader.allAvailable( true );
26 debugLst( lst );
27
28 lst = loader.filtered( true );
29 debugLst( lst );
30
31 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
32 QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface );
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
43
44 /*
45 * now it's autodelete so cleaned up for us
46 */
47}