aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
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
parent72df5cf1bc6f5b5c12454daf951bed87c5cc48dc (diff)
downloadfluxbox_paul-c613a57c64b43e02fbbfc16a15e7d4604466f1e6.zip
fluxbox_paul-c613a57c64b43e02fbbfc16a15e7d4604466f1e6.tar.bz2
resourceValue and findResource
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Resource.cc28
-rw-r--r--src/FbTk/Resource.hh4
2 files changed, 24 insertions, 8 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() {
diff --git a/src/FbTk/Resource.hh b/src/FbTk/Resource.hh
index 93cfc9e..6fddbac 100644
--- a/src/FbTk/Resource.hh
+++ b/src/FbTk/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 2003/12/19 17:08:25 fluxgen Exp $ 22// $Id: Resource.hh,v 1.7 2003/12/19 18:25:39 fluxgen Exp $
23 23
24#ifndef FBTK_RESOURCE_HH 24#ifndef FBTK_RESOURCE_HH
25#define FBTK_RESOURCE_HH 25#define FBTK_RESOURCE_HH
@@ -97,6 +97,8 @@ public:
97 m_resourcelist.remove(&r); 97 m_resourcelist.remove(&r);
98 } 98 }
99 99
100 Resource_base *findResource(const std::string &resourcename);
101 std::string resourceValue(const std::string &resourcename);
100 void setResourceValue(const std::string &resourcename, const std::string &value); 102 void setResourceValue(const std::string &resourcename, const std::string &value);
101 103
102 // this marks the database as "in use" and will avoid reloading 104 // this marks the database as "in use" and will avoid reloading