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


C++ SimpleString::replace方法代码示例

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


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

示例1: encodeXmlText

SimpleString JUnitTestOutput::encodeXmlText(const SimpleString& textbody)
{
    SimpleString buf = textbody.asCharString();
    buf.replace("&", "&");
    buf.replace("\"", """);
    buf.replace("<", "&lt;");
    buf.replace(">", "&gt;");
    buf.replace("\n", "{newline}");
    return buf;
}
开发者ID:offa,项目名称:cpputest,代码行数:10,代码来源:JUnitTestOutput.cpp

示例2: writeFailure

void JUnitTestOutput::writeFailure(JUnitTestCaseResultNode* node)
{
	SimpleString message = node->failure_->getMessage().asCharString();
	message.replace('"', '\'');
	message.replace('<', '[');
	message.replace('>', ']');
	message.replace("\n", "{newline}");
	SimpleString buf = StringFromFormat(
			"<failure message=\"%s:%d: %s\" type=\"AssertionFailedError\">\n",
			node->failure_->getFileName().asCharString(),
			node->failure_->getFailureLineNumber(), message.asCharString());
	writeToFile(buf.asCharString());
	writeToFile("</failure>\n");
}
开发者ID:Pindar,项目名称:common-data-structures-in-c,代码行数:14,代码来源:JUnitTestOutput.cpp

示例3: listTestGroupAndCaseNames

void TestRegistry::listTestGroupAndCaseNames(TestResult& result)
{
    SimpleString groupAndNameList;

    for (UtestShell *test = tests_; test != NULL; test = test->getNext()) {
        if (testShouldRun(test, result)) {
            SimpleString groupAndName;
            groupAndName += "#";
            groupAndName += test->getGroup();
            groupAndName += ".";
            groupAndName += test->getName();
            groupAndName += "#";

            if (!groupAndNameList.contains(groupAndName)) {
                groupAndNameList += groupAndName;
                groupAndNameList += " ";
            }
        }
    }

    groupAndNameList.replace("#", "");

    if (groupAndNameList.endsWith(" "))
        groupAndNameList = groupAndNameList.subString(0, groupAndNameList.size() - 1);
    result.print(groupAndNameList.asCharString());
}
开发者ID:13coders,项目名称:cookiecutter-kata-cpputest,代码行数:26,代码来源:TestRegistry.cpp

示例4: writeFailure

void JUnitTestOutput::writeFailure(JUnitTestCaseResultNode* node)
{
	const int buf_size = 1024;
	static char buf[buf_size];

	SimpleString message = node->failure_->getMessage().asCharString();
	message.replace('"', '\'');
	message.replace('<','[');
	message.replace('>',']');
	message.replace("\n","{newline}");
	cpputest_snprintf(buf, buf_size, "<failure message=\"%s:%d: %s\" type=\"AssertionFailedError\">\n", 
		node->failure_->getFileName().asCharString(), node->failure_->getLineNumber(), message.asCharString());

	writeToFile(buf);
	writeToFile("</failure>\n");
}
开发者ID:RobinLiu,项目名称:Test,代码行数:16,代码来源:JUnitTestOutput.cpp

示例5: createFileName

SimpleString JUnitTestOutput::createFileName(const SimpleString& group)
{
    SimpleString fileName = "cpputest_";
    fileName += group;
    fileName.replace('/', '_');
    fileName += ".xml";
    return fileName;
}
开发者ID:offa,项目名称:cpputest,代码行数:8,代码来源:JUnitTestOutput.cpp

示例6: createVariableNameFromFileLineInfo

SimpleString CodeMemoryReportFormatter::createVariableNameFromFileLineInfo(const char *file, int line)
{
    SimpleString fileNameOnly = extractFileNameFromPath(file);
    fileNameOnly.replace(".", "_");

    for (int i = 1; i < 100000; i++) {
		SimpleString variableName = StringFromFormat("%s_%d_%d", fileNameOnly.asCharString(), line, i);
		if (!variableExists(variableName))
			return variableName;
    }
    return "";
}
开发者ID:UlkUpp,项目名称:cpputest,代码行数:12,代码来源:CodeMemoryReportFormatter.cpp

示例7: parseArguments

bool MemoryReporterPlugin::parseArguments(int /* ac */, const char** av, int index)
{
	SimpleString argument (av[index]);
	if (argument.contains("-pmemoryreport=")) {
		argument.replace("-pmemoryreport=", "");

		destroyMemoryFormatter(formatter_);
		formatter_ = createMemoryFormatter(argument);
		return true;
	}
	return false;
}
开发者ID:CNCBASHER,项目名称:mri,代码行数:12,代码来源:MemoryReporterPlugin.cpp


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