From 1cec88dfbb12f7a8702c5bb98ac3b0b2b383d58a Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 3 Jun 2011 13:40:56 +0200 Subject: convert ResourceManager::{add,remove}Resource from template to a regular function --- src/FbTk/Resource.cc | 29 +++++++++++++++++++++++++++++ src/FbTk/Resource.hh | 36 ++---------------------------------- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/FbTk/Resource.cc b/src/FbTk/Resource.cc index 4be85de..85e78da 100644 --- a/src/FbTk/Resource.cc +++ b/src/FbTk/Resource.cc @@ -226,4 +226,33 @@ void ResourceManager::unlock() { } } +// add the resource and load its value +void ResourceManager::addResource(Resource_base &r) { + m_resourcelist.push_back(&r); + m_resourcelist.unique(); + + // lock ensures that the database is loaded. + lock(); + + if (m_database == 0) { + unlock(); + return; + } + + XrmValue value; + char *value_type; + + // now, load the value for this resource + if (XrmGetResource(**m_database, r.name().c_str(), + r.altName().c_str(), &value_type, &value)) { + r.setFromString(value.addr); + } else { + std::cerr<<"Failed to read: "< - template - void addResource(Resource &r); + void addResource(Resource_base &r); /// Remove a specific resource, only used in Resource - template - void removeResource(Resource &r) { + void removeResource(Resource_base &r) { m_resourcelist.remove(&r); } @@ -194,36 +192,6 @@ private: }; -// add the resource and load its value -template -void ResourceManager::addResource(Resource &r) { - m_resourcelist.push_back(&r); - m_resourcelist.unique(); - - // lock ensures that the database is loaded. - lock(); - - if (m_database == 0) { - unlock(); - return; - } - - XrmValue value; - char *value_type; - - // now, load the value for this resource - if (XrmGetResource(**m_database, r.name().c_str(), - r.altName().c_str(), &value_type, &value)) { - r.setFromString(value.addr); - } else { - std::cerr<<"Failed to read: "< Resource &ResourceManager::getResource(const std::string &resname) { -- cgit v0.11.2