diff options
Diffstat (limited to 'src/FbTk/Resource.cc')
-rw-r--r-- | src/FbTk/Resource.cc | 28 |
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 | ||
146 | void ResourceManager::setResourceValue(const std::string &resname, const std::string &value) { | 146 | Resource_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 | |||
158 | string 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 | |||
166 | void 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 | ||
159 | void ResourceManager::ensureXrmIsInitialize() { | 173 | void ResourceManager::ensureXrmIsInitialize() { |