renamed (Const)Iterator to (const_)iterator; changed size() to return an uint

svn-id: r12722
This commit is contained in:
Max Horn 2004-02-05 00:19:57 +00:00
parent dc852177fb
commit f59eb3b219
27 changed files with 63 additions and 71 deletions

View file

@ -167,7 +167,7 @@ static const char *checkDetect(const FilesystemNode *entry)
DetectedGameList candidates;
const PluginList &plugins = PluginManager::instance().getPlugins();
PluginList::ConstIterator iter = plugins.begin();
PluginList::const_iterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
candidates.push_back((*iter)->detectGames(files));
}
@ -278,7 +278,7 @@ static int findGames(Game *games, int max)
dirs[curr_dir].deficon[0] = '\0';
FSList *fslist = dirs[curr_dir++].node->listDir(FilesystemNode::kListAll);
if (fslist != NULL) {
for (FSList::ConstIterator entry = fslist->begin(); entry != fslist->end();
for (FSList::const_iterator entry = fslist->begin(); entry != fslist->end();
++entry) {
if (entry->isDirectory()) {
if(num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(),

View file

@ -151,14 +151,14 @@ public:
*/
class FSList : Common::List<FilesystemNode *> {
public:
class ConstIterator {
class const_iterator {
friend class FSList;
FilesystemNode **_data;
ConstIterator(FilesystemNode **data) : _data(data) { }
const_iterator(FilesystemNode **data) : _data(data) { }
public:
const FilesystemNode &operator *() const { return **_data; }
const FilesystemNode *operator->() const { return *_data; }
bool operator !=(const ConstIterator &iter) const { return _data != iter._data; }
bool operator !=(const const_iterator &iter) const { return _data != iter._data; }
void operator ++() { ++_data; }
};
@ -187,12 +187,12 @@ public:
int size() const { return _size; }
ConstIterator begin() const {
return ConstIterator(_data);
const_iterator begin() const {
return const_iterator(_data);
}
ConstIterator end() const {
return ConstIterator(_data + _size);
const_iterator end() const {
return const_iterator(_data + _size);
}
};

View file

@ -99,7 +99,7 @@ void CELauncherDialog::automaticScanDirectory(const FilesystemNode *node) {
addCandidate(node->path(), candidates);
// Then recurse on the subdirectories
FSList *dirs = node->listDir(FilesystemNode::kListDirectoriesOnly);
for (FSList::ConstIterator currentDir = dirs->begin(); currentDir != dirs->end(); ++currentDir)
for (FSList::const_iterator currentDir = dirs->begin(); currentDir != dirs->end(); ++currentDir)
automaticScanDirectory(&(*currentDir));
}

View file

@ -42,7 +42,7 @@ namespace CEGUI {
}
bool Panel::draw(SDL_Surface *surface) {
ItemMap::ConstIterator iterator;
ItemMap::const_iterator iterator;
if (!_drawn && _visible) {
GUIElement::draw(surface);
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator) {
@ -55,14 +55,14 @@ namespace CEGUI {
}
void Panel::forceRedraw() {
ItemMap::ConstIterator iterator;
ItemMap::const_iterator iterator;
GUIElement::forceRedraw();
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator)
((GUIElement*)(iterator->_value))->forceRedraw();
}
bool Panel::action(int x, int y, bool pushed) {
ItemMap::ConstIterator iterator;
ItemMap::const_iterator iterator;
bool result = false;
if (!checkInside(x, y))
return false;

View file

@ -159,10 +159,10 @@ void listGames() {
printf("Game ID Full Title \n"
"-------------------- ------------------------------------------------------\n");
PluginList::ConstIterator iter = plugins.begin();
PluginList::const_iterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
GameList list = (*iter)->getSupportedGames();
for (GameList::Iterator v = list.begin(); v != list.end(); ++v) {
for (GameList::iterator v = list.begin(); v != list.end(); ++v) {
printf("%-20s %s\n", v->name, v->description);
}
}
@ -176,7 +176,7 @@ void listTargets() {
printf("Target Description \n"
"-------------------- ------------------------------------------------------\n");
ConfigManager::DomainMap::ConstIterator iter = domains.begin();
ConfigManager::DomainMap::const_iterator iter = domains.begin();
for (iter = domains.begin(); iter != domains.end(); ++iter) {
String name(iter->_key);
String description(iter->_value.get("description"));
@ -196,7 +196,7 @@ GameSettings GameDetector::findGame(const String &gameName, const Plugin **plugi
const PluginList &plugins = PluginManager::instance().getPlugins();
GameSettings result = {NULL, NULL, 0};
PluginList::ConstIterator iter = plugins.begin();
PluginList::const_iterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
result = (*iter)->findGame(gameName.c_str());
if (result.name) {

View file

@ -53,7 +53,7 @@ GameSettings Plugin::findGame(const char *gameName) const {
assert(gameName);
GameList games = getSupportedGames();
GameSettings result = {NULL, NULL, 0};
for (GameList::Iterator g = games.begin(); g != games.end(); ++g) {
for (GameList::iterator g = games.begin(); g != games.end(); ++g) {
if (!scumm_stricmp(g->name, gameName)) {
result = *g;
break;
@ -254,7 +254,7 @@ void PluginManager::loadPlugins() {
}
void PluginManager::unloadPlugins() {
int i;
uint i;
for (i = 0; i < _plugins.size(); i++) {
_plugins[i]->unloadPlugin();
delete _plugins[i];
@ -281,7 +281,7 @@ DetectedGameList PluginManager::detectGames(const FSList &fslist) const {
// Iterate over all known games and for each check if it might be
// the game in the presented directory.
PluginList::ConstIterator iter;
PluginList::const_iterator iter;
for (iter = _plugins.begin(); iter != _plugins.end(); ++iter) {
candidates.push_back((*iter)->detectGames(fslist));
}

View file

@ -171,7 +171,7 @@ void ConfigManager::flushToDisk() {
if (!(cfg_file = fopen(_filename.c_str(), "w"))) {
warning("Unable to write configuration file: %s.\n", _filename.c_str());
} else {
DomainMap::ConstIterator d;
DomainMap::const_iterator d;
// First write the global domains
for (d = _globalDomains.begin(); d != _globalDomains.end(); ++d) {
@ -193,7 +193,7 @@ void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &do
fprintf(file, "[%s]\n", name.c_str());
Domain::ConstIterator x;
Domain::const_iterator x;
for (x = domain.begin(); x != domain.end(); ++x) {
const String &value = x->_value;
if (!value.isEmpty())
@ -218,7 +218,7 @@ bool ConfigManager::hasKey(const String &key) const {
if (!_activeDomain.isEmpty() && _gameDomains[_activeDomain].contains(key))
return true;
DomainMap::ConstIterator iter;
DomainMap::const_iterator iter;
for (iter = _globalDomains.begin(); iter != _globalDomains.end(); ++iter) {
if (iter->_value.contains(key))
return true;
@ -273,7 +273,7 @@ const String & ConfigManager::get(const String &key, const String &domain) const
if (!dom.isEmpty() && _gameDomains.contains(dom) && _gameDomains[dom].contains(key))
return _gameDomains[dom][key];
DomainMap::ConstIterator iter;
DomainMap::const_iterator iter;
for (iter = _globalDomains.begin(); iter != _globalDomains.end(); ++iter) {
if (iter->_value.contains(key))
return iter->_value[key];

View file

@ -34,8 +34,8 @@ protected:
T *_data;
public:
typedef T *Iterator;
typedef const T *ConstIterator;
typedef T *iterator;
typedef const T *const_iterator;
public:
List<T>() : _capacity(0), _size(0), _data(0) {}
@ -103,7 +103,7 @@ public:
return *this;
}
int size() const {
uint size() const {
return _size;
}
@ -121,19 +121,19 @@ public:
}
Iterator begin() {
iterator begin() {
return _data;
}
Iterator end() {
iterator end() {
return _data + _size;
}
ConstIterator begin() const {
const_iterator begin() const {
return _data;
}
ConstIterator end() const {
const_iterator end() const {
return _data + _size;
}

View file

@ -68,19 +68,19 @@ private:
Map<Key, Value, Comparator> &operator =(const Map<Key, Value, Comparator> &map);
public:
class ConstIterator {
class const_iterator {
friend class Map<Key, Value, Comparator>;
protected:
Node *_node;
ConstIterator(Node *node) : _node(node) {}
const_iterator(Node *node) : _node(node) {}
public:
ConstIterator() : _node(0) {}
const_iterator() : _node(0) {}
Node &operator *() { assert(_node != 0); return *_node; }
const Node &operator *() const { assert(_node != 0); return *_node; }
const Node *operator->() const { assert(_node != 0); return _node; }
bool operator !=(const ConstIterator &iter) const { return _node != iter._node; }
bool operator !=(const const_iterator &iter) const { return _node != iter._node; }
void operator ++() {
if (!_node)
return;
@ -203,17 +203,17 @@ public:
merge(map._root);
}
ConstIterator begin() const {
const_iterator begin() const {
Node *node = _root;
if (node) {
while (node->_left)
node = node->_left;
}
return ConstIterator(node);
return const_iterator(node);
}
ConstIterator end() const {
return ConstIterator();
const_iterator end() const {
return const_iterator();
}
protected:

View file

@ -67,7 +67,7 @@ public:
}
const char *c_str() const { return _str ? _str : ""; }
int size() const { return _len; }
uint size() const { return _len; }
bool isEmpty() const { return (_len == 0); }
};

View file

@ -59,7 +59,7 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount){
x += _labelOffset;
int width = 0;
int i;
uint i;
for (i = 0; i < _label.size(); ++i) {
width += gui->getCharWidth(_label[i]);
@ -112,7 +112,7 @@ bool EditTextWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
}
break;
case 256 + 19: // right arrow
if (_pos < _label.size()) {
if (_pos < (int)_label.size()) {
_pos++;
dirty = adjustOffset();
}

View file

@ -23,7 +23,6 @@
#include "gui/widget.h"
#include "common/str.h"
#include "common/list.h"
namespace GUI {

View file

@ -97,7 +97,7 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) {
if (isEnabled()) {
int oldSelectedItem = _selectedItem;
_selectedItem = (y - 1) / kLineHeight + _currentPos;
if (_selectedItem > _list.size() - 1)
if (_selectedItem > (int)_list.size() - 1)
_selectedItem = -1;
if (oldSelectedItem != _selectedItem) {
@ -183,7 +183,7 @@ bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
_selectedItem--;
break;
case 256+18: // down arrow
if (_selectedItem < _list.size() - 1)
if (_selectedItem < (int)_list.size() - 1)
_selectedItem++;
break;
case 256+24: // pageup
@ -193,7 +193,7 @@ bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
break;
case 256+25: // pagedown
_selectedItem += _entriesPerPage - 1;
if (_selectedItem >= _list.size() )
if (_selectedItem >= (int)_list.size() )
_selectedItem = _list.size() - 1;
break;
case 256+22: // home

View file

@ -23,7 +23,6 @@
#include "gui/widget.h"
#include "common/str.h"
#include "common/list.h"
namespace GUI {

View file

@ -307,7 +307,7 @@ void PopUpWidget::clearEntries() {
void PopUpWidget::setSelected(int item) {
// FIXME
if (item != _selectedItem) {
if (item >= 0 && item < _entries.size()) {
if (item >= 0 && item < (int)_entries.size()) {
_selectedItem = item;
} else {
_selectedItem = -1;

View file

@ -45,7 +45,7 @@ TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
}
TabWidget::~TabWidget() {
for (int i = 0; i < _tabs.size(); ++i) {
for (uint i = 0; i < _tabs.size(); ++i) {
delete _tabs[i].firstWidget;
_tabs[i].firstWidget = 0;
}
@ -81,7 +81,7 @@ int TabWidget::addTab(const String &title) {
}
void TabWidget::setActiveTab(int tabID) {
assert(0 <= tabID && tabID < _tabs.size());
assert(0 <= tabID && tabID < (int)_tabs.size());
if (_activeTab != tabID) {
// Exchange the widget lists, and switch to the new tab
if (_activeTab != -1)
@ -101,7 +101,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
x -= kTabLeftOffset;
if (x >= 0 && x % (_tabWidth + kTabSpacing) < _tabWidth) {
tabID = x / (_tabWidth + kTabSpacing);
if (tabID >= _tabs.size())
if (tabID >= (int)_tabs.size())
tabID = -1;
}
@ -126,7 +126,7 @@ void TabWidget::drawWidget(bool hilite) {
// Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset;
for (i = 0; i < _tabs.size(); ++i) {
for (i = 0; i < (int)_tabs.size(); ++i) {
NewGuiColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor;
int yOffset = (i == _activeTab) ? 0 : 2;
gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color);

View file

@ -21,9 +21,8 @@
#ifndef BROWSER_DIALOG_H
#define BROWSER_DIALOG_H
#include "dialog.h"
#include "gui/dialog.h"
#include "common/str.h"
#include "common/list.h"
#ifdef MACOSX
#include <Carbon/Carbon.h>

View file

@ -22,7 +22,6 @@
#define CHOOSER_DIALOG_H
#include "common/str.h"
#include "common/list.h"
#include "gui/dialog.h"
namespace GUI {

View file

@ -356,7 +356,7 @@ void LauncherDialog::updateListing() {
// Retrieve a list of all games defined in the config file
_domains.clear();
const ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
ConfigManager::DomainMap::ConstIterator iter = domains.begin();
ConfigManager::DomainMap::const_iterator iter = domains.begin();
for (iter = domains.begin(); iter != domains.end(); ++iter) {
String name(iter->_value.get("gameid"));
String description(iter->_value.get("description"));
@ -417,14 +417,14 @@ void LauncherDialog::addGame() {
} else {
// Display the candidates to the user and let her/him pick one
StringList list;
for (idx = 0; idx < candidates.size(); idx++)
for (idx = 0; idx < (int)candidates.size(); idx++)
list.push_back(candidates[idx].description);
ChooserDialog dialog("Pick the game:");
dialog.setList(list);
idx = dialog.runModal();
}
if (0 <= idx && idx < candidates.size()) {
if (0 <= idx && idx < (int)candidates.size()) {
DetectedGame result = candidates[idx];
// The auto detector or the user made a choice.

View file

@ -22,11 +22,7 @@
#define MESSAGE_DIALOG_H
#include "gui/dialog.h"
namespace Common {
class String;
class StringList;
}
#include "common/str.h"
namespace GUI {

View file

@ -459,7 +459,7 @@ void NewGui::drawChar(byte chr, int xx, int yy, NewGuiColor color) {
int NewGui::getStringWidth(const String &str) {
int space = 0;
for (int i = 0; i < str.size(); ++i)
for (uint i = 0; i < str.size(); ++i)
space += getCharWidth(str[i]);
return space;
}
@ -483,7 +483,7 @@ int NewGui::getCharWidth(byte c) {
void NewGui::drawString(const String &s, int x, int y, int w, NewGuiColor color, int align, int deltax, bool useEllipsis) {
const int leftX = x, rightX = x + w;
int i;
uint i;
int width = getStringWidth(s);
String str;

View file

@ -69,7 +69,7 @@ DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *gameName = file->displayName().c_str();
if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {

View file

@ -2914,7 +2914,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
}
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *name = file->displayName().c_str();
if ((0 == scumm_stricmp(detectName, name)) ||

View file

@ -98,7 +98,7 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
strcat(detectName2, ".");
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *name = file->displayName().c_str();
if ((0 == scumm_stricmp(detectName, name)) ||

View file

@ -88,7 +88,7 @@ GameList Engine_SKY_gameList() {
DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *fileName = file->displayName().c_str();
if (0 == scumm_stricmp("sky.dsk", fileName)) {

View file

@ -57,7 +57,7 @@ DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *gameName = file->displayName().c_str();
if ((0 == scumm_stricmp("swordres.rif", gameName)) ||

View file

@ -68,7 +68,7 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
for (g = sword2_settings; g->name; ++g) {
// Iterate over all files in the given directory
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
const char *gameName = file->displayName().c_str();
if (0 == scumm_stricmp(g->detectname, gameName)) {