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

void Calendar::validateField ( UCalendarDateFields  field,
UErrorCode status 
) [private, virtual]

Validate a single field of this calendar. Subclasses should override this method to validate any calendar-specific fields. Generic fields can be handled by Calendar.validateField().

See also:
validateField(int, int, int, int&)

For internal use only.

Validate a single field of this calendar. Subclasses should override this method to validate any calendar-specific fields. Generic fields can be handled by Calendar.validateField().

See also:
validateField(int, int, int)

Definition at line 2266 of file calendar.cpp.

References getMaximum(), getMinimum(), handleGetExtendedYear(), handleGetMonthLength(), handleGetYearLength(), internalGet(), U_ILLEGAL_ARGUMENT_ERROR, UCAL_DAY_OF_MONTH, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_DAY_OF_YEAR, and UCAL_MONTH.

Referenced by validateFields().

                                                                          {
    int32_t y;
    switch (field) {
    case UCAL_DAY_OF_MONTH:
        y = handleGetExtendedYear();
        validateField(field, 1, handleGetMonthLength(y, internalGet(UCAL_MONTH)), status);
        break;
    case UCAL_DAY_OF_YEAR:
        y = handleGetExtendedYear();
        validateField(field, 1, handleGetYearLength(y), status);
        break;
    case UCAL_DAY_OF_WEEK_IN_MONTH:
        if (internalGet(field) == 0) {
#if defined (U_DEBUG_CAL)
            fprintf(stderr, "%s:%d: ILLEGAL ARG because DOW in month cannot be 0\n", 
                __FILE__, __LINE__);
#endif
            status = U_ILLEGAL_ARGUMENT_ERROR; // "DAY_OF_WEEK_IN_MONTH cannot be zero"
            return;
        }
        validateField(field, getMinimum(field), getMaximum(field), status);
        break;
    default:
        validateField(field, getMinimum(field), getMaximum(field), status);
        break;
    }
}


Generated by  Doxygen 1.6.0   Back to index