KRES::Resource Class Reference
This class provides a resource which is managed in a general way. More...
#include <resource.h>
Inheritance diagram for KRES::Resource:

Public Methods | |
Resource (const KConfig *config) | |
virtual | ~Resource () |
virtual void | writeConfig (KConfig *config) |
bool | open () |
void | close () |
bool | isOpen () const |
QString | identifier () const |
QString | type () const |
virtual void | setReadOnly (bool value) |
virtual bool | readOnly () const |
virtual void | setResourceName (const QString &name) |
virtual QString | resourceName () const |
void | setActive (bool active) |
bool | isActive () const |
virtual void | dump () const |
Protected Methods | |
virtual bool | doOpen () |
virtual void | doClose () |
Detailed Description
This class provides a resource which is managed in a general way.A Resource represents the concept of an object with the following attributes:
- Applications operate on sets of one or more Resource objects.
- Creation and deletetion of Resource objects is done in a general way, independent of concrete functionality of the Resource.
- The end user has control over creation, deletion and configuration of Resource object.
- Properties, behaviour and configuration of different Resource objects can widely differ.
- Resources can be active or inactive.
- There is one special Resource which is the standard Resource. This can for example be used as default destination for newly created object managed by a certain Resource family.
- Activation of Resources can be covered by a two step process of being opened and then loaded. Deactivation corresponds to saving and closing.
- Different application ususally share the same set of Resources.
Concrete functionality of Resources is specified per family by a subclass of Resource. This classes in turn have subclasses which implement the different flavours of the functionality represented by the family.
A subclass should reimplement at least the constructor and the writeConfig method.
An example for a Resource subclass hierarchy would be the "calendar" family. The ResourceCalendar subclass would specify an API for accessing calendar data. Subclasses of ResourceCalendar would implement this API for local files, remote files, specific calendar servers etc.
Definition at line 255 of file resource.h.
Constructor & Destructor Documentation
|
Constructor. Construct resource from config.
Definition at line 47 of file resource.cpp. |
|
Destructor.
Definition at line 68 of file resource.cpp. |
Member Function Documentation
|
Write configuration information for this resource to a configuration file. If you override this method, remember to call Resource::writeConfig or Terrible Things(TM) will happen.
Definition at line 74 of file resource.cpp. |
|
Open this resource, if it not already open. Increase the open count of this object, and open the resource by calling doOpen(). This method may block while another thread is concurrently opening or closing the resource. Returns true if the resource was already opened or if it was opened successfully; returns false if the resource was not opened successfully. Definition at line 85 of file resource.cpp. References doOpen(), and resourceName(). |
|
Decrease the open count of this object, and if the count reaches zero, close this resource by calling doClose(). This method may block while another thread is concurrently closing or opening the resource. Definition at line 99 of file resource.cpp. References doClose(), and resourceName(). |
|
Returns whether the resource is open or not.
Definition at line 118 of file resource.cpp. |
|
Returns a unique identifier. The identifier is unique for this resource. It is created when the resource is first created, and it is retained in the resource family configuration file for this resource.
Definition at line 128 of file resource.cpp. |
|
Returns the type of this resource.
Definition at line 138 of file resource.cpp. |
|
Mark the resource as read-only. You can override this method, but also remember to call Resource::setReadOnly(). Definition at line 143 of file resource.cpp. |
|
Returns, if the resource is read-only.
Definition at line 148 of file resource.cpp. Referenced by KRES::SelectDialog::getResource(), and KRES::SelectDialog::SelectDialog(). |
|
Set the name of resource. You can override this method, but also remember to call Resource::setResourceName(). Definition at line 153 of file resource.cpp. |
|
Returns the name of resource.
Definition at line 158 of file resource.cpp. Referenced by close(), open(), and KRES::SelectDialog::SelectDialog(). |
|
Sets, if the resource is active.
Definition at line 163 of file resource.cpp. |
|
Return true, if the resource is active.
Definition at line 168 of file resource.cpp. |
|
Print resource information as debug output.
Definition at line 173 of file resource.cpp. |
|
Open this resource. When called, the resource must be in a closed state. Returns true if the resource was opened successfully; returns false if the resource was not opened successfully. The result of this call can be accessed later by isOpen() Definition at line 368 of file resource.h. Referenced by open(). |
|
Close this resource. Pre-condition: resource is open. Post-condition: resource is closed. Definition at line 374 of file resource.h. Referenced by close(). |
The documentation for this class was generated from the following files: