当前位置: 首页>>代码示例>>C++>>正文


C++ StringArray::end方法代码示例

本文整理汇总了C++中common::StringArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ StringArray::end方法的具体用法?C++ StringArray::end怎么用?C++ StringArray::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common::StringArray的用法示例。


在下文中一共展示了StringArray::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:35,代码来源:project_item.cpp

示例2: 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;
}
开发者ID:alexnikleo,项目名称:scummvm,代码行数:32,代码来源:detection.cpp

示例3: listSaves

	virtual SaveStateList listSaves(const char *target) const {
		Common::String pattern = target;
		pattern += ".???";

		Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
		sort(filenames.begin(), filenames.end());
		TsAGE::tSageSavegameHeader header;

		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_SAVES) {
				Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);

				if (in) {
					if (TsAGE::Saver::readSavegameHeader(in, header)) {
						saveList.push_back(SaveStateDescriptor(slot, header._saveName));

						header._thumbnail->free();
						delete header._thumbnail;
					}

					delete in;
				}
			}
		}

		return saveList;
	}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:31,代码来源:detection.cpp

示例4: listSaves

SaveStateList TinselMetaEngine::listSaves(const char *target) const {
	Common::String pattern = target;
	pattern = pattern + ".???";
	Common::StringArray files = g_system->getSavefileManager()->listSavefiles(pattern);
	sort(files.begin(), files.end());	// Sort (hopefully ensuring we are sorted numerically..)

	SaveStateList saveList;
	int slotNum = 0;
	for (Common::StringArray::const_iterator file = files.begin(); file != files.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);

		const Common::String &fname = *file;
		Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fname);
		if (in) {
			in->readUint32LE();		// skip id
			in->readUint32LE();		// skip size
			in->readUint32LE();		// skip version
			char saveDesc[Tinsel::SG_DESC_LEN];
			in->read(saveDesc, sizeof(saveDesc));

			saveDesc[Tinsel::SG_DESC_LEN - 1] = 0;

			saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
			delete in;
		}
	}

	return saveList;
}
开发者ID:mauimauer,项目名称:scummvm,代码行数:30,代码来源:detection.cpp

示例5: 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;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:35,代码来源:menu.cpp

示例6: listSaves

SaveStateList QueenMetaEngine::listSaves(const char *target) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::StringArray filenames;
	char saveDesc[32];
	Common::String pattern("queen.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 <= 99) {
			Common::InSaveFile *in = saveFileMan->openForLoading(*file);
			if (in) {
				for (int i = 0; i < 4; i++)
					in->readUint32BE();
				in->read(saveDesc, 32);
				saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
				delete in;
			}
		}
	}

	return saveList;
}
开发者ID:Bundesdrucker,项目名称:scummvm,代码行数:28,代码来源:queen.cpp

示例7: Sort

SaveStateList Sword2MetaEngine::listSaves(const char *target) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::StringArray filenames;
	char saveDesc[SAVE_DESCRIPTION_LEN];
	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) {
				in->readUint32LE();
				in->read(saveDesc, SAVE_DESCRIPTION_LEN);
				saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
				delete in;
			}
		}
	}

	return saveList;
}
开发者ID:project-cabal,项目名称:cabal,代码行数:28,代码来源:sword2.cpp

示例8: 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);
        }
    }

}
开发者ID:bluegr,项目名称:scummvm-picture,代码行数:35,代码来源:detection.cpp

示例9: generateRecordFileName

Common::String EventRecorder::generateRecordFileName(const Common::String &target) {
	Common::String pattern(target+".r??");
	Common::StringArray files = g_system->getSavefileManager()->listSavefiles(pattern);
	for (int i = 0; i < kMaxRecordsNames; ++i) {
		Common::String recordName = Common::String::format("%s.r%02d", target.c_str(), i);
		if (find(files.begin(), files.end(), recordName) != files.end()) {
			continue;
		}
		return recordName;
	}
	return "";
}
开发者ID:Akz-,项目名称:residual,代码行数:12,代码来源:EventRecorder.cpp

示例10: listSaves

SaveStateList AvalancheMetaEngine::listSaves(const char *target) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::StringArray filenames;
	Common::String pattern = target;
	pattern.toUppercase();
	pattern += ".???";

	filenames = saveFileMan->listSavefiles(pattern);
	sort(filenames.begin(), filenames.end());   // Sort (hopefully ensuring we are sorted numerically..)

	SaveStateList saveList;
	for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
		const Common::String &fname = *filename;
		int slotNum = atoi(fname.c_str() + fname.size() - 3);
		if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
			Common::InSaveFile *file = saveFileMan->openForLoading(fname);
			if (file) {
				// Check for our signature.
				uint32 signature = file->readUint32LE();
				if (signature != MKTAG('A', 'V', 'A', 'L')) {
					warning("Savegame of incompatible type!");
					delete file;
					continue;
				}

				// Check version.
				byte saveVersion = file->readByte();
				if (saveVersion != kSavegameVersion) {
					warning("Savegame of incompatible version!");
					delete file;
					continue;
				}

				// Read name.
				uint32 nameSize = file->readUint32LE();
				if (nameSize >= 255) {
					delete file;
					continue;
				}
				char *name = new char[nameSize + 1];
				file->read(name, nameSize);
				name[nameSize] = 0;

				saveList.push_back(SaveStateDescriptor(slotNum, name));
				delete[] name;
				delete file;
			}
		}
	}

	return saveList;
}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:52,代码来源:detection.cpp

