-rw-r--r-- | examples/opiecore/oplugins/.cvsignore | 3 | ||||
-rw-r--r-- | examples/opiecore/oplugins/oplugins.cpp | 47 | ||||
-rw-r--r-- | examples/opiecore/oplugins/oplugins.pro | 11 |
3 files changed, 61 insertions, 0 deletions
diff --git a/examples/opiecore/oplugins/.cvsignore b/examples/opiecore/oplugins/.cvsignore new file mode 100644 index 0000000..514e011 --- a/dev/null +++ b/examples/opiecore/oplugins/.cvsignore | |||
@@ -0,0 +1,3 @@ | |||
1 | oplugins | ||
2 | Makefile | ||
3 | .moc | ||
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 | |||
9 | using Opie::Core::OPluginItem; | ||
10 | using Opie::Core::OGenericPluginLoader; | ||
11 | using Opie::Core::OPluginLoader; | ||
12 | |||
13 | void 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 | |||
19 | int 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 | } | ||
diff --git a/examples/opiecore/oplugins/oplugins.pro b/examples/opiecore/oplugins/oplugins.pro new file mode 100644 index 0000000..03f8e4d --- a/dev/null +++ b/examples/opiecore/oplugins/oplugins.pro | |||
@@ -0,0 +1,11 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG += qt warn_on | ||
3 | |||
4 | SOURCES = oplugins.cpp | ||
5 | |||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | DEPENDSPATH += $(OPIEDIR)/include | ||
8 | |||
9 | LIBS += -lopiecore2 | ||
10 | |||
11 | include( $(OPIEDIR)/include.pro ) | ||