]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/fmtable.h
ICU-62108.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / fmtable.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 1997-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File FMTABLE.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 02/29/97 aliu Creation.
15 ********************************************************************************
16 */
17 #ifndef FMTABLE_H
18 #define FMTABLE_H
19
20 #include "unicode/utypes.h"
21
22 /**
23 * \file
24 * \brief C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing
25 */
26
27 #if !UCONFIG_NO_FORMATTING
28
29 #include "unicode/unistr.h"
30 #include "unicode/stringpiece.h"
31 #include "unicode/uformattable.h"
32
33 #if U_SHOW_CPLUSPLUS_API
34 U_NAMESPACE_BEGIN
35
36 class CharString;
37 class DigitList;
38 namespace number {
39 namespace impl {
40 class DecimalQuantity;
41 }
42 }
43
44 /**
45 * \def UNUM_INTERNAL_STACKARRAY_SIZE
46 * @internal
47 */
48 #if U_PLATFORM == U_PF_OS400
49 #define UNUM_INTERNAL_STACKARRAY_SIZE 144
50 #else
51 #define UNUM_INTERNAL_STACKARRAY_SIZE 128
52 #endif
53
54 /**
55 * Formattable objects can be passed to the Format class or
56 * its subclasses for formatting. Formattable is a thin wrapper
57 * class which interconverts between the primitive numeric types
58 * (double, long, etc.) as well as UDate and UnicodeString.
59 *
60 * <p>Internally, a Formattable object is a union of primitive types.
61 * As such, it can only store one flavor of data at a time. To
62 * determine what flavor of data it contains, use the getType method.
63 *
64 * <p>As of ICU 3.0, Formattable may also wrap a UObject pointer,
65 * which it owns. This allows an instance of any ICU class to be
66 * encapsulated in a Formattable. For legacy reasons and for
67 * efficiency, primitive numeric types are still stored directly
68 * within a Formattable.
69 *
70 * <p>The Formattable class is not suitable for subclassing.
71 *
72 * <p>See UFormattable for a C wrapper.
73 */
74 class U_I18N_API Formattable : public UObject {
75 public:
76 /**
77 * This enum is only used to let callers distinguish between
78 * the Formattable(UDate) constructor and the Formattable(double)
79 * constructor; the compiler cannot distinguish the signatures,
80 * since UDate is currently typedefed to be either double or long.
81 * If UDate is changed later to be a bonafide class
82 * or struct, then we no longer need this enum.
83 * @stable ICU 2.4
84 */
85 enum ISDATE { kIsDate };
86
87 /**
88 * Default constructor
89 * @stable ICU 2.4
90 */
91 Formattable(); // Type kLong, value 0
92
93 /**
94 * Creates a Formattable object with a UDate instance.
95 * @param d the UDate instance.
96 * @param flag the flag to indicate this is a date. Always set it to kIsDate
97 * @stable ICU 2.0
98 */
99 Formattable(UDate d, ISDATE flag);
100
101 /**
102 * Creates a Formattable object with a double number.
103 * @param d the double number.
104 * @stable ICU 2.0
105 */
106 Formattable(double d);
107
108 /**
109 * Creates a Formattable object with a long number.
110 * @param l the long number.
111 * @stable ICU 2.0
112 */
113 Formattable(int32_t l);
114
115 /**
116 * Creates a Formattable object with an int64_t number
117 * @param ll the int64_t number.
118 * @stable ICU 2.8
119 */
120 Formattable(int64_t ll);
121
122 #if !UCONFIG_NO_CONVERSION
123 /**
124 * Creates a Formattable object with a char string pointer.
125 * Assumes that the char string is null terminated.
126 * @param strToCopy the char string.
127 * @stable ICU 2.0
128 */
129 Formattable(const char* strToCopy);
130 #endif
131
132 /**
133 * Creates a Formattable object of an appropriate numeric type from a
134 * a decimal number in string form. The Formattable will retain the
135 * full precision of the input in decimal format, even when it exceeds
136 * what can be represented by a double or int64_t.
137 *
138 * @param number the unformatted (not localized) string representation
139 * of the Decimal number.
140 * @param status the error code. Possible errors include U_INVALID_FORMAT_ERROR
141 * if the format of the string does not conform to that of a
142 * decimal number.
143 * @stable ICU 4.4
144 */
145 Formattable(StringPiece number, UErrorCode &status);
146
147 /**
148 * Creates a Formattable object with a UnicodeString object to copy from.
149 * @param strToCopy the UnicodeString string.
150 * @stable ICU 2.0
151 */
152 Formattable(const UnicodeString& strToCopy);
153
154 /**
155 * Creates a Formattable object with a UnicodeString object to adopt from.
156 * @param strToAdopt the UnicodeString string.
157 * @stable ICU 2.0
158 */
159 Formattable(UnicodeString* strToAdopt);
160
161 /**
162 * Creates a Formattable object with an array of Formattable objects.
163 * @param arrayToCopy the Formattable object array.
164 * @param count the array count.
165 * @stable ICU 2.0
166 */
167 Formattable(const Formattable* arrayToCopy, int32_t count);
168
169 /**
170 * Creates a Formattable object that adopts the given UObject.
171 * @param objectToAdopt the UObject to set this object to
172 * @stable ICU 3.0
173 */
174 Formattable(UObject* objectToAdopt);
175
176 /**
177 * Copy constructor.
178 * @stable ICU 2.0
179 */
180 Formattable(const Formattable&);
181
182 /**
183 * Assignment operator.
184 * @param rhs The Formattable object to copy into this object.
185 * @stable ICU 2.0
186 */
187 Formattable& operator=(const Formattable &rhs);
188
189 /**
190 * Equality comparison.
191 * @param other the object to be compared with.
192 * @return TRUE if other are equal to this, FALSE otherwise.
193 * @stable ICU 2.0
194 */
195 UBool operator==(const Formattable &other) const;
196
197 /**
198 * Equality operator.
199 * @param other the object to be compared with.
200 * @return TRUE if other are unequal to this, FALSE otherwise.
201 * @stable ICU 2.0
202 */
203 UBool operator!=(const Formattable& other) const
204 { return !operator==(other); }
205
206 /**
207 * Destructor.
208 * @stable ICU 2.0
209 */
210 virtual ~Formattable();
211
212 /**
213 * Clone this object.
214 * Clones can be used concurrently in multiple threads.
215 * If an error occurs, then NULL is returned.
216 * The caller must delete the clone.
217 *
218 * @return a clone of this object
219 *
220 * @see getDynamicClassID
221 * @stable ICU 2.8
222 */
223 Formattable *clone() const;
224
225 /**
226 * Selector for flavor of data type contained within a
227 * Formattable object. Formattable is a union of several
228 * different types, and at any time contains exactly one type.
229 * @stable ICU 2.4
230 */
231 enum Type {
232 /**
233 * Selector indicating a UDate value. Use getDate to retrieve
234 * the value.
235 * @stable ICU 2.4
236 */
237 kDate,
238
239 /**
240 * Selector indicating a double value. Use getDouble to
241 * retrieve the value.
242 * @stable ICU 2.4
243 */
244 kDouble,
245
246 /**
247 * Selector indicating a 32-bit integer value. Use getLong to
248 * retrieve the value.
249 * @stable ICU 2.4
250 */
251 kLong,
252
253 /**
254 * Selector indicating a UnicodeString value. Use getString
255 * to retrieve the value.
256 * @stable ICU 2.4
257 */
258 kString,
259
260 /**
261 * Selector indicating an array of Formattables. Use getArray
262 * to retrieve the value.
263 * @stable ICU 2.4
264 */
265 kArray,
266
267 /**
268 * Selector indicating a 64-bit integer value. Use getInt64
269 * to retrieve the value.
270 * @stable ICU 2.8
271 */
272 kInt64,
273
274 /**
275 * Selector indicating a UObject value. Use getObject to
276 * retrieve the value.
277 * @stable ICU 3.0
278 */
279 kObject
280 };
281
282 /**
283 * Gets the data type of this Formattable object.
284 * @return the data type of this Formattable object.
285 * @stable ICU 2.0
286 */
287 Type getType(void) const;
288
289 /**
290 * Returns TRUE if the data type of this Formattable object
291 * is kDouble, kLong, or kInt64
292 * @return TRUE if this is a pure numeric object
293 * @stable ICU 3.0
294 */
295 UBool isNumeric() const;
296
297 /**
298 * Gets the double value of this object. If this object is not of type
299 * kDouble then the result is undefined.
300 * @return the double value of this object.
301 * @stable ICU 2.0
302 */
303 double getDouble(void) const { return fValue.fDouble; }
304
305 /**
306 * Gets the double value of this object. If this object is of type
307 * long, int64 or Decimal Number then a conversion is peformed, with
308 * possible loss of precision. If the type is kObject and the
309 * object is a Measure, then the result of
310 * getNumber().getDouble(status) is returned. If this object is
311 * neither a numeric type nor a Measure, then 0 is returned and
312 * the status is set to U_INVALID_FORMAT_ERROR.
313 * @param status the error code
314 * @return the double value of this object.
315 * @stable ICU 3.0
316 */
317 double getDouble(UErrorCode& status) const;
318
319 /**
320 * Gets the long value of this object. If this object is not of type
321 * kLong then the result is undefined.
322 * @return the long value of this object.
323 * @stable ICU 2.0
324 */
325 int32_t getLong(void) const { return (int32_t)fValue.fInt64; }
326
327 /**
328 * Gets the long value of this object. If the magnitude is too
329 * large to fit in a long, then the maximum or minimum long value,
330 * as appropriate, is returned and the status is set to
331 * U_INVALID_FORMAT_ERROR. If this object is of type kInt64 and
332 * it fits within a long, then no precision is lost. If it is of
333 * type kDouble, then a conversion is peformed, with
334 * truncation of any fractional part. If the type is kObject and
335 * the object is a Measure, then the result of
336 * getNumber().getLong(status) is returned. If this object is
337 * neither a numeric type nor a Measure, then 0 is returned and
338 * the status is set to U_INVALID_FORMAT_ERROR.
339 * @param status the error code
340 * @return the long value of this object.
341 * @stable ICU 3.0
342 */
343 int32_t getLong(UErrorCode& status) const;
344
345 /**
346 * Gets the int64 value of this object. If this object is not of type
347 * kInt64 then the result is undefined.
348 * @return the int64 value of this object.
349 * @stable ICU 2.8
350 */
351 int64_t getInt64(void) const { return fValue.fInt64; }
352
353 /**
354 * Gets the int64 value of this object. If this object is of a numeric
355 * type and the magnitude is too large to fit in an int64, then
356 * the maximum or minimum int64 value, as appropriate, is returned
357 * and the status is set to U_INVALID_FORMAT_ERROR. If the
358 * magnitude fits in an int64, then a casting conversion is
359 * peformed, with truncation of any fractional part. If the type
360 * is kObject and the object is a Measure, then the result of
361 * getNumber().getDouble(status) is returned. If this object is
362 * neither a numeric type nor a Measure, then 0 is returned and
363 * the status is set to U_INVALID_FORMAT_ERROR.
364 * @param status the error code
365 * @return the int64 value of this object.
366 * @stable ICU 3.0
367 */
368 int64_t getInt64(UErrorCode& status) const;
369
370 /**
371 * Gets the Date value of this object. If this object is not of type
372 * kDate then the result is undefined.
373 * @return the Date value of this object.
374 * @stable ICU 2.0
375 */
376 UDate getDate() const { return fValue.fDate; }
377
378 /**
379 * Gets the Date value of this object. If the type is not a date,
380 * status is set to U_INVALID_FORMAT_ERROR and the return value is
381 * undefined.
382 * @param status the error code.
383 * @return the Date value of this object.
384 * @stable ICU 3.0
385 */
386 UDate getDate(UErrorCode& status) const;
387
388 /**
389 * Gets the string value of this object. If this object is not of type
390 * kString then the result is undefined.
391 * @param result Output param to receive the Date value of this object.
392 * @return A reference to 'result'.
393 * @stable ICU 2.0
394 */
395 UnicodeString& getString(UnicodeString& result) const
396 { result=*fValue.fString; return result; }
397
398 /**
399 * Gets the string value of this object. If the type is not a
400 * string, status is set to U_INVALID_FORMAT_ERROR and a bogus
401 * string is returned.
402 * @param result Output param to receive the Date value of this object.
403 * @param status the error code.
404 * @return A reference to 'result'.
405 * @stable ICU 3.0
406 */
407 UnicodeString& getString(UnicodeString& result, UErrorCode& status) const;
408
409 /**
410 * Gets a const reference to the string value of this object. If
411 * this object is not of type kString then the result is
412 * undefined.
413 * @return a const reference to the string value of this object.
414 * @stable ICU 2.0
415 */
416 inline const UnicodeString& getString(void) const;
417
418 /**
419 * Gets a const reference to the string value of this object. If
420 * the type is not a string, status is set to
421 * U_INVALID_FORMAT_ERROR and the result is a bogus string.
422 * @param status the error code.
423 * @return a const reference to the string value of this object.
424 * @stable ICU 3.0
425 */
426 const UnicodeString& getString(UErrorCode& status) const;
427
428 /**
429 * Gets a reference to the string value of this object. If this
430 * object is not of type kString then the result is undefined.
431 * @return a reference to the string value of this object.
432 * @stable ICU 2.0
433 */
434 inline UnicodeString& getString(void);
435
436 /**
437 * Gets a reference to the string value of this object. If the
438 * type is not a string, status is set to U_INVALID_FORMAT_ERROR
439 * and the result is a bogus string.
440 * @param status the error code.
441 * @return a reference to the string value of this object.
442 * @stable ICU 3.0
443 */
444 UnicodeString& getString(UErrorCode& status);
445
446 /**
447 * Gets the array value and count of this object. If this object
448 * is not of type kArray then the result is undefined.
449 * @param count fill-in with the count of this object.
450 * @return the array value of this object.
451 * @stable ICU 2.0
452 */
453 const Formattable* getArray(int32_t& count) const
454 { count=fValue.fArrayAndCount.fCount; return fValue.fArrayAndCount.fArray; }
455
456 /**
457 * Gets the array value and count of this object. If the type is
458 * not an array, status is set to U_INVALID_FORMAT_ERROR, count is
459 * set to 0, and the result is NULL.
460 * @param count fill-in with the count of this object.
461 * @param status the error code.
462 * @return the array value of this object.
463 * @stable ICU 3.0
464 */
465 const Formattable* getArray(int32_t& count, UErrorCode& status) const;
466
467 /**
468 * Accesses the specified element in the array value of this
469 * Formattable object. If this object is not of type kArray then
470 * the result is undefined.
471 * @param index the specified index.
472 * @return the accessed element in the array.
473 * @stable ICU 2.0
474 */
475 Formattable& operator[](int32_t index) { return fValue.fArrayAndCount.fArray[index]; }
476
477 /**
478 * Returns a pointer to the UObject contained within this
479 * formattable, or NULL if this object does not contain a UObject.
480 * @return a UObject pointer, or NULL
481 * @stable ICU 3.0
482 */
483 const UObject* getObject() const;
484
485 /**
486 * Returns a numeric string representation of the number contained within this
487 * formattable, or NULL if this object does not contain numeric type.
488 * For values obtained by parsing, the returned decimal number retains
489 * the full precision and range of the original input, unconstrained by
490 * the limits of a double floating point or a 64 bit int.
491 *
492 * This function is not thread safe, and therfore is not declared const,
493 * even though it is logically const.
494 *
495 * Possible errors include U_MEMORY_ALLOCATION_ERROR, and
496 * U_INVALID_STATE if the formattable object has not been set to
497 * a numeric type.
498 *
499 * @param status the error code.
500 * @return the unformatted string representation of a number.
501 * @stable ICU 4.4
502 */
503 StringPiece getDecimalNumber(UErrorCode &status);
504
505 /**
506 * Sets the double value of this object and changes the type to
507 * kDouble.
508 * @param d the new double value to be set.
509 * @stable ICU 2.0
510 */
511 void setDouble(double d);
512
513 /**
514 * Sets the long value of this object and changes the type to
515 * kLong.
516 * @param l the new long value to be set.
517 * @stable ICU 2.0
518 */
519 void setLong(int32_t l);
520
521 /**
522 * Sets the int64 value of this object and changes the type to
523 * kInt64.
524 * @param ll the new int64 value to be set.
525 * @stable ICU 2.8
526 */
527 void setInt64(int64_t ll);
528
529 /**
530 * Sets the Date value of this object and changes the type to
531 * kDate.
532 * @param d the new Date value to be set.
533 * @stable ICU 2.0
534 */
535 void setDate(UDate d);
536
537 /**
538 * Sets the string value of this object and changes the type to
539 * kString.
540 * @param stringToCopy the new string value to be set.
541 * @stable ICU 2.0
542 */
543 void setString(const UnicodeString& stringToCopy);
544
545 /**
546 * Sets the array value and count of this object and changes the
547 * type to kArray.
548 * @param array the array value.
549 * @param count the number of array elements to be copied.
550 * @stable ICU 2.0
551 */
552 void setArray(const Formattable* array, int32_t count);
553
554 /**
555 * Sets and adopts the string value and count of this object and
556 * changes the type to kArray.
557 * @param stringToAdopt the new string value to be adopted.
558 * @stable ICU 2.0
559 */
560 void adoptString(UnicodeString* stringToAdopt);
561
562 /**
563 * Sets and adopts the array value and count of this object and
564 * changes the type to kArray.
565 * @stable ICU 2.0
566 */
567 void adoptArray(Formattable* array, int32_t count);
568
569 /**
570 * Sets and adopts the UObject value of this object and changes
571 * the type to kObject. After this call, the caller must not
572 * delete the given object.
573 * @param objectToAdopt the UObject value to be adopted
574 * @stable ICU 3.0
575 */
576 void adoptObject(UObject* objectToAdopt);
577
578 /**
579 * Sets the the numeric value from a decimal number string, and changes
580 * the type to to a numeric type appropriate for the number.
581 * The syntax of the number is a "numeric string"
582 * as defined in the Decimal Arithmetic Specification, available at
583 * http://speleotrove.com/decimal
584 * The full precision and range of the input number will be retained,
585 * even when it exceeds what can be represented by a double or an int64.
586 *
587 * @param numberString a string representation of the unformatted decimal number.
588 * @param status the error code. Set to U_INVALID_FORMAT_ERROR if the
589 * incoming string is not a valid decimal number.
590 * @stable ICU 4.4
591 */
592 void setDecimalNumber(StringPiece numberString,
593 UErrorCode &status);
594
595 /**
596 * ICU "poor man's RTTI", returns a UClassID for the actual class.
597 *
598 * @stable ICU 2.2
599 */
600 virtual UClassID getDynamicClassID() const;
601
602 /**
603 * ICU "poor man's RTTI", returns a UClassID for this class.
604 *
605 * @stable ICU 2.2
606 */
607 static UClassID U_EXPORT2 getStaticClassID();
608
609 /**
610 * Convert the UFormattable to a Formattable. Internally, this is a reinterpret_cast.
611 * @param fmt a valid UFormattable
612 * @return the UFormattable as a Formattable object pointer. This is an alias to the original
613 * UFormattable, and so is only valid while the original argument remains in scope.
614 * @stable ICU 52
615 */
616 static inline Formattable *fromUFormattable(UFormattable *fmt);
617
618 /**
619 * Convert the const UFormattable to a const Formattable. Internally, this is a reinterpret_cast.
620 * @param fmt a valid UFormattable
621 * @return the UFormattable as a Formattable object pointer. This is an alias to the original
622 * UFormattable, and so is only valid while the original argument remains in scope.
623 * @stable ICU 52
624 */
625 static inline const Formattable *fromUFormattable(const UFormattable *fmt);
626
627 /**
628 * Convert this object pointer to a UFormattable.
629 * @return this object as a UFormattable pointer. This is an alias to this object,
630 * and so is only valid while this object remains in scope.
631 * @stable ICU 52
632 */
633 inline UFormattable *toUFormattable();
634
635 /**
636 * Convert this object pointer to a UFormattable.
637 * @return this object as a UFormattable pointer. This is an alias to this object,
638 * and so is only valid while this object remains in scope.
639 * @stable ICU 52
640 */
641 inline const UFormattable *toUFormattable() const;
642
643 #ifndef U_HIDE_DEPRECATED_API
644 /**
645 * Deprecated variant of getLong(UErrorCode&).
646 * @param status the error code
647 * @return the long value of this object.
648 * @deprecated ICU 3.0 use getLong(UErrorCode&) instead
649 */
650 inline int32_t getLong(UErrorCode* status) const;
651 #endif /* U_HIDE_DEPRECATED_API */
652
653 #ifndef U_HIDE_INTERNAL_API
654 /**
655 * Internal function, do not use.
656 * TODO: figure out how to make this be non-public.
657 * NumberFormat::format(Formattable, ...
658 * needs to get at the DigitList, if it exists, for
659 * big decimal formatting.
660 * @internal
661 */
662 DigitList *getDigitList() const { return fDecimalNum;}
663
664 /**
665 * @internal
666 */
667 DigitList *getInternalDigitList();
668
669 /**
670 * Internal function, do not use.
671 * TODO: figure out how to make this be non-public.
672 * NumberFormat::format(Formattable, ...
673 * needs to get at the DecimalQuantity, if it exists, for
674 * big decimal formatting.
675 * @internal
676 */
677 number::impl::DecimalQuantity *getDecimalQuantity() const { return fDecimalQuantity;}
678
679 /**
680 * Export the value of this Formattable to a DecimalQuantity.
681 * @internal
682 */
683 void populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const;
684
685 /**
686 * Adopt, and set value from, a DigitList
687 * Internal Function, do not use.
688 * @param dl the Digit List to be adopted
689 * @internal
690 */
691 void adoptDigitList(DigitList *dl);
692
693 /**
694 * Adopt, and set value from, a DecimalQuantity
695 * Internal Function, do not use.
696 * @param dl the DecimalQuantity to be adopted
697 * @internal
698 */
699 void adoptDecimalQuantity(number::impl::DecimalQuantity *dq);
700
701 /**
702 * Internal function to return the CharString pointer.
703 * @param status error code
704 * @return pointer to the CharString - may become invalid if the object is modified
705 * @internal
706 */
707 CharString *internalGetCharString(UErrorCode &status);
708
709 #endif /* U_HIDE_INTERNAL_API */
710
711 private:
712 /**
713 * Cleans up the memory for unwanted values. For example, the adopted
714 * string or array objects.
715 */
716 void dispose(void);
717
718 /**
719 * Common initialization, for use by constructors.
720 */
721 void init();
722
723 UnicodeString* getBogus() const;
724
725 union {
726 UObject* fObject;
727 UnicodeString* fString;
728 double fDouble;
729 int64_t fInt64;
730 UDate fDate;
731 struct {
732 Formattable* fArray;
733 int32_t fCount;
734 } fArrayAndCount;
735 } fValue;
736
737 CharString *fDecimalStr;
738
739 DigitList *fDecimalNum;
740
741 char fStackData[UNUM_INTERNAL_STACKARRAY_SIZE]; // must be big enough for DigitList
742
743 number::impl::DecimalQuantity *fDecimalQuantity;
744
745 Type fType;
746 UnicodeString fBogus; // Bogus string when it's needed.
747 };
748
749 inline UDate Formattable::getDate(UErrorCode& status) const {
750 if (fType != kDate) {
751 if (U_SUCCESS(status)) {
752 status = U_INVALID_FORMAT_ERROR;
753 }
754 return 0;
755 }
756 return fValue.fDate;
757 }
758
759 inline const UnicodeString& Formattable::getString(void) const {
760 return *fValue.fString;
761 }
762
763 inline UnicodeString& Formattable::getString(void) {
764 return *fValue.fString;
765 }
766
767 #ifndef U_HIDE_DEPRECATED_API
768 inline int32_t Formattable::getLong(UErrorCode* status) const {
769 return getLong(*status);
770 }
771 #endif /* U_HIDE_DEPRECATED_API */
772
773 inline UFormattable* Formattable::toUFormattable() {
774 return reinterpret_cast<UFormattable*>(this);
775 }
776
777 inline const UFormattable* Formattable::toUFormattable() const {
778 return reinterpret_cast<const UFormattable*>(this);
779 }
780
781 inline Formattable* Formattable::fromUFormattable(UFormattable *fmt) {
782 return reinterpret_cast<Formattable *>(fmt);
783 }
784
785 inline const Formattable* Formattable::fromUFormattable(const UFormattable *fmt) {
786 return reinterpret_cast<const Formattable *>(fmt);
787 }
788
789 U_NAMESPACE_END
790 #endif // U_SHOW_CPLUSPLUS_API
791
792 #endif /* #if !UCONFIG_NO_FORMATTING */
793
794 #endif //_FMTABLE
795 //eof