2 *******************************************************************************
3 * Copyright (C) 1997-2016, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
9 * Modification History:
11 * Date Name Description
12 * 03/25/97 clhuang Initial Implementation.
13 ********************************************************************************
16 #include "unicode/utypes.h"
18 #if !UCONFIG_NO_FORMATTING
21 #include "unicode/fmtable.h"
22 #include "unicode/ustring.h"
23 #include "unicode/measure.h"
24 #include "unicode/curramt.h"
25 #include "unicode/uformattable.h"
29 #include "decNumber.h"
31 #include "fmtableimp.h"
33 // *****************************************************************************
35 // *****************************************************************************
39 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Formattable
)
42 //-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
44 // NOTE: As of 3.0, there are limitations to the UObject API. It does
45 // not (yet) support cloning, operator=, nor operator==. To
46 // work around this, I implement some simple inlines here. Later
47 // these can be modified or removed. [alan]
49 // NOTE: These inlines assume that all fObjects are in fact instances
50 // of the Measure class, which is true as of 3.0. [alan]
52 // Return TRUE if *a == *b.
53 static inline UBool
objectEquals(const UObject
* a
, const UObject
* b
) {
54 // LATER: return *a == *b;
55 return *((const Measure
*) a
) == *((const Measure
*) b
);
58 // Return a clone of *a.
59 static inline UObject
* objectClone(const UObject
* a
) {
60 // LATER: return a->clone();
61 return ((const Measure
*) a
)->clone();
64 // Return TRUE if *a is an instance of Measure.
65 static inline UBool
instanceOfMeasure(const UObject
* a
) {
66 return dynamic_cast<const Measure
*>(a
) != NULL
;
70 * Creates a new Formattable array and copies the values from the specified
72 * @param array the original array
73 * @param count the original array count
74 * @return the new Formattable array.
76 static Formattable
* createArrayCopy(const Formattable
* array
, int32_t count
) {
77 Formattable
*result
= new Formattable
[count
];
79 for (int32_t i
=0; i
<count
; ++i
)
80 result
[i
] = array
[i
]; // Don't memcpy!
85 //-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
88 * Set 'ec' to 'err' only if 'ec' is not already set to a failing UErrorCode.
90 static void setError(UErrorCode
& ec
, UErrorCode err
) {
97 // Common initialization code, shared by constructors.
98 // Put everything into a known state.
100 void Formattable::init() {
108 // -------------------------------------
109 // default constructor.
110 // Creates a formattable object with a long value 0.
112 Formattable::Formattable() {
116 // -------------------------------------
117 // Creates a formattable object with a Date instance.
119 Formattable::Formattable(UDate date
, ISDATE
/*isDate*/)
126 // -------------------------------------
127 // Creates a formattable object with a double value.
129 Formattable::Formattable(double value
)
133 fValue
.fDouble
= value
;
136 // -------------------------------------
137 // Creates a formattable object with an int32_t value.
139 Formattable::Formattable(int32_t value
)
142 fValue
.fInt64
= value
;
145 // -------------------------------------
146 // Creates a formattable object with an int64_t value.
148 Formattable::Formattable(int64_t value
)
152 fValue
.fInt64
= value
;
155 // -------------------------------------
156 // Creates a formattable object with a decimal number value from a string.
158 Formattable::Formattable(const StringPiece
&number
, UErrorCode
&status
) {
160 setDecimalNumber(number
, status
);
164 // -------------------------------------
165 // Creates a formattable object with a UnicodeString instance.
167 Formattable::Formattable(const UnicodeString
& stringToCopy
)
171 fValue
.fString
= new UnicodeString(stringToCopy
);
174 // -------------------------------------
175 // Creates a formattable object with a UnicodeString* value.
176 // (adopting symantics)
178 Formattable::Formattable(UnicodeString
* stringToAdopt
)
182 fValue
.fString
= stringToAdopt
;
185 Formattable::Formattable(UObject
* objectToAdopt
)
189 fValue
.fObject
= objectToAdopt
;
192 // -------------------------------------
194 Formattable::Formattable(const Formattable
* arrayToCopy
, int32_t count
)
195 : UObject(), fType(kArray
)
199 fValue
.fArrayAndCount
.fArray
= createArrayCopy(arrayToCopy
, count
);
200 fValue
.fArrayAndCount
.fCount
= count
;
203 // -------------------------------------
207 Formattable::Formattable(const Formattable
&source
)
214 // -------------------------------------
215 // assignment operator
218 Formattable::operator=(const Formattable
& source
)
222 // Disposes the current formattable value/setting.
225 // Sets the correct data type for this value.
226 fType
= source
.fType
;
230 // Sets each element in the array one by one and records the array count.
231 fValue
.fArrayAndCount
.fCount
= source
.fValue
.fArrayAndCount
.fCount
;
232 fValue
.fArrayAndCount
.fArray
= createArrayCopy(source
.fValue
.fArrayAndCount
.fArray
,
233 source
.fValue
.fArrayAndCount
.fCount
);
236 // Sets the string value.
237 fValue
.fString
= new UnicodeString(*source
.fValue
.fString
);
240 // Sets the double value.
241 fValue
.fDouble
= source
.fValue
.fDouble
;
245 // Sets the long value.
246 fValue
.fInt64
= source
.fValue
.fInt64
;
249 // Sets the Date value.
250 fValue
.fDate
= source
.fValue
.fDate
;
253 fValue
.fObject
= objectClone(source
.fValue
.fObject
);
257 UErrorCode status
= U_ZERO_ERROR
;
258 if (source
.fDecimalNum
!= NULL
) {
259 fDecimalNum
= new DigitList(*source
.fDecimalNum
); // TODO: use internal digit list
261 if (source
.fDecimalStr
!= NULL
) {
262 fDecimalStr
= new CharString(*source
.fDecimalStr
, status
);
263 if (U_FAILURE(status
)) {
272 // -------------------------------------
275 Formattable::operator==(const Formattable
& that
) const
279 if (this == &that
) return TRUE
;
281 // Returns FALSE if the data types are different.
282 if (fType
!= that
.fType
) return FALSE
;
284 // Compares the actual data values.
288 equal
= (fValue
.fDate
== that
.fValue
.fDate
);
291 equal
= (fValue
.fDouble
== that
.fValue
.fDouble
);
295 equal
= (fValue
.fInt64
== that
.fValue
.fInt64
);
298 equal
= (*(fValue
.fString
) == *(that
.fValue
.fString
));
301 if (fValue
.fArrayAndCount
.fCount
!= that
.fValue
.fArrayAndCount
.fCount
) {
305 // Checks each element for equality.
306 for (i
=0; i
<fValue
.fArrayAndCount
.fCount
; ++i
) {
307 if (fValue
.fArrayAndCount
.fArray
[i
] != that
.fValue
.fArrayAndCount
.fArray
[i
]) {
314 if (fValue
.fObject
== NULL
|| that
.fValue
.fObject
== NULL
) {
317 equal
= objectEquals(fValue
.fObject
, that
.fValue
.fObject
);
322 // TODO: compare digit lists if numeric.
326 // -------------------------------------
328 Formattable::~Formattable()
333 // -------------------------------------
335 void Formattable::dispose()
337 // Deletes the data value if necessary.
340 delete fValue
.fString
;
343 delete[] fValue
.fArrayAndCount
.fArray
;
346 delete fValue
.fObject
;
358 FmtStackData
*stackData
= (FmtStackData
*)fStackData
;
359 if(fDecimalNum
!= &(stackData
->stackDecimalNum
)) {
362 fDecimalNum
->~DigitList(); // destruct, don't deallocate
368 Formattable::clone() const {
369 return new Formattable(*this);
372 // -------------------------------------
373 // Gets the data type of this Formattable object.
375 Formattable::getType() const
381 Formattable::isNumeric() const {
392 // -------------------------------------
394 //Formattable::getLong(UErrorCode* status) const
395 Formattable::getLong(UErrorCode
& status
) const
397 if (U_FAILURE(status
)) {
402 case Formattable::kLong
:
403 return (int32_t)fValue
.fInt64
;
404 case Formattable::kInt64
:
405 if (fValue
.fInt64
> INT32_MAX
) {
406 status
= U_INVALID_FORMAT_ERROR
;
408 } else if (fValue
.fInt64
< INT32_MIN
) {
409 status
= U_INVALID_FORMAT_ERROR
;
412 return (int32_t)fValue
.fInt64
;
414 case Formattable::kDouble
:
415 if (fValue
.fDouble
> INT32_MAX
) {
416 status
= U_INVALID_FORMAT_ERROR
;
418 } else if (fValue
.fDouble
< INT32_MIN
) {
419 status
= U_INVALID_FORMAT_ERROR
;
422 return (int32_t)fValue
.fDouble
; // loses fraction
424 case Formattable::kObject
:
425 if (fValue
.fObject
== NULL
) {
426 status
= U_MEMORY_ALLOCATION_ERROR
;
429 // TODO Later replace this with instanceof call
430 if (instanceOfMeasure(fValue
.fObject
)) {
431 return ((const Measure
*) fValue
.fObject
)->
432 getNumber().getLong(status
);
436 status
= U_INVALID_FORMAT_ERROR
;
441 // -------------------------------------
442 // Maximum int that can be represented exactly in a double. (53 bits)
443 // Larger ints may be rounded to a near-by value as not all are representable.
444 // TODO: move this constant elsewhere, possibly configure it for different
445 // floating point formats, if any non-standard ones are still in use.
446 static const int64_t U_DOUBLE_MAX_EXACT_INT
= 9007199254740992LL;
449 Formattable::getInt64(UErrorCode
& status
) const
451 if (U_FAILURE(status
)) {
456 case Formattable::kLong
:
457 case Formattable::kInt64
:
458 return fValue
.fInt64
;
459 case Formattable::kDouble
:
460 if (fValue
.fDouble
> (double)U_INT64_MAX
) {
461 status
= U_INVALID_FORMAT_ERROR
;
463 } else if (fValue
.fDouble
< (double)U_INT64_MIN
) {
464 status
= U_INVALID_FORMAT_ERROR
;
466 } else if (fabs(fValue
.fDouble
) > U_DOUBLE_MAX_EXACT_INT
&& fDecimalNum
!= NULL
) {
467 int64_t val
= fDecimalNum
->getInt64();
471 status
= U_INVALID_FORMAT_ERROR
;
472 return fValue
.fDouble
> 0 ? U_INT64_MAX
: U_INT64_MIN
;
475 return (int64_t)fValue
.fDouble
;
477 case Formattable::kObject
:
478 if (fValue
.fObject
== NULL
) {
479 status
= U_MEMORY_ALLOCATION_ERROR
;
482 if (instanceOfMeasure(fValue
.fObject
)) {
483 return ((const Measure
*) fValue
.fObject
)->
484 getNumber().getInt64(status
);
488 status
= U_INVALID_FORMAT_ERROR
;
493 // -------------------------------------
495 Formattable::getDouble(UErrorCode
& status
) const
497 if (U_FAILURE(status
)) {
502 case Formattable::kLong
:
503 case Formattable::kInt64
: // loses precision
504 return (double)fValue
.fInt64
;
505 case Formattable::kDouble
:
506 return fValue
.fDouble
;
507 case Formattable::kObject
:
508 if (fValue
.fObject
== NULL
) {
509 status
= U_MEMORY_ALLOCATION_ERROR
;
512 // TODO Later replace this with instanceof call
513 if (instanceOfMeasure(fValue
.fObject
)) {
514 return ((const Measure
*) fValue
.fObject
)->
515 getNumber().getDouble(status
);
519 status
= U_INVALID_FORMAT_ERROR
;
525 Formattable::getObject() const {
526 return (fType
== kObject
) ? fValue
.fObject
: NULL
;
529 // -------------------------------------
530 // Sets the value to a double value d.
533 Formattable::setDouble(double d
)
540 // -------------------------------------
541 // Sets the value to a long value l.
544 Formattable::setLong(int32_t l
)
551 // -------------------------------------
552 // Sets the value to an int64 value ll.
555 Formattable::setInt64(int64_t ll
)
562 // -------------------------------------
563 // Sets the value to a Date instance d.
566 Formattable::setDate(UDate d
)
573 // -------------------------------------
574 // Sets the value to a string value stringToCopy.
577 Formattable::setString(const UnicodeString
& stringToCopy
)
581 fValue
.fString
= new UnicodeString(stringToCopy
);
584 // -------------------------------------
585 // Sets the value to an array of Formattable objects.
588 Formattable::setArray(const Formattable
* array
, int32_t count
)
592 fValue
.fArrayAndCount
.fArray
= createArrayCopy(array
, count
);
593 fValue
.fArrayAndCount
.fCount
= count
;
596 // -------------------------------------
597 // Adopts the stringToAdopt value.
600 Formattable::adoptString(UnicodeString
* stringToAdopt
)
604 fValue
.fString
= stringToAdopt
;
607 // -------------------------------------
608 // Adopts the array value and its count.
611 Formattable::adoptArray(Formattable
* array
, int32_t count
)
615 fValue
.fArrayAndCount
.fArray
= array
;
616 fValue
.fArrayAndCount
.fCount
= count
;
620 Formattable::adoptObject(UObject
* objectToAdopt
) {
623 fValue
.fObject
= objectToAdopt
;
626 // -------------------------------------
628 Formattable::getString(UnicodeString
& result
, UErrorCode
& status
) const
630 if (fType
!= kString
) {
631 setError(status
, U_INVALID_FORMAT_ERROR
);
634 if (fValue
.fString
== NULL
) {
635 setError(status
, U_MEMORY_ALLOCATION_ERROR
);
637 result
= *fValue
.fString
;
643 // -------------------------------------
645 Formattable::getString(UErrorCode
& status
) const
647 if (fType
!= kString
) {
648 setError(status
, U_INVALID_FORMAT_ERROR
);
651 if (fValue
.fString
== NULL
) {
652 setError(status
, U_MEMORY_ALLOCATION_ERROR
);
655 return *fValue
.fString
;
658 // -------------------------------------
660 Formattable::getString(UErrorCode
& status
)
662 if (fType
!= kString
) {
663 setError(status
, U_INVALID_FORMAT_ERROR
);
666 if (fValue
.fString
== NULL
) {
667 setError(status
, U_MEMORY_ALLOCATION_ERROR
);
670 return *fValue
.fString
;
673 // -------------------------------------
675 Formattable::getArray(int32_t& count
, UErrorCode
& status
) const
677 if (fType
!= kArray
) {
678 setError(status
, U_INVALID_FORMAT_ERROR
);
682 count
= fValue
.fArrayAndCount
.fCount
;
683 return fValue
.fArrayAndCount
.fArray
;
686 // -------------------------------------
687 // Gets the bogus string, ensures mondo bogosity.
690 Formattable::getBogus() const
692 return (UnicodeString
*)&fBogus
; /* cast away const :-( */
696 // --------------------------------------
697 StringPiece
Formattable::getDecimalNumber(UErrorCode
&status
) {
698 if (U_FAILURE(status
)) {
701 if (fDecimalStr
!= NULL
) {
702 return fDecimalStr
->toStringPiece();
705 CharString
*decimalStr
= internalGetCharString(status
);
706 if(decimalStr
== NULL
) {
707 return ""; // getDecimalNumber returns "" for error cases
709 return decimalStr
->toStringPiece();
713 CharString
*Formattable::internalGetCharString(UErrorCode
&status
) {
714 if(fDecimalStr
== NULL
) {
715 if (fDecimalNum
== NULL
) {
716 // No decimal number for the formattable yet. Which means the value was
717 // set directly by the user as an int, int64 or double. If the value came
718 // from parsing, or from the user setting a decimal number, fDecimalNum
719 // would already be set.
721 fDecimalNum
= new DigitList
; // TODO: use internal digit list
722 if (fDecimalNum
== NULL
) {
723 status
= U_MEMORY_ALLOCATION_ERROR
;
729 fDecimalNum
->set(this->getDouble());
732 fDecimalNum
->set(this->getLong());
735 fDecimalNum
->set(this->getInt64());
738 // The formattable's value is not a numeric type.
739 status
= U_INVALID_STATE_ERROR
;
744 fDecimalStr
= new CharString
;
745 if (fDecimalStr
== NULL
) {
746 status
= U_MEMORY_ALLOCATION_ERROR
;
749 fDecimalNum
->getDecimal(*fDecimalStr
, status
);
756 Formattable::getInternalDigitList() {
757 FmtStackData
*stackData
= (FmtStackData
*)fStackData
;
758 if(fDecimalNum
!= &(stackData
->stackDecimalNum
)) {
760 fDecimalNum
= new (&(stackData
->stackDecimalNum
), kOnStack
) DigitList();
762 fDecimalNum
->clear();
767 // ---------------------------------------
769 Formattable::adoptDigitList(DigitList
*dl
) {
770 if(fDecimalNum
==dl
) {
771 fDecimalNum
= NULL
; // don't delete
777 if(dl
==NULL
) { // allow adoptDigitList(NULL) to clear
781 // Set the value into the Union of simple type values.
782 // Cannot use the set() functions because they would delete the fDecimalNum value,
784 if (fDecimalNum
->fitsIntoLong(FALSE
)) {
786 fValue
.fInt64
= fDecimalNum
->getLong();
787 } else if (fDecimalNum
->fitsIntoInt64(FALSE
)) {
789 fValue
.fInt64
= fDecimalNum
->getInt64();
792 fValue
.fDouble
= fDecimalNum
->getDouble();
797 // ---------------------------------------
799 Formattable::setDecimalNumber(const StringPiece
&numberString
, UErrorCode
&status
) {
800 if (U_FAILURE(status
)) {
805 // Copy the input string and nul-terminate it.
806 // The decNumber library requires nul-terminated input. StringPiece input
807 // is not guaranteed nul-terminated. Too bad.
808 // CharString automatically adds the nul.
809 DigitList
*dnum
= new DigitList(); // TODO: use getInternalDigitList
811 status
= U_MEMORY_ALLOCATION_ERROR
;
814 dnum
->set(CharString(numberString
, status
).toStringPiece(), status
);
815 if (U_FAILURE(status
)) {
817 return; // String didn't contain a decimal number.
819 adoptDigitList(dnum
);
821 // Note that we do not hang on to the caller's input string.
822 // If we are asked for the string, we will regenerate one from fDecimalNum.
826 //----------------------------------------------------
828 //----------------------------------------------------
834 #include "unicode/datefmt.h"
837 class FormattableStreamer
/* not : public UObject because all methods are static */ {
839 static void streamOut(ostream
& stream
, const Formattable
& obj
);
842 FormattableStreamer() {} // private - forbid instantiation
845 // This is for debugging purposes only. This will send a displayable
846 // form of the Formattable object to the output stream.
849 FormattableStreamer::streamOut(ostream
& stream
, const Formattable
& obj
)
851 static DateFormat
*defDateFormat
= 0;
853 UnicodeString buffer
;
854 switch(obj
.getType()) {
855 case Formattable::kDate
:
856 // Creates a DateFormat instance for formatting the
858 if (defDateFormat
== 0) {
859 defDateFormat
= DateFormat::createInstance();
861 defDateFormat
->format(obj
.getDate(), buffer
);
864 case Formattable::kDouble
:
865 // Output the double as is.
866 stream
<< obj
.getDouble() << 'D';
868 case Formattable::kLong
:
869 // Output the double as is.
870 stream
<< obj
.getLong() << 'L';
872 case Formattable::kString
:
873 // Output the double as is. Please see UnicodeString console
874 // I/O routine for more details.
875 stream
<< '"' << obj
.getString(buffer
) << '"';
877 case Formattable::kArray
:
879 const Formattable
* array
;
880 array
= obj
.getArray(count
);
882 // Recursively calling the console I/O routine for each element in the array.
883 for (i
=0; i
<count
; ++i
) {
884 FormattableStreamer::streamOut(stream
, array
[i
]);
885 stream
<< ( (i
==(count
-1)) ? "" : ", " );
890 // Not a recognizable Formattable object.
891 stream
<< "INVALID_Formattable";
901 /* ---- UFormattable implementation ---- */
905 U_DRAFT UFormattable
* U_EXPORT2
906 ufmt_open(UErrorCode
*status
) {
907 if( U_FAILURE(*status
) ) {
910 UFormattable
*fmt
= (new Formattable())->toUFormattable();
913 *status
= U_MEMORY_ALLOCATION_ERROR
;
918 U_DRAFT
void U_EXPORT2
919 ufmt_close(UFormattable
*fmt
) {
920 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
925 U_INTERNAL UFormattableType U_EXPORT2
926 ufmt_getType(const UFormattable
*fmt
, UErrorCode
*status
) {
927 if(U_FAILURE(*status
)) {
928 return (UFormattableType
)UFMT_COUNT
;
930 const Formattable
*obj
= Formattable::fromUFormattable(fmt
);
931 return (UFormattableType
)obj
->getType();
935 U_INTERNAL UBool U_EXPORT2
936 ufmt_isNumeric(const UFormattable
*fmt
) {
937 const Formattable
*obj
= Formattable::fromUFormattable(fmt
);
938 return obj
->isNumeric();
941 U_DRAFT UDate U_EXPORT2
942 ufmt_getDate(const UFormattable
*fmt
, UErrorCode
*status
) {
943 const Formattable
*obj
= Formattable::fromUFormattable(fmt
);
945 return obj
->getDate(*status
);
948 U_DRAFT
double U_EXPORT2
949 ufmt_getDouble(UFormattable
*fmt
, UErrorCode
*status
) {
950 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
952 return obj
->getDouble(*status
);
955 U_DRAFT
int32_t U_EXPORT2
956 ufmt_getLong(UFormattable
*fmt
, UErrorCode
*status
) {
957 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
959 return obj
->getLong(*status
);
963 U_DRAFT
const void *U_EXPORT2
964 ufmt_getObject(const UFormattable
*fmt
, UErrorCode
*status
) {
965 const Formattable
*obj
= Formattable::fromUFormattable(fmt
);
967 const void *ret
= obj
->getObject();
969 (obj
->getType() != Formattable::kObject
) &&
970 U_SUCCESS( *status
)) {
971 *status
= U_INVALID_FORMAT_ERROR
;
976 U_DRAFT
const UChar
* U_EXPORT2
977 ufmt_getUChars(UFormattable
*fmt
, int32_t *len
, UErrorCode
*status
) {
978 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
980 // avoid bogosity by checking the type first.
981 if( obj
->getType() != Formattable::kString
) {
982 if( U_SUCCESS(*status
) ){
983 *status
= U_INVALID_FORMAT_ERROR
;
988 // This should return a valid string
989 UnicodeString
&str
= obj
->getString(*status
);
990 if( U_SUCCESS(*status
) && len
!= NULL
) {
993 return str
.getTerminatedBuffer();
996 U_DRAFT
int32_t U_EXPORT2
997 ufmt_getArrayLength(const UFormattable
* fmt
, UErrorCode
*status
) {
998 const Formattable
*obj
= Formattable::fromUFormattable(fmt
);
1001 (void)obj
->getArray(count
, *status
);
1005 U_DRAFT UFormattable
* U_EXPORT2
1006 ufmt_getArrayItemByIndex(UFormattable
* fmt
, int32_t n
, UErrorCode
*status
) {
1007 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
1009 (void)obj
->getArray(count
, *status
);
1010 if(U_FAILURE(*status
)) {
1012 } else if(n
<0 || n
>=count
) {
1013 setError(*status
, U_INDEX_OUTOFBOUNDS_ERROR
);
1016 return (*obj
)[n
].toUFormattable(); // returns non-const Formattable
1020 U_DRAFT
const char * U_EXPORT2
1021 ufmt_getDecNumChars(UFormattable
*fmt
, int32_t *len
, UErrorCode
*status
) {
1022 if(U_FAILURE(*status
)) {
1025 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
1026 CharString
*charString
= obj
->internalGetCharString(*status
);
1027 if(U_FAILURE(*status
)) {
1030 if(charString
== NULL
) {
1031 *status
= U_MEMORY_ALLOCATION_ERROR
;
1035 *len
= charString
->length();
1037 return charString
->data();
1041 U_DRAFT
int64_t U_EXPORT2
1042 ufmt_getInt64(UFormattable
*fmt
, UErrorCode
*status
) {
1043 Formattable
*obj
= Formattable::fromUFormattable(fmt
);
1044 return obj
->getInt64(*status
);
1047 #endif /* #if !UCONFIG_NO_FORMATTING */