| OLD | NEW |
| 1 /* | 1 /* |
| 2 ****************************************************************************** | 2 ****************************************************************************** |
| 3 * Copyright (C) 1997-2012, International Business Machines | 3 * Copyright (C) 1997-2014, International Business Machines |
| 4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
| 5 ****************************************************************************** | 5 ****************************************************************************** |
| 6 * file name: nfrs.cpp | 6 * file name: nfrs.cpp |
| 7 * encoding: US-ASCII | 7 * encoding: US-ASCII |
| 8 * tab size: 8 (not used) | 8 * tab size: 8 (not used) |
| 9 * indentation:4 | 9 * indentation:4 |
| 10 * | 10 * |
| 11 * Modification history | 11 * Modification history |
| 12 * Date Name Comments | 12 * Date Name Comments |
| 13 * 10/11/2001 Doug Ported from ICU4J | 13 * 10/11/2001 Doug Ported from ICU4J |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 return TRUE; | 330 return TRUE; |
| 331 } | 331 } |
| 332 return FALSE; | 332 return FALSE; |
| 333 } | 333 } |
| 334 | 334 |
| 335 #define RECURSION_LIMIT 50 | 335 #define RECURSION_LIMIT 50 |
| 336 | 336 |
| 337 void | 337 void |
| 338 NFRuleSet::format(int64_t number, UnicodeString& toAppendTo, int32_t pos) const | 338 NFRuleSet::format(int64_t number, UnicodeString& toAppendTo, int32_t pos, UError
Code& status) const |
| 339 { | 339 { |
| 340 NFRule *rule = findNormalRule(number); | 340 NFRule *rule = findNormalRule(number); |
| 341 if (rule) { // else error, but can't report it | 341 if (rule) { // else error, but can't report it |
| 342 NFRuleSet* ncThis = (NFRuleSet*)this; | 342 NFRuleSet* ncThis = (NFRuleSet*)this; |
| 343 if (ncThis->fRecursionCount++ >= RECURSION_LIMIT) { | 343 if (ncThis->fRecursionCount++ >= RECURSION_LIMIT) { |
| 344 // stop recursion | 344 // stop recursion |
| 345 ncThis->fRecursionCount = 0; | 345 ncThis->fRecursionCount = 0; |
| 346 } else { | 346 } else { |
| 347 rule->doFormat(number, toAppendTo, pos); | 347 rule->doFormat(number, toAppendTo, pos, status); |
| 348 ncThis->fRecursionCount--; | 348 ncThis->fRecursionCount--; |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 void | 353 void |
| 354 NFRuleSet::format(double number, UnicodeString& toAppendTo, int32_t pos) const | 354 NFRuleSet::format(double number, UnicodeString& toAppendTo, int32_t pos, UErrorC
ode& status) const |
| 355 { | 355 { |
| 356 NFRule *rule = findDoubleRule(number); | 356 NFRule *rule = findDoubleRule(number); |
| 357 if (rule) { // else error, but can't report it | 357 if (rule) { // else error, but can't report it |
| 358 NFRuleSet* ncThis = (NFRuleSet*)this; | 358 NFRuleSet* ncThis = (NFRuleSet*)this; |
| 359 if (ncThis->fRecursionCount++ >= RECURSION_LIMIT) { | 359 if (ncThis->fRecursionCount++ >= RECURSION_LIMIT) { |
| 360 // stop recursion | 360 // stop recursion |
| 361 ncThis->fRecursionCount = 0; | 361 ncThis->fRecursionCount = 0; |
| 362 } else { | 362 } else { |
| 363 rule->doFormat(number, toAppendTo, pos); | 363 rule->doFormat(number, toAppendTo, pos, status); |
| 364 ncThis->fRecursionCount--; | 364 ncThis->fRecursionCount--; |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 NFRule* | 369 NFRule* |
| 370 NFRuleSet::findDoubleRule(double number) const | 370 NFRuleSet::findDoubleRule(double number) const |
| 371 { | 371 { |
| 372 // if this is a fraction rule set, use findFractionRuleSetRule() | 372 // if this is a fraction rule set, use findFractionRuleSetRule() |
| 373 if (isFractionRuleSet()) { | 373 if (isFractionRuleSet()) { |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 | 962 |
| 963 return len; | 963 return len; |
| 964 } | 964 } |
| 965 | 965 |
| 966 | 966 |
| 967 U_NAMESPACE_END | 967 U_NAMESPACE_END |
| 968 | 968 |
| 969 /* U_HAVE_RBNF */ | 969 /* U_HAVE_RBNF */ |
| 970 #endif | 970 #endif |
| 971 | 971 |
| OLD | NEW |