aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Resource.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Resource.hh')
-rw-r--r--src/FbTk/Resource.hh15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/FbTk/Resource.hh b/src/FbTk/Resource.hh
index c4a7951..700fe70 100644
--- a/src/FbTk/Resource.hh
+++ b/src/FbTk/Resource.hh
@@ -92,6 +92,11 @@ public:
92 92
93 virtual ~ResourceManager_base() {} 93 virtual ~ResourceManager_base() {}
94 94
95 /// Load all resources registered to this class
96 /// if loading of filename fails, it tries to load fallback
97 /// if that fails, it throws an exception
98 void load(const std::string &filename, const std::string &fallback);
99
95 /// Save all resouces registered to this class 100 /// Save all resouces registered to this class
96 /// @return true on success 101 /// @return true on success
97 virtual bool save(const char *filename, const char *mergefilename=0) = 0; 102 virtual bool save(const char *filename, const char *mergefilename=0) = 0;
@@ -130,8 +135,12 @@ public:
130 ResourceList::const_iterator end() { return m_resourcelist.end(); } 135 ResourceList::const_iterator end() { return m_resourcelist.end(); }
131 136
132protected: 137protected:
138 /// does the actual loading
139 virtual void doLoad(const std::string &filename) = 0;
140
133 ResourceList m_resourcelist; 141 ResourceList m_resourcelist;
134 const std::string m_root; 142 const std::string m_root;
143 std::string m_filename;
135}; 144};
136 145
137class ResourceManager: public ResourceManager_base 146class ResourceManager: public ResourceManager_base
@@ -143,10 +152,6 @@ public:
143 const char *filename, bool lock_db); 152 const char *filename, bool lock_db);
144 virtual ~ResourceManager(); 153 virtual ~ResourceManager();
145 154
146 /// Load all resources registered to this class
147 /// @return true on success
148 virtual bool load(const char *filename);
149
150 /// Save all resouces registered to this class 155 /// Save all resouces registered to this class
151 /// @return true on success 156 /// @return true on success
152 virtual bool save(const char *filename, const char *mergefilename=0); 157 virtual bool save(const char *filename, const char *mergefilename=0);
@@ -173,6 +178,7 @@ public:
173 } 178 }
174 } 179 }
175protected: 180protected:
181 virtual void doLoad(const std::string &filename);
176 182
177 int m_db_lock; 183 int m_db_lock;
178 184
@@ -180,7 +186,6 @@ private:
180 186
181 XrmDatabaseHelper *m_database; 187 XrmDatabaseHelper *m_database;
182 188
183 std::string m_filename;
184 std::string m_alt_root; 189 std::string m_alt_root;
185}; 190};
186 191