+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
************************************************************************
-* Copyright (c) 2007, International Business Machines
+* Copyright (c) 2007-2011, International Business Machines
* Corporation and others. All Rights Reserved.
************************************************************************
*/
u_UCharsToChars(u, ch, len);
ch[len] = 0; /* include terminating \0 */
it_errln(UnicodeString("Parse Failed: Field ") + UnicodeString(ch) + UnicodeString(", err ") + UnicodeString(u_errorName(status)));
+ delete[] kv;
+ delete[] dest;
return -1;
}
u_UCharsToChars(u, ch, len);
ch[len] = 0; /* include terminating \0 */
it_errln(UnicodeString("Parse Failed: Value ") + UnicodeString(ch) + UnicodeString(", err ") + UnicodeString(u_errorName(status)));
+ delete[] kv;
+ delete[] dest;
return -1;
}
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());