本文整理汇总了C++中common::ArchiveMemberList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchiveMemberList::end方法的具体用法?C++ ArchiveMemberList::end怎么用?C++ ArchiveMemberList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::ArchiveMemberList
的用法示例。
在下文中一共展示了ArchiveMemberList::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listMembers
int ResourceManager::listMembers(Common::ArchiveMemberList &list) const {
int count = 0;
for (Common::Array<HPFArchive *>::const_iterator it = _archives.begin(); it != _archives.end(); ++it) {
Common::ArchiveMemberList members;
count += (*it)->listMembers(members);
list.insert(list.end(), members.begin(), members.end());
}
return count;
}
示例2: 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());
}
示例3: listMembers
int LangFilter::listMembers(Common::ArchiveMemberList &list) const {
if (!_arc)
return false;
Common::ArchiveMemberList orgList;
Common::String orgName, name;
_arc->listMembers(orgList);
int num = 0;
//Search only files with the right language and create a list with their basenames
for (Common::ArchiveMemberList::const_iterator it = orgList.begin(); it != orgList.end(); it++) {
orgName = (*it)->getName();
if (orgName.hasPrefix(kLanguages1[_lang]) ||orgName.hasPrefix(kLanguages1[kCommon]))
name = Common::String(orgName.c_str() + 3);
else if (orgName.hasPrefix(kLanguages2[_lang]) || orgName.hasPrefix(kLanguages2[kCommon])) {
int i = 0;
while (orgName[i++] != '/') {;}
name = Common::String(orgName.c_str() + i);
//If the file is a subfolder, reject it
if (name.contains('/'))
continue;
} else
continue;
name.toLowercase();
list.push_back(getMember(name));
++num;
}
return num;
}
示例4: listUsableThemes
void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeDescriptor> &list) {
ThemeDescriptor td;
Common::ArchiveMemberList fileList;
archive.listMatchingMembers(fileList, "*.zip");
for (Common::ArchiveMemberList::iterator i = fileList.begin();
i != fileList.end(); ++i) {
td.name.clear();
if (themeConfigUsable(**i, td.name)) {
td.filename = (*i)->getName();
td.id = (*i)->getDisplayName();
// If the name of the node object also contains
// the ".zip" suffix, we will strip it.
if (td.id.matchString("*.zip", true)) {
for (int j = 0; j < 4; ++j)
td.id.deleteLastChar();
}
list.push_back(td);
}
}
fileList.clear();
}
示例5: runTests
void Lingo::runTests() {
Common::File inFile;
Common::ArchiveMemberList fileList;
SearchMan.listMatchingMembers(fileList, "*.lingo");
int counter = 1;
for (Common::ArchiveMemberList::iterator it = fileList.begin(); it != fileList.end(); ++it) {
Common::ArchiveMember const &m = **it;
Common::SeekableReadStream *const stream = m.createReadStream();
if (stream) {
uint size = stream->size();
char *script = (char *)calloc(size + 1, 1);
stream->read(script, size);
warning("Compiling file %s of size %d, id: %d", m.getName().c_str(), size, counter);
_hadError = false;
addCode(script, kMovieScript, counter);
if (!_hadError)
executeScript(kMovieScript, counter);
else
warning("Skipping execution");
free(script);
counter++;
}
inFile.close();
}
}
示例6: Lab
ResourceLoader::ResourceLoader() {
int lab_counter = 0;
_cacheDirty = false;
_cacheMemorySize = 0;
Lab *l;
Common::ArchiveMemberList files;
SearchMan.listMatchingMembers(files, "*.lab");
SearchMan.listMatchingMembers(files, "*.m4b");
if (files.empty())
error("Cannot find game data - check configuration file");
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
const Common::String filename = (*x)->getName();
l = new Lab();
if (l->open(filename)) {
if (filename.equalsIgnoreCase("data005.lab"))
_labs.push_front(l);
else
_labs.push_back(l);
lab_counter++;
} else {
delete l;
}
}
files.clear();
if (g_grim->getGameFlags() & GF_DEMO) {
SearchMan.listMatchingMembers(files, "*.mus");
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
const Common::String filename = (*x)->getName();
l = new Lab();
if (l->open(filename)) {
_labs.push_back(l);
lab_counter++;
} else {
delete l;
}
}
}
}
示例7: savePath
Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &pattern) {
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
Common::String _dir;
Common::String search;
bool _mc = (_getDev(savePath) == MC_DEV);
// (strncmp(savePath.getPath().c_str(), "mc0:", 4) == 0);
char *game=0, path[32], temp[32];
if (!savePath.exists() || !savePath.isDirectory())
return Common::StringArray();
printf("listSavefiles = %s\n", pattern.c_str());
if (_mc) {
strcpy(temp, pattern.c_str());
// mcSplit(temp, game, ext);
game = strdup(strtok(temp, "."));
sprintf(path, "mc0:ScummVM/%s", game); // per game path
mcCheck(path);
sprintf(path, "mc0:ScummVM/%s/", game);
_dir = Common::String(path);
search = Common::String("*.sav");
}
else {
_dir = Common::String(savePath.getPath());
search = pattern;
}
Common::FSDirectory dir(_dir);
Common::ArchiveMemberList savefiles;
Common::StringArray results;
printf("dir = %s --- reg = %s\n", _dir.c_str(), search.c_str());
if (dir.listMatchingMembers(savefiles, search) > 0) {
for (Common::ArchiveMemberList::const_iterator file = savefiles.begin(); file != savefiles.end(); ++file) {
if (_mc) { // convert them back in ScummVM names
strncpy(temp, (*file)->getName().c_str(), 3);
temp[3] = '\0';
sprintf(path, "%s.%s", game, temp);
results.push_back(path);
printf(" --> found = %s -> %s\n", (*file)->getName().c_str(), path);
}
else {
results.push_back((*file)->getName());
printf(" --> found = %s\n", (*file)->getName().c_str());
}
}
}
free(game);
return results;
}
示例8: cmdParseAllScrFiles
bool Console::cmdParseAllScrFiles(int argc, const char **argv) {
Common::ArchiveMemberList list;
SearchMan.listMatchingMembers(list, "*.scr");
for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) {
_engine->getScriptManager()->parseScrFile((*iter)->getName());
}
return true;
}
示例9: readWaveAudioPatches
void ResourceManager::readWaveAudioPatches() {
// Here we do check for SCI1.1+ so we can patch wav files in as audio resources
Common::ArchiveMemberList files;
SearchMan.listMatchingMembers(files, "*.wav");
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
Common::String name = (*x)->getName();
if (Common::isDigit(name[0]))
processWavePatch(ResourceId(kResourceTypeAudio, atoi(name.c_str())), name);
}
}
示例10: loadThemeXML
bool ThemeEngine::loadThemeXML(const Common::String &themeId) {
assert(_parser);
assert(_themeArchive);
_themeName.clear();
//
// Now that we have a Common::Archive, verify that it contains a valid THEMERC File
//
Common::File themercFile;
themercFile.open("THEMERC", *_themeArchive);
if (!themercFile.isOpen()) {
warning("Theme '%s' contains no 'THEMERC' file.", themeId.c_str());
return false;
}
Common::String stxHeader = themercFile.readLine();
if (!themeConfigParseHeader(stxHeader, _themeName) || _themeName.empty()) {
warning("Corrupted 'THEMERC' file in theme '%s'", themeId.c_str());
return false;
}
Common::ArchiveMemberList members;
if (0 == _themeArchive->listMatchingMembers(members, "*.stx")) {
warning("Found no STX files for theme '%s'.", themeId.c_str());
return false;
}
//
// Loop over all STX files, load and parse them
//
for (Common::ArchiveMemberList::iterator i = members.begin(); i != members.end(); ++i) {
assert((*i)->getName().hasSuffix(".stx"));
if (_parser->loadStream((*i)->createReadStream()) == false) {
warning("Failed to load STX file '%s'", (*i)->getDisplayName().c_str());
_parser->close();
return false;
}
if (_parser->parse() == false) {
warning("Failed to parse STX file '%s'", (*i)->getDisplayName().c_str());
_parser->close();
return false;
}
_parser->close();
}
assert(!_themeName.empty());
return true;
}
示例11: diskFileExists
bool diskFileExists(const Common::String &filename) {
// Try directly from SearchMan first
Common::ArchiveMemberList files;
SearchMan.listMatchingMembers(files, filename);
for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); ++it) {
if ((*it)->getName() == filename) {
return true;
}
}
// File wasn't found in SearchMan, try to parse the path as a relative path.
Common::FSNode searchNode = getNodeForRelativePath(filename);
if (searchNode.exists() && !searchNode.isDirectory() && searchNode.isReadable()) {
return true;
}
return false;
}
示例12: Cmd_DumpArchive
bool Console::Cmd_DumpArchive(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Extract all the files from a game archive.\n");
debugPrintf("The destination folder, named 'dump', must exist.\n");
debugPrintf("Usage :\n");
debugPrintf("dumpArchive [archive name]\n");
return true;
}
Formats::XARCArchive xarc;
if (!xarc.open(argv[1])) {
debugPrintf("Can't open archive with name '%s'\n", argv[1]);
return true;
}
Common::ArchiveMemberList members;
xarc.listMembers(members);
for (Common::ArchiveMemberList::const_iterator it = members.begin(); it != members.end(); it++) {
Common::String fileName = Common::String::format("dump/%s", it->get()->getName().c_str());
// Open the output file
Common::DumpFile outFile;
if (!outFile.open(fileName)) {
debugPrintf("Unable to open file '%s' for writing\n", fileName.c_str());
return true;
}
// Copy the archive content to the output file using a temporary buffer
Common::SeekableReadStream *inStream = it->get()->createReadStream();
uint8 *buf = new uint8[inStream->size()];
inStream->read(buf, inStream->size());
outFile.write(buf, inStream->size());
delete[] buf;
delete inStream;
outFile.close();
debugPrintf("Extracted '%s'\n", it->get()->getName().c_str());
}
return true;
}
示例13: runTests
void Lingo::runTests() {
Common::File inFile;
Common::ArchiveMemberList fsList;
SearchMan.listMatchingMembers(fsList, "*.lingo");
Common::StringArray fileList;
int counter = 1;
for (Common::ArchiveMemberList::iterator it = fsList.begin(); it != fsList.end(); ++it)
fileList.push_back((*it)->getName());
Common::sort(fileList.begin(), fileList.end());
for (uint i = 0; i < fileList.size(); i++) {
Common::SeekableReadStream *const stream = SearchMan.createReadStreamForMember(fileList[i]);
if (stream) {
uint size = stream->size();
char *script = (char *)calloc(size + 1, 1);
stream->read(script, size);
debugC(2, kDebugLingoCompile, "Compiling file %s of size %d, id: %d", fileList[i].c_str(), size, counter);
_hadError = false;
addCode(script, kMovieScript, counter);
if (!_hadError)
executeScript(kMovieScript, counter);
else
debugC(2, kDebugLingoCompile, "Skipping execution");
free(script);
counter++;
}
inFile.close();
}
}
示例14: listMembers
int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) const {
if (_hasCached) {
member_list.insert(member_list.end(), _cachedMembers.begin(), _cachedMembers.end());
return _cachedMembers.size();
}
int count = 0;
AAssetDir *dir = AAssetManager_openDir(_am, "");
const char *file = AAssetDir_getNextFileName(dir);
while (file) {
member_list.push_back(getMember(file));
++count;
file = AAssetDir_getNextFileName(dir);
}
AAssetDir_close(dir);
_cachedMembers = Common::ArchiveMemberList(member_list);
_hasCached = true;
return count;
}
示例15: listSavefiles
Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String &pattern) {
Common::String savePathName = getSavePath();
checkPath(Common::FSNode(savePathName));
if (getError().getCode() != Common::kNoError)
return Common::StringArray();
// recreate FSNode since checkPath may have changed/created the directory
Common::FSNode savePath(savePathName);
Common::FSDirectory dir(savePath);
Common::ArchiveMemberList savefiles;
Common::StringArray results;
Common::String search(pattern);
if (dir.listMatchingMembers(savefiles, search) > 0) {
for (Common::ArchiveMemberList::const_iterator file = savefiles.begin(); file != savefiles.end(); ++file) {
results.push_back((*file)->getName());
}
}
return results;
}