[Scummvm-cvs-logs] CVS: scummvm/common config-manager.cpp,1.9,1.10
Max Horn
fingolfin at users.sourceforge.net
Fri Nov 7 07:58:13 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.53,1.54
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.75,1.76 options.cpp,1.40,1.41 options.h,1.10,1.11 widget.cpp,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv21858/common
Modified Files:
config-manager.cpp
Log Message:
change behaviour of ConfigManager::get once again -> now we *do* fall back to the registered defaults...
Index: config-manager.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- config-manager.cpp 7 Nov 2003 02:43:47 -0000 1.9
+++ config-manager.cpp 7 Nov 2003 15:57:36 -0000 1.10
@@ -253,6 +253,10 @@
const String & ConfigManager::get(const String &key) const {
+ return get(key, _activeDomain);
+}
+
+const String & ConfigManager::get(const String &key, const String &dom) const {
// Search the domains in the following order:
// 1) Run time domain
// 2) Active game domain (if any)
@@ -262,9 +266,9 @@
// if (_transientDomain.contain(key))
// return true;
- if (!_activeDomain.isEmpty() && _gameDomains[_activeDomain].contains(key))
- return _gameDomains[_activeDomain][key];
-
+ if (!dom.isEmpty() && _gameDomains.contains(dom) && _gameDomains[dom].contains(key))
+ return _gameDomains[dom][key];
+
DomainMap::ConstIterator iter;
for (iter = _globalDomains.begin(); iter != _globalDomains.end(); ++iter) {
if (iter->_value.contains(key))
@@ -272,32 +276,6 @@
}
return _defaultsDomain.get(key);
-}
-
-const String & ConfigManager::get(const String &key, const String &dom) const {
- if (dom.isEmpty())
- return get(key);
-
- // TODO: How exactly should we handle the case were the domain 'dom'
- // is not found, or were dom is found, but doesn't contain 'key' ?
- // Right now we just return an empty string. But might want to print
- // out a warning, or even error out?
- if (_gameDomains.contains(dom)) {
- // Return the value, if any; defaults to the empty string if the key is
- // not present in the domain. We purposely do not return the registered
- // default value.
- //
- return _gameDomains[dom].get(key);
- } else if (_globalDomains.contains(dom)) {
- if (_globalDomains[dom].contains(key))
- return _globalDomains[dom].get(key);
- // For global domains, we *do* use the registered default value.
- return _defaultsDomain.get(key);
- } else {
- // Domain was not found. Do *not* return the registered default
- // value, see above for the reasons.
- return String::emptyString;
- }
}
int ConfigManager::getInt(const String &key, const String &dom) const {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.53,1.54
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.75,1.76 options.cpp,1.40,1.41 options.h,1.10,1.11 widget.cpp,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list