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

U_STABLE void U_EXPORT2 udat_parseCalendar ( const UDateFormat format,
UCalendar calendar,
const UChar text,
int32_t  textLength,
int32_t *  parsePos,
UErrorCode status 
)

Parse a string into an date/time using a UDateFormat. The date will be parsed using the conventions specified in udat_open

Parameters:
formatThe formatter to use.
calendarThe calendar in which to store the parsed data.
textThe text to parse.
textLengthThe length of text, or -1 if null-terminated.
parsePosIf not 0, on input a pointer to an integer specifying the offset at which to begin parsing. If not 0, on output the offset at which parsing ended.
statusA pointer to an UErrorCode to receive any errors
See also:
udat_format ICU 2.0

Definition at line 183 of file udat.cpp.

References ParsePosition::getErrorIndex(), ParsePosition::getIndex(), ParsePosition::setIndex(), U_FAILURE, and U_PARSE_ERROR.

{
    if(U_FAILURE(*status)) return;

    const UnicodeString src((UBool)(textLength == -1), text, textLength);
    ParsePosition pp;

    if(parsePos != 0)
        pp.setIndex(*parsePos);

    ((DateFormat*)format)->parse(src, *(Calendar*)calendar, pp);

    if(parsePos != 0) {
        if(pp.getErrorIndex() == -1)
            *parsePos = pp.getIndex();
        else {
            *parsePos = pp.getErrorIndex();
            *status = U_PARSE_ERROR;
        }
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index