ICU-3783 restore getStaticClassID() to several classes from which it had been removed in error.

X-SVN-Rev: 15619
This commit is contained in:
Andy Heninger 2004-05-28 20:13:11 +00:00
parent c7f2a8b65a
commit e57f8ed178
10 changed files with 58 additions and 54 deletions

View file

@ -93,14 +93,14 @@ public:
*
* @stable ICU 2.2
*/
virtual UClassID getDynamicClassID() const = 0;
virtual UClassID getDynamicClassID() const;
/*
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @stable ICU 2.2
*/
/* static UClassID getStaticClassID() { return (UClassID)&fgClassID; }*/
static UClassID getStaticClassID();
protected:
@ -110,14 +110,6 @@ protected:
* @stable ICU 2.0
*/
/* UnicodeFilter();*/
private:
/*
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
/* static const char fgClassID;*/
};
/*inline UnicodeFilter::UnicodeFilter() {}*/

View file

@ -67,18 +67,13 @@ public:
*/
virtual UnicodeReplacer* toReplacer() const;
/*
/**
* Return the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID(). For example:
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
* . Derived::getStaticClassID()) ...
* </pre>
* comparing to a return value from getDynamicClassID().
* @return The class ID for all objects of this class.
* @stable ICU 2.0
*/
/*static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }*/
static UClassID getStaticClassID(void);
/**
* Returns a unique class ID <b>polymorphically</b>. This method
@ -86,24 +81,16 @@ public:
* compilers support genuine RTTI. Polymorphic operator==() and
* clone() methods call this method.
*
* <p>Concrete subclasses of UnicodeFunctor that wish clients to
* be able to identify them should implement getDynamicClassID()
* and also a static method and data member:
*
* <pre>
* static UClassID getStaticClassID() { return (UClassID)&fgClassID; }
* static char fgClassID;
* </pre>
*
* Subclasses that do not implement this method will have a
* dynamic class ID of UnicodeFunctor::getStatisClassID().
* <p>Concrete subclasses of UnicodeFunctor should use the macro
* UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to
* provide definitios getStaticClassID and getDynamicClassID.
*
* @return The class ID for this object. All objects of a given
* class have the same class ID. Objects of other classes have
* different class IDs.
* @stable ICU 2.4
*/
virtual UClassID getDynamicClassID(void) const = 0;
virtual UClassID getDynamicClassID(void) const;
/**
* Set the data object associated with this functor. The data
@ -124,13 +111,6 @@ protected:
*/
/*UnicodeFunctor();*/
private:
/*
* Class identifier for subclasses of UnicodeFunctor that do not
* define their class (anonymous subclasses).
*/
/*static const char fgClassID;*/
};
/*inline UnicodeFunctor::UnicodeFunctor() {}*/

View file

@ -12,6 +12,8 @@
#include "unicode/rep.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeFilter)
/* Define this here due to the lack of another file.
It can't be defined in the header */

View file

@ -9,6 +9,8 @@
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeFunctor)
UnicodeFunctor::~UnicodeFunctor() {}
UnicodeMatcher* UnicodeFunctor::toMatcher() const {

View file

@ -75,6 +75,7 @@ static const UChar gLastResortScientificPat[] = {
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NumberFormat)
// If the maximum base 10 exponent were 4, then the largest number would
// be 99,999 which has 5 digits.
const int32_t NumberFormat::fgMaxIntegerDigits = DBL_MAX_10_EXP + 1; // Should be ~40 ? --srl

View file

@ -372,6 +372,8 @@ TimeZone::getGMT(void)
// class TimeZone
// *****************************************************************************
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeZone)
TimeZone::TimeZone()
: UObject(), fID()
{

View file

@ -100,6 +100,8 @@ static const UChar EMPTY[] = {0}; //""
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Transliterator)
/**
* Return TRUE if the given UTransPosition is valid for text of
* the given length.

View file

@ -647,6 +647,16 @@ public:
public:
/**
* Return the class ID for this class. This is useful for
* comparing to a return value from getDynamicClassID(). Note that,
* because NumberFormat is an abstract base class, no fully constructed object
* will have the class ID returned by NumberFormat::getStaticClassID().
* @return The class ID for all objects of this class.
* @stable ICU 2.0
*/
static UClassID getStaticClassID(void);
/**
* Returns a unique class ID POLYMORPHICALLY. Pure virtual override.
* This method is to implement a simple version of RTTI, since not all
@ -658,7 +668,7 @@ public:
* other classes have different class IDs.
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
virtual UClassID getDynamicClassID(void) const;
protected:

View file

@ -575,21 +575,25 @@ public:
virtual TimeZone* clone(void) const = 0;
/**
* Returns a unique class ID POLYMORPHICALLY. Pure virtual method. This method is to
* Return the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID().
* @return The class ID for all objects of this class.
* @stable ICU 2.0
*/
static UClassID getStaticClassID(void);
/**
* Returns a unique class ID POLYMORPHICALLY. This method is to
* implement a simple version of RTTI, since not all C++ compilers support genuine
* RTTI. Polymorphic operator==() and clone() methods call this method.
* <P>
* Concrete subclasses of TimeZone must implement getDynamicClassID() and also a
* static method and data member:
* <pre>
* . static UClassID getStaticClassID() { return (UClassID)&fgClassID; }
* . static char fgClassID;
* </pre>
* Concrete subclasses of TimeZone must use the UOBJECT_DEFINE_RTTI_IMPLEMENTATION
* macro from uobject.h in their implementation to provide correct RTTI information.
* @return The class ID for this object. All objects of a given class have the
* same class ID. Objects of other classes have different class IDs.
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
virtual UClassID getDynamicClassID(void) const;
protected:

View file

@ -1208,25 +1208,34 @@ protected:
public:
/**
* Return the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID().
* Note that Transliterator is an abstract base class, and therefor
* no fully constructed object will have a dynamic
* UCLassID that equals the UClassID returned from
* TRansliterator::getStaticClassID().
* @return The class ID for class Transliterator.
* @stable ICU 2.0
*/
static UClassID getStaticClassID(void);
/**
* Returns a unique class ID <b>polymorphically</b>. This method
* is to implement a simple version of RTTI, since not all C++
* compilers support genuine RTTI. Polymorphic operator==() and
* clone() methods call this method.
*
* <p>Concrete subclasses of Transliterator that wish clients to
* be able to identify them should implement getDynamicClassID()
* and also a static method and data member:
*
* Subclasses that do not implement this method will have a
* dynamic class ID of Transliterator::getStatisClassID().
* <p>Concrete subclasses of Transliterator must use the
* UOBJECT_DEFINE_RTTI_IMPLEMENTATION macro from
* uobject.h to provide the RTTI functions.
*
* @return The class ID for this object. All objects of a given
* class have the same class ID. Objects of other classes have
* different class IDs.
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
virtual UClassID getDynamicClassID(void) const;
private:
static UBool initializeRegistry(void);