1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
diff -Naur fbdesk-1.1.5.orig/src/Resource.hh fbdesk-1.1.5/src/Resource.hh
--- fbdesk-1.1.5.orig/src/Resource.hh 2003-01-14 22:45:53.000000000 +0100
+++ fbdesk-1.1.5/src/Resource.hh 2004-07-17 11:31:57.000000000 +0200
@@ -56,40 +56,8 @@
std::string m_altname; ///< alternative name
};
-class ResourceManager;
-
-/**
- Real resource class
-*/
template <typename T>
-class Resource:public Resource_base
-{
-public:
- Resource(ResourceManager &rm, T val,
- const std::string &name, const std::string &altname):
- Resource_base(name, altname),
- m_value(val), m_defaultval(val),
- m_rm(rm)
- {
- m_rm.addResource(*this); // add this to resource handler
- }
- virtual ~Resource() {
- m_rm.removeResource(*this); // remove this from resource handler
- }
-
- inline void setDefaultValue() { m_value = m_defaultval; }
- void setFromString(const char *strval);
- inline Resource<T>& operator = (const T& newvalue) { m_value = newvalue; return *this;}
-
- std::string getString();
- inline T& operator*() { return m_value; }
- inline const T& operator*() const { return m_value; }
- inline T *operator->() { return &m_value; }
- inline const T *operator->() const { return &m_value; }
-private:
- T m_value, m_defaultval;
- ResourceManager &m_rm;
-};
+class Resource;
class ResourceManager
{
@@ -129,4 +97,37 @@
ResourceList m_resourcelist;
};
+/**
+ Real resource class
+*/
+template <typename T>
+class Resource:public Resource_base
+{
+public:
+ Resource(ResourceManager &rm, T val,
+ const std::string &name, const std::string &altname):
+ Resource_base(name, altname),
+ m_value(val), m_defaultval(val),
+ m_rm(rm)
+ {
+ m_rm.addResource(*this); // add this to resource handler
+ }
+ virtual ~Resource() {
+ m_rm.removeResource(*this); // remove this from resource handler
+ }
+
+ inline void setDefaultValue() { m_value = m_defaultval; }
+ void setFromString(const char *strval);
+ inline Resource<T>& operator = (const T& newvalue) { m_value = newvalue; return *this;}
+
+ std::string getString();
+ inline T& operator*() { return m_value; }
+ inline const T& operator*() const { return m_value; }
+ inline T *operator->() { return &m_value; }
+ inline const T *operator->() const { return &m_value; }
+private:
+ T m_value, m_defaultval;
+ ResourceManager &m_rm;
+};
+
#endif //_RESOURCE_HH_
|