// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * * File FMTABLE.H * * Modification History: * * Date Name Description * 02/29/97 aliu Creation. ******************************************************************************** */ #ifndef FMTABLE_H #define FMTABLE_H #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API /** * \file * \brief C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing */ #if !UCONFIG_NO_FORMATTING #include "unicode/unistr.h" #include "unicode/stringpiece.h" #include "unicode/uformattable.h" U_NAMESPACE_BEGIN class CharString; namespace number { namespace impl { class DecimalQuantity; } } /** * Formattable objects can be passed to the Format class or * its subclasses for formatting. Formattable is a thin wrapper * class which interconverts between the primitive numeric types * (double, long, etc.) as well as UDate and UnicodeString. * * <p>Internally, a Formattable object is a union of primitive types. * As such, it can only store one flavor of data at a time. To * determine what flavor of data it contains, use the getType method. * * <p>As of ICU 3.0, Formattable may also wrap a UObject pointer, * which it owns. This allows an instance of any ICU class to be * encapsulated in a Formattable. For legacy reasons and for * efficiency, primitive numeric types are still stored directly * within a Formattable. * * <p>The Formattable class is not suitable for subclassing. * * <p>See UFormattable for a C wrapper. */ class U_I18N_API Formattable : public UObject { … }; inline UDate Formattable::getDate(UErrorCode& status) const { … } inline const UnicodeString& Formattable::getString(void) const { … } inline UnicodeString& Formattable::getString(void) { … } #ifndef U_HIDE_DEPRECATED_API inline int32_t Formattable::getLong(UErrorCode* status) const { … } #endif /* U_HIDE_DEPRECATED_API */ inline UFormattable* Formattable::toUFormattable() { … } inline const UFormattable* Formattable::toUFormattable() const { … } inline Formattable* Formattable::fromUFormattable(UFormattable *fmt) { … } inline const Formattable* Formattable::fromUFormattable(const UFormattable *fmt) { … } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ #endif //_FMTABLE //eof