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

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

Formattable Class Reference

#include <fmtable.h>

Inheritance diagram for Formattable:
Inheritance graph
Collaboration diagram for Formattable:
Collaboration graph

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 adoptObject (UObject *objectToAdopt)
void adoptString (UnicodeString *stringToAdopt)
Formattableclone () const
 Formattable (UDate d, ISDATE flag)
 Formattable (int32_t l)
 Formattable (UnicodeString *strToAdopt)
 Formattable (const Formattable *arrayToCopy, int32_t count)
 Formattable (int64_t ll)
 Formattable (UObject *objectToAdopt)
 Formattable ()
 Formattable (const Formattable &)
 Formattable (double d)
 Formattable (const char *strToCopy)
 Formattable (const UnicodeString &strToCopy)
const FormattablegetArray (int32_t &count) const
const FormattablegetArray (int32_t &count, UErrorCode &status) const
UDate getDate () const
UDate getDate (UErrorCode &status) 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 (UErrorCode &status) const
int32_t getLong (UErrorCode *status) const
int32_t getLong (void) const
const UObjectgetObject () const
UnicodeStringgetString (UErrorCode &status)
UnicodeStringgetString (void)
UnicodeStringgetString (UnicodeString &result) const
UnicodeStringgetString (UnicodeString &result, UErrorCode &status) const
const UnicodeStringgetString (void) const
const UnicodeStringgetString (UErrorCode &status) const
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 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

Private Attributes

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

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 47 of file fmtable.h.

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

Generated by  Doxygen 1.6.0   Back to index