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


C++ String::wordWrap方法代码示例

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


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

示例1: reportUnknown

void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds) const {
	Common::String report = Common::String::format(
			_("The game in '%s' seems to be an unknown %s engine game "
			  "variant.\n\nPlease report the following data to the ResidualVM "
			  "team at %s along with the name of the game you tried to add and "
			  "its version, language, etc.:"),
			path.getPath().c_str(), getName(), "https://github.com/residualvm/residualvm/issues");

	if (matchedGameIds.size()) {
		report += "\n\n";
		report += _("Matched game IDs:");
		report += " ";

		for (ADGameIdList::const_iterator gameId = matchedGameIds.begin(); gameId != matchedGameIds.end(); ++gameId) {
			if (gameId != matchedGameIds.begin()) {
				report += ", ";
			}
			report += *gameId;
		}
	}

	report += "\n\n";

	report.wordWrap(80);

	for (ADFilePropertiesMap::const_iterator file = filesProps.begin(); file != filesProps.end(); ++file)
		report += Common::String::format("  {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size);

	report += "\n";

	g_system->logMessage(LogMessageType::kInfo, report.c_str());
}
开发者ID:Botje,项目名称:residualvm,代码行数:32,代码来源:advancedDetector.cpp

示例2: generateUnknownGameReport

Common::String DetectionResults::generateUnknownGameReport(bool translate, uint32 wordwrapAt) const {
	assert(!_detectedGames.empty());

	const char *reportStart = _s("The game in '%s' seems to be an unknown game variant.\n\n"
	                             "Please report the following data to the ResidualVM team at %s "
	                             "along with the name of the game you tried to add and "
	                             "its version, language, etc.:");
	const char *reportEngineHeader = _s("Matched game IDs for the %s engine:");

	Common::String report = Common::String::format(
			translate ? _(reportStart) : reportStart, _detectedGames[0].path.c_str(),
			"https://github.com/residualvm/residualvm/issues"
	);
	report += "\n";

	FilePropertiesMap matchedFiles;

	const char *currentEngineName = nullptr;
	for (uint i = 0; i < _detectedGames.size(); i++) {
		const DetectedGame &game = _detectedGames[i];

		if (!game.hasUnknownFiles) continue;

		if (!currentEngineName || strcmp(currentEngineName, game.engineName) != 0) {
			currentEngineName = game.engineName;

			// If the engine is not the same as for the previous entry, print an engine line header
			report += "\n";
			report += Common::String::format(
					translate ? _(reportEngineHeader) : reportEngineHeader,
					game.engineName
			);
			report += " ";

		} else {
			report += ", ";
		}

		// Add the gameId to the list of matched games for the engine
		// TODO: Use the gameId here instead of the preferred target.
		// This is currently impossible due to the AD singleId feature losing the information.
		report += game.preferredTarget;

		// Consolidate matched files across all engines and detection entries
		for (FilePropertiesMap::const_iterator it = game.matchedFiles.begin(); it != game.matchedFiles.end(); it++) {
			matchedFiles.setVal(it->_key, it->_value);
		}
	}

	if (wordwrapAt) {
		report.wordWrap(wordwrapAt);
	}

	report += "\n\n";

	for (FilePropertiesMap::const_iterator file = matchedFiles.begin(); file != matchedFiles.end(); ++file)
		report += Common::String::format("  {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size);

	report += "\n";

	return report;
}
开发者ID:DouglasLiuGamer,项目名称:residualvm,代码行数:62,代码来源:game.cpp


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