mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-7912 more review comments
X-SVN-Rev: 34428
This commit is contained in:
parent
4396765af8
commit
58fd7c7583
4 changed files with 25 additions and 13 deletions
|
@ -922,7 +922,7 @@ ufmt_close(UFormattable *fmt) {
|
|||
U_INTERNAL UFormattableType U_EXPORT2
|
||||
ufmt_getType(const UFormattable *fmt, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) {
|
||||
return (UFormattableType)-1;
|
||||
return (UFormattableType)UFMT_COUNT;
|
||||
}
|
||||
const Formattable *obj = Formattable::fromUFormattable(fmt);
|
||||
return (UFormattableType)obj->getType();
|
||||
|
|
|
@ -624,6 +624,14 @@ public:
|
|||
*/
|
||||
inline UFormattable *toUFormattable();
|
||||
|
||||
/**
|
||||
* Convert this object pointer to a UFormattable.
|
||||
* @return this object as a UFormattable pointer. This is an alias to this object,
|
||||
* and so is only valid while this object remains in scope.
|
||||
* @draft ICU 52
|
||||
*/
|
||||
inline const UFormattable *toUFormattable() const;
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* Deprecated variant of getLong(UErrorCode&).
|
||||
|
@ -732,6 +740,10 @@ inline UFormattable* Formattable::toUFormattable() {
|
|||
return reinterpret_cast<UFormattable*>(this);
|
||||
}
|
||||
|
||||
inline const UFormattable* Formattable::toUFormattable() const {
|
||||
return reinterpret_cast<const UFormattable*>(this);
|
||||
}
|
||||
|
||||
inline Formattable* Formattable::fromUFormattable(UFormattable *fmt) {
|
||||
return reinterpret_cast<Formattable *>(fmt);
|
||||
}
|
||||
|
|
|
@ -596,8 +596,8 @@ unum_formatUFormattable(const UNumberFormat* fmt,
|
|||
* @param fmt The formatter to use.
|
||||
* @param text The text to parse.
|
||||
* @param textLength The length of text, or -1 if null-terminated.
|
||||
* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not 0, on output the offset at which parsing ended.
|
||||
* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not NULL, on output the offset at which parsing ended.
|
||||
* @param status A pointer to an UErrorCode to receive any errors
|
||||
* @return The value of the parsed integer
|
||||
* @see unum_parseInt64
|
||||
|
@ -620,8 +620,8 @@ unum_parse( const UNumberFormat* fmt,
|
|||
* @param fmt The formatter to use.
|
||||
* @param text The text to parse.
|
||||
* @param textLength The length of text, or -1 if null-terminated.
|
||||
* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not 0, on output the offset at which parsing ended.
|
||||
* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not NULL, on output the offset at which parsing ended.
|
||||
* @param status A pointer to an UErrorCode to receive any errors
|
||||
* @return The value of the parsed integer
|
||||
* @see unum_parse
|
||||
|
@ -644,8 +644,8 @@ unum_parseInt64(const UNumberFormat* fmt,
|
|||
* @param fmt The formatter to use.
|
||||
* @param text The text to parse.
|
||||
* @param textLength The length of text, or -1 if null-terminated.
|
||||
* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not 0, on output the offset at which parsing ended.
|
||||
* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not NULL, on output the offset at which parsing ended.
|
||||
* @param status A pointer to an UErrorCode to receive any errors
|
||||
* @return The value of the parsed double
|
||||
* @see unum_parse
|
||||
|
@ -672,8 +672,8 @@ unum_parseDouble( const UNumberFormat* fmt,
|
|||
* @param fmt The formatter to use.
|
||||
* @param text The text to parse.
|
||||
* @param textLength The length of text, or -1 if null-terminated.
|
||||
* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not 0, on output the offset at which parsing ended.
|
||||
* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
|
||||
* to begin parsing. If not NULL, on output the offset at which parsing ended.
|
||||
* @param outBuf A (char *) buffer to receive the parsed number as a string. The output string
|
||||
* will be nul-terminated if there is sufficient space.
|
||||
* @param outBufLength The size of the output buffer. May be zero, in which case
|
||||
|
@ -705,7 +705,7 @@ unum_parseDecimal(const UNumberFormat* fmt,
|
|||
* @param textLength the length of text, or -1 if null-terminated
|
||||
* @param parsePos a pointer to an offset index into text at which to
|
||||
* begin parsing. On output, *parsePos will point after the last
|
||||
* parsed character. This parameter may be 0, in which case parsing
|
||||
* parsed character. This parameter may be NULL, in which case parsing
|
||||
* begins at offset 0.
|
||||
* @param currency a pointer to the buffer to receive the parsed null-
|
||||
* terminated currency. This buffer must have a capacity of at least
|
||||
|
@ -734,7 +734,7 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt,
|
|||
* @param textLength the length of text, or -1 if null-terminated
|
||||
* @param parsePos a pointer to an offset index into text at which to
|
||||
* begin parsing. On output, *parsePos will point after the last
|
||||
* parsed character. This parameter may be 0, in which case parsing
|
||||
* parsed character. This parameter may be NULL in which case parsing
|
||||
* begins at offset 0.
|
||||
* @param status a pointer to an input-output UErrorCode
|
||||
* @return the UFormattable. Will be ==result unless NULL was passed in for result, in which case it will be the newly opened UFormattable.
|
||||
|
|
|
@ -2219,7 +2219,7 @@ static void TestUFormattable(void) {
|
|||
log_verbose("-- pattern: %s\n", pattern);
|
||||
u_uastrcpy(buffer, pattern);
|
||||
unum_parseToUFormattable(unum, ufmt, buffer, -1, NULL, &status);
|
||||
if(assertSuccess("unum_parseToUFormattable[31337]", &status)) {
|
||||
if(assertSuccess("unum_parseToUFormattable(31337)", &status)) {
|
||||
assertTrue("ufmt_getLong()=31337", ufmt_getLong(ufmt, &status) == 31337);
|
||||
assertTrue("ufmt_getType()=UFMT_LONG", ufmt_getType(ufmt, &status) == UFMT_LONG);
|
||||
log_verbose("long = %d\n", ufmt_getLong(ufmt, &status));
|
||||
|
@ -2234,7 +2234,7 @@ static void TestUFormattable(void) {
|
|||
log_verbose("-- pattern: %s\n", pattern);
|
||||
u_uastrcpy(buffer, pattern);
|
||||
unum_parseToUFormattable(unum, ufmt, buffer, -1, NULL, &status);
|
||||
if(assertSuccess("unum_parseToUFormattable[3.14159]", &status)) {
|
||||
if(assertSuccess("unum_parseToUFormattable(3.14159)", &status)) {
|
||||
assertTrue("ufmt_getDouble()==3.14159", withinErr(ufmt_getDouble(ufmt, &status), 3.14159, 1e-15));
|
||||
assertSuccess("ufmt_getDouble()", &status);
|
||||
assertTrue("ufmt_getType()=UFMT_DOUBLE", ufmt_getType(ufmt, &status) == UFMT_DOUBLE);
|
||||
|
|
Loading…
Add table
Reference in a new issue