Logo Search packages:      
Sourcecode: icu version File versions  Download package

Formattable Class Reference

#include <fmtable.h>

Inheritance diagram for Formattable:
Collaboration diagram for Formattable:

List of all members.

Public Types

enum  ISDATE { kIsDate }
enum  Type {
  kDate, kDouble, kLong, kString,
  kArray, kInt64, kObject
}

Public Member Functions

void adoptArray (Formattable *array, int32_t count)
void adoptDigitList (DigitList *dl)
void adoptObject (UObject *objectToAdopt)
void adoptString (UnicodeString *stringToAdopt)
Formattableclone () const
 Formattable ()
 Formattable (UDate d, ISDATE flag)
 Formattable (double d)
 Formattable (int32_t l)
 Formattable (int64_t ll)
 Formattable (const char *strToCopy)
 Formattable (const StringPiece &number, UErrorCode &status)
 Formattable (const UnicodeString &strToCopy)
 Formattable (UnicodeString *strToAdopt)
 Formattable (const Formattable *arrayToCopy, int32_t count)
 Formattable (UObject *objectToAdopt)
 Formattable (const Formattable &)
const FormattablegetArray (int32_t &count) const
const FormattablegetArray (int32_t &count, UErrorCode &status) const
UDate getDate () const
UDate getDate (UErrorCode &status) const
StringPiece getDecimalNumber (UErrorCode &status)
DigitListgetDigitList () const
double getDouble (void) const
double getDouble (UErrorCode &status) const
virtual UClassID getDynamicClassID () const
int64_t getInt64 (void) const
int64_t getInt64 (UErrorCode &status) const
int32_t getLong (void) const
int32_t getLong (UErrorCode &status) const
int32_t getLong (UErrorCode *status) const
const UObjectgetObject () const
UnicodeStringgetString (UnicodeString &result) const
UnicodeStringgetString (UnicodeString &result, UErrorCode &status) const
const UnicodeStringgetString (void) const
const UnicodeStringgetString (UErrorCode &status) const
UnicodeStringgetString (void)
UnicodeStringgetString (UErrorCode &status)
Type getType (void) const
UBool isNumeric () const
UBool operator!= (const Formattable &other) const
Formattableoperator= (const Formattable &rhs)
UBool operator== (const Formattable &other) const
Formattableoperator[] (int32_t index)
void setArray (const Formattable *array, int32_t count)
void setDate (UDate d)
void setDecimalNumber (const StringPiece &numberString, UErrorCode &status)
void setDouble (double d)
void setInt64 (int64_t ll)
void setLong (int32_t l)
void setString (const UnicodeString &stringToCopy)
virtual ~Formattable ()

Static Public Member Functions

static UClassID U_EXPORT2 getStaticClassID ()
static void U_EXPORT2 operator delete (void *p) U_NO_THROW
static void U_EXPORT2 operator delete (void *, void *) U_NO_THROW
static void U_EXPORT2 operator delete[] (void *p) U_NO_THROW
static void *U_EXPORT2 operator new (size_t size) U_NO_THROW
static void *U_EXPORT2 operator new (size_t, void *ptr) U_NO_THROW
static void *U_EXPORT2 operator new[] (size_t size) U_NO_THROW

Private Member Functions

void dispose (void)
UnicodeStringgetBogus () const
void init ()

Private Attributes

UnicodeString fBogus
DigitListfDecimalNum
CharStringfDecimalStr
Type fType
union {
   struct {
      Formattable *   fArray
      int32_t   fCount
   }   fArrayAndCount
   UDate   fDate
   double   fDouble
   int64_t   fInt64
   UObject *   fObject
   UnicodeString *   fString
fValue

Detailed Description

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.

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.

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.

The Formattable class is not suitable for subclassing.

Definition at line 52 of file fmtable.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index