/*
************************************************************************
-* Copyright (c) 2007, International Business Machines
+* Copyright (c) 2007-2008, International Business Machines
* Corporation and others. All Rights Reserved.
************************************************************************
*/
int32_t FieldsSet::handleParseName(const FieldsSet* /* inheritFrom */, const UnicodeString& name, const UnicodeString& /* substr*/ , UErrorCode& status) {
if(fEnum > -1) {
- return udbg_enumByString(fEnum, name);
+ int32_t which = udbg_enumByString(fEnum, name);
+ if(which == UDBG_INVALID_ENUM) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return which;
} else {
status = U_UNSUPPORTED_ERROR;
return -1;
for (int i=0; i<UDAT_FIELD_COUNT; i++) {
if (isSet((UCalendarDateFields)i)) {
int32_t value = get((UCalendarDateFields)i);
- //fprintf(stderr, "Setting: %s#%d=%d\n",udbg_enumName(UDBG_UCalendarDateFields,i),i,value);
cal->set((UCalendarDateFields)i, value);
}
}
UBool CalendarFieldsSet::matches(Calendar *cal, CalendarFieldsSet &diffSet,
UErrorCode& status) const {
UBool match = TRUE;
- if (U_FAILURE(status))
+ if (U_FAILURE(status)) {
return FALSE;
+ }
for (int i=0; i<UDAT_FIELD_COUNT; i++) {
if (isSet((UCalendarDateFields)i)) {
int32_t calVal = cal->get((UCalendarDateFields)i, status);
}
-enum {
- DTS_DATE = 0,
- DTS_TIME,
- DTS_COUNT
+/**
+ * DateTimeStyleSet has two 'fields' -- date, and time.
+ */
+enum DateTimeStyleSetFields {
+ DTS_DATE = 0, /** Field one: the date (long, medium, short, etc). */
+ DTS_TIME, /** Field two: the time (long, medium, short, etc). */
+ DTS_COUNT /** The number of fields */
};
/**
* */
DateTimeStyleSet::DateTimeStyleSet() :
FieldsSet(DTS_COUNT) {
-
}
DateTimeStyleSet::~DateTimeStyleSet() {
}
void DateTimeStyleSet::handleParseValue(const FieldsSet* inheritFrom, int32_t field, const UnicodeString& substr, UErrorCode& status) {
-// int32_t value = udbg_enumByString(UDBG_UDateFormatStyle, substr);
-// fprintf(stderr, " HPV: %d -> %d\n", field, value);
UnicodeString kRELATIVE_("RELATIVE_");
if(substr.startsWith(kRELATIVE_)) {
UnicodeString relativeas(substr,kRELATIVE_.length());