本文整理汇总了C++中common::UString::replaceAll方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::replaceAll方法的具体用法?C++ UString::replaceAll怎么用?C++ UString::replaceAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::UString
的用法示例。
在下文中一共展示了UString::replaceAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extractFiles
void extractFiles(Aurora::ERFFile &erf, Aurora::GameID game,
std::set<Common::UString> &files, ExtractMode mode) {
const Aurora::Archive::ResourceList &resources = erf.getResources();
const size_t fileCount = resources.size();
std::printf("Number of files: %u\n\n", (uint)fileCount);
size_t i = 1;
for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r, ++i) {
Common::UString name = r->name;
if (name.empty())
findHashedName(r->hash, name);
name.replaceAll('\\', '/');
if (mode == kExtractModeStrip)
name = Common::FilePath::getFile(name);
const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);
Common::UString fileName = TypeMan.addFileType(name, type);
if (!files.empty() && (files.find(fileName) == files.end()))
continue;
if (mode == kExtractModeSubstitute)
fileName.replaceAll('/', '=');
std::printf("Extracting %u/%u: %s ... ", (uint)i, (uint)fileCount, fileName.c_str());
Common::SeekableReadStream *stream = 0;
try {
stream = erf.getResource(r->index);
dumpStream(*stream, fileName);
std::printf("Done\n");
} catch (Common::Exception &e) {
Common::printException(e, "");
}
delete stream;
}
}
示例2: getBaseModel
Common::UString Creature::getBaseModel(const Common::UString &base) {
const Aurora::TwoDARow &appearance = TwoDAReg.get2DA("appearance").getRow(_appearanceID);
Common::UString baseModel = appearance.getString(base);
// Male/Female
baseModel.replaceAll('?', isFemale() ? 'F' : 'M');
return baseModel;
}
示例3: listVerboseFiles
void listVerboseFiles(Aurora::ERFFile &erf, Aurora::GameID game) {
const Aurora::Archive::ResourceList &resources = erf.getResources();
const size_t fileCount = resources.size();
std::printf("Number of files: %u\n\n", (uint)fileCount);
std::vector<FileEntry> fileEntries;
fileEntries.reserve(fileCount);
size_t nameLength = 10;
for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r) {
const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);
Common::UString name = r->name;
if (name.empty())
findHashedName(r->hash, name);
name.replaceAll('\\', '/');
name = TypeMan.addFileType(name, type);
nameLength = MAX<size_t>(nameLength, name.size() + 1);
fileEntries.push_back(FileEntry(name, erf.getResourceSize(r->index)));
}
if ((nameLength % 2) == 1)
nameLength++;
std::printf("%sFileName%s| Size\n", Common::UString(' ', (nameLength - 8) / 2).c_str(),
Common::UString(' ', (nameLength - 8) / 2).c_str());
std::printf("%s|===========\n", Common::UString('=', nameLength).c_str());
for (std::vector<FileEntry>::const_iterator f = fileEntries.begin(); f != fileEntries.end(); ++f)
std::printf("%-*s| %10d\n", (int)nameLength, f->file.c_str(), f->size);
}