本文整理汇总了C++中Transliterator::getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:C++ Transliterator::getDisplayName方法的具体用法?C++ Transliterator::getDisplayName怎么用?C++ Transliterator::getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transliterator
的用法示例。
在下文中一共展示了Transliterator::getDisplayName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestGetDisplayName
void TransliteratorAPITest::TestGetDisplayName() {
UnicodeString dispNames[]= {
//ID, displayName
//"CurlyQuotes-StraightQuotes" ,"CurlyQuotes to StraightQuotes",
"Any-Hex" ,"Any to Hex Escape",
"Halfwidth-Fullwidth" ,"Halfwidth to Fullwidth" ,
//"Latin-Arabic" ,"Latin to Arabic" ,
"Latin-Devanagari" ,"Latin to Devanagari" ,
"Greek-Latin" ,"Greek to Latin" ,
//"Arabic-Latin" ,"Arabic to Latin" ,
"Hex-Any" ,"Hex Escape to Any",
"Cyrillic-Latin" ,"Cyrillic to Latin" ,
"Latin-Greek" ,"Latin to Greek" ,
"Latin-Katakana" ,"Latin to Katakana" ,
//"Latin-Hebrew" ,"Latin to Hebrew" ,
"Katakana-Latin" ,"Katakana to Latin"
};
UnicodeString name="";
Transliterator* t;
UnicodeString message;
UErrorCode status = U_ZERO_ERROR;
UParseError parseError;
#if UCONFIG_NO_FORMATTING
logln("Skipping, UCONFIG_NO_FORMATTING is set\n");
return;
#else
for (uint32_t i=0; i<sizeof(dispNames)/sizeof(dispNames[0]); i=i+2 ) {
t = Transliterator::createInstance(dispNames[i+0], UTRANS_FORWARD, parseError, status);
if(t==0){
dataerrln("FAIL: construction: " + dispNames[i+0] + " - " + u_errorName(status));
status = U_ZERO_ERROR;
continue;
}
t->getDisplayName(t->getID(), name);
message="Display name for ID:" + t->getID();
// doTest(message, name, dispNames[i+1]); //!!! This will obviously fail for any locale other than english and its children!!!
name="";
t->getDisplayName(t->getID(), Locale::getUS(), name);
message.remove();
message.append("Display name for on english locale ID:");
message.append(t->getID());
// message="Display name for on english locale ID:" + t->getID();
doTest(message, name, dispNames[i+1]);
name="";
delete t;
}
#endif
}