本文整理汇总了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("<", "<");
buf.replace(">", ">");
buf.replace("\n", "{newline}");
return buf;
}
示例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");
}
示例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());
}
示例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");
}
示例5: createFileName
SimpleString JUnitTestOutput::createFileName(const SimpleString& group)
{
SimpleString fileName = "cpputest_";
fileName += group;
fileName.replace('/', '_');
fileName += ".xml";
return fileName;
}
示例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 "";
}
示例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;
}