Get rid of Common::String::emptyString, and also of some port specific hackery (getting rid of certain global C++ objs)

svn-id: r46781
This commit is contained in:
Max Horn 2009-12-30 23:01:36 +00:00
parent a753f606ec
commit b0e02675e7
6 changed files with 9 additions and 59 deletions

View File

@ -40,17 +40,6 @@ static bool isValidDomainName(const Common::String &domName) {
namespace Common {
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
const String ConfigManager::kApplicationDomain("scummvm");
const String ConfigManager::kTransientDomain("__TRANSIENT");
#ifdef ENABLE_KEYMAPPER
const String ConfigManager::kKeymapperDomain("keymapper");
#endif
#else
const char *ConfigManager::kApplicationDomain = "scummvm";
const char *ConfigManager::kTransientDomain = "__TRANSIENT";
@ -58,13 +47,10 @@ const char *ConfigManager::kTransientDomain = "__TRANSIENT";
const char *ConfigManager::kKeymapperDomain = "keymapper";
#endif
#endif
#pragma mark -
ConfigManager::ConfigManager()
: _activeDomain(0) {
ConfigManager::ConfigManager() : _activeDomain(0) {
}
@ -407,11 +393,7 @@ const String & ConfigManager::get(const String &key) const {
else if (_defaultsDomain.contains(key))
return _defaultsDomain[key];
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
return String::emptyString;
#else
return ConfMan._emptyString;
#endif
return _emptyString;
}
const String & ConfigManager::get(const String &key, const String &domName) const {
@ -434,11 +416,7 @@ const String & ConfigManager::get(const String &key, const String &domName) cons
if (!domain->contains(key)) {
#if 1
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
return String::emptyString;
#else
return ConfMan._emptyString;
#endif
return _emptyString;
#else
error("ConfigManager::get(%s,%s) called on non-existent key",
key.c_str(), domName.c_str());
@ -641,11 +619,7 @@ const String &ConfigManager::Domain::get(const String &key) const {
if (iter != end())
return iter->_value;
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
return String::emptyString;
#else
return ConfMan._emptyString;
#endif
}
void ConfigManager::Domain::setDomainComment(const String &comment) {

View File

@ -68,29 +68,15 @@ public:
typedef HashMap<String, Domain, IgnoreCase_Hash, IgnoreCase_EqualTo> DomainMap;
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
/** The name of the application domain (normally 'scummvm'). */
static const String kApplicationDomain;
static const char *kApplicationDomain;
/** The transient (pseudo) domain. */
static const String kTransientDomain;
#ifdef ENABLE_KEYMAPPER
/** The name of keymapper domain used to store the key maps */
static const String kKeymapperDomain;
#endif
#else
static const char *kApplicationDomain;
static const char *kTransientDomain;
const String _emptyString;
#ifdef ENABLE_KEYMAPPER
/** The name of keymapper domain used to store the key maps */
static const char *kKeymapperDomain;
#endif
#endif
void loadDefaultConfigFile();
@ -179,6 +165,8 @@ private:
Domain * _activeDomain;
String _filename;
const String _emptyString;
};
} // End of namespace Common

View File

@ -37,13 +37,6 @@
namespace Common {
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
const String String::emptyString;
#else
const char *String::emptyString = "";
#endif
MemoryPool *g_refCountPool = 0; // FIXME: This is never freed right now
static uint32 computeCapacity(uint32 len) {

View File

@ -90,12 +90,6 @@ protected:
}
public:
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
static const String emptyString;
#else
static const char *emptyString;
#endif
/** Construct a new empty string. */
String() : _size(0), _str(_storage) { _storage[0] = 0; }

View File

@ -75,7 +75,7 @@ public:
int getSelected() const { return _selectedItem; }
uint32 getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (uint32)-1; }
const String& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : String::emptyString; }
// const String& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : String::emptyString; }
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); }

View File

@ -114,7 +114,8 @@ void SaveLoadChooser::open() {
}
const Common::String &SaveLoadChooser::getResultString() const {
return (_list->getSelected() > -1) ? _list->getSelectedString() : _resultString;
int selItem = _list->getSelected();
return (selItem >= 0) ? _list->getSelectedString() : _resultString;
}
void SaveLoadChooser::setSaveMode(bool saveMode) {