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
This commit is contained in:
Max Horn 2010-03-18 15:09:24 +00:00
parent 30c84d2cff
commit c934642bdb
46 changed files with 139 additions and 77 deletions

View file

@ -1857,7 +1857,7 @@ void OSystem_SDL::displayMessageOnOSD(const char *msg) {
SDL_FillRect(_osdSurface, 0, kOSDColorKey); SDL_FillRect(_osdSurface, 0, kOSDColorKey);
// Split the message into separate lines. // Split the message into separate lines.
Common::StringList lines; Common::Array<Common::String> lines;
const char *ptr; const char *ptr;
for (ptr = msg; *ptr; ++ptr) { for (ptr = msg; *ptr; ++ptr) {
if (*ptr == '\n') { if (*ptr == '\n') {

View file

@ -26,6 +26,7 @@
#ifndef BASE_PLUGINS_H #ifndef BASE_PLUGINS_H
#define BASE_PLUGINS_H #define BASE_PLUGINS_H
#include "common/array.h"
#include "common/error.h" #include "common/error.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "common/util.h" #include "common/util.h"

View file

@ -217,7 +217,7 @@ void ConfigManager::flushToDisk() {
// First write the domains in _domainSaveOrder, in that order. // First write the domains in _domainSaveOrder, in that order.
// Note: It's possible for _domainSaveOrder to list domains which // Note: It's possible for _domainSaveOrder to list domains which
// are not present anymore. // are not present anymore.
StringList::const_iterator i; Array<String>::const_iterator i;
for (i = _domainSaveOrder.begin(); i != _domainSaveOrder.end(); ++i) { for (i = _domainSaveOrder.begin(); i != _domainSaveOrder.end(); ++i) {
if (kApplicationDomain == *i) { if (kApplicationDomain == *i) {
writeDomain(*stream, *i, _appDomain); writeDomain(*stream, *i, _appDomain);

View file

@ -159,7 +159,7 @@ private:
Domain _keymapperDomain; Domain _keymapperDomain;
#endif #endif
StringList _domainSaveOrder; Array<String> _domainSaveOrder;
String _activeDomainName; String _activeDomainName;
Domain * _activeDomain; Domain * _activeDomain;

View file

@ -29,11 +29,12 @@
#include "common/noncopyable.h" #include "common/noncopyable.h"
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/stream.h" #include "common/stream.h"
#include "common/str.h" #include "common/str-array.h"
#include "common/error.h" #include "common/error.h"
namespace Common { namespace Common {
/** /**
* A class which allows game engines to load game state data. * A class which allows game engines to load game state data.
* That typically means "save games", but also includes things like the * 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. * @return list of strings for all present file names.
* @see Common::matchString() * @see Common::matchString()
*/ */
virtual StringList listSavefiles(const String &pattern) = 0; virtual StringArray listSavefiles(const String &pattern) = 0;
}; };
} // End of namespace Common } // End of namespace Common

49
common/str-array.h Normal file
View file

@ -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<String> StringArray;
/**
* Alias for type StringArray. For backwards compatibility only.
* @deprecated Use StringArray instead!
*/
typedef StringArray StringList;
} // End of namespace Common
#endif

View file

@ -26,7 +26,6 @@
#define COMMON_STRING_H #define COMMON_STRING_H
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/array.h"
namespace Common { 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); 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<String> StringList;
/** /**
* Take a 32 bit value and turn it into a four character string, where each of * 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 * the four bytes is turned into one character. Most significant byte is printed

View file

@ -67,7 +67,7 @@ void bringWordtoTop(char *str, int wordnum) {
// This function reorders the words on the given pred.dic line // 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 // 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). // right behind the numerical code word at the start of the line).
Common::StringList words; Common::Array<Common::String> words;
char buf[MAXLINELEN]; char buf[MAXLINELEN];
if (!str) if (!str)

View file

@ -26,6 +26,7 @@
#include "common/md5.h" #include "common/md5.h"
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/random.h" #include "common/random.h"
#include "common/str-array.h"
#include "agi/agi.h" #include "agi/agi.h"

View file

@ -31,6 +31,8 @@
namespace Cine { namespace Cine {
// FIXME: Global C++ objects affect portability negatively.
// Turn this into a class member instead.
Common::StringList messageTable; Common::StringList messageTable;
void loadMsg(char *pMsgName) { void loadMsg(char *pMsgName) {

View file

@ -26,13 +26,13 @@
#ifndef CINE_MSG_H #ifndef CINE_MSG_H
#define CINE_MSG_H #define CINE_MSG_H
#include "common/str.h" #include "common/str-array.h"
namespace Cine { namespace Cine {
#define NUM_MAX_MESSAGE 255 #define NUM_MAX_MESSAGE 255
extern Common::StringList messageTable; extern Common::StringArray messageTable;
void loadMsg(char *pMsgName); void loadMsg(char *pMsgName);

View file

@ -27,6 +27,7 @@
#define GROOVIE_CURSOR_H #define GROOVIE_CURSOR_H
#include "common/system.h" #include "common/system.h"
#include "common/array.h"
#include "common/file.h" #include "common/file.h"
namespace Groovie { namespace Groovie {

View file

@ -29,6 +29,8 @@
#include "m4/viewmgr.h" #include "m4/viewmgr.h"
#include "m4/compression.h" #include "m4/compression.h"
#include "common/str-array.h"
namespace M4 { namespace M4 {
enum SceneTransition { enum SceneTransition {
@ -97,7 +99,7 @@ public:
uint8 flags; uint8 flags;
uint16 roomNumber; uint16 roomNumber;
uint16 frameTicks; uint16 frameTicks;
Common::StringList filenames; Common::StringArray filenames;
Common::String lbmFilename; Common::String lbmFilename;
Common::String spritesFilename; Common::String spritesFilename;
Common::String soundName; Common::String soundName;

View file

@ -26,9 +26,9 @@
#ifndef MADE_SOUND_H #ifndef MADE_SOUND_H
#define MADE_SOUND_H #define MADE_SOUND_H
#include "common/array.h"
#include "common/util.h" #include "common/util.h"
#include "common/file.h" #include "common/file.h"
#include "common/list.h"
#include "common/stream.h" #include "common/stream.h"
namespace Made { namespace Made {

View file

@ -172,7 +172,7 @@ static void printTabs(byte tabs) {
printf ("\t"); 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) if (_stream->pos() != 0)
_stream->seek(0); _stream->seek(0);
@ -180,7 +180,7 @@ void RivenScript::dumpScript(Common::StringList varNames, Common::StringList xNa
dumpCommands(varNames, xNames, tabs + 1); 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(); uint16 commandCount = _stream->readUint16BE();
for (uint16 i = 0; i < commandCount; i++) { for (uint16 i = 0; i < commandCount; i++) {

View file

@ -26,6 +26,8 @@
#ifndef RIVEN_SCRIPTS_H #ifndef RIVEN_SCRIPTS_H
#define RIVEN_SCRIPTS_H #define RIVEN_SCRIPTS_H
#include "common/str-array.h"
class MohawkEngine_Riven; class MohawkEngine_Riven;
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 argc, uint16 *argv) #define DECLARE_OPCODE(x) void x(uint16 op, uint16 argc, uint16 *argv)
@ -55,7 +57,7 @@ public:
~RivenScript(); ~RivenScript();
void runScript(); 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; } uint16 getScriptType() { return _scriptType; }
// Read in an array of script objects from a stream // Read in an array of script objects from a stream
@ -74,7 +76,7 @@ private:
Common::SeekableReadStream *_stream; Common::SeekableReadStream *_stream;
uint16 _scriptType; 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); void processCommands(bool runCommands);
static uint32 calculateCommandSize(Common::SeekableReadStream* script); static uint32 calculateCommandSize(Common::SeekableReadStream* script);

View file

@ -27,6 +27,7 @@
#define MOHAWK_VIDEO_QDM2_H #define MOHAWK_VIDEO_QDM2_H
#include "sound/audiostream.h" #include "sound/audiostream.h"
#include "common/array.h"
#include "common/stream.h" #include "common/stream.h"
namespace Mohawk { namespace Mohawk {

View file

@ -26,7 +26,7 @@
#ifndef QUEEN_CREDITS_H #ifndef QUEEN_CREDITS_H
#define QUEEN_CREDITS_H #define QUEEN_CREDITS_H
#include "common/util.h" #include "common/str-array.h"
#include "queen/defs.h" #include "queen/defs.h"
namespace Queen { namespace Queen {
@ -82,7 +82,7 @@ private:
uint _lineNum; uint _lineNum;
//! contains the credits description //! contains the credits description
Common::StringList _credits; Common::StringArray _credits;
QueenEngine *_vm; QueenEngine *_vm;
}; };

View file

@ -26,7 +26,7 @@
#ifndef QUEEN_LOGIC_H #ifndef QUEEN_LOGIC_H
#define QUEEN_LOGIC_H #define QUEEN_LOGIC_H
#include "common/str.h" #include "common/str-array.h"
#include "common/util.h" #include "common/util.h"
#include "queen/structs.h" #include "queen/structs.h"
@ -337,7 +337,7 @@ protected:
//! actor initial position in room is _walkOffData[_entryObj] //! actor initial position in room is _walkOffData[_entryObj]
int16 _entryObj; int16 _entryObj;
Common::StringList _jasStringList; Common::StringArray _jasStringList;
int _jasStringOffset[JSO_COUNT]; int _jasStringOffset[JSO_COUNT];
uint16 _numDescriptions; uint16 _numDescriptions;

View file

@ -27,6 +27,7 @@
#define QUEEN_RESOURCE_H #define QUEEN_RESOURCE_H
#include "common/file.h" #include "common/file.h"
#include "common/str-array.h"
#include "common/util.h" #include "common/util.h"
#include "queen/defs.h" #include "queen/defs.h"
@ -74,7 +75,7 @@ public:
uint8 *loadFile(const char *filename, uint32 skipBytes = 0, uint32 *size = NULL); uint8 *loadFile(const char *filename, uint32 skipBytes = 0, uint32 *size = NULL);
//! loads a text file //! 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 //! returns true if the file is present in the resource
bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; } bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }

View file

@ -29,6 +29,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/rect.h" #include "common/rect.h"
#include "common/str-array.h"
#include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS #include "sci/sci.h" // for USE_OLD_MUSIC_FUNCTIONS
#include "sci/engine/vm_types.h" // for reg_t #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 * Check for any hardcoded selector table we might have that can be used
* if a game is missing the selector names. * if a game is missing the selector names.
*/ */
Common::StringList checkStaticSelectorNames(); Common::StringArray checkStaticSelectorNames();
/** /**
* Maps special selectors * Maps special selectors
@ -191,8 +192,8 @@ private:
uint32 features; uint32 features;
// Kernel-related lists // Kernel-related lists
Common::StringList _selectorNames; Common::StringArray _selectorNames;
Common::StringList _kernelNames; Common::StringArray _kernelNames;
}; };
/******************** Text functionality ********************/ /******************** Text functionality ********************/

View file

@ -29,6 +29,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/array.h" #include "common/array.h"
#include "common/serializer.h" #include "common/serializer.h"
#include "common/str-array.h"
namespace Common { namespace Common {
class SeekableReadStream; class SeekableReadStream;
@ -54,8 +55,8 @@ class SoundCommandParser;
class DirSeeker { class DirSeeker {
protected: protected:
reg_t _outbuffer; reg_t _outbuffer;
Common::StringList _savefiles; Common::StringArray _savefiles;
Common::StringList::const_iterator _iter; Common::StringArray::const_iterator _iter;
public: public:
DirSeeker() { DirSeeker() {

View file

@ -29,6 +29,7 @@
#include "common/events.h" #include "common/events.h"
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/str-array.h"
class OSystem; class OSystem;
namespace Common { namespace Common {
@ -194,8 +195,8 @@ public:
uint16 _selectedGame; uint16 _selectedGame;
uint16 saveGameToFile(); uint16 saveGameToFile();
void loadDescriptions(Common::StringList &list); void loadDescriptions(Common::StringArray &list);
void saveDescriptions(const Common::StringList &list); void saveDescriptions(const Common::StringArray &list);
private: private:
int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4); int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);
@ -222,7 +223,7 @@ private:
void drawCross(uint16 x, uint16 y); void drawCross(uint16 x, uint16 y);
uint16 saveRestorePanel(bool allowSave); 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 showSprites(DataFileHeader **nameSprites, bool allowSave);
void handleKeyPress(Common::KeyState kbd, Common::String &textBuf); void handleKeyPress(Common::KeyState kbd, Common::String &textBuf);

View file

@ -28,6 +28,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/events.h" #include "common/events.h"
#include "common/str-array.h"
#include "sword1/sworddefs.h" #include "sword1/sworddefs.h"
class OSystem; class OSystem;
@ -111,7 +112,7 @@ private:
uint8 _numSaves; uint8 _numSaves;
uint8 _saveScrollPos; uint8 _saveScrollPos;
uint8 _selectedSavegame; uint8 _selectedSavegame;
Common::StringList _saveNames; Common::StringArray _saveNames;
Common::String _oldName; Common::String _oldName;
uint8 _cursorTick; uint8 _cursorTick;
bool _cursorVisible; bool _cursorVisible;

View file

@ -27,6 +27,7 @@
#define TEEN_MUSIC_H #define TEEN_MUSIC_H
#include "sound/mods/paula.h" #include "sound/mods/paula.h"
#include "common/array.h"
namespace TeenAgent { namespace TeenAgent {

View file

@ -27,12 +27,14 @@
#include "teenagent/surface.h" #include "teenagent/surface.h"
#include "teenagent/actor.h" #include "teenagent/actor.h"
#include "common/system.h"
#include "common/list.h"
#include "teenagent/objects.h" #include "teenagent/objects.h"
#include "teenagent/surface.h" #include "teenagent/surface.h"
#include "teenagent/surface_list.h" #include "teenagent/surface_list.h"
#include "common/system.h"
#include "common/array.h"
#include "common/list.h"
namespace TeenAgent { namespace TeenAgent {
class TeenAgentEngine; class TeenAgentEngine;

View file

@ -864,10 +864,10 @@ void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, in
struct WordWrapper { struct WordWrapper {
Common::StringList &lines; Common::Array<Common::String> &lines;
int actualMaxLineWidth; int actualMaxLineWidth;
WordWrapper(Common::StringList &l) : lines(l), actualMaxLineWidth(0) { WordWrapper(Common::Array<Common::String> &l) : lines(l), actualMaxLineWidth(0) {
} }
void add(Common::String &line, int &w) { 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<Common::String> &lines) const {
WordWrapper wrapper(lines); WordWrapper wrapper(lines);
Common::String line; Common::String line;
Common::String tmpStr; Common::String tmpStr;

View file

@ -26,6 +26,7 @@
#define GRAPHICS_FONT_H #define GRAPHICS_FONT_H
#include "common/str.h" #include "common/str.h"
#include "common/array.h"
#include "graphics/surface.h" #include "graphics/surface.h"
namespace Common { namespace Common {
@ -78,7 +79,7 @@ public:
* @param lines the string list to which the text lines from str are appended * @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 * @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<Common::String> &lines) const;
}; };

View file

@ -55,7 +55,7 @@ KeysDialog::KeysDialog(const Common::String &title)
_keyMapping->setFlags(WIDGET_CLEARBG); _keyMapping->setFlags(WIDGET_CLEARBG);
// Get actions names // Get actions names
Common::StringList l; ListWidget::StringArray l;
for (int i = 0; i < Actions::Instance()->size(); i++) for (int i = 0; i < Actions::Instance()->size(); i++)
l.push_back(Actions::Instance()->actionName((ActionType)i)); l.push_back(Actions::Instance()->actionName((ActionType)i));

View file

@ -152,7 +152,7 @@ ThemeEngine::FontColor ListWidget::getSelectionColor() const {
return _listColors[_listIndex[_selectedItem]]; 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) if (_editMode && _caretVisible)
drawCaret(true); drawCaret(true);
@ -306,7 +306,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
int newSelectedItem = 0; int newSelectedItem = 0;
int bestMatch = 0; int bestMatch = 0;
bool stop; 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); const int match = matchingCharsIgnoringCase(i->c_str(), _quickSelectStr.c_str(), stop);
if (match > bestMatch || stop) { if (match > bestMatch || stop) {
_selectedItem = newSelectedItem; _selectedItem = newSelectedItem;
@ -692,7 +692,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) {
_list.clear(); _list.clear();
_listIndex.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 = *i;
tmp.toLowercase(); tmp.toLowercase();
bool matches = true; bool matches = true;

View file

@ -52,11 +52,11 @@ enum {
class ListWidget : public EditableWidget { class ListWidget : public EditableWidget {
public: public:
typedef Common::String String; typedef Common::String String;
typedef Common::StringList StringList; typedef Common::Array<Common::String> StringArray;
typedef Common::Array<ThemeEngine::FontColor> ColorList; typedef Common::Array<ThemeEngine::FontColor> ColorList;
protected: protected:
StringList _list; StringArray _list;
StringList _dataList; StringArray _dataList;
ColorList _listColors; ColorList _listColors;
Common::Array<int> _listIndex; Common::Array<int> _listIndex;
bool _editable; bool _editable;
@ -93,8 +93,8 @@ public:
virtual Widget *findWidget(int x, int y); virtual Widget *findWidget(int x, int y);
void setList(const StringList &list, const ColorList *colors = 0); void setList(const StringArray &list, const ColorList *colors = 0);
const StringList &getList() const { return _dataList; } const StringArray &getList() const { return _dataList; }
void append(const String &s, ThemeEngine::FontColor color = ThemeEngine::kFontColorNormal); void append(const String &s, ThemeEngine::FontColor color = ThemeEngine::kFontColorNormal);

View file

@ -164,10 +164,10 @@ void AboutDialog::addLine(const char *str) {
Common::String format(str, 2); Common::String format(str, 2);
str += 2; str += 2;
Common::StringList wrappedLines; StringArray wrappedLines;
g_gui.getFont().wordWrapText(str, _w - 2 * _xOff, 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); _lines.push_back(format + *i);
} }
} }

View file

@ -32,11 +32,11 @@
namespace GUI { namespace GUI {
class AboutDialog : public Dialog { class AboutDialog : public Dialog {
typedef Common::StringList StringList; typedef Common::Array<Common::String> StringArray;
protected: protected:
int _scrollPos; int _scrollPos;
uint32 _scrollTime; uint32 _scrollTime;
StringList _lines; StringArray _lines;
uint32 _lineHeight; uint32 _lineHeight;
bool _willClose; bool _willClose;

View file

@ -150,7 +150,7 @@ void BrowserDialog::updateListing() {
Common::sort(_nodeContent.begin(), _nodeContent.end()); Common::sort(_nodeContent.begin(), _nodeContent.end());
// Populate the ListWidget // Populate the ListWidget
Common::StringList list; ListWidget::StringArray list;
ListWidget::ColorList colors; ListWidget::ColorList colors;
for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) {
if (i->isDirectory()) if (i->isDirectory())

View file

@ -50,7 +50,7 @@ ChooserDialog::ChooserDialog(const String &title, String dialogId)
_chooseButton->setEnabled(false); _chooseButton->setEnabled(false);
} }
void ChooserDialog::setList(const StringList& list) { void ChooserDialog::setList(const StringArray& list) {
_list->setList(list); _list->setList(list);
} }

View file

@ -39,7 +39,7 @@ class ListWidget;
class ChooserDialog : public Dialog { class ChooserDialog : public Dialog {
typedef Common::String String; typedef Common::String String;
typedef Common::StringList StringList; typedef Common::Array<Common::String> StringArray;
protected: protected:
ListWidget *_list; ListWidget *_list;
ButtonWidget *_chooseButton; ButtonWidget *_chooseButton;
@ -47,7 +47,7 @@ protected:
public: public:
ChooserDialog(const String &title, String dialogId = "Browser"); 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); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
}; };

View file

@ -427,7 +427,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
DebugPrintf("Commands are:\n"); DebugPrintf("Commands are:\n");
// Obtain a list of sorted command names // Obtain a list of sorted command names
Common::StringList cmds; Common::Array<Common::String> cmds;
CommandsMap::const_iterator iter, e = _cmds.end(); CommandsMap::const_iterator iter, e = _cmds.end();
for (iter = _cmds.begin(); iter != e; ++iter) { for (iter = _cmds.begin(); iter != e; ++iter) {
cmds.push_back(iter->_key); cmds.push_back(iter->_key);

View file

@ -119,7 +119,7 @@ protected:
class EditGameDialog : public OptionsDialog { class EditGameDialog : public OptionsDialog {
typedef Common::String String; typedef Common::String String;
typedef Common::StringList StringList; typedef Common::Array<Common::String> StringArray;
public: public:
EditGameDialog(const String &domain, const String &desc); EditGameDialog(const String &domain, const String &desc);
@ -553,7 +553,7 @@ LauncherDialog::LauncherDialog()
void LauncherDialog::selectTarget(const String &target) { void LauncherDialog::selectTarget(const String &target) {
if (!target.empty()) { if (!target.empty()) {
int itemToSelect = 0; int itemToSelect = 0;
StringList::const_iterator iter; StringArray::const_iterator iter;
for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) { for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) {
if (target == *iter) { if (target == *iter) {
_list->setSelected(itemToSelect); _list->setSelected(itemToSelect);
@ -593,7 +593,7 @@ void LauncherDialog::close() {
} }
void LauncherDialog::updateListing() { void LauncherDialog::updateListing() {
Common::StringList l; StringArray l;
// Retrieve a list of all games defined in the config file // Retrieve a list of all games defined in the config file
_domains.clear(); _domains.clear();
@ -722,7 +722,7 @@ void LauncherDialog::addGame() {
idx = 0; idx = 0;
} else { } else {
// Display the candidates to the user and let her/him pick one // Display the candidates to the user and let her/him pick one
StringList list; StringArray list;
for (idx = 0; idx < (int)candidates.size(); idx++) for (idx = 0; idx < (int)candidates.size(); idx++)
list.push_back(candidates[idx].description()); list.push_back(candidates[idx].description());

View file

@ -40,7 +40,7 @@ Common::String addGameToConf(const GameDescriptor &result);
class LauncherDialog : public Dialog { class LauncherDialog : public Dialog {
typedef Common::String String; typedef Common::String String;
typedef Common::StringList StringList; typedef Common::Array<Common::String> StringArray;
public: public:
LauncherDialog(); LauncherDialog();
~LauncherDialog(); ~LauncherDialog();
@ -64,7 +64,7 @@ protected:
#endif #endif
StaticTextWidget *_searchDesc; StaticTextWidget *_searchDesc;
ButtonWidget *_searchClearButton; ButtonWidget *_searchClearButton;
StringList _domains; StringArray _domains;
BrowserDialog *_browser; BrowserDialog *_browser;
SaveLoadChooser *_loadDialog; SaveLoadChooser *_loadDialog;

View file

@ -66,7 +66,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir)
_dirProgressText(0), _dirProgressText(0),
_gameProgressText(0) { _gameProgressText(0) {
Common::StringList l; StringArray l;
// The dir we start our scan at // The dir we start our scan at
_scanStack.push(startDir); _scanStack.push(startDir);
@ -199,8 +199,8 @@ void MassAddDialog::handleTickle() {
// Check for existing config entries for this path/gameid/lang/platform combination // Check for existing config entries for this path/gameid/lang/platform combination
if (_pathToTargets.contains(path)) { if (_pathToTargets.contains(path)) {
bool duplicate = false; bool duplicate = false;
const Common::StringList &targets = _pathToTargets[path]; const StringArray &targets = _pathToTargets[path];
for (Common::StringList::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { for (StringArray::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) {
// If the gameid, platform and language match -> skip it // If the gameid, platform and language match -> skip it
Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter); Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter);
assert(dom); assert(dom);

View file

@ -37,6 +37,7 @@ namespace GUI {
class StaticTextWidget; class StaticTextWidget;
class MassAddDialog : public Dialog { class MassAddDialog : public Dialog {
typedef Common::Array<Common::String> StringArray;
public: public:
MassAddDialog(const Common::FSNode &startDir); MassAddDialog(const Common::FSNode &startDir);
@ -59,7 +60,7 @@ private:
* Used to detect whether a potential new target is already present in the * Used to detect whether a potential new target is already present in the
* config manager. * config manager.
*/ */
Common::HashMap<Common::String, Common::StringList> _pathToTargets; Common::HashMap<Common::String, StringArray> _pathToTargets;
int _dirsScanned; int _dirsScanned;

View file

@ -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. // 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 // Using this, and accounting for the space the button(s) need, we can set
// the real size of the dialog // the real size of the dialog
Common::StringList lines; Common::Array<Common::String> lines;
int lineCount, okButtonPos, cancelButtonPos; int lineCount, okButtonPos, cancelButtonPos;
int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines);

View file

@ -313,7 +313,7 @@ void SaveLoadChooser::close() {
_plugin = 0; _plugin = 0;
_target.clear(); _target.clear();
_saveList.clear(); _saveList.clear();
_list->setList(StringList()); _list->setList(StringArray());
Dialog::close(); Dialog::close();
} }
@ -323,7 +323,7 @@ void SaveLoadChooser::updateSaveList() {
int curSlot = 0; int curSlot = 0;
int saveSlot = 0; int saveSlot = 0;
StringList saveNames; StringArray saveNames;
ListWidget::ColorList colors; ListWidget::ColorList colors;
for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
// Handle gaps in the list of save games // Handle gaps in the list of save games

View file

@ -35,7 +35,7 @@ class GraphicsWidget;
class SaveLoadChooser : public GUI::Dialog { class SaveLoadChooser : public GUI::Dialog {
typedef Common::String String; typedef Common::String String;
typedef Common::StringList StringList; typedef Common::Array<Common::String> StringArray;
protected: protected:
GUI::ListWidget *_list; GUI::ListWidget *_list;
GUI::ButtonWidget *_chooseButton; GUI::ButtonWidget *_chooseButton;
@ -65,7 +65,7 @@ public:
~SaveLoadChooser(); ~SaveLoadChooser();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); 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); int runModal(const EnginePlugin *plugin, const String &target);
void open(); void open();

View file

@ -100,7 +100,7 @@ void ThemeBrowser::updateListing() {
const Common::String currentThemeId = g_gui.theme()->getThemeId(); const Common::String currentThemeId = g_gui.theme()->getThemeId();
int currentThemeIndex = 0, index = 0; int currentThemeIndex = 0, index = 0;
Common::StringList list; ListWidget::StringArray list;
for (ThemeDescList::const_iterator i = _themes.begin(); i != _themes.end(); ++i, ++index) { for (ThemeDescList::const_iterator i = _themes.begin(); i != _themes.end(); ++i, ++index) {
list.push_back(i->name); list.push_back(i->name);

View file

@ -196,7 +196,7 @@ class ArrayTestSuite : public CxxTest::TestSuite
void test_array_constructor_str() { void test_array_constructor_str() {
const char *array1[] = { "a", "b", "c" }; const char *array1[] = { "a", "b", "c" };
Common::StringList array2(array1, 3); Common::Array<Common::String> array2(array1, 3);
TS_ASSERT_EQUALS(array2[0], "a"); TS_ASSERT_EQUALS(array2[0], "a");
TS_ASSERT_EQUALS(array2[1], "b"); TS_ASSERT_EQUALS(array2[1], "b");