From c934642bdb7e6747a20054d7cc7b079e69bc22c2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Mar 2010 15:09:24 +0000 Subject: COMMON: Move typedef StringList from str.h to new header str-array.h This removes the dependency on array.h from str.h. Also, begun migration from the confusing type name "StringList" to the more appropriate StringArray. svn-id: r48282 --- backends/platform/sdl/graphics.cpp | 2 +- base/plugins.h | 1 + common/config-manager.cpp | 2 +- common/config-manager.h | 2 +- common/savefile.h | 5 ++-- common/str-array.h | 49 ++++++++++++++++++++++++++++++++++++++ common/str.h | 8 ------- engines/agi/predictive.cpp | 2 +- engines/agi/sound.cpp | 1 + engines/cine/msg.cpp | 2 ++ engines/cine/msg.h | 4 ++-- engines/groovie/cursor.h | 1 + engines/m4/mads_anim.h | 4 +++- engines/made/sound.h | 2 +- engines/mohawk/riven_scripts.cpp | 4 ++-- engines/mohawk/riven_scripts.h | 6 +++-- engines/mohawk/video/qdm2.h | 1 + engines/queen/credits.h | 4 ++-- engines/queen/logic.h | 4 ++-- engines/queen/resource.h | 3 ++- engines/sci/engine/kernel.h | 7 +++--- engines/sci/engine/state.h | 5 ++-- engines/sky/control.h | 7 +++--- engines/sword1/control.h | 3 ++- engines/teenagent/music.h | 1 + engines/teenagent/scene.h | 6 +++-- graphics/font.cpp | 6 ++--- graphics/font.h | 3 ++- gui/KeysDialog.cpp | 2 +- gui/ListWidget.cpp | 6 ++--- gui/ListWidget.h | 10 ++++---- gui/about.cpp | 4 ++-- gui/about.h | 4 ++-- gui/browser.cpp | 2 +- gui/chooser.cpp | 2 +- gui/chooser.h | 4 ++-- gui/debugger.cpp | 2 +- gui/launcher.cpp | 8 +++---- gui/launcher.h | 4 ++-- gui/massadd.cpp | 6 ++--- gui/massadd.h | 3 ++- gui/message.cpp | 2 +- gui/saveload.cpp | 4 ++-- gui/saveload.h | 4 ++-- gui/themebrowser.cpp | 2 +- test/common/array.h | 2 +- 46 files changed, 139 insertions(+), 77 deletions(-) create mode 100644 common/str-array.h diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 705b44215e..7cc100375c 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -1857,7 +1857,7 @@ void OSystem_SDL::displayMessageOnOSD(const char *msg) { SDL_FillRect(_osdSurface, 0, kOSDColorKey); // Split the message into separate lines. - Common::StringList lines; + Common::Array lines; const char *ptr; for (ptr = msg; *ptr; ++ptr) { if (*ptr == '\n') { diff --git a/base/plugins.h b/base/plugins.h index faf256c6b5..a4c7f114f9 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -26,6 +26,7 @@ #ifndef BASE_PLUGINS_H #define BASE_PLUGINS_H +#include "common/array.h" #include "common/error.h" #include "common/singleton.h" #include "common/util.h" diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 9d8281a748..5bb764bbb2 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -217,7 +217,7 @@ void ConfigManager::flushToDisk() { // First write the domains in _domainSaveOrder, in that order. // Note: It's possible for _domainSaveOrder to list domains which // are not present anymore. - StringList::const_iterator i; + Array::const_iterator i; for (i = _domainSaveOrder.begin(); i != _domainSaveOrder.end(); ++i) { if (kApplicationDomain == *i) { writeDomain(*stream, *i, _appDomain); diff --git a/common/config-manager.h b/common/config-manager.h index 699774dfcd..68c6c4f5ee 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -159,7 +159,7 @@ private: Domain _keymapperDomain; #endif - StringList _domainSaveOrder; + Array _domainSaveOrder; String _activeDomainName; Domain * _activeDomain; diff --git a/common/savefile.h b/common/savefile.h index d8d2dbc9c2..39be661b45 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -29,11 +29,12 @@ #include "common/noncopyable.h" #include "common/scummsys.h" #include "common/stream.h" -#include "common/str.h" +#include "common/str-array.h" #include "common/error.h" namespace Common { + /** * A class which allows game engines to load game state data. * That typically means "save games", but also includes things like the @@ -142,7 +143,7 @@ public: * @return list of strings for all present file names. * @see Common::matchString() */ - virtual StringList listSavefiles(const String &pattern) = 0; + virtual StringArray listSavefiles(const String &pattern) = 0; }; } // End of namespace Common diff --git a/common/str-array.h b/common/str-array.h new file mode 100644 index 0000000000..b8630bfadb --- /dev/null +++ b/common/str-array.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef COMMON_STRING_ARRAY_H +#define COMMON_STRING_ARRAY_H + +#include "common/array.h" +#include "common/str.h" + +namespace Common { + +/** + * An array of of strings. + */ +typedef Array StringArray; + + +/** + * Alias for type StringArray. For backwards compatibility only. + * @deprecated Use StringArray instead! + */ +typedef StringArray StringList; + + +} // End of namespace Common + +#endif diff --git a/common/str.h b/common/str.h index 829348a870..0cdd3e8c10 100644 --- a/common/str.h +++ b/common/str.h @@ -26,7 +26,6 @@ #define COMMON_STRING_H #include "common/scummsys.h" -#include "common/array.h" namespace Common { @@ -319,13 +318,6 @@ Common::String normalizePath(const Common::String &path, const char sep); bool matchString(const char *str, const char *pat, bool ignoreCase = false, bool pathMode = false); -/** - * A 'list' of strings. Actually, this is nowadays an array, and hence misnamed. - */ -typedef Array StringList; - - - /** * Take a 32 bit value and turn it into a four character string, where each of * the four bytes is turned into one character. Most significant byte is printed diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index c4b6649563..153fec641a 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -67,7 +67,7 @@ void bringWordtoTop(char *str, int wordnum) { // This function reorders the words on the given pred.dic line // by moving the word at position 'wordnum' to the front (that is, right behind // right behind the numerical code word at the start of the line). - Common::StringList words; + Common::Array words; char buf[MAXLINELEN]; if (!str) diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index 760dfd3320..24abf88c0e 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -26,6 +26,7 @@ #include "common/md5.h" #include "common/config-manager.h" #include "common/random.h" +#include "common/str-array.h" #include "agi/agi.h" diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp index a7cccf03c7..eb7167c6a3 100644 --- a/engines/cine/msg.cpp +++ b/engines/cine/msg.cpp @@ -31,6 +31,8 @@ namespace Cine { +// FIXME: Global C++ objects affect portability negatively. +// Turn this into a class member instead. Common::StringList messageTable; void loadMsg(char *pMsgName) { diff --git a/engines/cine/msg.h b/engines/cine/msg.h index ddf8ade8c2..cf51cdb48f 100644 --- a/engines/cine/msg.h +++ b/engines/cine/msg.h @@ -26,13 +26,13 @@ #ifndef CINE_MSG_H #define CINE_MSG_H -#include "common/str.h" +#include "common/str-array.h" namespace Cine { #define NUM_MAX_MESSAGE 255 -extern Common::StringList messageTable; +extern Common::StringArray messageTable; void loadMsg(char *pMsgName); diff --git a/engines/groovie/cursor.h b/engines/groovie/cursor.h index b37384bee5..6df7860e23 100644 --- a/engines/groovie/cursor.h +++ b/engines/groovie/cursor.h @@ -27,6 +27,7 @@ #define GROOVIE_CURSOR_H #include "common/system.h" +#include "common/array.h" #include "common/file.h" namespace Groovie { diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index e4732f25b2..680c5ff901 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -29,6 +29,8 @@ #include "m4/viewmgr.h" #include "m4/compression.h" +#include "common/str-array.h" + namespace M4 { enum SceneTransition { @@ -97,7 +99,7 @@ public: uint8 flags; uint16 roomNumber; uint16 frameTicks; - Common::StringList filenames; + Common::StringArray filenames; Common::String lbmFilename; Common::String spritesFilename; Common::String soundName; diff --git a/engines/made/sound.h b/engines/made/sound.h index eb2157bd42..0766c1040c 100644 --- a/engines/made/sound.h +++ b/engines/made/sound.h @@ -26,9 +26,9 @@ #ifndef MADE_SOUND_H #define MADE_SOUND_H +#include "common/array.h" #include "common/util.h" #include "common/file.h" -#include "common/list.h" #include "common/stream.h" namespace Made { diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 911ee16028..e809ad9642 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -172,7 +172,7 @@ static void printTabs(byte tabs) { printf ("\t"); } -void RivenScript::dumpScript(Common::StringList varNames, Common::StringList xNames, byte tabs) { +void RivenScript::dumpScript(Common::StringArray varNames, Common::StringArray xNames, byte tabs) { if (_stream->pos() != 0) _stream->seek(0); @@ -180,7 +180,7 @@ void RivenScript::dumpScript(Common::StringList varNames, Common::StringList xNa dumpCommands(varNames, xNames, tabs + 1); } -void RivenScript::dumpCommands(Common::StringList varNames, Common::StringList xNames, byte tabs) { +void RivenScript::dumpCommands(Common::StringArray varNames, Common::StringArray xNames, byte tabs) { uint16 commandCount = _stream->readUint16BE(); for (uint16 i = 0; i < commandCount; i++) { diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index 2879fa014d..f61abee36b 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -26,6 +26,8 @@ #ifndef RIVEN_SCRIPTS_H #define RIVEN_SCRIPTS_H +#include "common/str-array.h" + class MohawkEngine_Riven; #define DECLARE_OPCODE(x) void x(uint16 op, uint16 argc, uint16 *argv) @@ -55,7 +57,7 @@ public: ~RivenScript(); void runScript(); - void dumpScript(Common::StringList varNames, Common::StringList xNames, byte tabs); + void dumpScript(Common::StringArray varNames, Common::StringArray xNames, byte tabs); uint16 getScriptType() { return _scriptType; } // Read in an array of script objects from a stream @@ -74,7 +76,7 @@ private: Common::SeekableReadStream *_stream; uint16 _scriptType; - void dumpCommands(Common::StringList varNames, Common::StringList xNames, byte tabs); + void dumpCommands(Common::StringArray varNames, Common::StringArray xNames, byte tabs); void processCommands(bool runCommands); static uint32 calculateCommandSize(Common::SeekableReadStream* script); diff --git a/engines/mohawk/video/qdm2.h b/engines/mohawk/video/qdm2.h index a2f55a10ac..ffa5f77030 100644 --- a/engines/mohawk/video/qdm2.h +++ b/engines/mohawk/video/qdm2.h @@ -27,6 +27,7 @@ #define MOHAWK_VIDEO_QDM2_H #include "sound/audiostream.h" +#include "common/array.h" #include "common/stream.h" namespace Mohawk { diff --git a/engines/queen/credits.h b/engines/queen/credits.h index 0aafe010f4..059c651ca7 100644 --- a/engines/queen/credits.h +++ b/engines/queen/credits.h @@ -26,7 +26,7 @@ #ifndef QUEEN_CREDITS_H #define QUEEN_CREDITS_H -#include "common/util.h" +#include "common/str-array.h" #include "queen/defs.h" namespace Queen { @@ -82,7 +82,7 @@ private: uint _lineNum; //! contains the credits description - Common::StringList _credits; + Common::StringArray _credits; QueenEngine *_vm; }; diff --git a/engines/queen/logic.h b/engines/queen/logic.h index ee0a4f2270..e6924b3e41 100644 --- a/engines/queen/logic.h +++ b/engines/queen/logic.h @@ -26,7 +26,7 @@ #ifndef QUEEN_LOGIC_H #define QUEEN_LOGIC_H -#include "common/str.h" +#include "common/str-array.h" #include "common/util.h" #include "queen/structs.h" @@ -337,7 +337,7 @@ protected: //! actor initial position in room is _walkOffData[_entryObj] int16 _entryObj; - Common::StringList _jasStringList; + Common::StringArray _jasStringList; int _jasStringOffset[JSO_COUNT]; uint16 _numDescriptions; diff --git a/engines/queen/resource.h b/engines/queen/resource.h index b057827dcd..63720a0755 100644 --- a/engines/queen/resource.h +++ b/engines/queen/resource.h @@ -27,6 +27,7 @@ #define QUEEN_RESOURCE_H #include "common/file.h" +#include "common/str-array.h" #include "common/util.h" #include "queen/defs.h" @@ -74,7 +75,7 @@ public: uint8 *loadFile(const char *filename, uint32 skipBytes = 0, uint32 *size = NULL); //! loads a text file - void loadTextFile(const char *filename, Common::StringList &stringList); + void loadTextFile(const char *filename, Common::StringArray &stringList); //! returns true if the file is present in the resource bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; } diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 542612113d..a8915f4860 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -29,6 +29,7 @@ #include "common/scummsys.h" #include "common/debug.h" #include "common/rect.h" +#include "common/str-array.h" #include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS #include "sci/engine/vm_types.h" // for reg_t @@ -175,7 +176,7 @@ private: * Check for any hardcoded selector table we might have that can be used * if a game is missing the selector names. */ - Common::StringList checkStaticSelectorNames(); + Common::StringArray checkStaticSelectorNames(); /** * Maps special selectors @@ -191,8 +192,8 @@ private: uint32 features; // Kernel-related lists - Common::StringList _selectorNames; - Common::StringList _kernelNames; + Common::StringArray _selectorNames; + Common::StringArray _kernelNames; }; /******************** Text functionality ********************/ diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index f638f78d03..4f36ae00c4 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -29,6 +29,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/serializer.h" +#include "common/str-array.h" namespace Common { class SeekableReadStream; @@ -54,8 +55,8 @@ class SoundCommandParser; class DirSeeker { protected: reg_t _outbuffer; - Common::StringList _savefiles; - Common::StringList::const_iterator _iter; + Common::StringArray _savefiles; + Common::StringArray::const_iterator _iter; public: DirSeeker() { diff --git a/engines/sky/control.h b/engines/sky/control.h index 9c0e3c3cac..a0024ce73b 100644 --- a/engines/sky/control.h +++ b/engines/sky/control.h @@ -29,6 +29,7 @@ #include "common/events.h" #include "common/scummsys.h" +#include "common/str-array.h" class OSystem; namespace Common { @@ -194,8 +195,8 @@ public: uint16 _selectedGame; uint16 saveGameToFile(); - void loadDescriptions(Common::StringList &list); - void saveDescriptions(const Common::StringList &list); + void loadDescriptions(Common::StringArray &list); + void saveDescriptions(const Common::StringArray &list); private: int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4); @@ -222,7 +223,7 @@ private: void drawCross(uint16 x, uint16 y); uint16 saveRestorePanel(bool allowSave); - void setUpGameSprites(const Common::StringList &saveGameNames, DataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame); + void setUpGameSprites(const Common::StringArray &saveGameNames, DataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame); void showSprites(DataFileHeader **nameSprites, bool allowSave); void handleKeyPress(Common::KeyState kbd, Common::String &textBuf); diff --git a/engines/sword1/control.h b/engines/sword1/control.h index 6741b3dd79..a6ccb09a04 100644 --- a/engines/sword1/control.h +++ b/engines/sword1/control.h @@ -28,6 +28,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/str-array.h" #include "sword1/sworddefs.h" class OSystem; @@ -111,7 +112,7 @@ private: uint8 _numSaves; uint8 _saveScrollPos; uint8 _selectedSavegame; - Common::StringList _saveNames; + Common::StringArray _saveNames; Common::String _oldName; uint8 _cursorTick; bool _cursorVisible; diff --git a/engines/teenagent/music.h b/engines/teenagent/music.h index 9c518b58e0..c1f5765a55 100644 --- a/engines/teenagent/music.h +++ b/engines/teenagent/music.h @@ -27,6 +27,7 @@ #define TEEN_MUSIC_H #include "sound/mods/paula.h" +#include "common/array.h" namespace TeenAgent { diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index bf01e211ef..92e5e05c04 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -27,12 +27,14 @@ #include "teenagent/surface.h" #include "teenagent/actor.h" -#include "common/system.h" -#include "common/list.h" #include "teenagent/objects.h" #include "teenagent/surface.h" #include "teenagent/surface_list.h" +#include "common/system.h" +#include "common/array.h" +#include "common/list.h" + namespace TeenAgent { class TeenAgentEngine; diff --git a/graphics/font.cpp b/graphics/font.cpp index c6053e9eb3..629f2f4b82 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -864,10 +864,10 @@ void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, in struct WordWrapper { - Common::StringList &lines; + Common::Array &lines; int actualMaxLineWidth; - WordWrapper(Common::StringList &l) : lines(l), actualMaxLineWidth(0) { + WordWrapper(Common::Array &l) : lines(l), actualMaxLineWidth(0) { } void add(Common::String &line, int &w) { @@ -881,7 +881,7 @@ struct WordWrapper { } }; -int Font::wordWrapText(const Common::String &str, int maxWidth, Common::StringList &lines) const { +int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array &lines) const { WordWrapper wrapper(lines); Common::String line; Common::String tmpStr; diff --git a/graphics/font.h b/graphics/font.h index e1c052c9e1..6927e0e076 100644 --- a/graphics/font.h +++ b/graphics/font.h @@ -26,6 +26,7 @@ #define GRAPHICS_FONT_H #include "common/str.h" +#include "common/array.h" #include "graphics/surface.h" namespace Common { @@ -78,7 +79,7 @@ public: * @param lines the string list to which the text lines from str are appended * @return the maximal width of any of the lines added to lines */ - int wordWrapText(const Common::String &str, int maxWidth, Common::StringList &lines) const; + int wordWrapText(const Common::String &str, int maxWidth, Common::Array &lines) const; }; diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp index 7a9256e30f..103ae918ef 100644 --- a/gui/KeysDialog.cpp +++ b/gui/KeysDialog.cpp @@ -55,7 +55,7 @@ KeysDialog::KeysDialog(const Common::String &title) _keyMapping->setFlags(WIDGET_CLEARBG); // Get actions names - Common::StringList l; + ListWidget::StringArray l; for (int i = 0; i < Actions::Instance()->size(); i++) l.push_back(Actions::Instance()->actionName((ActionType)i)); diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index f138fe7cc1..80289b9b80 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -152,7 +152,7 @@ ThemeEngine::FontColor ListWidget::getSelectionColor() const { return _listColors[_listIndex[_selectedItem]]; } -void ListWidget::setList(const StringList &list, const ColorList *colors) { +void ListWidget::setList(const StringArray &list, const ColorList *colors) { if (_editMode && _caretVisible) drawCaret(true); @@ -306,7 +306,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) { int newSelectedItem = 0; int bestMatch = 0; bool stop; - for (StringList::const_iterator i = _list.begin(); i != _list.end(); ++i) { + for (StringArray::const_iterator i = _list.begin(); i != _list.end(); ++i) { const int match = matchingCharsIgnoringCase(i->c_str(), _quickSelectStr.c_str(), stop); if (match > bestMatch || stop) { _selectedItem = newSelectedItem; @@ -692,7 +692,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) { _list.clear(); _listIndex.clear(); - for (StringList::iterator i = _dataList.begin(); i != _dataList.end(); ++i, ++n) { + for (StringArray::iterator i = _dataList.begin(); i != _dataList.end(); ++i, ++n) { tmp = *i; tmp.toLowercase(); bool matches = true; diff --git a/gui/ListWidget.h b/gui/ListWidget.h index 9b9949c299..02f2c22e7c 100644 --- a/gui/ListWidget.h +++ b/gui/ListWidget.h @@ -52,11 +52,11 @@ enum { class ListWidget : public EditableWidget { public: typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array StringArray; typedef Common::Array ColorList; protected: - StringList _list; - StringList _dataList; + StringArray _list; + StringArray _dataList; ColorList _listColors; Common::Array _listIndex; bool _editable; @@ -93,8 +93,8 @@ public: virtual Widget *findWidget(int x, int y); - void setList(const StringList &list, const ColorList *colors = 0); - const StringList &getList() const { return _dataList; } + void setList(const StringArray &list, const ColorList *colors = 0); + const StringArray &getList() const { return _dataList; } void append(const String &s, ThemeEngine::FontColor color = ThemeEngine::kFontColorNormal); diff --git a/gui/about.cpp b/gui/about.cpp index 650c42d97c..74851caf94 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -164,10 +164,10 @@ void AboutDialog::addLine(const char *str) { Common::String format(str, 2); str += 2; - Common::StringList wrappedLines; + StringArray wrappedLines; g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, wrappedLines); - for (Common::StringList::const_iterator i = wrappedLines.begin(); i != wrappedLines.end(); ++i) { + for (StringArray::const_iterator i = wrappedLines.begin(); i != wrappedLines.end(); ++i) { _lines.push_back(format + *i); } } diff --git a/gui/about.h b/gui/about.h index d62510b1a6..fc216a78dc 100644 --- a/gui/about.h +++ b/gui/about.h @@ -32,11 +32,11 @@ namespace GUI { class AboutDialog : public Dialog { - typedef Common::StringList StringList; + typedef Common::Array StringArray; protected: int _scrollPos; uint32 _scrollTime; - StringList _lines; + StringArray _lines; uint32 _lineHeight; bool _willClose; diff --git a/gui/browser.cpp b/gui/browser.cpp index 906ca0dbe0..c090742988 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -150,7 +150,7 @@ void BrowserDialog::updateListing() { Common::sort(_nodeContent.begin(), _nodeContent.end()); // Populate the ListWidget - Common::StringList list; + ListWidget::StringArray list; ListWidget::ColorList colors; for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { if (i->isDirectory()) diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 04f68a60b0..0155bb2afb 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -50,7 +50,7 @@ ChooserDialog::ChooserDialog(const String &title, String dialogId) _chooseButton->setEnabled(false); } -void ChooserDialog::setList(const StringList& list) { +void ChooserDialog::setList(const StringArray& list) { _list->setList(list); } diff --git a/gui/chooser.h b/gui/chooser.h index 836f30bd8c..ce67c008df 100644 --- a/gui/chooser.h +++ b/gui/chooser.h @@ -39,7 +39,7 @@ class ListWidget; class ChooserDialog : public Dialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array StringArray; protected: ListWidget *_list; ButtonWidget *_chooseButton; @@ -47,7 +47,7 @@ protected: public: ChooserDialog(const String &title, String dialogId = "Browser"); - void setList(const StringList& list); + void setList(const StringArray& list); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); }; diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 39e5d7d3bb..fa1c12f28e 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -427,7 +427,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) { DebugPrintf("Commands are:\n"); // Obtain a list of sorted command names - Common::StringList cmds; + Common::Array cmds; CommandsMap::const_iterator iter, e = _cmds.end(); for (iter = _cmds.begin(); iter != e; ++iter) { cmds.push_back(iter->_key); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 0b26c6c44e..ae23fe9499 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -119,7 +119,7 @@ protected: class EditGameDialog : public OptionsDialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array StringArray; public: EditGameDialog(const String &domain, const String &desc); @@ -553,7 +553,7 @@ LauncherDialog::LauncherDialog() void LauncherDialog::selectTarget(const String &target) { if (!target.empty()) { int itemToSelect = 0; - StringList::const_iterator iter; + StringArray::const_iterator iter; for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) { if (target == *iter) { _list->setSelected(itemToSelect); @@ -593,7 +593,7 @@ void LauncherDialog::close() { } void LauncherDialog::updateListing() { - Common::StringList l; + StringArray l; // Retrieve a list of all games defined in the config file _domains.clear(); @@ -722,7 +722,7 @@ void LauncherDialog::addGame() { idx = 0; } else { // Display the candidates to the user and let her/him pick one - StringList list; + StringArray list; for (idx = 0; idx < (int)candidates.size(); idx++) list.push_back(candidates[idx].description()); diff --git a/gui/launcher.h b/gui/launcher.h index ceb44d9e8e..df9a6fb639 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -40,7 +40,7 @@ Common::String addGameToConf(const GameDescriptor &result); class LauncherDialog : public Dialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array StringArray; public: LauncherDialog(); ~LauncherDialog(); @@ -64,7 +64,7 @@ protected: #endif StaticTextWidget *_searchDesc; ButtonWidget *_searchClearButton; - StringList _domains; + StringArray _domains; BrowserDialog *_browser; SaveLoadChooser *_loadDialog; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 8a1206ee31..91c1b6c459 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -66,7 +66,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) _dirProgressText(0), _gameProgressText(0) { - Common::StringList l; + StringArray l; // The dir we start our scan at _scanStack.push(startDir); @@ -199,8 +199,8 @@ void MassAddDialog::handleTickle() { // Check for existing config entries for this path/gameid/lang/platform combination if (_pathToTargets.contains(path)) { bool duplicate = false; - const Common::StringList &targets = _pathToTargets[path]; - for (Common::StringList::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { + const StringArray &targets = _pathToTargets[path]; + for (StringArray::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { // If the gameid, platform and language match -> skip it Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter); assert(dom); diff --git a/gui/massadd.h b/gui/massadd.h index e37df9f426..31a8821a26 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -37,6 +37,7 @@ namespace GUI { class StaticTextWidget; class MassAddDialog : public Dialog { + typedef Common::Array StringArray; public: MassAddDialog(const Common::FSNode &startDir); @@ -59,7 +60,7 @@ private: * Used to detect whether a potential new target is already present in the * config manager. */ - Common::HashMap _pathToTargets; + Common::HashMap _pathToTargets; int _dirsScanned; diff --git a/gui/message.cpp b/gui/message.cpp index e4f0bb12da..12ac3123a4 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -53,7 +53,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB // down the string into lines, and taking the maximum of their widths. // Using this, and accounting for the space the button(s) need, we can set // the real size of the dialog - Common::StringList lines; + Common::Array lines; int lineCount, okButtonPos, cancelButtonPos; int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 247b7bdeb8..8ec4dc4133 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -313,7 +313,7 @@ void SaveLoadChooser::close() { _plugin = 0; _target.clear(); _saveList.clear(); - _list->setList(StringList()); + _list->setList(StringArray()); Dialog::close(); } @@ -323,7 +323,7 @@ void SaveLoadChooser::updateSaveList() { int curSlot = 0; int saveSlot = 0; - StringList saveNames; + StringArray saveNames; ListWidget::ColorList colors; for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { // Handle gaps in the list of save games diff --git a/gui/saveload.h b/gui/saveload.h index d1f58b1f59..dde70c9a7a 100644 --- a/gui/saveload.h +++ b/gui/saveload.h @@ -35,7 +35,7 @@ class GraphicsWidget; class SaveLoadChooser : public GUI::Dialog { typedef Common::String String; - typedef Common::StringList StringList; + typedef Common::Array StringArray; protected: GUI::ListWidget *_list; GUI::ButtonWidget *_chooseButton; @@ -65,7 +65,7 @@ public: ~SaveLoadChooser(); virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); - void setList(const StringList& list); + void setList(const StringArray& list); int runModal(const EnginePlugin *plugin, const String &target); void open(); diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index cd207c54fe..5d0e24394f 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -100,7 +100,7 @@ void ThemeBrowser::updateListing() { const Common::String currentThemeId = g_gui.theme()->getThemeId(); int currentThemeIndex = 0, index = 0; - Common::StringList list; + ListWidget::StringArray list; for (ThemeDescList::const_iterator i = _themes.begin(); i != _themes.end(); ++i, ++index) { list.push_back(i->name); diff --git a/test/common/array.h b/test/common/array.h index 5ab6b73ef1..c85e056b19 100644 --- a/test/common/array.h +++ b/test/common/array.h @@ -196,7 +196,7 @@ class ArrayTestSuite : public CxxTest::TestSuite void test_array_constructor_str() { const char *array1[] = { "a", "b", "c" }; - Common::StringList array2(array1, 3); + Common::Array array2(array1, 3); TS_ASSERT_EQUALS(array2[0], "a"); TS_ASSERT_EQUALS(array2[1], "b"); -- cgit v1.2.3