ICU-10979 add udat_adoptNumberFormat & update doc
X-SVN-Rev: 36035
This commit is contained in:
parent
f58b3f8fd7
commit
8787394bd1
@ -356,6 +356,13 @@ udat_setNumberFormat(UDateFormat* fmt,
|
|||||||
((DateFormat*)fmt)->setNumberFormat(*((NumberFormat*)numberFormatToSet));
|
((DateFormat*)fmt)->setNumberFormat(*((NumberFormat*)numberFormatToSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U_DRAFT void U_EXPORT2
|
||||||
|
udat_adoptNumberFormat( UDateFormat* fmt,
|
||||||
|
UNumberFormat* numberFormatToAdopt)
|
||||||
|
{
|
||||||
|
((DateFormat*)fmt)->adoptNumberFormat((NumberFormat*)numberFormatToAdopt);
|
||||||
|
}
|
||||||
|
|
||||||
U_CAPI const char* U_EXPORT2
|
U_CAPI const char* U_EXPORT2
|
||||||
udat_getAvailable(int32_t index)
|
udat_getAvailable(int32_t index)
|
||||||
{
|
{
|
||||||
|
@ -1088,6 +1088,7 @@ udat_getNumberFormat(const UDateFormat* fmt);
|
|||||||
* Set the UNumberFormat associated with an UDateFormat.
|
* Set the UNumberFormat associated with an UDateFormat.
|
||||||
* A UDateFormat uses a UNumberFormat to format numbers within a date,
|
* A UDateFormat uses a UNumberFormat to format numbers within a date,
|
||||||
* for example the day number.
|
* for example the day number.
|
||||||
|
* Note: udat_setNumberFormat will clone the UNumberFormat*
|
||||||
* @param fmt The formatter to set.
|
* @param fmt The formatter to set.
|
||||||
* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
|
* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
|
||||||
* @see udat_getNumberFormat
|
* @see udat_getNumberFormat
|
||||||
@ -1097,6 +1098,19 @@ U_STABLE void U_EXPORT2
|
|||||||
udat_setNumberFormat( UDateFormat* fmt,
|
udat_setNumberFormat( UDateFormat* fmt,
|
||||||
const UNumberFormat* numberFormatToSet);
|
const UNumberFormat* numberFormatToSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adopt the UNumberFormat associated with an UDateFormat.
|
||||||
|
* A UDateFormat uses a UNumberFormat to format numbers within a date,
|
||||||
|
* for example the day number.
|
||||||
|
* @param fmt The formatter to set.
|
||||||
|
* @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to format numbers.
|
||||||
|
* @see udat_getNumberFormat
|
||||||
|
* @draft ICU 54
|
||||||
|
*/
|
||||||
|
U_DRAFT void U_EXPORT2
|
||||||
|
udat_adoptNumberFormat( UDateFormat* fmt,
|
||||||
|
UNumberFormat* numberFormatToAdopt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a locale for which date/time formatting patterns are available.
|
* Get a locale for which date/time formatting patterns are available.
|
||||||
* A UDateFormat in a locale returned by this function will perform the correct
|
* A UDateFormat in a locale returned by this function will perform the correct
|
||||||
|
@ -66,6 +66,7 @@ static void TestDateFormat()
|
|||||||
UChar* result = NULL;
|
UChar* result = NULL;
|
||||||
const UCalendar *cal;
|
const UCalendar *cal;
|
||||||
const UNumberFormat *numformat1, *numformat2;
|
const UNumberFormat *numformat1, *numformat2;
|
||||||
|
UNumberFormat *adoptNF;
|
||||||
UChar temp[50];
|
UChar temp[50];
|
||||||
int32_t numlocales;
|
int32_t numlocales;
|
||||||
UDate d1;
|
UDate d1;
|
||||||
@ -338,6 +339,16 @@ static void TestDateFormat()
|
|||||||
log_err("FAIL: error in setNumberFormat or getNumberFormat()\n");
|
log_err("FAIL: error in setNumberFormat or getNumberFormat()\n");
|
||||||
else
|
else
|
||||||
log_verbose("PASS:setNumberFormat and getNumberFormat succesful\n");
|
log_verbose("PASS:setNumberFormat and getNumberFormat succesful\n");
|
||||||
|
|
||||||
|
/*Test getNumberFormat() and adoptNumberFormat() */
|
||||||
|
log_verbose("\nTesting the get and adopt NumberFormat properties of date format\n");
|
||||||
|
adoptNF= unum_open(UNUM_DEFAULT, NULL, 0, NULL, NULL, &status);
|
||||||
|
udat_adoptNumberFormat(def1, adoptNF);
|
||||||
|
numformat2=udat_getNumberFormat(def1);
|
||||||
|
if(u_strcmp(myNumformat(adoptNF, num), myNumformat(numformat2, num)) !=0)
|
||||||
|
log_err("FAIL: error in adoptNumberFormat or getNumberFormat()\n");
|
||||||
|
else
|
||||||
|
log_verbose("PASS:adoptNumberFormat and getNumberFormat succesful\n");
|
||||||
|
|
||||||
/*try setting the number format to another format */
|
/*try setting the number format to another format */
|
||||||
numformat1=udat_getNumberFormat(def);
|
numformat1=udat_getNumberFormat(def);
|
||||||
|
Loading…
Reference in New Issue
Block a user