本文整理汇总了C++中NumberFormat::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ NumberFormat::clone方法的具体用法?C++ NumberFormat::clone怎么用?C++ NumberFormat::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NumberFormat
的用法示例。
在下文中一共展示了NumberFormat::clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFormat
virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType)
{
if (formatType == UNUM_CURRENCY) {
return (NumberFormat*)currencyStyle->clone();
}
return NULL;
}
示例2: adoptNumberFormat
void
TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){
if (U_FAILURE(status)) {
return;
}
adoptNumberFormat((NumberFormat *)format.clone(), status);
}
示例3: adoptNumberFormat
void
DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)
{
NumberFormat* newNumFmtClone = (NumberFormat*)newNumberFormat.clone();
if (newNumFmtClone != NULL) {
adoptNumberFormat(newNumFmtClone);
}
}
示例4: while
void
TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){
if (U_FAILURE(status) || (fNumberFormat && format == *fNumberFormat)) {
return;
}
delete fNumberFormat;
fNumberFormat = (NumberFormat*)format.clone();
// reset the number formatter in the fTimeUnitToCountToPatterns map
for (TimeUnit::UTimeUnitFields i = TimeUnit::UTIMEUNIT_YEAR;
i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
i = (TimeUnit::UTimeUnitFields)(i+1)) {
int32_t pos = -1;
const UHashElement* elem = NULL;
while ((elem = fTimeUnitToCountToPatterns[i]->nextElement(pos)) != NULL){
const UHashTok keyTok = elem->value;
MessageFormat** pattern = (MessageFormat**)keyTok.pointer;
pattern[kFull]->setFormat(0, format);
pattern[kAbbreviate]->setFormat(0, format);
}
}
}