示例11: listSaves

SaveStateList SkyMetaEngine::listSaves(const char *target) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	SaveStateList saveList;

	// Load the descriptions
	Common::StringArray savenames;
	savenames.resize(MAX_SAVE_GAMES+1);

	Common::InSaveFile *inf;
	inf = saveFileMan->openForLoading("SKY-VM.SAV");
	if (inf != NULL) {
		char *tmpBuf =  new char[MAX_SAVE_GAMES * MAX_TEXT_LEN];
		char *tmpPtr = tmpBuf;
		inf->read(tmpBuf, MAX_SAVE_GAMES * MAX_TEXT_LEN);
		for (int i = 0; i < MAX_SAVE_GAMES; ++i) {
			savenames[i] = tmpPtr;
			tmpPtr += savenames[i].size() + 1;
		}
		delete inf;
		delete[] tmpBuf;
	}

	// Find all saves
	Common::StringArray filenames;
	filenames = saveFileMan->listSavefiles("SKY-VM.???");
	sort(filenames.begin(), filenames.end());	// Sort (hopefully ensuring we are sorted numerically..)

	// Slot 0 is the autosave, if it exists.
	// TODO: Check for the existence of the autosave -- but this require us
	// to know which SKY variant we are looking at.
	saveList.insert_at(0, SaveStateDescriptor(0, "*AUTOSAVE*"));

	// Prepare the list of savestates by looping over all matching savefiles
	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
		// Extract the extension
		Common::String ext = file->c_str() + file->size() - 3;
		ext.toUppercase();
		if (Common::isDigit(ext[0]) && Common::isDigit(ext[1]) && Common::isDigit(ext[2])) {
			int slotNum = atoi(ext.c_str());
			Common::InSaveFile *in = saveFileMan->openForLoading(*file);
			if (in) {
				saveList.push_back(SaveStateDescriptor(slotNum+1, savenames[slotNum]));
				delete in;
			}
		}
	}

	return saveList;
}
开发者ID:project-cabal,项目名称:cabal,代码行数:49,代码来源:detection.cpp

示例12: 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);

	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;
			}
		}
	}

	// Sort saves based on slot number.
	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
	return saveList;
}
开发者ID:Cruel,项目名称:scummvm,代码行数:27,代码来源:detection.cpp

示例13: listSaves

	SaveStateList listSaves(const char *target) const override {
		Common::String pattern = Common::String::format("%s-###.tlj", target);
		Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);

		int targetLen = strlen(target);

		SaveStateList saveList;
		for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
			// Extract the slot number from the filename
			char slot[4];
			slot[0] = (*filename)[targetLen + 1];
			slot[1] = (*filename)[targetLen + 2];
			slot[2] = (*filename)[targetLen + 3];
			slot[3] = '\0';

			// Read the description from the save
			Common::String description;
			Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(*filename);
			if (save) {
				StateReadStream *stream = new StateReadStream(save);
				description = stream->readString();
				delete stream;
			}

			saveList.push_back(SaveStateDescriptor(atoi(slot), description));
		}

		Common::sort(saveList.begin(), saveList.end(), cmpSave);
		return saveList;
	}
开发者ID:aquadran,项目名称:residualvm,代码行数:30,代码来源:detection.cpp

示例14: listSaves

SaveStateList AccessMetaEngine::listSaves(const char *target) const {
    Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
    Common::StringArray filenames;
    Common::String saveDesc;
    Common::String pattern = Common::String::format("%s.0##", target);
    Access::AccessSavegameHeader header;

    filenames = saveFileMan->listSavefiles(pattern);

    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_SAVES) {
            Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);

            if (in) {
                Access::AccessEngine::readSavegameHeader(in, header);
                saveList.push_back(SaveStateDescriptor(slot, header._saveName));

                header._thumbnail->free();
                delete header._thumbnail;
                delete in;
            }
        }
    }

    // Sort saves based on slot number.
    Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
    return saveList;
}
开发者ID:86400,项目名称:scummvm,代码行数:32,代码来源:detection.cpp

示例15: listSaves

SaveStateList WageMetaEngine::listSaves(const char *target) const {
    const uint32 WAGEflag = MKTAG('W','A','G','E');
    Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
    Common::StringArray filenames;
    char saveDesc[31];
    Common::String pattern = target;
    pattern += ".###";

    filenames = saveFileMan->listSavefiles(pattern);

    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 == WAGEflag)
                    in->read(saveDesc, 31);
                saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
                delete in;
            }
        }
    }

    // Sort saves based on slot number.
    Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
    return saveList;
}
开发者ID:m-kiewitz,项目名称:scummvm,代码行数:31,代码来源:detection.cpp


注:本文中的common::StringArray::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。