aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Resource.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-19 18:25:39 (GMT)
committerfluxgen <fluxgen>2003-12-19 18:25:39 (GMT)
commitc613a57c64b43e02fbbfc16a15e7d4604466f1e6 (patch)
tree368f5183b9a29bd9803975feb2c9b930dd053d7d /src/FbTk/Resource.cc
parent72df5cf1bc6f5b5c12454daf951bed87c5cc48dc (diff)
downloadfluxbox_pavel-c613a57c64b43e02fbbfc16a15e7d4604466f1e6.zip
fluxbox_pavel-c613a57c64b43e02fbbfc16a15e7d4604466f1e6.tar.bz2
resourceValue and findResource
Diffstat (limited to 'src/FbTk/Resource.cc')
-rw-r--r--src/FbTk/Resource.cc28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/FbTk/Resource.cc b/src/FbTk/Resource.cc
index ad30b57..4c56dbb 100644
--- a/src/FbTk/Resource.cc
+++ b/src/FbTk/Resource.cc
@@ -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.cc,v 1.3 2003/12/19 17:08:25 fluxgen Exp $ 22// $Id: Resource.cc,v 1.4 2003/12/19 18:25:39 fluxgen Exp $
23 23
24#include "XrmDatabaseHelper.hh" 24#include "XrmDatabaseHelper.hh"
25#include "Resource.hh" 25#include "Resource.hh"
@@ -143,17 +143,31 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) {
143 return true; 143 return true;
144} 144}
145 145
146void ResourceManager::setResourceValue(const std::string &resname, const std::string &value) { 146Resource_base *ResourceManager::findResource(const std::string &resname) {
147 // find resource name 147 // find resource name
148 ResourceList::iterator i = m_resourcelist.begin(); 148 ResourceList::iterator i = m_resourcelist.begin();
149 ResourceList::iterator i_end = m_resourcelist.end(); 149 ResourceList::iterator i_end = m_resourcelist.end();
150 for (; i != i_end; ++i) { 150 for (; i != i_end; ++i) {
151 if ((*i)->name() == resname || 151 if ((*i)->name() == resname ||
152 (*i)->altName() == resname) { 152 (*i)->altName() == resname)
153 (*i)->setFromString(value.c_str()); 153 return *i;
154 return;
155 }
156 } 154 }
155 return 0;
156}
157
158string ResourceManager::resourceValue(const std::string &resname) {
159 Resource_base *res = findResource(resname);
160 if (res != 0)
161 return res->getString();
162
163 return "";
164}
165
166void ResourceManager::setResourceValue(const std::string &resname, const std::string &value) {
167 Resource_base *res = findResource(resname);
168 if (res != 0)
169 res->setFromString(value.c_str());
170
157} 171}
158 172
159void ResourceManager::ensureXrmIsInitialize() { 173void ResourceManager::ensureXrmIsInitialize() {