Logo Search packages:      
Sourcecode: icu version File versions

int32_t DecimalFormat::compareAffix ( const UnicodeString text,
int32_t  pos,
UBool  isNegative,
UBool  isPrefix,
const UnicodeString affixPat,
UBool  currencyParsing,
int8_t  type,
UChar currency 
) const [private]

Return the length matched by the given affix, or -1 if none. Runs of white space in the affix, match runs of white space in the input. Pattern white space and input white space are determined differently; see code.

Parameters:
textinput text
posoffset into input at which to begin matching
isNegative
isPrefix
affixPataffix pattern used for currency affix comparison.
currencyParsingwhether it is currency parsing or not
typethe currency type to parse against, LONG_NAME only or not.
currencyreturn value for parsed currency, for generic currency parsing mode, or null for normal parsing. In generic currency parsing mode, any currency is parsed, not just the currency that this formatter is set to.
Returns:
length of input that matches, or -1 if match failure

Definition at line 2262 of file decimfmt.cpp.

References compareComplexAffix(), compareSimpleAffix(), fCurrencyChoice, fPositivePrefix, NumberFormat::isLenient(), and NULL.

Referenced by subparse().

{
    const UnicodeString *patternToCompare;
    if (fCurrencyChoice != NULL || currency != NULL ||
        (fCurrencySignCount > fgCurrencySignCountZero && currencyParsing)) {

        if (affixPat != NULL) {
            return compareComplexAffix(*affixPat, text, pos, type, currency);
        }
    }

    if (isNegative) {
        if (isPrefix) {
            patternToCompare = &fNegativePrefix;
        }
        else {
            patternToCompare = &fNegativeSuffix;
        }
    }
    else {
        if (isPrefix) {
            patternToCompare = &fPositivePrefix;
        }
        else {
            patternToCompare = &fPositiveSuffix;
        }
    }
    return compareSimpleAffix(*patternToCompare, text, pos, isLenient());
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index