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

U_DRAFT int32_t U_EXPORT2 ucal_getCanonicalTimeZoneID ( const UChar id,
int32_t  len,
UChar result,
int32_t  resultCapacity,
UBool isSystemID,
UErrorCode status 
)

Returns the canonical system timezone ID or the normalized custom time zone ID for the given time zone ID.

Parameters:
idThe input timezone ID to be canonicalized.
lenThe length of id, or -1 if null-terminated.
resultThe buffer receives the canonical system timezone ID or the custom timezone ID in normalized format.
resultCapacityThe capacity of the result buffer.
isSystemIDReceives if the given ID is a known system timezone ID.
statusRecevies the status. When the given timezone ID is neither a known system time zone ID nor a valid custom timezone ID, U_ILLEGAL_ARGUMENT_ERROR is set.
Returns:
The result string length, not including the terminating null. ICU 4.0

Definition at line 502 of file ucal.cpp.

References UnicodeString::extract(), FALSE, TimeZone::getCanonicalID(), U_FAILURE, U_ILLEGAL_ARGUMENT_ERROR, and U_SUCCESS.

                                                                                                          {
    if(status == 0 || U_FAILURE(*status)) {
        return 0;
    }
    if (isSystemID) {
        *isSystemID = FALSE;
    }
    if (id == 0 || len == 0 || result == 0 || resultCapacity <= 0) {
        *status = U_ILLEGAL_ARGUMENT_ERROR;
        return 0;
    }
    int32_t reslen = 0;
    UnicodeString canonical;
    UBool systemID = FALSE;
    TimeZone::getCanonicalID(UnicodeString(id, len), canonical, systemID, *status);
    if (U_SUCCESS(*status)) {
        if (isSystemID) {
            *isSystemID = systemID;
        }
        reslen = canonical.extract(result, resultCapacity, *status);
    }
    return reslen;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index