• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kresources
 

kresources

  • kresources
testresources.cpp
1 #include <kdebug.h>
2 #include <kapplication.h>
3 #include <kaboutdata.h>
4 #include <kcmdlineargs.h>
5 
6 #include "resource.h"
7 #include "manager.h"
8 
9 using namespace KRES;
10 
11 class TestResource : public Resource
12 {
13  public:
14  TestResource() : Resource( 0 ) {}
15 
16 };
17 
18 class TestSubResource : public TestResource
19 {
20  public:
21  TestSubResource() : TestResource() {}
22 
23  void dump() const
24  {
25  kdDebug() << "TestSubResource" << endl;
26  TestResource::dump();
27  }
28 };
29 
30 int main( int argc, char **argv )
31 {
32  KAboutData aboutData( "testresources", "Kresource Test", "0" );
33  KCmdLineArgs::init( argc, argv, &aboutData );
34 
35  KApplication app;
36 
37  Manager<TestResource> manager( "test" );
38 
39  TestResource *resource1 = new TestResource;
40  resource1->setResourceName( "One" );
41  manager.add( resource1 );
42 
43  TestResource *resource2 = new TestSubResource;
44  resource2->setResourceName( "Two" );
45  manager.add( resource2 );
46 
47  TestResource *resource3 = new TestSubResource;
48  resource3->setResourceName( "Three" );
49  manager.add( resource3 );
50 
51  kdDebug() << "LIST ALL:" << endl;
52  Manager<TestResource>::Iterator it;
53  for( it = manager.begin(); it != manager.end(); ++it ) {
54  (*it)->dump();
55  }
56 
57  resource2->setActive( false );
58  resource3->setActive( true );
59 
60  kdDebug() << "LIST ACTIVE" << endl;
61  Manager<TestResource>::ActiveIterator it2;
62  for( it2 = manager.activeBegin(); it2 != manager.activeEnd(); ++it2 ) {
63  (*it2)->dump();
64  }
65 
66  resource1->setActive( false );
67  resource2->setActive( true );
68  resource3->setActive( true );
69 
70  kdDebug() << "LIST ACTIVE" << endl;
71  for( it2 = manager.activeBegin(); it2 != manager.activeEnd(); ++it2 ) {
72  (*it2)->dump();
73  }
74 
75  kdDebug() << "LIST ALL" << endl;
76  for( it = manager.begin(); it != manager.end(); ++it ) {
77  (*it)->dump();
78  }
79 
80 
81 }
KRES
Definition: configdialog.h:31
KRES::Manager::Iterator
Iterator for iterations over all resources managed by a manager.
Definition: manager.h:85
KRES::Manager::ActiveIterator
Iterator for iterations over only active resources managed by a manager.
Definition: manager.h:127
KRES::Resource::dump
virtual void dump() const
Print resource information as debug output.
Definition: resource.cpp:173
KRES::Resource
This class provides a resource which is managed in a general way.
Definition: resource.h:255
KRES::Manager
This class provides a manager for resources of a specified family.
Definition: manager.h:79

kresources

Skip menu "kresources"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kresources

Skip menu "kresources"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kresources by doxygen 1.8.13
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |