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

U_INTERNAL int32_t U_EXPORT2 udat_toPatternRelativeTime ( const UDateFormat fmt,
UChar result,
int32_t  resultLength,
UErrorCode status 

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

fmtThe formatter to query.
resultA pointer to a buffer to receive the pattern.
resultLengthThe maximum size of result.
statusA pointer to a UErrorCode to receive any errors
The total buffer size needed; if greater than resultLength, the output was truncated.
See also:
udat_applyPatternRelative ICU 4.2 technology preview

Definition at line 882 of file udat.cpp.

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

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

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

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index