summaryrefslogtreecommitdiffstats
path: root/kresources/testresources.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kresources/testresources.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/testresources.cpp')
-rw-r--r--kresources/testresources.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/kresources/testresources.cpp b/kresources/testresources.cpp
new file mode 100644
index 000000000..257f58ca1
--- /dev/null
+++ b/kresources/testresources.cpp
@@ -0,0 +1,81 @@
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+
+#include "resource.h"
+#include "manager.h"
+
+using namespace KRES;
+
+class TestResource : public Resource
+{
+ public:
+ TestResource() : Resource( 0 ) {}
+
+};
+
+class TestSubResource : public TestResource
+{
+ public:
+ TestSubResource() : TestResource() {}
+
+ void dump() const
+ {
+ kdDebug() << "TestSubResource" << endl;
+ TestResource::dump();
+ }
+};
+
+int main( int argc, char **argv )
+{
+ KAboutData aboutData( "testresources", "Kresource Test", "0" );
+ KCmdLineArgs::init( argc, argv, &aboutData );
+
+ KApplication app;
+
+ Manager<TestResource> manager( "test" );
+
+ TestResource *resource1 = new TestResource;
+ resource1->setResourceName( "One" );
+ manager.add( resource1 );
+
+ TestResource *resource2 = new TestSubResource;
+ resource2->setResourceName( "Two" );
+ manager.add( resource2 );
+
+ TestResource *resource3 = new TestSubResource;
+ resource3->setResourceName( "Three" );
+ manager.add( resource3 );
+
+ kdDebug() << "LIST ALL:" << endl;
+ Manager<TestResource>::Iterator it;
+ for( it = manager.begin(); it != manager.end(); ++it ) {
+ (*it)->dump();
+ }
+
+ resource2->setActive( false );
+ resource3->setActive( true );
+
+ kdDebug() << "LIST ACTIVE" << endl;
+ Manager<TestResource>::ActiveIterator it2;
+ for( it2 = manager.activeBegin(); it2 != manager.activeEnd(); ++it2 ) {
+ (*it2)->dump();
+ }
+
+ resource1->setActive( false );
+ resource2->setActive( true );
+ resource3->setActive( true );
+
+ kdDebug() << "LIST ACTIVE" << endl;
+ for( it2 = manager.activeBegin(); it2 != manager.activeEnd(); ++it2 ) {
+ (*it2)->dump();
+ }
+
+ kdDebug() << "LIST ALL" << endl;
+ for( it = manager.begin(); it != manager.end(); ++it ) {
+ (*it)->dump();
+ }
+
+
+}