本文整理汇总了C++中common::StringArray::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ StringArray::begin方法的具体用法?C++ StringArray::begin怎么用?C++ StringArray::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::StringArray
的用法示例。
在下文中一共展示了StringArray::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listValidSaves
SaveStateList SaveLoad::listValidSaves(const Common::String &target) {
SaveStateList list;
// Get the list of savefiles
Common::String pattern = Common::String::format("%s.0##", target.c_str());
Common::StringArray savefiles = g_system->getSavefileManager()->listSavefiles(pattern);
// Sort the list of filenames
sort(savefiles.begin(), savefiles.end());
// Fill the information for the existing savegames
Common::StringArray::iterator it = savefiles.begin();
while (it != savefiles.end()) {
const char *ext = strrchr(it->c_str(), '.');
if (!ext)
continue;
int slot = atoi(ext + 1);
if (!isSlotValid(slot))
continue;
SaveStateDescriptor descriptor;
Common::InSaveFile *file = SaveLoad::openForLoading(target, slot, &descriptor);
if (file) {
// It's a valid savefile, save the descriptor
delete file;
list.push_back(descriptor);
}
it++;
}
return list;
}
示例2: listSaves
SaveStateList LabMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Lab::SaveGameHeader header;
Common::String pattern = target;
pattern += ".###";
Common::StringArray filenames;
filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if ((slotNum >= 0) && (slotNum <= 999)) {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) {
if (Lab::readSaveGameHeader(in, header))
saveList.push_back(SaveStateDescriptor(slotNum, header._descr.getDescription()));
delete in;
}
}
}
return saveList;
}
示例3: listValidSaves
SaveStateList SaveLoad::listValidSaves(const Common::String &target) {
SaveStateList list;
// Get the list of savefiles
Common::String pattern = target + ".00?";
Common::StringArray savefiles = g_system->getSavefileManager()->listSavefiles(pattern);
// Sort the list of filenames
sort(savefiles.begin(), savefiles.end());
// Fill the information for the existing savegames
Common::StringArray::iterator it = savefiles.begin();
while (it != savefiles.end()) {
int slot = it->lastChar() - '0';
SaveStateDescriptor descriptor;
Common::InSaveFile *file = SaveLoad::openForLoading(target, slot, &descriptor);
if (file) {
// It's a valid savefile, save the descriptor
delete file;
list.push_back(descriptor);
}
it++;
}
return list;
}
示例4: getSongNames
void Music::getSongNames(Common::StringArray &songs) {
songs.clear();
if (IS_SERRATED_SCALPEL) {
if (IS_3DO) {
Common::FSDirectory gameDirectory(ConfMan.get("path"));
Common::FSDirectory *musicDirectory = gameDirectory.getSubDirectory("music");
Common::ArchiveMemberList files;
musicDirectory->listMatchingMembers(files, "*_mw22.aifc");
for (Common::ArchiveMemberList::iterator i = files.begin(); i != files.end(); ++i) {
Common::String name = (*i)->getName();
name.erase(name.size() - 10);
songs.push_back(name);
}
} else {
for (int i = 0; i < ARRAYSIZE(SONG_NAMES); i++) {
songs.push_back(SONG_NAMES[i]);
}
}
} else {
Common::StringArray fileList;
_vm->_res->getResourceNames("music.lib", fileList);
for (Common::StringArray::iterator i = fileList.begin(); i != fileList.end(); ++i) {
if ((*i).matchString("*.XMI", true)) {
(*i).erase((*i).size() - 4);
songs.push_back(*i);
}
}
}
Common::sort(songs.begin(), songs.end());
}
示例5: listSaves
SaveStateList TonyMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String saveDesc;
Common::String pattern = "tony.0??";
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
byte thumbnailData[160 * 120 * 2];
Common::String saveName;
byte difficulty;
if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slotNum, thumbnailData, saveName, difficulty)) {
// Add the save name to the savegame list
saveList.push_back(SaveStateDescriptor(slotNum, saveName));
}
}
}
return saveList;
}
示例6: loadSavegamesList
int MenuSystem::loadSavegamesList() {
int maxSlotNum = -1;
_savegameListTopIndex = 0;
_savegames.clear();
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Toltecs::ToltecsEngine::SaveHeader header;
Common::String pattern = _vm->getTargetName();
pattern += ".???";
Common::StringArray filenames;
filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum > maxSlotNum)
maxSlotNum = slotNum;
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) {
if (Toltecs::ToltecsEngine::readSaveHeader(in, false, header) == Toltecs::ToltecsEngine::kRSHENoError) {
_savegames.push_back(SavegameItem(slotNum, header.description));
//debug("%s -> %s", file->c_str(), header.description.c_str());
}
delete in;
}
}
}
return maxSlotNum;
}
示例7: listSaves
SaveStateList KyraMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Kyra::KyraEngine_v1::SaveHeader header;
Common::String pattern = target;
pattern += ".???";
Common::StringArray filenames;
filenames = saveFileMan->listSavefiles(pattern);
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
if (Kyra::KyraEngine_v1::readSaveHeader(in, false, header) == Kyra::KyraEngine_v1::kRSHENoError) {
// WORKAROUND: Old savegames are using 'German' as description for kyra3 restart game save (slot 0),
// since that looks odd we replace it by "New Game".
if (slotNum == 0 && header.gameID == Kyra::GI_KYRA3)
header.description = "New Game";
saveList.push_back(SaveStateDescriptor(slotNum, header.description));
}
delete in;
}
}
}
return saveList;
}
示例8: listSaves
SaveStateList LureMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String saveDesc;
Common::String pattern = "lure.???";
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
saveDesc = Lure::getSaveName(in);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in;
}
}
}
return saveList;
}
示例9: removeSaveState
void PictureMetaEngine::removeSaveState(const char *target, int slot) const {
// Slot 0 can't be deleted, it's for restarting the game(s)
if (slot == 0)
return;
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::String filename = Picture::PictureEngine::getSavegameFilename(target, slot);
saveFileMan->removeSavefile(filename.c_str());
Common::StringArray filenames;
Common::String pattern = target;
pattern += ".???";
filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
// Rename every slot greater than the deleted slot,
// Also do not rename quicksaves.
if (slotNum > slot && slotNum < 990) {
// FIXME: Our savefile renaming done here is inconsitent with what we do in
// GUI_v2::deleteMenu. While here we rename every slot with a greater equal
// number of the deleted slot to deleted slot, deleted slot + 1 etc.,
// we only rename the following slots in GUI_v2::deleteMenu until a slot
// is missing.
saveFileMan->renameSavefile(file->c_str(), filename.c_str());
filename = Picture::PictureEngine::getSavegameFilename(target, ++slot);
}
}
}
示例10: listSaves
virtual SaveStateList listSaves(const char *target) const {
Common::String pattern = target;
pattern += ".*";
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
Common::sort(filenames.begin(), filenames.end());
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
int slot;
const char *ext = strrchr(file->c_str(), '.');
if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) {
Common::ScopedPtr<Common::InSaveFile> in(g_system->getSavefileManager()->openForLoading(*file));
if (!in)
continue;
char buf[25];
in->seek(0);
in->read(buf, 24);
buf[24] = 0;
saveList.push_back(SaveStateDescriptor(slot, buf));
}
}
return saveList;
}
示例11: listSaves
SaveStateList AgiMetaEngine::listSaves(const char *target) const {
const uint32 AGIflag = MKTAG('A','G','I',':');
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
char saveDesc[31];
Common::String pattern = target;
pattern += ".???";
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
uint32 type = in->readUint32BE();
if (type == AGIflag)
in->read(saveDesc, 31);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in;
}
}
}
return saveList;
}
示例12: listSaves
SaveStateList SwordMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
SaveStateList saveList;
char saveName[40];
Common::StringArray filenames = saveFileMan->listSavefiles("sword1.???");
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
int slotNum = 0;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
in->readUint32LE(); // header
in->read(saveName, 40);
saveList.push_back(SaveStateDescriptor(slotNum, saveName));
delete in;
}
}
}
return saveList;
}
示例13: listSaves
SaveStateList FullpipeMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern("fullpipe.s##");
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
Fullpipe::FullpipeSavegameHeader header;
Fullpipe::readSavegameHeader(in, header);
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
delete header.thumbnail;
delete in;
}
}
}
return saveList;
}
示例14: listSaves
SaveStateList SciMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String pattern = target;
pattern += ".???";
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
int slotNum = 0;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 99) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
SavegameMetadata meta;
if (!get_savegame_metadata(in, &meta)) {
// invalid
delete in;
continue;
}
saveList.push_back(SaveStateDescriptor(slotNum, meta.name));
delete in;
}
}
}
return saveList;
}
示例15: getSavegameList
SaveStateList CProjectItem::getSavegameList(const Common::String &target) {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
Common::String saveDesc;
Common::String pattern = Common::String::format("%s.0??", target.c_str());
TitanicSavegameHeader header;
filenames = saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort to get the files in numerical order
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
const char *ext = strrchr(file->c_str(), '.');
int slot = ext ? atoi(ext + 1) : -1;
if (slot >= 0 && slot < MAX_SAVEGAME_SLOTS) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
if (in) {
SimpleFile f;
f.open(in);
if (!readSavegameHeader(&f, header))
continue;
saveList.push_back(SaveStateDescriptor(slot, header._saveName));
header._thumbnail->free();
delete header._thumbnail;
delete in;
}
}
}
return saveList;
}