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


C++ UString::replaceAll方法代码示例

本文整理汇总了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;
    }

}
开发者ID:idkwim,项目名称:xoreos-tools,代码行数:45,代码来源:unerf.cpp

示例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;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:10,代码来源:creature.cpp

示例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);
}
开发者ID:idkwim,项目名称:xoreos-tools,代码行数:36,代码来源:unerf.cpp


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