#include <fmtable.h>
Public Members | |||
![]() | ![]() | enum | ISDATE { kIsDate } |
![]() | ![]() | This enum is only used to let callers distinguish between the Formattable(UDate) constructor and the Formattable(double) constructor; the compiler cannot distinguish the signatures, since UDate is currently typedefed to be either double or long. More... | |
![]() | ![]() | enum | Type { kDate, kDouble, kLong, kString, kArray } |
![]() | ![]() | The list of possible data types of this Formattable object. More... | |
![]() | ![]() | Formattable () | |
![]() | ![]() | Formattable (UDate d, ISDATE) | |
![]() | ![]() | Creates a Formattable object with a UDate instance. More... | |
![]() | ![]() | Formattable (double d) | |
![]() | ![]() | Creates a Formattable object with a double number. More... | |
![]() | ![]() | Formattable (int32_t l) | |
![]() | ![]() | Creates a Formattable object with a long number. More... | |
![]() | ![]() | Formattable (const char* strToCopy) | |
![]() | ![]() | Creates a Formattable object with a char string pointer. More... | |
![]() | ![]() | Formattable (const UnicodeString& stringToCopy) | |
![]() | ![]() | Creates a Formattable object with a UnicodeString object to copy from. More... | |
![]() | ![]() | Formattable (UnicodeString* stringToAdopt) | |
![]() | ![]() | Creates a Formattable object with a UnicodeString object to adopt from. More... | |
![]() | ![]() | Formattable (const Formattable* arrayToCopy, int32_t count) | |
![]() | ![]() | Creates a Formattable object with an array of Formattable objects. More... | |
![]() | ![]() | Formattable (const Formattable&) | |
![]() | ![]() | Copy constructor. More... | |
![]() | ![]() | Formattable& | operator= (const Formattable&) |
![]() | ![]() | Assignment operator. More... | |
![]() | ![]() | UBool | operator== (const Formattable&) const |
![]() | ![]() | Equality comparison. More... | |
![]() | ![]() | UBool | operator!= (const Formattable& other) const |
![]() | ![]() | virtual | ~Formattable () |
![]() | ![]() | Destructor. More... | |
![]() | ![]() | Type | getType (void) const |
![]() | ![]() | Gets the data type of this Formattable object. More... | |
![]() | ![]() | double | getDouble (void) const |
![]() | ![]() | Gets the double value of this object. More... | |
![]() | ![]() | int32_t | getLong (void) const |
![]() | ![]() | Gets the long value of this object. More... | |
![]() | ![]() | UDate | getDate (void) const |
![]() | ![]() | Gets the Date value of this object. More... | |
![]() | ![]() | UnicodeString& | getString (UnicodeString& result) const |
![]() | ![]() | Gets the string value of this object. More... | |
![]() | ![]() | const UnicodeString& | getString (void) const |
![]() | ![]() | Gets a const reference to the string value of this object. More... | |
![]() | ![]() | UnicodeString& | getString (void) |
![]() | ![]() | Gets a reference to the string value of this object. More... | |
![]() | ![]() | const Formattable* | getArray (int32_t& count) const |
![]() | ![]() | Gets the array value and count of this object. More... | |
![]() | ![]() | Formattable& | operator[] (int32_t index) |
![]() | ![]() | Accesses the specified element in the array value of this Formattable object. More... | |
![]() | ![]() | void | setDouble (double d) |
![]() | ![]() | Sets the double value of this object. More... | |
![]() | ![]() | void | setLong (int32_t l) |
![]() | ![]() | Sets the long value of this object. More... | |
![]() | ![]() | void | setDate (UDate d) |
![]() | ![]() | Sets the Date value of this object. More... | |
![]() | ![]() | void | setString (const UnicodeString& stringToCopy) |
![]() | ![]() | Sets the string value of this object. More... | |
![]() | ![]() | void | setArray (const Formattable* array, int32_t count) |
![]() | ![]() | Sets the array value and count of this object. More... | |
![]() | ![]() | void | adoptString (UnicodeString* stringToAdopt) |
![]() | ![]() | Sets and adopts the string value and count of this object. More... | |
![]() | ![]() | void | adoptArray (Formattable* array, int32_t count) |
![]() | ![]() | Sets and adopts the array value and count of this object. More... | |
![]() | ![]() | UnicodeString* | fString |
![]() | ![]() | double | fDouble |
![]() | ![]() | int32_t | fLong |
![]() | ![]() | UDate | fDate |
![]() | ![]() | Formattable* | fArray |
![]() | ![]() | int32_t | fCount |
![]() | ![]() | struct { | |
![]() | ![]() | Formattable* fArray | |
![]() | ![]() | int32_t fCount | |
![]() | ![]() | } | fArrayAndCount |
Formattable is a thin wrapper class which interconverts between the primitive numeric types (double, long, etc.) as well as UDate and UnicodeString.
Note that this is fundamentally different from the Java behavior, since in this case the various formattable objects do not occupy a hierarchy, but are all wrapped within this one class. Formattable encapsulates all the polymorphism in itself.
It would be easy to change this so that Formattable was an abstract base class of a genuine hierarchy, and that would clean up the code that currently must explicitly check for type, but that seems like overkill at this point.
Definition at line 38 of file fmtable.h.
enum Formattable::ISDATE |
This enum is only used to let callers distinguish between the Formattable(UDate) constructor and the Formattable(double) constructor; the compiler cannot distinguish the signatures, since UDate is currently typedefed to be either double or long.
If UDate is changed later to be a bonafide class or struct, then we no longer need this enum.
kIsDate |
enum Formattable::Type |
The list of possible data types of this Formattable object.
Formattable::Formattable () |
Formattable::Formattable (UDate d, ISDATE) |
Creates a Formattable object with a UDate instance.
d | the UDate instance. |
ISDATE | the flag to indicate this is a date. |
Formattable::Formattable (double d) |
Creates a Formattable object with a double number.
d | the double number. |
Formattable::Formattable (int32_t l) |
Creates a Formattable object with a long number.
d | the long number. |
Formattable::Formattable (const char * strToCopy) |
Creates a Formattable object with a char string pointer.
Assumes that the char string is null terminated.
strToCopy | the char string. |
Formattable::Formattable (const UnicodeString & stringToCopy) |
Creates a Formattable object with a UnicodeString object to copy from.
strToCopy | the UnicodeString string. |
Formattable::Formattable (UnicodeString * stringToAdopt) |
Creates a Formattable object with a UnicodeString object to adopt from.
strToAdopt | the UnicodeString string. |
Formattable::Formattable (const Formattable * arrayToCopy, int32_t count) |
Creates a Formattable object with an array of Formattable objects.
arrayToCopy | the Formattable object array. |
count | the array count. |
Formattable::Formattable (const Formattable &) |
Copy constructor.
Formattable & Formattable::operator= (const Formattable &) |
Assignment operator.
UBool Formattable::operator== (const Formattable &) const |
Equality comparison.
UBool Formattable::operator!= (const Formattable & other) const [inline]
|
virtual Formattable::~Formattable () [virtual]
|
Destructor.
Type Formattable::getType (void) const |
Gets the data type of this Formattable object.
double Formattable::getDouble (void) const [inline]
|
int32_t Formattable::getLong (void) const [inline]
|
UDate Formattable::getDate (void) const [inline]
|
UnicodeString & Formattable::getString (UnicodeString & result) const [inline]
|
const UnicodeString & Formattable::getString (void) const [inline]
|
Gets a const reference to the string value of this object.
UnicodeString & Formattable::getString (void) [inline]
|
Gets a reference to the string value of this object.
const Formattable * Formattable::getArray (int32_t & count) const [inline]
|
Formattable & Formattable::operator[] (int32_t index) [inline]
|
Accesses the specified element in the array value of this Formattable object.
index | the specified index. |
void Formattable::setDouble (double d) |
Sets the double value of this object.
void Formattable::setLong (int32_t l) |
Sets the long value of this object.
void Formattable::setDate (UDate d) |
Sets the Date value of this object.
void Formattable::setString (const UnicodeString & stringToCopy) |
Sets the string value of this object.
void Formattable::setArray (const Formattable * array, int32_t count) |
Sets the array value and count of this object.
void Formattable::adoptString (UnicodeString * stringToAdopt) |
Sets and adopts the string value and count of this object.
void Formattable::adoptArray (Formattable * array, int32_t count) |
Sets and adopts the array value and count of this object.
UnicodeString* Formattable::fString |
double Formattable::fDouble |
int32_t Formattable::fLong |
UDate Formattable::fDate |
Formattable* Formattable::fArray |
int32_t Formattable::fCount |
struct { ... } fArrayAndCount |