summaryrefslogtreecommitdiff
path: root/src/resources/resource.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-23 23:33:34 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-23 23:33:34 +0000
commit4b0172d1f666a12cffbdd6bd331e95a92d8f652f (patch)
treedde7ab71fd5d02200be35e041b00e5649f9cd3a8 /src/resources/resource.h
parent33587089cf7d87bbc2104e80746fdddc7a5498e1 (diff)
downloadmana-client-4b0172d1f666a12cffbdd6bd331e95a92d8f652f.tar.gz
mana-client-4b0172d1f666a12cffbdd6bd331e95a92d8f652f.tar.bz2
mana-client-4b0172d1f666a12cffbdd6bd331e95a92d8f652f.tar.xz
mana-client-4b0172d1f666a12cffbdd6bd331e95a92d8f652f.zip
Finishing resource manager ability to clean up resources. Still work to do on
resources other than images.
Diffstat (limited to 'src/resources/resource.h')
-rw-r--r--src/resources/resource.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 266b4198..09c12c90 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -24,6 +24,8 @@
#ifndef _TMW_RESOURCE_H
#define _TMW_RESOURCE_H
+#include <string>
+
/**
* A generic reference counted resource object.
*/
@@ -36,40 +38,38 @@ class Resource
Resource();
/**
- * Destructor.
- */
- virtual ~Resource();
-
- /**
- * Frees this objects internal resources.
+ * Sets the id path of this resource. This path is used to notify the
+ * resource manager when this resource is deleted.
*/
- virtual void unload() = 0;
-
- /**
- * Indicates whether or not a resource is loaded.
- * @return <code>true</code> if resource is loaded
- * <code>false</code> otherwise.
- */
- virtual bool isLoaded() const;
+ void
+ setIdPath(const std::string &idPath);
/**
* Increments the internal reference count.
*/
- void incRef();
+ void
+ incRef();
/**
* Decrements the reference count and deletes the object
* if no references are left.
+ *
* @return <code>true</code> if the object was deleted
- * <code>false</code> otherwise.
+ * <code>false</code> otherwise.
*/
- bool decRef();
+ bool
+ decRef();
protected:
- bool loaded;
+ /**
+ * Destructor.
+ */
+ virtual
+ ~Resource();
private:
- unsigned int referenceCount;
+ unsigned int mRefCount; /**< Reference count */
+ std::string mIdPath; /**< Path identifying this resource */
};
#endif