1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others. 2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html 3*0e209d39SAndroid Build Coastguard Worker /* 4*0e209d39SAndroid Build Coastguard Worker ******************************************************************************** 5*0e209d39SAndroid Build Coastguard Worker * Copyright (C) 2013-2014, International Business Machines Corporation and others. 6*0e209d39SAndroid Build Coastguard Worker * All Rights Reserved. 7*0e209d39SAndroid Build Coastguard Worker ******************************************************************************** 8*0e209d39SAndroid Build Coastguard Worker * 9*0e209d39SAndroid Build Coastguard Worker * File UFORMATTABLE.H 10*0e209d39SAndroid Build Coastguard Worker * 11*0e209d39SAndroid Build Coastguard Worker * Modification History: 12*0e209d39SAndroid Build Coastguard Worker * 13*0e209d39SAndroid Build Coastguard Worker * Date Name Description 14*0e209d39SAndroid Build Coastguard Worker * 2013 Jun 7 srl New 15*0e209d39SAndroid Build Coastguard Worker ******************************************************************************** 16*0e209d39SAndroid Build Coastguard Worker */ 17*0e209d39SAndroid Build Coastguard Worker 18*0e209d39SAndroid Build Coastguard Worker /** 19*0e209d39SAndroid Build Coastguard Worker * \file 20*0e209d39SAndroid Build Coastguard Worker * \brief C API: UFormattable is a thin wrapper for primitive types used for formatting and parsing. 21*0e209d39SAndroid Build Coastguard Worker * 22*0e209d39SAndroid Build Coastguard Worker * This is a C interface to the icu::Formattable class. Static functions on this class convert 23*0e209d39SAndroid Build Coastguard Worker * to and from this interface (via reinterpret_cast). Note that Formattables (and thus UFormattables) 24*0e209d39SAndroid Build Coastguard Worker * are mutable, and many operations (even getters) may actually modify the internal state. For this 25*0e209d39SAndroid Build Coastguard Worker * reason, UFormattables are not thread safe, and should not be shared between threads. 26*0e209d39SAndroid Build Coastguard Worker * 27*0e209d39SAndroid Build Coastguard Worker * See {@link unum_parseToUFormattable} for example code. 28*0e209d39SAndroid Build Coastguard Worker */ 29*0e209d39SAndroid Build Coastguard Worker 30*0e209d39SAndroid Build Coastguard Worker #ifndef UFORMATTABLE_H 31*0e209d39SAndroid Build Coastguard Worker #define UFORMATTABLE_H 32*0e209d39SAndroid Build Coastguard Worker 33*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h" 34*0e209d39SAndroid Build Coastguard Worker 35*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_FORMATTING 36*0e209d39SAndroid Build Coastguard Worker 37*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API 38*0e209d39SAndroid Build Coastguard Worker #include "unicode/localpointer.h" 39*0e209d39SAndroid Build Coastguard Worker #endif // U_SHOW_CPLUSPLUS_API 40*0e209d39SAndroid Build Coastguard Worker 41*0e209d39SAndroid Build Coastguard Worker /** 42*0e209d39SAndroid Build Coastguard Worker * Enum designating the type of a UFormattable instance. 43*0e209d39SAndroid Build Coastguard Worker * Practically, this indicates which of the getters would return without conversion 44*0e209d39SAndroid Build Coastguard Worker * or error. 45*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::Type 46*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 47*0e209d39SAndroid Build Coastguard Worker */ 48*0e209d39SAndroid Build Coastguard Worker typedef enum UFormattableType { 49*0e209d39SAndroid Build Coastguard Worker UFMT_DATE = 0, /**< ufmt_getDate() will return without conversion. @see ufmt_getDate*/ 50*0e209d39SAndroid Build Coastguard Worker UFMT_DOUBLE, /**< ufmt_getDouble() will return without conversion. @see ufmt_getDouble*/ 51*0e209d39SAndroid Build Coastguard Worker UFMT_LONG, /**< ufmt_getLong() will return without conversion. @see ufmt_getLong */ 52*0e209d39SAndroid Build Coastguard Worker UFMT_STRING, /**< ufmt_getUChars() will return without conversion. @see ufmt_getUChars*/ 53*0e209d39SAndroid Build Coastguard Worker UFMT_ARRAY, /**< ufmt_countArray() and ufmt_getArray() will return the value. @see ufmt_getArrayItemByIndex */ 54*0e209d39SAndroid Build Coastguard Worker UFMT_INT64, /**< ufmt_getInt64() will return without conversion. @see ufmt_getInt64 */ 55*0e209d39SAndroid Build Coastguard Worker UFMT_OBJECT, /**< ufmt_getObject() will return without conversion. @see ufmt_getObject*/ 56*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_DEPRECATED_API 57*0e209d39SAndroid Build Coastguard Worker /** 58*0e209d39SAndroid Build Coastguard Worker * One more than the highest normal UFormattableType value. 59*0e209d39SAndroid Build Coastguard Worker * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. 60*0e209d39SAndroid Build Coastguard Worker */ 61*0e209d39SAndroid Build Coastguard Worker UFMT_COUNT 62*0e209d39SAndroid Build Coastguard Worker #endif /* U_HIDE_DEPRECATED_API */ 63*0e209d39SAndroid Build Coastguard Worker } UFormattableType; 64*0e209d39SAndroid Build Coastguard Worker 65*0e209d39SAndroid Build Coastguard Worker 66*0e209d39SAndroid Build Coastguard Worker /** 67*0e209d39SAndroid Build Coastguard Worker * Opaque type representing various types of data which may be used for formatting 68*0e209d39SAndroid Build Coastguard Worker * and parsing operations. 69*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable 70*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 71*0e209d39SAndroid Build Coastguard Worker */ 72*0e209d39SAndroid Build Coastguard Worker typedef void *UFormattable; 73*0e209d39SAndroid Build Coastguard Worker 74*0e209d39SAndroid Build Coastguard Worker /** 75*0e209d39SAndroid Build Coastguard Worker * Initialize a UFormattable, to type UNUM_LONG, value 0 76*0e209d39SAndroid Build Coastguard Worker * may return error if memory allocation failed. 77*0e209d39SAndroid Build Coastguard Worker * parameter status error code. 78*0e209d39SAndroid Build Coastguard Worker * See {@link unum_parseToUFormattable} for example code. 79*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 80*0e209d39SAndroid Build Coastguard Worker * @return the new UFormattable 81*0e209d39SAndroid Build Coastguard Worker * @see ufmt_close 82*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::Formattable() 83*0e209d39SAndroid Build Coastguard Worker */ 84*0e209d39SAndroid Build Coastguard Worker U_CAPI UFormattable* U_EXPORT2 85*0e209d39SAndroid Build Coastguard Worker ufmt_open(UErrorCode* status); 86*0e209d39SAndroid Build Coastguard Worker 87*0e209d39SAndroid Build Coastguard Worker /** 88*0e209d39SAndroid Build Coastguard Worker * Cleanup any additional memory allocated by this UFormattable. 89*0e209d39SAndroid Build Coastguard Worker * @param fmt the formatter 90*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 91*0e209d39SAndroid Build Coastguard Worker * @see ufmt_open 92*0e209d39SAndroid Build Coastguard Worker */ 93*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 94*0e209d39SAndroid Build Coastguard Worker ufmt_close(UFormattable* fmt); 95*0e209d39SAndroid Build Coastguard Worker 96*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API 97*0e209d39SAndroid Build Coastguard Worker 98*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN 99*0e209d39SAndroid Build Coastguard Worker 100*0e209d39SAndroid Build Coastguard Worker /** 101*0e209d39SAndroid Build Coastguard Worker * \class LocalUFormattablePointer 102*0e209d39SAndroid Build Coastguard Worker * "Smart pointer" class, closes a UFormattable via ufmt_close(). 103*0e209d39SAndroid Build Coastguard Worker * For most methods see the LocalPointerBase base class. 104*0e209d39SAndroid Build Coastguard Worker * 105*0e209d39SAndroid Build Coastguard Worker * @see LocalPointerBase 106*0e209d39SAndroid Build Coastguard Worker * @see LocalPointer 107*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 108*0e209d39SAndroid Build Coastguard Worker */ 109*0e209d39SAndroid Build Coastguard Worker U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattablePointer, UFormattable, ufmt_close); 110*0e209d39SAndroid Build Coastguard Worker 111*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END 112*0e209d39SAndroid Build Coastguard Worker 113*0e209d39SAndroid Build Coastguard Worker #endif 114*0e209d39SAndroid Build Coastguard Worker 115*0e209d39SAndroid Build Coastguard Worker /** 116*0e209d39SAndroid Build Coastguard Worker * Return the type of this object 117*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 118*0e209d39SAndroid Build Coastguard Worker * @param status status code - U_ILLEGAL_ARGUMENT_ERROR is returned if the UFormattable contains data not supported by 119*0e209d39SAndroid Build Coastguard Worker * the API 120*0e209d39SAndroid Build Coastguard Worker * @return the value as a UFormattableType 121*0e209d39SAndroid Build Coastguard Worker * @see ufmt_isNumeric 122*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getType() const 123*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 124*0e209d39SAndroid Build Coastguard Worker */ 125*0e209d39SAndroid Build Coastguard Worker U_CAPI UFormattableType U_EXPORT2 126*0e209d39SAndroid Build Coastguard Worker ufmt_getType(const UFormattable* fmt, UErrorCode *status); 127*0e209d39SAndroid Build Coastguard Worker 128*0e209d39SAndroid Build Coastguard Worker /** 129*0e209d39SAndroid Build Coastguard Worker * Return whether the object is numeric. 130*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 131*0e209d39SAndroid Build Coastguard Worker * @return true if the object is a double, long, or int64 value, else false. 132*0e209d39SAndroid Build Coastguard Worker * @see ufmt_getType 133*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::isNumeric() const 134*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 135*0e209d39SAndroid Build Coastguard Worker */ 136*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 137*0e209d39SAndroid Build Coastguard Worker ufmt_isNumeric(const UFormattable* fmt); 138*0e209d39SAndroid Build Coastguard Worker 139*0e209d39SAndroid Build Coastguard Worker /** 140*0e209d39SAndroid Build Coastguard Worker * Gets the UDate value of this object. If the type is not of type UFMT_DATE, 141*0e209d39SAndroid Build Coastguard Worker * status is set to U_INVALID_FORMAT_ERROR and the return value is 142*0e209d39SAndroid Build Coastguard Worker * undefined. 143*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 144*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors 145*0e209d39SAndroid Build Coastguard Worker * @return the value 146*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 147*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getDate(UErrorCode&) const 148*0e209d39SAndroid Build Coastguard Worker */ 149*0e209d39SAndroid Build Coastguard Worker U_CAPI UDate U_EXPORT2 150*0e209d39SAndroid Build Coastguard Worker ufmt_getDate(const UFormattable* fmt, UErrorCode *status); 151*0e209d39SAndroid Build Coastguard Worker 152*0e209d39SAndroid Build Coastguard Worker /** 153*0e209d39SAndroid Build Coastguard Worker * Gets the double value of this object. If the type is not a UFMT_DOUBLE, or 154*0e209d39SAndroid Build Coastguard Worker * if there are additional significant digits than fit in a double type, 155*0e209d39SAndroid Build Coastguard Worker * a conversion is performed with possible loss of precision. 156*0e209d39SAndroid Build Coastguard Worker * If the type is UFMT_OBJECT and the 157*0e209d39SAndroid Build Coastguard Worker * object is a Measure, then the result of 158*0e209d39SAndroid Build Coastguard Worker * getNumber().getDouble(status) is returned. If this object is 159*0e209d39SAndroid Build Coastguard Worker * neither a numeric type nor a Measure, then 0 is returned and 160*0e209d39SAndroid Build Coastguard Worker * the status is set to U_INVALID_FORMAT_ERROR. 161*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 162*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors 163*0e209d39SAndroid Build Coastguard Worker * @return the value 164*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 165*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getDouble(UErrorCode&) const 166*0e209d39SAndroid Build Coastguard Worker */ 167*0e209d39SAndroid Build Coastguard Worker U_CAPI double U_EXPORT2 168*0e209d39SAndroid Build Coastguard Worker ufmt_getDouble(UFormattable* fmt, UErrorCode *status); 169*0e209d39SAndroid Build Coastguard Worker 170*0e209d39SAndroid Build Coastguard Worker /** 171*0e209d39SAndroid Build Coastguard Worker * Gets the long (int32_t) value of this object. If the magnitude is too 172*0e209d39SAndroid Build Coastguard Worker * large to fit in a long, then the maximum or minimum long value, 173*0e209d39SAndroid Build Coastguard Worker * as appropriate, is returned and the status is set to 174*0e209d39SAndroid Build Coastguard Worker * U_INVALID_FORMAT_ERROR. If this object is of type UFMT_INT64 and 175*0e209d39SAndroid Build Coastguard Worker * it fits within a long, then no precision is lost. If it is of 176*0e209d39SAndroid Build Coastguard Worker * type kDouble or kDecimalNumber, then a conversion is performed, with 177*0e209d39SAndroid Build Coastguard Worker * truncation of any fractional part. If the type is UFMT_OBJECT and 178*0e209d39SAndroid Build Coastguard Worker * the object is a Measure, then the result of 179*0e209d39SAndroid Build Coastguard Worker * getNumber().getLong(status) is returned. If this object is 180*0e209d39SAndroid Build Coastguard Worker * neither a numeric type nor a Measure, then 0 is returned and 181*0e209d39SAndroid Build Coastguard Worker * the status is set to U_INVALID_FORMAT_ERROR. 182*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 183*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors 184*0e209d39SAndroid Build Coastguard Worker * @return the value 185*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 186*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getLong(UErrorCode&) const 187*0e209d39SAndroid Build Coastguard Worker */ 188*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 189*0e209d39SAndroid Build Coastguard Worker ufmt_getLong(UFormattable* fmt, UErrorCode *status); 190*0e209d39SAndroid Build Coastguard Worker 191*0e209d39SAndroid Build Coastguard Worker 192*0e209d39SAndroid Build Coastguard Worker /** 193*0e209d39SAndroid Build Coastguard Worker * Gets the int64_t value of this object. If this object is of a numeric 194*0e209d39SAndroid Build Coastguard Worker * type and the magnitude is too large to fit in an int64, then 195*0e209d39SAndroid Build Coastguard Worker * the maximum or minimum int64 value, as appropriate, is returned 196*0e209d39SAndroid Build Coastguard Worker * and the status is set to U_INVALID_FORMAT_ERROR. If the 197*0e209d39SAndroid Build Coastguard Worker * magnitude fits in an int64, then a casting conversion is 198*0e209d39SAndroid Build Coastguard Worker * performed, with truncation of any fractional part. If the type 199*0e209d39SAndroid Build Coastguard Worker * is UFMT_OBJECT and the object is a Measure, then the result of 200*0e209d39SAndroid Build Coastguard Worker * getNumber().getDouble(status) is returned. If this object is 201*0e209d39SAndroid Build Coastguard Worker * neither a numeric type nor a Measure, then 0 is returned and 202*0e209d39SAndroid Build Coastguard Worker * the status is set to U_INVALID_FORMAT_ERROR. 203*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 204*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors 205*0e209d39SAndroid Build Coastguard Worker * @return the value 206*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 207*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getInt64(UErrorCode&) const 208*0e209d39SAndroid Build Coastguard Worker */ 209*0e209d39SAndroid Build Coastguard Worker U_CAPI int64_t U_EXPORT2 210*0e209d39SAndroid Build Coastguard Worker ufmt_getInt64(UFormattable* fmt, UErrorCode *status); 211*0e209d39SAndroid Build Coastguard Worker 212*0e209d39SAndroid Build Coastguard Worker /** 213*0e209d39SAndroid Build Coastguard Worker * Returns a pointer to the UObject contained within this 214*0e209d39SAndroid Build Coastguard Worker * formattable (as a const void*), or NULL if this object 215*0e209d39SAndroid Build Coastguard Worker * is not of type UFMT_OBJECT. 216*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 217*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors 218*0e209d39SAndroid Build Coastguard Worker * @return the value as a const void*. It is a polymorphic C++ object. 219*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 220*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getObject() const 221*0e209d39SAndroid Build Coastguard Worker */ 222*0e209d39SAndroid Build Coastguard Worker U_CAPI const void *U_EXPORT2 223*0e209d39SAndroid Build Coastguard Worker ufmt_getObject(const UFormattable* fmt, UErrorCode *status); 224*0e209d39SAndroid Build Coastguard Worker 225*0e209d39SAndroid Build Coastguard Worker /** 226*0e209d39SAndroid Build Coastguard Worker * Gets the string value of this object as a UChar string. If the type is not a 227*0e209d39SAndroid Build Coastguard Worker * string, status is set to U_INVALID_FORMAT_ERROR and a NULL pointer is returned. 228*0e209d39SAndroid Build Coastguard Worker * This function is not thread safe and may modify the UFormattable if need be to terminate the string. 229*0e209d39SAndroid Build Coastguard Worker * The returned pointer is not valid if any other functions are called on this UFormattable, or if the UFormattable is closed. 230*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 231*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors 232*0e209d39SAndroid Build Coastguard Worker * @param len if non null, contains the string length on return 233*0e209d39SAndroid Build Coastguard Worker * @return the null terminated string value - must not be referenced after any other functions are called on this UFormattable. 234*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 235*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getString(UnicodeString&)const 236*0e209d39SAndroid Build Coastguard Worker */ 237*0e209d39SAndroid Build Coastguard Worker U_CAPI const UChar* U_EXPORT2 238*0e209d39SAndroid Build Coastguard Worker ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status); 239*0e209d39SAndroid Build Coastguard Worker 240*0e209d39SAndroid Build Coastguard Worker /** 241*0e209d39SAndroid Build Coastguard Worker * Get the number of array objects contained, if an array type UFMT_ARRAY 242*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 243*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors. U_ILLEGAL_ARGUMENT_ERROR if not an array type. 244*0e209d39SAndroid Build Coastguard Worker * @return the number of array objects or undefined if not an array type 245*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 246*0e209d39SAndroid Build Coastguard Worker * @see ufmt_getArrayItemByIndex 247*0e209d39SAndroid Build Coastguard Worker */ 248*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 249*0e209d39SAndroid Build Coastguard Worker ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status); 250*0e209d39SAndroid Build Coastguard Worker 251*0e209d39SAndroid Build Coastguard Worker /** 252*0e209d39SAndroid Build Coastguard Worker * Get the specified value from the array of UFormattables. Invalid if the object is not an array type UFMT_ARRAY 253*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 254*0e209d39SAndroid Build Coastguard Worker * @param n the number of the array to return (0 based). 255*0e209d39SAndroid Build Coastguard Worker * @param status the error code - any conversion or format errors. Returns an error if n is out of bounds. 256*0e209d39SAndroid Build Coastguard Worker * @return the nth array value, only valid while the containing UFormattable is valid. NULL if not an array. 257*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 258*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getArray(int32_t&, UErrorCode&) const 259*0e209d39SAndroid Build Coastguard Worker */ 260*0e209d39SAndroid Build Coastguard Worker U_CAPI UFormattable * U_EXPORT2 261*0e209d39SAndroid Build Coastguard Worker ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status); 262*0e209d39SAndroid Build Coastguard Worker 263*0e209d39SAndroid Build Coastguard Worker /** 264*0e209d39SAndroid Build Coastguard Worker * Returns a numeric string representation of the number contained within this 265*0e209d39SAndroid Build Coastguard Worker * formattable, or NULL if this object does not contain numeric type. 266*0e209d39SAndroid Build Coastguard Worker * For values obtained by parsing, the returned decimal number retains 267*0e209d39SAndroid Build Coastguard Worker * the full precision and range of the original input, unconstrained by 268*0e209d39SAndroid Build Coastguard Worker * the limits of a double floating point or a 64 bit int. 269*0e209d39SAndroid Build Coastguard Worker * 270*0e209d39SAndroid Build Coastguard Worker * This function is not thread safe, and therefore is not declared const, 271*0e209d39SAndroid Build Coastguard Worker * even though it is logically const. 272*0e209d39SAndroid Build Coastguard Worker * The resulting buffer is owned by the UFormattable and is invalid if any other functions are 273*0e209d39SAndroid Build Coastguard Worker * called on the UFormattable. 274*0e209d39SAndroid Build Coastguard Worker * 275*0e209d39SAndroid Build Coastguard Worker * Possible errors include U_MEMORY_ALLOCATION_ERROR, and 276*0e209d39SAndroid Build Coastguard Worker * U_INVALID_STATE if the formattable object has not been set to 277*0e209d39SAndroid Build Coastguard Worker * a numeric type. 278*0e209d39SAndroid Build Coastguard Worker * @param fmt the UFormattable object 279*0e209d39SAndroid Build Coastguard Worker * @param len if non-null, on exit contains the string length (not including the terminating null) 280*0e209d39SAndroid Build Coastguard Worker * @param status the error code 281*0e209d39SAndroid Build Coastguard Worker * @return the character buffer as a NULL terminated string, which is owned by the object and must not be accessed if any other functions are called on this object. 282*0e209d39SAndroid Build Coastguard Worker * @stable ICU 52 283*0e209d39SAndroid Build Coastguard Worker * @see icu::Formattable::getDecimalNumber(UErrorCode&) 284*0e209d39SAndroid Build Coastguard Worker */ 285*0e209d39SAndroid Build Coastguard Worker U_CAPI const char * U_EXPORT2 286*0e209d39SAndroid Build Coastguard Worker ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status); 287*0e209d39SAndroid Build Coastguard Worker 288*0e209d39SAndroid Build Coastguard Worker #endif 289*0e209d39SAndroid Build Coastguard Worker 290*0e209d39SAndroid Build Coastguard Worker #endif 291