本文整理汇总了C++中LocalPointer::doStuff方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalPointer::doStuff方法的具体用法?C++ LocalPointer::doStuff怎么用?C++ LocalPointer::doStuff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalPointer
的用法示例。
在下文中一共展示了LocalPointer::doStuff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
//.........这里部分代码省略.........
if(0 != output.compare(kNumberFormatTestData[whichLine].string)) {
IntlTest::gTest->errln("format().. expected " + kNumberFormatTestData[whichLine].string
+ " got " + output);
goto cleanupAndReturn;
}
// Now check percent.
output.remove();
whichLine = (iteration + fOffset)%kPercentFormatTestDataLength;
percentFormatter->format(kPercentFormatTestData[whichLine].number, output);
if(0 != output.compare(kPercentFormatTestData[whichLine].string))
{
IntlTest::gTest->errln("percent format().. \n" +
showDifference(kPercentFormatTestData[whichLine].string,output));
goto cleanupAndReturn;
}
// Test message error
const int kNumberOfMessageTests = 3;
UErrorCode statusToCheck;
UnicodeString patternToCheck;
Locale messageLocale;
Locale countryToCheck;
double currencyToCheck;
UnicodeString expected;
// load the cases.
switch((iteration+fOffset) % kNumberOfMessageTests)
{
default:
case 0:
statusToCheck= U_FILE_ACCESS_ERROR;
patternToCheck= "0:Someone from {2} is receiving a #{0}"
" error - {1}. Their telephone call is costing "
"{3,number,currency}."; // number,currency
messageLocale= Locale("en","US");
countryToCheck= Locale("","HR");
currencyToCheck= 8192.77;
expected= "0:Someone from Croatia is receiving a #4 error - "
"U_FILE_ACCESS_ERROR. Their telephone call is costing $8,192.77.";
break;
case 1:
statusToCheck= U_INDEX_OUTOFBOUNDS_ERROR;
patternToCheck= "1:A customer in {2} is receiving a #{0} error - {1}. "
"Their telephone call is costing {3,number,currency}."; // number,currency
messageLocale= Locale("de","[email protected]=DEM");
countryToCheck= Locale("","BF");
currencyToCheck= 2.32;
expected= CharsToUnicodeString(
"1:A customer in Burkina Faso is receiving a #8 error - U_INDEX_OUTOFBOUNDS_ERROR. "
"Their telephone call is costing 2,32\\u00A0DM.");
break;
case 2:
statusToCheck= U_MEMORY_ALLOCATION_ERROR;
patternToCheck= "2:user in {2} is receiving a #{0} error - {1}. "
"They insist they just spent {3,number,currency} "
"on memory."; // number,currency
messageLocale= Locale("de","[email protected]=ATS"); // Austrian German
countryToCheck= Locale("","US"); // hmm
currencyToCheck= 40193.12;
expected= CharsToUnicodeString(
"2:user in Vereinigte Staaten is receiving a #7 error"
" - U_MEMORY_ALLOCATION_ERROR. They insist they just spent"
" \\u00f6S\\u00A040\\u00A0193,12 on memory.");
break;
}
UnicodeString result;
UErrorCode status = U_ZERO_ERROR;
formatErrorMessage(status,patternToCheck,messageLocale,statusToCheck,
countryToCheck,currencyToCheck,result);
if(U_FAILURE(status))
{
UnicodeString tmp(u_errorName(status));
IntlTest::gTest->errln("Failure on message format, pattern=" + patternToCheck +
", error = " + tmp);
goto cleanupAndReturn;
}
if(result != expected)
{
IntlTest::gTest->errln("PatternFormat: \n" + showDifference(expected,result));
goto cleanupAndReturn;
}
// test the Thread Safe Format
UnicodeString appendErr;
if(!fTSF->doStuff(fNum, appendErr, status)) {
IntlTest::gTest->errln(appendErr);
goto cleanupAndReturn;
}
} /* end of for loop */
cleanupAndReturn:
fTraceInfo = 2;
}