本文整理汇总了C++中NFRule::doFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ NFRule::doFormat方法的具体用法?C++ NFRule::doFormat怎么用?C++ NFRule::doFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFRule
的用法示例。
在下文中一共展示了NFRule::doFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findDoubleRule
void
NFRuleSet::format(double number, UnicodeString& toAppendTo, int32_t pos, UErrorCode& status) const
{
NFRule *rule = findDoubleRule(number);
if (rule) { // else error, but can't report it
NFRuleSet* ncThis = (NFRuleSet*)this;
if (ncThis->fRecursionCount++ >= RECURSION_LIMIT) {
// stop recursion
ncThis->fRecursionCount = 0;
} else {
rule->doFormat(number, toAppendTo, pos, status);
ncThis->fRecursionCount--;
}
}
}
示例2: transformNumber
/**
* If this is a >>> substitution, use ruleToUse to fill in
* the substitution. Otherwise, just use the superclass function.
* @param number The number being formatted
* @toInsertInto The string to insert the result of this substitution
* into
* @param pos The position of the rule text in toInsertInto
*/
void
ModulusSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t _pos) const
{
// if this isn't a >>> substitution, just use the inherited version
// of this function (which uses either a rule set or a DecimalFormat
// to format its substitution value)
if (ruleToUse == NULL) {
NFSubstitution::doSubstitution(number, toInsertInto, _pos);
// a >>> substitution goes straight to a particular rule to
// format the substitution value
} else {
int64_t numberToFormat = transformNumber(number);
ruleToUse->doFormat(numberToFormat, toInsertInto, _pos + getPos());
}
}