Renamed various container isEmpty() methods to empty() to match STL conventions

svn-id: r21472
This commit is contained in:
Max Horn 2006-03-28 09:42:54 +00:00
parent 950c3451a2
commit 9f93e5bb81
31 changed files with 101 additions and 94 deletions

View file

@ -87,7 +87,7 @@ void CELauncherDialog::addCandidate(String &path, DetectedGameList &candidates)
int idx = -1; int idx = -1;
DetectedGame result; DetectedGame result;
if (candidates.isEmpty()) if (candidates.empty())
return; return;
if (candidates.size() == 1) if (candidates.size() == 1)

View file

@ -257,7 +257,7 @@ void listTargets() {
String name(iter->_key); String name(iter->_key);
String description(iter->_value.get("description")); String description(iter->_value.get("description"));
if (description.isEmpty()) { if (description.empty()) {
// FIXME: At this point, we should check for a "gameid" override // FIXME: At this point, we should check for a "gameid" override
// to find the proper desc. In fact, the platform probably should // to find the proper desc. In fact, the platform probably should
// be taken into account, too. // be taken into account, too.
@ -634,7 +634,7 @@ void GameDetector::setTarget(const String &target) {
} }
bool GameDetector::detectMain() { bool GameDetector::detectMain() {
if (_targetName.isEmpty()) { if (_targetName.empty()) {
warning("No game was specified..."); warning("No game was specified...");
return false; return false;
} }
@ -656,7 +656,7 @@ bool GameDetector::detectMain() {
printf("Trying to start game '%s'\n", game.description.c_str()); printf("Trying to start game '%s'\n", game.description.c_str());
String gameDataPath(ConfMan.get("path")); String gameDataPath(ConfMan.get("path"));
if (gameDataPath.isEmpty()) { if (gameDataPath.empty()) {
warning("No path was provided. Assuming the data files are in the current directory"); warning("No path was provided. Assuming the data files are in the current directory");
gameDataPath = "./"; gameDataPath = "./";
} else if (gameDataPath.lastChar() != '/' } else if (gameDataPath.lastChar() != '/'

View file

@ -297,11 +297,11 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String
Common::String caption(ConfMan.get("description", detector._targetName)); Common::String caption(ConfMan.get("description", detector._targetName));
Common::String desc = GameDetector::findGame(detector._gameid).description; Common::String desc = GameDetector::findGame(detector._gameid).description;
if (caption.isEmpty() && !desc.isEmpty()) if (caption.empty() && !desc.empty())
caption = desc; caption = desc;
if (caption.isEmpty()) if (caption.empty())
caption = detector._targetName; caption = detector._targetName;
if (!caption.isEmpty()) { if (!caption.empty()) {
system.setWindowCaption(caption.c_str()); system.setWindowCaption(caption.c_str());
} }
@ -494,7 +494,7 @@ extern "C" int main(int argc, char *argv[]) {
system.setWindowCaption(gScummVMFullVersion); system.setWindowCaption(gScummVMFullVersion);
// Unless a game was specified, show the launcher dialog // Unless a game was specified, show the launcher dialog
if (detector._targetName.isEmpty()) if (detector._targetName.empty())
running = launcherDialog(detector, system); running = launcherDialog(detector, system);
else else
// Setup a dummy palette, for the mouse cursor, in case an error // Setup a dummy palette, for the mouse cursor, in case an error

View file

@ -130,7 +130,7 @@ public:
_capacity = 0; _capacity = 0;
} }
bool isEmpty() const { bool empty() const {
return (_size == 0); return (_size == 0);
} }

View file

@ -140,9 +140,16 @@ public:
// even allow in-place modifications of // even allow in-place modifications of
Key *new_all_keys(void) const; Key *new_all_keys(void) const;
Val *new_all_values(void) const; Val *new_all_values(void) const;
//const_iterator begin() const
//const_iterator end() const
// TODO: There is no "remove" method yet.
//void remove(const Key &key);
// TODO: There is no "remove(key)" method yet. bool empty() const {
return (_nele == 0);
}
}; };
//------------------------------------------------------- //-------------------------------------------------------

View file

@ -122,7 +122,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
*p = 0; *p = 0;
// Previous section is finished now, store it. // Previous section is finished now, store it.
if (!section.name.isEmpty()) if (!section.name.empty())
_sections.push_back(section); _sections.push_back(section);
section.name = buf + 1; section.name = buf + 1;
@ -140,7 +140,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
continue; continue;
// If no section has been set, this config file is invalid! // If no section has been set, this config file is invalid!
if (section.name.isEmpty()) { if (section.name.empty()) {
error("Config file buggy: Key/value pair found outside a section in line %d", lineno); error("Config file buggy: Key/value pair found outside a section in line %d", lineno);
} }
@ -162,7 +162,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
} }
// Save last section // Save last section
if (!section.name.isEmpty()) if (!section.name.empty())
_sections.push_back(section); _sections.push_back(section);
return (!stream.ioFailed() || stream.eos()); return (!stream.ioFailed() || stream.eos());
@ -179,7 +179,7 @@ bool ConfigFile::saveToFile(const String &filename) {
bool ConfigFile::saveToStream(WriteStream &stream) { bool ConfigFile::saveToStream(WriteStream &stream) {
for (List<Section>::iterator i = _sections.begin(); i != _sections.end(); ++i) { for (List<Section>::iterator i = _sections.begin(); i != _sections.end(); ++i) {
// Write out the section comment, if any // Write out the section comment, if any
if (! i->comment.isEmpty()) { if (! i->comment.empty()) {
stream.writeString(i->comment); stream.writeString(i->comment);
} }
@ -192,7 +192,7 @@ bool ConfigFile::saveToStream(WriteStream &stream) {
// Write out the key/value pairs // Write out the key/value pairs
for (List<KeyValue>::iterator kv = i->keys.begin(); kv != i->keys.end(); ++kv) { for (List<KeyValue>::iterator kv = i->keys.begin(); kv != i->keys.end(); ++kv) {
// Write out the comment, if any // Write out the comment, if any
if (! kv->comment.isEmpty()) { if (! kv->comment.empty()) {
stream.writeString(kv->comment); stream.writeString(kv->comment);
} }
// Write out the key/value pair // Write out the key/value pair

View file

@ -198,7 +198,7 @@ void ConfigManager::loadFile(const String &filename) {
continue; continue;
// If no domain has been set, this config file is invalid! // If no domain has been set, this config file is invalid!
if (domain.isEmpty()) { if (domain.empty()) {
error("Config file buggy: Key/value pair found outside a domain in line %d", lineno); error("Config file buggy: Key/value pair found outside a domain in line %d", lineno);
} }
@ -265,14 +265,14 @@ void ConfigManager::flushToDisk() {
} }
void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &domain) { void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &domain) {
if (domain.isEmpty()) if (domain.empty())
return; // Don't bother writing empty domains. return; // Don't bother writing empty domains.
String comment; String comment;
// Write domain comment (if any) // Write domain comment (if any)
comment = domain.getDomainComment(); comment = domain.getDomainComment();
if (!comment.isEmpty()) if (!comment.empty())
fprintf(file, "%s", comment.c_str()); fprintf(file, "%s", comment.c_str());
// Write domain start // Write domain start
@ -282,7 +282,7 @@ void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &do
Domain::const_iterator x; Domain::const_iterator x;
for (x = domain.begin(); x != domain.end(); ++x) { for (x = domain.begin(); x != domain.end(); ++x) {
const String &value = x->_value; const String &value = x->_value;
if (!value.isEmpty()) { if (!value.empty()) {
// Write comment (if any) // Write comment (if any)
if (domain.hasKVComment(x->_key)) { if (domain.hasKVComment(x->_key)) {
comment = domain.getKVComment(x->_key); comment = domain.getKVComment(x->_key);
@ -308,7 +308,7 @@ bool ConfigManager::hasKey(const String &key) const {
if (_transientDomain.contains(key)) if (_transientDomain.contains(key))
return true; return true;
if (!_activeDomain.isEmpty() && _gameDomains[_activeDomain].contains(key)) if (!_activeDomain.empty() && _gameDomains[_activeDomain].contains(key))
return true; return true;
DomainMap::const_iterator iter; DomainMap::const_iterator iter;
@ -321,7 +321,7 @@ bool ConfigManager::hasKey(const String &key) const {
} }
bool ConfigManager::hasKey(const String &key, const String &dom) const { bool ConfigManager::hasKey(const String &key, const String &dom) const {
assert(!dom.isEmpty()); assert(!dom.empty());
assert(isValidDomainName(dom)); assert(isValidDomainName(dom));
if (dom == kTransientDomain) if (dom == kTransientDomain)
@ -335,7 +335,7 @@ bool ConfigManager::hasKey(const String &key, const String &dom) const {
} }
void ConfigManager::removeKey(const String &key, const String &dom) { void ConfigManager::removeKey(const String &key, const String &dom) {
assert(!dom.isEmpty()); assert(!dom.empty());
assert(isValidDomainName(dom)); assert(isValidDomainName(dom));
if (dom == kTransientDomain) if (dom == kTransientDomain)
@ -361,12 +361,12 @@ const String & ConfigManager::get(const String &key, const String &domain) const
// 3) All global domains // 3) All global domains
// 4) The defaults // 4) The defaults
if ((domain.isEmpty() || domain == kTransientDomain) && _transientDomain.contains(key)) if ((domain.empty() || domain == kTransientDomain) && _transientDomain.contains(key))
return _transientDomain[key]; return _transientDomain[key];
const String &dom = domain.isEmpty() ? _activeDomain : domain; const String &dom = domain.empty() ? _activeDomain : domain;
if (!dom.isEmpty() && _gameDomains.contains(dom) && _gameDomains[dom].contains(key)) if (!dom.empty() && _gameDomains.contains(dom) && _gameDomains[dom].contains(key))
return _gameDomains[dom][key]; return _gameDomains[dom][key];
DomainMap::const_iterator iter; DomainMap::const_iterator iter;
@ -385,7 +385,7 @@ int ConfigManager::getInt(const String &key, const String &dom) const {
// For now, be tolerant against missing config keys. Strictly spoken, it is // For now, be tolerant against missing config keys. Strictly spoken, it is
// a bug in the calling code to retrieve an int for a key which isn't even // a bug in the calling code to retrieve an int for a key which isn't even
// present... and a default value of 0 seems rather arbitrary. // present... and a default value of 0 seems rather arbitrary.
if (value.isEmpty()) if (value.empty())
return 0; return 0;
int ivalue = (int)strtol(value.c_str(), &errpos, 10); int ivalue = (int)strtol(value.c_str(), &errpos, 10);
@ -412,11 +412,11 @@ bool ConfigManager::getBool(const String &key, const String &dom) const {
void ConfigManager::set(const String &key, const String &value, const String &dom) { void ConfigManager::set(const String &key, const String &value, const String &dom) {
assert(isValidDomainName(dom)); assert(isValidDomainName(dom));
if (dom.isEmpty()) { if (dom.empty()) {
// Remove the transient domain value // Remove the transient domain value
_transientDomain.remove(key); _transientDomain.remove(key);
if (_activeDomain.isEmpty()) if (_activeDomain.empty())
_globalDomains[kApplicationDomain][key] = value; _globalDomains[kApplicationDomain][key] = value;
else else
_gameDomains[_activeDomain][key] = value; _gameDomains[_activeDomain][key] = value;
@ -428,7 +428,7 @@ void ConfigManager::set(const String &key, const String &value, const String &do
else { else {
if (_globalDomains.contains(dom)) { if (_globalDomains.contains(dom)) {
_globalDomains[dom][key] = value; _globalDomains[dom][key] = value;
if (_activeDomain.isEmpty() || !_gameDomains[_activeDomain].contains(key)) if (_activeDomain.empty() || !_gameDomains[_activeDomain].contains(key))
_transientDomain.remove(key); _transientDomain.remove(key);
} else { } else {
_gameDomains[dom][key] = value; _gameDomains[dom][key] = value;
@ -480,14 +480,14 @@ void ConfigManager::registerDefault(const String &key, bool value) {
void ConfigManager::setActiveDomain(const String &domain) { void ConfigManager::setActiveDomain(const String &domain) {
assert(!domain.isEmpty()); assert(!domain.empty());
assert(isValidDomainName(domain)); assert(isValidDomainName(domain));
_activeDomain = domain; _activeDomain = domain;
_gameDomains.addKey(domain); _gameDomains.addKey(domain);
} }
void ConfigManager::removeGameDomain(const String &domain) { void ConfigManager::removeGameDomain(const String &domain) {
assert(!domain.isEmpty()); assert(!domain.empty());
assert(isValidDomainName(domain)); assert(isValidDomainName(domain));
_gameDomains.remove(domain); _gameDomains.remove(domain);
} }
@ -496,8 +496,8 @@ void ConfigManager::renameGameDomain(const String &oldName, const String &newNam
if (oldName == newName) if (oldName == newName)
return; return;
assert(!oldName.isEmpty()); assert(!oldName.empty());
assert(!newName.isEmpty()); assert(!newName.empty());
assert(isValidDomainName(oldName)); assert(isValidDomainName(oldName));
assert(isValidDomainName(newName)); assert(isValidDomainName(newName));
@ -507,7 +507,7 @@ void ConfigManager::renameGameDomain(const String &oldName, const String &newNam
} }
bool ConfigManager::hasGameDomain(const String &domain) const { bool ConfigManager::hasGameDomain(const String &domain) const {
assert(!domain.isEmpty()); assert(!domain.empty());
return isValidDomainName(domain) && _gameDomains.contains(domain); return isValidDomainName(domain) && _gameDomains.contains(domain);
} }

View file

@ -230,7 +230,7 @@ public:
erase(begin(), end()); erase(begin(), end());
} }
bool isEmpty() const { bool empty() const {
return (_anchor == _anchor->_next); return (_anchor == _anchor->_next);
} }

View file

@ -150,7 +150,7 @@ public:
_root = 0; _root = 0;
} }
bool isEmpty() const { bool empty() const {
return (_root == 0); return (_root == 0);
} }

View file

@ -83,7 +83,7 @@ public:
Stack<T>() {} Stack<T>() {}
bool empty() const { bool empty() const {
return _stack.isEmpty(); return _stack.empty();
} }
void clear() { void clear() {
_stack.clear(); _stack.clear();

View file

@ -71,7 +71,7 @@ public:
const char *c_str() const { return _str ? _str : ""; } const char *c_str() const { return _str ? _str : ""; }
uint size() const { return _len; } uint size() const { return _len; }
bool isEmpty() const { return (_len == 0); } bool empty() const { return (_len == 0); }
char lastChar() const { return (_len > 0) ? _str[_len-1] : 0; } char lastChar() const { return (_len > 0) ? _str[_len-1] : 0; }
char operator [](int idx) const { char operator [](int idx) const {

View file

@ -131,7 +131,7 @@ const LanguageDescription g_languages[] = {
}; };
Language parseLanguage(const String &str) { Language parseLanguage(const String &str) {
if (str.isEmpty()) if (str.empty())
return UNK_LANG; return UNK_LANG;
const char *s = str.c_str(); const char *s = str.c_str();
@ -189,7 +189,7 @@ const PlatformDescription g_platforms[] = {
}; };
Platform parsePlatform(const String &str) { Platform parsePlatform(const String &str) {
if (str.isEmpty()) if (str.empty())
return kPlatformUnknown; return kPlatformUnknown;
const char *s = str.c_str(); const char *s = str.c_str();
@ -245,7 +245,7 @@ const RenderModeDescription g_renderModes[] = {
}; };
RenderMode parseRenderMode(const String &str) { RenderMode parseRenderMode(const String &str) {
if (str.isEmpty()) if (str.empty())
return kRenderDefault; return kRenderDefault;
const char *s = str.c_str(); const char *s = str.c_str();

View file

@ -325,7 +325,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
detectedGames.push_back(DetectedGame(g->gameid, g->description)); detectedGames.push_back(DetectedGame(g->gameid, g->description));
} }
} }
if (detectedGames.isEmpty()) { if (detectedGames.empty()) {
printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
const PlainGameDescriptor *g1 = gob_list; const PlainGameDescriptor *g1 = gob_list;

View file

@ -188,7 +188,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
detectedGames.push_back(dg); detectedGames.push_back(dg);
} }
} }
if (detectedGames.isEmpty()) { if (detectedGames.empty()) {
printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
const PlainGameDescriptor *g1 = kyra_list; const PlainGameDescriptor *g1 = kyra_list;

View file

@ -137,7 +137,7 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
detectedGames.push_back(dg); detectedGames.push_back(dg);
} }
} }
if (detectedGames.isEmpty()) { if (detectedGames.empty()) {
debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
const PlainGameDescriptor *g1 = lure_list; const PlainGameDescriptor *g1 = lure_list;

View file

@ -189,7 +189,7 @@ MovementData::MovementData(MovementResource *rec) {
bool MovementDataList::getFrame(uint16 currentFrame, int16 &xChange, bool MovementDataList::getFrame(uint16 currentFrame, int16 &xChange,
int16 &yChange, uint16 &nextFrame) { int16 &yChange, uint16 &nextFrame) {
if (isEmpty()) return false; if (empty()) return false;
bool foundFlag = false; bool foundFlag = false;
iterator i; iterator i;

View file

@ -206,7 +206,7 @@ uint8 Room::checkRoomExits() {
Resources &res = Resources::getReference(); Resources &res = Resources::getReference();
RoomExitHotspotList &exits = _roomData->exitHotspots; RoomExitHotspotList &exits = _roomData->exitHotspots;
if (exits.isEmpty()) return CURSOR_ARROW; if (exits.empty()) return CURSOR_ARROW;
RoomExitJoinData *join; RoomExitJoinData *join;
bool skipFlag; bool skipFlag;

View file

@ -836,7 +836,7 @@ void Display::setTextCentered(uint16 y, const char *text, bool outlined) {
void Display::drawTexts() { void Display::drawTexts() {
for (int y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) { for (int y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
const TextSlot *pts = &_texts[y]; const TextSlot *pts = &_texts[y];
if (!pts->text.isEmpty()) { if (!pts->text.empty()) {
drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined); drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
} }
} }

View file

@ -1599,7 +1599,7 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
} }
} }
if (!filesMD5.isEmpty() && (matchedCount == 0)) { if (!filesMD5.empty() && (matchedCount == 0)) {
printf("MD5s of your game version are unknown. Please, report following data to\n"); printf("MD5s of your game version are unknown. Please, report following data to\n");
printf("ScummVM team along with your game name and version:\n"); printf("ScummVM team along with your game name and version:\n");

View file

@ -190,7 +190,7 @@ void Script::abortAllThreads(void) {
void Script::completeThread(void) { void Script::completeThread(void) {
int limit = (_vm->getGameType() == GType_IHNM) ? 100 : 40; int limit = (_vm->getGameType() == GType_IHNM) ? 100 : 40;
for (int i = 0; i < limit && !_threadList.isEmpty(); i++) for (int i = 0; i < limit && !_threadList.empty(); i++)
executeThreads(0); executeThreads(0);
} }

View file

@ -303,7 +303,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
case GUI::kListItemActivatedCmd: case GUI::kListItemActivatedCmd:
case GUI::kListItemDoubleClickedCmd: case GUI::kListItemDoubleClickedCmd:
if (selItem >= 0) { if (selItem >= 0) {
if (_saveMode || !getResultString().isEmpty()) { if (_saveMode || !getResultString().empty()) {
setResult(selItem); setResult(selItem);
close(); close();
} }
@ -316,7 +316,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
// Disable button if nothing is selected, or (in load mode) if an empty // Disable button if nothing is selected, or (in load mode) if an empty
// list item is selected. We allow choosing an empty item in save mode // list item is selected. We allow choosing an empty item in save mode
// because we then just assign a default name. // because we then just assign a default name.
_chooseButton->setEnabled(selItem >= 0 && (_saveMode || !getResultString().isEmpty())); _chooseButton->setEnabled(selItem >= 0 && (_saveMode || !getResultString().empty()));
_chooseButton->draw(); _chooseButton->draw();
break; break;
default: default:
@ -434,7 +434,7 @@ void SaveLoadChooserEx::handleCommand(CommandSender *sender, uint32 cmd, uint32
case GUI::kListItemActivatedCmd: case GUI::kListItemActivatedCmd:
case GUI::kListItemDoubleClickedCmd: case GUI::kListItemDoubleClickedCmd:
if (selItem >= 0) { if (selItem >= 0) {
if (_saveMode || !getResultString().isEmpty()) { if (_saveMode || !getResultString().empty()) {
_list->endEditMode(); _list->endEditMode();
setResult(selItem); setResult(selItem);
close(); close();
@ -498,7 +498,7 @@ void SaveLoadChooserEx::handleCommand(CommandSender *sender, uint32 cmd, uint32
// Disable button if nothing is selected, or (in load mode) if an empty // Disable button if nothing is selected, or (in load mode) if an empty
// list item is selected. We allow choosing an empty item in save mode // list item is selected. We allow choosing an empty item in save mode
// because we then just assign a default name. // because we then just assign a default name.
_chooseButton->setEnabled(selItem >= 0 && (_saveMode || !getResultString().isEmpty())); _chooseButton->setEnabled(selItem >= 0 && (_saveMode || !getResultString().empty()));
_chooseButton->draw(); _chooseButton->draw();
} break; } break;
case kCloseCmd: case kCloseCmd:
@ -608,10 +608,10 @@ void MainMenuDialog::save() {
_saveDialog->setList(generateSavegameList(_vm, true)); _saveDialog->setList(generateSavegameList(_vm, true));
idx = _saveDialog->runModal(); idx = _saveDialog->runModal();
if (idx >= 0) { if (idx >= 0) {
const String &result = _saveDialog->getResultString(); String result(_saveDialog->getResultString());
char buffer[20]; char buffer[20];
const char *str; const char *str;
if (result.isEmpty()) { if (result.empty()) {
// If the user was lazy and entered no save name, come up with a default name. // If the user was lazy and entered no save name, come up with a default name.
sprintf(buffer, "Save %d", idx + 1); sprintf(buffer, "Save %d", idx + 1);
str = buffer; str = buffer;

View file

@ -286,7 +286,7 @@ void ScummEngine::readRoomsOffsets() {
bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resourceFile) { bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resourceFile) {
bool result = false; bool result = false;
if (!_containerFile.isEmpty()) { if (!_containerFile.empty()) {
char name[128]; char name[128];
file.close(); file.close();

View file

@ -1450,7 +1450,7 @@ int detectGame(const FSList &fslist, bool mode, int start) {
} }
} }
if (!filesMD5.isEmpty() && start == -1) { if (!filesMD5.empty() && start == -1) {
printf("MD5s of your game version are unknown. Please, report following data to\n"); printf("MD5s of your game version are unknown. Please, report following data to\n");
printf("ScummVM team along with your game name and version:\n"); printf("ScummVM team along with your game name and version:\n");

View file

@ -352,7 +352,7 @@ void PopUpWidget::init() {
_selectedItem = -1; _selectedItem = -1;
if (!_label.isEmpty() && _labelWidth == 0) if (!_label.empty() && _labelWidth == 0)
_labelWidth = g_gui.getStringWidth(_label); _labelWidth = g_gui.getStringWidth(_label);
} }

View file

@ -150,7 +150,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
// GAME: Determine the description string // GAME: Determine the description string
String description(ConfMan.get("description", domain)); String description(ConfMan.get("description", domain));
if (description.isEmpty() && !desc.isEmpty()) { if (description.empty() && !desc.empty()) {
description = desc; description = desc;
} }
@ -202,14 +202,14 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
// GUI: Button + Label for the additional path // GUI: Button + Label for the additional path
new ButtonWidget(tab, "gameoptions_extrapath", "Extra Path:", kCmdExtraBrowser, 0); new ButtonWidget(tab, "gameoptions_extrapath", "Extra Path:", kCmdExtraBrowser, 0);
_extraPathWidget = new StaticTextWidget(tab, "gameoptions_extrapathText", extraPath); _extraPathWidget = new StaticTextWidget(tab, "gameoptions_extrapathText", extraPath);
if (extraPath.isEmpty() || !ConfMan.hasKey("extrapath", _domain)) { if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
_extraPathWidget->setLabel("None"); _extraPathWidget->setLabel("None");
} }
// GUI: Button + Label for the save path // GUI: Button + Label for the save path
new ButtonWidget(tab, "gameoptions_savepath", "Save Path: ", kCmdSaveBrowser, 0); new ButtonWidget(tab, "gameoptions_savepath", "Save Path: ", kCmdSaveBrowser, 0);
_savePathWidget = new StaticTextWidget(tab, "gameoptions_savepathText", savePath); _savePathWidget = new StaticTextWidget(tab, "gameoptions_savepathText", savePath);
if (savePath.isEmpty() || !ConfMan.hasKey("savepath", _domain)) { if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
_savePathWidget->setLabel("Default"); _savePathWidget->setLabel("Default");
} }
@ -318,15 +318,15 @@ void EditGameDialog::close() {
ConfMan.set("language", Common::getLanguageCode(lang), _domain); ConfMan.set("language", Common::getLanguageCode(lang), _domain);
String gamePath = _gamePathWidget->getLabel(); String gamePath = _gamePathWidget->getLabel();
if (!gamePath.isEmpty()) if (!gamePath.empty())
ConfMan.set("path", gamePath, _domain); ConfMan.set("path", gamePath, _domain);
String extraPath = _extraPathWidget->getLabel(); String extraPath = _extraPathWidget->getLabel();
if (!extraPath.isEmpty() && (extraPath != "None")) if (!extraPath.empty() && (extraPath != "None"))
ConfMan.set("extrapath", extraPath, _domain); ConfMan.set("extrapath", extraPath, _domain);
String savePath = _savePathWidget->getLabel(); String savePath = _savePathWidget->getLabel();
if (!savePath.isEmpty() && (savePath != "Default")) if (!savePath.empty() && (savePath != "Default"))
ConfMan.set("savepath", savePath, _domain); ConfMan.set("savepath", savePath, _domain);
Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag(); Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag();
@ -416,7 +416,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// Write back changes made to config object // Write back changes made to config object
String newDomain(_domainWidget->getEditString()); String newDomain(_domainWidget->getEditString());
if (newDomain != _domain) { if (newDomain != _domain) {
if (newDomain.isEmpty() || ConfMan.hasGameDomain(newDomain)) { if (newDomain.empty() || ConfMan.hasGameDomain(newDomain)) {
MessageDialog alert("This game ID is already taken. Please choose another one."); MessageDialog alert("This game ID is already taken. Please choose another one.");
alert.runModal(); alert.runModal();
return; return;
@ -495,7 +495,7 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
} }
void LauncherDialog::selectGame(const String &name) { void LauncherDialog::selectGame(const String &name) {
if (!name.isEmpty()) { if (!name.empty()) {
int itemToSelect = 0; int itemToSelect = 0;
StringList::const_iterator iter; StringList::const_iterator iter;
for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) { for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) {
@ -534,15 +534,15 @@ void LauncherDialog::updateListing() {
String gameid(iter->_value.get("gameid")); String gameid(iter->_value.get("gameid"));
String description(iter->_value.get("description")); String description(iter->_value.get("description"));
if (gameid.isEmpty()) if (gameid.empty())
gameid = iter->_key; gameid = iter->_key;
if (description.isEmpty()) { if (description.empty()) {
GameDescriptor g = GameDetector::findGame(gameid); GameDescriptor g = GameDetector::findGame(gameid);
if (!g.description.isEmpty()) if (!g.description.empty())
description = g.description; description = g.description;
} }
if (!gameid.isEmpty() && !description.isEmpty()) { if (!gameid.empty() && !description.empty()) {
// Insert the game into the launcher list // Insert the game into the launcher list
int pos = 0, size = l.size(); int pos = 0, size = l.size();
@ -582,7 +582,7 @@ void LauncherDialog::addGame() {
DetectedGameList candidates(PluginManager::instance().detectGames(files)); DetectedGameList candidates(PluginManager::instance().detectGames(files));
int idx; int idx;
if (candidates.isEmpty()) { if (candidates.empty()) {
// No game was found in the specified directory // No game was found in the specified directory
MessageDialog alert("ScummVM could not find any game in the specified directory!"); MessageDialog alert("ScummVM could not find any game in the specified directory!");
alert.runModal(); alert.runModal();
@ -675,7 +675,7 @@ void LauncherDialog::editGame(int item) {
// music support etc. // music support etc.
assert(item >= 0); assert(item >= 0);
String gameId(ConfMan.get("gameid", _domains[item])); String gameId(ConfMan.get("gameid", _domains[item]));
if (gameId.isEmpty()) if (gameId.empty())
gameId = _domains[item]; gameId = _domains[item];
EditGameDialog editDialog(_domains[item], GameDetector::findGame(gameId).description); EditGameDialog editDialog(_domains[item], GameDetector::findGame(gameId).description);
if (editDialog.runModal() > 0) { if (editDialog.runModal() > 0) {

View file

@ -514,7 +514,7 @@ void GlobalOptionsDialog::open() {
Common::String extraPath(ConfMan.get("extrapath", _domain)); Common::String extraPath(ConfMan.get("extrapath", _domain));
Common::String soundFont(ConfMan.get("soundfont", _domain)); Common::String soundFont(ConfMan.get("soundfont", _domain));
if (!dir.isEmpty()) { if (!dir.empty()) {
_savePath->setLabel(dir); _savePath->setLabel(dir);
} else { } else {
// Default to the current directory... // Default to the current directory...
@ -523,13 +523,13 @@ void GlobalOptionsDialog::open() {
_savePath->setLabel(buf); _savePath->setLabel(buf);
} }
if (extraPath.isEmpty() || !ConfMan.hasKey("extrapath", _domain)) { if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
_extraPath->setLabel("None"); _extraPath->setLabel("None");
} else { } else {
_extraPath->setLabel(extraPath); _extraPath->setLabel(extraPath);
} }
if (soundFont.isEmpty() || !ConfMan.hasKey("soundfont", _domain)) { if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
_soundFont->setLabel("None"); _soundFont->setLabel("None");
} else { } else {
_soundFont->setLabel(soundFont); _soundFont->setLabel(soundFont);
@ -543,11 +543,11 @@ void GlobalOptionsDialog::close() {
ConfMan.set("savepath", _savePath->getLabel(), _domain); ConfMan.set("savepath", _savePath->getLabel(), _domain);
String extraPath = _extraPath->getLabel(); String extraPath = _extraPath->getLabel();
if (!extraPath.isEmpty() && (extraPath != "None")) if (!extraPath.empty() && (extraPath != "None"))
ConfMan.set("extrapath", extraPath, _domain); ConfMan.set("extrapath", extraPath, _domain);
String soundFont = _soundFont->getLabel(); String soundFont = _soundFont->getLabel();
if (!soundFont.isEmpty() && (soundFont != "None")) if (!soundFont.empty() && (soundFont != "None"))
ConfMan.set("soundfont", soundFont, _domain); ConfMan.set("soundfont", soundFont, _domain);
} }
OptionsDialog::close(); OptionsDialog::close();

View file

@ -112,7 +112,7 @@ const MidiDriverDescription *MidiDriver::getAvailableMidiDrivers() {
} }
const MidiDriverDescription &MidiDriver::findMusicDriver(const Common::String &str) { const MidiDriverDescription &MidiDriver::findMusicDriver(const Common::String &str) {
if (str.isEmpty()) if (str.empty())
return s_musicDrivers[0]; return s_musicDrivers[0];
const char *s = str.c_str(); const char *s = str.c_str();

View file

@ -6,15 +6,15 @@
class ArrayTestSuite : public CxxTest::TestSuite class ArrayTestSuite : public CxxTest::TestSuite
{ {
public: public:
void test_isEmpty_clear( void ) void test_empty_clear( void )
{ {
Common::Array<int> array; Common::Array<int> array;
TS_ASSERT( array.isEmpty() ); TS_ASSERT( array.empty() );
array.push_back(17); array.push_back(17);
array.push_back(33); array.push_back(33);
TS_ASSERT( !array.isEmpty() ); TS_ASSERT( !array.empty() );
array.clear(); array.clear();
TS_ASSERT( array.isEmpty() ); TS_ASSERT( array.empty() );
} }
void test_iterator( void ) void test_iterator( void )

View file

@ -6,15 +6,15 @@
class ListTestSuite : public CxxTest::TestSuite class ListTestSuite : public CxxTest::TestSuite
{ {
public: public:
void test_isEmpty_clear( void ) void test_empty_clear( void )
{ {
Common::List<int> list; Common::List<int> list;
TS_ASSERT( list.isEmpty() ); TS_ASSERT( list.empty() );
list.push_back(17); list.push_back(17);
list.push_back(33); list.push_back(33);
TS_ASSERT( !list.isEmpty() ); TS_ASSERT( !list.empty() );
list.clear(); list.clear();
TS_ASSERT( list.isEmpty() ); TS_ASSERT( list.empty() );
} }
void test_iterator( void ) void test_iterator( void )

View file

@ -6,15 +6,15 @@
class MapTestSuite : public CxxTest::TestSuite class MapTestSuite : public CxxTest::TestSuite
{ {
public: public:
void test_isEmpty_clear( void ) void test_empty_clear( void )
{ {
Common::Map<int, int> map; Common::Map<int, int> map;
TS_ASSERT( map.isEmpty() ); TS_ASSERT( map.empty() );
map[0] = 17; map[0] = 17;
map[1] = 33; map[1] = 33;
TS_ASSERT( !map.isEmpty() ); TS_ASSERT( !map.empty() );
map.clear(); map.clear();
TS_ASSERT( map.isEmpty() ); TS_ASSERT( map.empty() );
} }
void test_contains( void ) void test_contains( void )
{ {

View file

@ -6,12 +6,12 @@
class StringTestSuite : public CxxTest::TestSuite class StringTestSuite : public CxxTest::TestSuite
{ {
public: public:
void test_isEmpty_clear( void ) void test_empty_clear( void )
{ {
Common::String str("test"); Common::String str("test");
TS_ASSERT( !str.isEmpty() ); TS_ASSERT( !str.empty() );
str.clear(); str.clear();
TS_ASSERT( str.isEmpty() ); TS_ASSERT( str.empty() );
} }
void test_lastChar( void ) void test_lastChar( void )