Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_INTERNAL int32_t U_EXPORT2 udat_toPatternRelativeDate ( const UDateFormat fmt,
UChar *  result,
int32_t  resultLength,
UErrorCode status 
)

Extract the date pattern from a UDateFormat set for relative date formatting. The pattern will follow the pattern syntax rules.

Parameters:
fmt The formatter to query.
result A pointer to a buffer to receive the pattern.
resultLength The maximum size of result.
status A pointer to a UErrorCode to receive any errors
Returns:
The total buffer size needed; if greater than resultLength, the output was truncated.
See also:
udat_applyPatternRelative

For internal use only.

ICU 4.2 technology preview

Definition at line 907 of file udat.cpp.

References UnicodeString::extract(), NULL, UnicodeString::setTo(), and U_FAILURE.

{
    verifyIsRelativeDateFormat(fmt, status);
    if(U_FAILURE(*status)) return -1;

    UnicodeString datePattern;
    if(!(result==NULL && resultLength==0)) {
        // NULL destination for pure preflighting: empty dummy string
        // otherwise, alias the destination buffer
        datePattern.setTo(result, 0, resultLength);
    }
    ((RelativeDateFormat*)fmt)->toPatternDate(datePattern, *status);
    return datePattern.extract(result, resultLength, *status);
}


Generated by  Doxygen 1.6.0   Back to index