summaryrefslogtreecommitdiffstats
path: root/tderesources/testresources.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:21 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:21 -0600
commitdfe289850f068f19ba4a83ab4e7e22a7e09c13c9 (patch)
treec297348a55df66c571de4525646e0b9762427353 /tderesources/testresources.cpp
parentb7658a0d5eca24a9d37c6e04f88298ef02389db0 (diff)
downloadtdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.tar.gz
tdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tderesources/testresources.cpp')
-rw-r--r--tderesources/testresources.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/tderesources/testresources.cpp b/tderesources/testresources.cpp
new file mode 100644
index 000000000..515563172
--- /dev/null
+++ b/tderesources/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 )
+{
+ TDEAboutData aboutData( "testresources", "Kresource Test", "0" );
+ TDECmdLineArgs::init( argc, argv, &aboutData );
+
+ TDEApplication 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();
+ }
+
+
+}