aboutsummaryrefslogtreecommitdiff
path: root/src/Resource.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-04 15:55:13 (GMT)
committerfluxgen <fluxgen>2002-08-04 15:55:13 (GMT)
commit56a41b23f9b5ecdef5e9536c2e6eeed0db32e623 (patch)
tree8b6fd3a735918278d54f1d108042d90df696169f /src/Resource.hh
parent380d50ba274c0ceb0a2f973ea464792847a80e6d (diff)
downloadfluxbox-56a41b23f9b5ecdef5e9536c2e6eeed0db32e623.zip
fluxbox-56a41b23f9b5ecdef5e9536c2e6eeed0db32e623.tar.bz2
doxygen comments
Diffstat (limited to 'src/Resource.hh')
-rw-r--r--src/Resource.hh33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/Resource.hh b/src/Resource.hh
index 8055701..0e4e939 100644
--- a/src/Resource.hh
+++ b/src/Resource.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Resource.hh,v 1.6 2002/07/20 09:51:03 fluxgen Exp $ 22// $Id: Resource.hh,v 1.7 2002/08/04 15:55:13 fluxgen Exp $
23 23
24#ifndef RESOURCE_HH 24#ifndef RESOURCE_HH
25#define RESOURCE_HH 25#define RESOURCE_HH
@@ -27,7 +27,9 @@
27#include "NotCopyable.hh" 27#include "NotCopyable.hh"
28#include <string> 28#include <string>
29#include <list> 29#include <list>
30 30/**
31 Base class for resources
32*/
31class Resource_base:private NotCopyable 33class Resource_base:private NotCopyable
32{ 34{
33public: 35public:
@@ -47,17 +49,18 @@ public:
47protected: 49protected:
48 Resource_base(const std::string &name, const std::string &altname): 50 Resource_base(const std::string &name, const std::string &altname):
49 m_name(name), m_altname(altname) 51 m_name(name), m_altname(altname)
50 { 52 { }
51
52 }
53 53
54private: 54private:
55 std::string m_name; // name of this resource 55 std::string m_name; ///< name of this resource
56 std::string m_altname; // alternative name 56 std::string m_altname; ///< alternative name
57}; 57};
58 58
59class ResourceManager; 59class ResourceManager;
60 60
61/**
62 Real resource class
63*/
61template <typename T> 64template <typename T>
62class Resource:public Resource_base 65class Resource:public Resource_base
63{ 66{
@@ -79,10 +82,10 @@ public:
79 inline Resource<T>& operator = (const T& newvalue) { m_value = newvalue; return *this;} 82 inline Resource<T>& operator = (const T& newvalue) { m_value = newvalue; return *this;}
80 83
81 std::string getString(); 84 std::string getString();
82 inline T& operator*(void) { return m_value; } 85 inline T& operator*() { return m_value; }
83 inline const T& operator*(void) const { return m_value; } 86 inline const T& operator*() const { return m_value; }
84 inline T *operator->(void) { return &m_value; } 87 inline T *operator->() { return &m_value; }
85 inline const T *operator->(void) const { return &m_value; } 88 inline const T *operator->() const { return &m_value; }
86private: 89private:
87 T m_value, m_defaultval; 90 T m_value, m_defaultval;
88 ResourceManager &m_rm; 91 ResourceManager &m_rm;
@@ -103,11 +106,17 @@ public:
103 save all resouces registered to this class 106 save all resouces registered to this class
104 */ 107 */
105 virtual bool save(const char *filename, const char *mergefilename=0); 108 virtual bool save(const char *filename, const char *mergefilename=0);
109 /**
110 add resource to list
111 */
106 template <class T> 112 template <class T>
107 void addResource(Resource<T> &r) { 113 void addResource(Resource<T> &r) {
108 m_resourcelist.push_back(&r); 114 m_resourcelist.push_back(&r);
109 m_resourcelist.unique(); 115 m_resourcelist.unique();
110 } 116 }
117 /**
118 Remove a specific resource
119 */
111 template <class T> 120 template <class T>
112 void removeResource(Resource<T> &r) { 121 void removeResource(Resource<T> &r) {
113 m_resourcelist.remove(&r); 122 m_resourcelist.remove(&r);
@@ -115,9 +124,9 @@ public:
115protected: 124protected:
116 static inline void ensureXrmIsInitialize(); 125 static inline void ensureXrmIsInitialize();
117private: 126private:
127
118 static bool m_init; 128 static bool m_init;
119 ResourceList m_resourcelist; 129 ResourceList m_resourcelist;
120
121}; 130};
122 131
123#endif //_RESOURCE_HH_ 132#endif //_RESOURCE_HH_