ICU-3221 Fix the AIX linker warning about multiple definitions of virtual functions.

X-SVN-Rev: 12958
This commit is contained in:
George Rhoten 2003-08-27 01:01:42 +00:00
parent f96aa0a84a
commit 4d18bb2b4f
43 changed files with 667 additions and 848 deletions

View file

@ -80,7 +80,7 @@ U_NAMESPACE_BEGIN
// TODO: add boilerplate methods.
const char CanonicalIterator::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CanonicalIterator)
/**
*@param source string to get results for

View file

@ -9,6 +9,9 @@
U_NAMESPACE_BEGIN
ForwardCharacterIterator::~ForwardCharacterIterator() {}
CharacterIterator::CharacterIterator()
: textLength(0), pos(0), begin(0), end(0) {
}

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1999-2001 IBM Corp. All rights reserved.
* Copyright (C) 1999-2003 IBM Corp. All rights reserved.
**********************************************************************
* Date Name Description
* 12/1/99 rgillam Complete port from Java.
@ -20,14 +20,14 @@
U_NAMESPACE_BEGIN
const char DictionaryBasedBreakIterator::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DictionaryBasedBreakIterator)
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// constructors
//
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
DictionaryBasedBreakIterator::DictionaryBasedBreakIterator() :
RuleBasedBreakIterator() {
@ -70,11 +70,11 @@ RuleBasedBreakIterator(other)
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Destructor
//
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
DictionaryBasedBreakIterator::~DictionaryBasedBreakIterator()
{
uprv_free(cachedBreakPositions);
@ -82,12 +82,12 @@ DictionaryBasedBreakIterator::~DictionaryBasedBreakIterator()
if (fTables != NULL) {fTables->removeReference();};
}
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Assignment operator. Sets this iterator to have the same behavior,
// and iterate over the same text, as the one passed in.
//
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
DictionaryBasedBreakIterator&
DictionaryBasedBreakIterator::operator=(const DictionaryBasedBreakIterator& that) {
if (this == &that) {
@ -103,12 +103,12 @@ DictionaryBasedBreakIterator::operator=(const DictionaryBasedBreakIterator& that
return *this;
}
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Clone() Returns a newly-constructed RuleBasedBreakIterator with the same
// behavior, and iterating over the same text, as this one.
//
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
BreakIterator*
DictionaryBasedBreakIterator::clone() const {
return new DictionaryBasedBreakIterator(*this);
@ -292,11 +292,11 @@ DictionaryBasedBreakIterator::reset()
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// init() Common initialization routine, for use by constructors, etc.
//
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void DictionaryBasedBreakIterator::init() {
cachedBreakPositions = NULL;
fTables = NULL;
@ -306,11 +306,11 @@ void DictionaryBasedBreakIterator::init() {
}
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// BufferClone
//
//-------------------------------------------------------------------------------
//------------------------------------------------------------------------------
BreakIterator * DictionaryBasedBreakIterator::createBufferClone(void *stackBuffer,
int32_t &bufferSize,
UErrorCode &status)

View file

@ -293,7 +293,7 @@ LocaleKey::debugClass(UnicodeString& result) const
}
#endif
const char LocaleKey::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocaleKey)
/*
******************************************************************
@ -409,7 +409,7 @@ LocaleKeyFactory::debugClass(UnicodeString& result) const
}
#endif
const char LocaleKeyFactory::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocaleKeyFactory)
/*
******************************************************************
@ -497,7 +497,7 @@ SimpleLocaleKeyFactory::debugClass(UnicodeString& result) const
}
#endif
const char SimpleLocaleKeyFactory::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleLocaleKeyFactory)
/*
******************************************************************
@ -549,7 +549,7 @@ ICUResourceBundleFactory::debugClass(UnicodeString& result) const
}
#endif
const char ICUResourceBundleFactory::fgClassID = '\0';
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUResourceBundleFactory)
/*
******************************************************************
@ -806,13 +806,11 @@ public:
}
public:
virtual UClassID getDynamicClassID(void) const { return getStaticClassID(); }
static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
private:
static const char fgClassID;
static UClassID getStaticClassID(void);
virtual UClassID getDynamicClassID(void) const;
};
const char ServiceEnumeration::fgClassID = '\0';
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceEnumeration)
StringEnumeration*
ICULocaleService::getAvailableLocales(void) const

View file

@ -157,13 +157,9 @@ class U_COMMON_API LocaleKey : public ICUServiceKey {
/**
* UObject boilerplate.
*/
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
static UClassID getStaticClassID();
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
#ifdef SERVICE_DEBUG
public:
@ -171,8 +167,6 @@ class U_COMMON_API LocaleKey : public ICUServiceKey {
virtual UnicodeString& debugClass(UnicodeString& result) const;
#endif
private:
static const char fgClassID;
};
/*
@ -274,17 +268,13 @@ protected:
*/
virtual const Hashtable* getSupportedIDs(UErrorCode& status) const;
public:
public:
/**
* UObject boilerplate.
*/
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
static UClassID getStaticClassID();
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
#ifdef SERVICE_DEBUG
public:
@ -292,8 +282,6 @@ protected:
virtual UnicodeString& debugClass(UnicodeString& result) const;
#endif
private:
static const char fgClassID;
};
/*
@ -344,17 +332,13 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory {
virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const;
public:
public:
/**
* UObject boilerplate.
*/
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
static UClassID getStaticClassID();
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
#ifdef SERVICE_DEBUG
public:
@ -362,8 +346,6 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory {
virtual UnicodeString& debugClass(UnicodeString& result) const;
#endif
private:
static const char fgClassID;
};
/*
@ -406,17 +388,13 @@ protected:
*/
virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const;
public:
public:
/**
* UObject boilerplate.
*/
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
static UClassID getStaticClassID();
virtual UClassID getDynamicClassID() const;
static UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
#ifdef SERVICE_DEBUG
public:
@ -424,8 +402,6 @@ protected:
virtual UnicodeString& debugClass(UnicodeString& result) const;
#endif
private:
static const char fgClassID;
};
/*

View file

@ -10,11 +10,30 @@
#if !UCONFIG_NO_SERVICE
#include "icunotif.h"
#if DEBUG
#include <stdio.h>
#endif
U_NAMESPACE_BEGIN
const char EventListener::fgClassID = '\0';
EventListener::~EventListener() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
ICUNotifier::ICUNotifier(void)
: notifyLock(0), listeners(NULL)
{
umtx_init(&notifyLock);
}
ICUNotifier::~ICUNotifier(void) {
{
Mutex lmx(&notifyLock);
delete listeners;
listeners = NULL;
}
umtx_destroy(&notifyLock);
}
void
ICUNotifier::addListener(const EventListener* l, UErrorCode& status)

View file

@ -32,19 +32,16 @@ U_NAMESPACE_END
U_NAMESPACE_BEGIN
class U_COMMON_API EventListener : public UObject {
public:
virtual ~EventListener() {}
public:
virtual ~EventListener();
public:
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
public:
static UClassID getStaticClassID();
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
public:
public:
#ifdef SERVICE_DEBUG
virtual UnicodeString& debug(UnicodeString& result) const {
return debugClass(result);
}
@ -52,9 +49,7 @@ class U_COMMON_API EventListener : public UObject {
virtual UnicodeString& debugClass(UnicodeString& result) const {
return result.append("Key");
}
private:
static const char fgClassID;
#endif
};
/**
@ -75,60 +70,49 @@ class U_COMMON_API EventListener : public UObject {
*/
class U_COMMON_API ICUNotifier : public UMemory {
private: UMTX notifyLock;
private: UVector* listeners;
public:
ICUNotifier(void)
: notifyLock(0), listeners(NULL)
{
umtx_init(&notifyLock);
}
virtual ~ICUNotifier(void) {
{
Mutex lmx(&notifyLock);
delete listeners;
listeners = NULL;
}
umtx_destroy(&notifyLock);
}
/**
* Add a listener to be notified when notifyChanged is called.
* The listener must not be null. AcceptsListener must return
* true for the listener. Attempts to concurrently
* register the identical listener more than once will be
* silently ignored.
*/
virtual void addListener(const EventListener* l, UErrorCode& status);
/**
* Stop notifying this listener. The listener must
* not be null. Attemps to remove a listener that is
* not registered will be silently ignored.
*/
virtual void removeListener(const EventListener* l, UErrorCode& status);
/**
* ICU doesn't spawn its own threads. All listeners are notified in
* the thread of the caller. Misbehaved listeners can therefore
* indefinitely block the calling thread. Callers should beware of
* deadlock situations.
*/
virtual void notifyChanged(void);
protected:
/**
* Subclasses implement this to return TRUE if the listener is
* of the appropriate type.
*/
virtual UBool acceptsListener(const EventListener& l) const = 0;
/**
* Subclasses implement this to notify the listener.
*/
virtual void notifyListener(EventListener& l) const = 0;
private: UMTX notifyLock;
private: UVector* listeners;
public:
ICUNotifier(void);
virtual ~ICUNotifier(void);
/**
* Add a listener to be notified when notifyChanged is called.
* The listener must not be null. AcceptsListener must return
* true for the listener. Attempts to concurrently
* register the identical listener more than once will be
* silently ignored.
*/
virtual void addListener(const EventListener* l, UErrorCode& status);
/**
* Stop notifying this listener. The listener must
* not be null. Attemps to remove a listener that is
* not registered will be silently ignored.
*/
virtual void removeListener(const EventListener* l, UErrorCode& status);
/**
* ICU doesn't spawn its own threads. All listeners are notified in
* the thread of the caller. Misbehaved listeners can therefore
* indefinitely block the calling thread. Callers should beware of
* deadlock situations.
*/
virtual void notifyChanged(void);
protected:
/**
* Subclasses implement this to return TRUE if the listener is
* of the appropriate type.
*/
virtual UBool acceptsListener(const EventListener& l) const = 0;
/**
* Subclasses implement this to notify the listener.
*/
virtual void notifyListener(EventListener& l) const = 0;
};
U_NAMESPACE_END

View file

@ -343,7 +343,7 @@ ICUServiceKey::debugClass(UnicodeString& result) const
}
#endif
const char ICUServiceKey::fgClassID = '\0';
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUServiceKey)
/*
******************************************************************
@ -411,13 +411,13 @@ SimpleFactory::debugClass(UnicodeString& toAppendTo) const
}
#endif
const char SimpleFactory::fgClassID = '\0';
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleFactory)
/*
******************************************************************
*/
const char ServiceListener::fgClassID = '\0';
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceListener)
/*
******************************************************************

View file

@ -183,20 +183,16 @@ class U_COMMON_API ICUServiceKey : public UObject {
*/
static UnicodeString& parseSuffix(UnicodeString& result);
public:
public:
/**
* UObject RTTI boilerplate.
*/
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
static UClassID getStaticClassID();
/**
* UObject RTTI boilerplate.
*/
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
#ifdef SERVICE_DEBUG
public:
@ -204,8 +200,6 @@ class U_COMMON_API ICUServiceKey : public UObject {
virtual UnicodeString& debugClass(UnicodeString& result) const;
#endif
private:
static const char fgClassID;
};
/*******************************************************************
@ -347,16 +341,12 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
/**
* UObject RTTI boilerplate.
*/
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
static UClassID getStaticClassID();
/**
* UObject RTTI boilerplate.
*/
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
#ifdef SERVICE_DEBUG
public:
@ -364,8 +354,6 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
virtual UnicodeString& debugClass(UnicodeString& toAppendTo) const;
#endif
private:
static const char fgClassID;
};
/*
@ -394,19 +382,13 @@ public:
/**
* UObject RTTI boilerplate.
*/
static inline UClassID getStaticClassID() {
return (UClassID)&fgClassID;
}
static UClassID getStaticClassID();
/**
* UObject RTTI boilerplate.
*/
virtual UClassID getDynamicClassID() const {
return getStaticClassID();
}
virtual UClassID getDynamicClassID() const;
private:
static const char fgClassID;
};
/*

View file

@ -109,7 +109,7 @@ locale_cleanup(void)
}
U_NAMESPACE_BEGIN
const char Locale::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Locale)
//
// locale_set_default_internal.

View file

@ -21,7 +21,7 @@
U_NAMESPACE_BEGIN
const char Normalizer::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Normalizer)
//-------------------------------------------------------------------------
// Constructors and other boilerplate

View file

@ -1,14 +1,14 @@
//
// file: rbbi.c Contains the implementation of the rule based break iterator
// runtime engine and the API implementation for
// class RuleBasedBreakIterator
//
/*
***************************************************************************
* Copyright (C) 1999-2003 International Business Machines Corporation *
* and others. All rights reserved. *
***************************************************************************
*/
//
// file: rbbi.c Contains the implementation of the rule based break iterator
// runtime engine and the API implementation for
// class RuleBasedBreakIterator
//
#include "unicode/utypes.h"
@ -31,11 +31,8 @@ U_NAMESPACE_BEGIN
static const int16_t START_STATE = 1; // The state number of the starting state
static const int16_t STOP_STATE = 0; // The state-transition value indicating "stop"
/**
* Class ID. (value is irrelevant; address is important)
*/
const char
RuleBasedBreakIterator::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedBreakIterator)
//=======================================================================

View file

@ -167,7 +167,7 @@ U_NAMESPACE_BEGIN
*/
//-----------------------------------------------------------------------------
const char ResourceBundle::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ResourceBundle)
ResourceBundle::ResourceBundle( const UnicodeString& path,
const Locale& locale,

View file

@ -18,7 +18,7 @@
U_NAMESPACE_BEGIN
const char StringCharacterIterator::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringCharacterIterator)
StringCharacterIterator::StringCharacterIterator()
: UCharCharacterIterator(),

View file

@ -11,7 +11,7 @@
U_NAMESPACE_BEGIN
const char UCharCharacterIterator::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UCharCharacterIterator)
UCharCharacterIterator::UCharCharacterIterator()
: CharacterIterator(),

View file

@ -120,19 +120,19 @@ public:
*/
static void permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
private:
// ===================== PRIVATES ==============================
@ -187,21 +187,8 @@ private:
void cleanPieces();
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
inline UClassID
CanonicalIterator::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
CanonicalIterator::getDynamicClassID() const
{ return CanonicalIterator::getStaticClassID(); }
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_NORMALIZATION */

View file

@ -84,100 +84,100 @@ U_NAMESPACE_BEGIN
*/
class U_COMMON_API ForwardCharacterIterator : public UObject {
public:
/**
* Value returned by most of ForwardCharacterIterator's functions
* when the iterator has reached the limits of its iteration.
* @stable ICU 2.0
*/
enum { DONE = 0xffff };
/**
* Destructor.
* @stable ICU 2.0
*/
virtual ~ForwardCharacterIterator() {}
/**
* Returns true when both iterators refer to the same
* character in the same character-storage object.
* @param that The ForwardCharacterIterator to be compared for equality
* @return true when both iterators refer to the same
* character in the same character-storage object
* @stable ICU 2.0
*/
virtual UBool operator==(const ForwardCharacterIterator& that) const = 0;
/**
* Returns true when the iterators refer to different
* text-storage objects, or to different characters in the
* same text-storage object.
* @param that The ForwardCharacterIterator to be compared for inequality
* @Returns true when the iterators refer to different
* text-storage objects, or to different characters in the
* same text-storage object
* @stable ICU 2.0
*/
inline UBool operator!=(const ForwardCharacterIterator& that) const;
/**
* Generates a hash code for this iterator.
* @return the hash code.
* @stable ICU 2.0
*/
virtual int32_t hashCode(void) const = 0;
/**
* Returns a UClassID for this ForwardCharacterIterator ("poor man's
* RTTI").<P> Despite the fact that this function is public,
* DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
* @Returns a UClassID for this ForwardCharacterIterator
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
/**
* Gets the current code unit for returning and advances to the next code unit
* in the iteration range
* (toward endIndex()). If there are
* no more code units to return, returns DONE.
* @return the current code unit.
* @stable ICU 2.0
*/
virtual UChar nextPostInc(void) = 0;
/**
* Gets the current code point for returning and advances to the next code point
* in the iteration range
* (toward endIndex()). If there are
* no more code points to return, returns DONE.
* @return the current code point.
* @stable ICU 2.0
*/
virtual UChar32 next32PostInc(void) = 0;
/**
* Returns FALSE if there are no more code units or code points
* at or after the current position in the iteration range.
* This is used with nextPostInc() or next32PostInc() in forward
* iteration.
* @returns FALSE if there are no more code units or code points
* at or after the current position in the iteration range.
* @stable ICU 2.0
*/
virtual UBool hasNext() = 0;
/**
* Value returned by most of ForwardCharacterIterator's functions
* when the iterator has reached the limits of its iteration.
* @stable ICU 2.0
*/
enum { DONE = 0xffff };
/**
* Destructor.
* @stable ICU 2.0
*/
virtual ~ForwardCharacterIterator();
/**
* Returns true when both iterators refer to the same
* character in the same character-storage object.
* @param that The ForwardCharacterIterator to be compared for equality
* @return true when both iterators refer to the same
* character in the same character-storage object
* @stable ICU 2.0
*/
virtual UBool operator==(const ForwardCharacterIterator& that) const = 0;
/**
* Returns true when the iterators refer to different
* text-storage objects, or to different characters in the
* same text-storage object.
* @param that The ForwardCharacterIterator to be compared for inequality
* @Returns true when the iterators refer to different
* text-storage objects, or to different characters in the
* same text-storage object
* @stable ICU 2.0
*/
inline UBool operator!=(const ForwardCharacterIterator& that) const;
/**
* Generates a hash code for this iterator.
* @return the hash code.
* @stable ICU 2.0
*/
virtual int32_t hashCode(void) const = 0;
/**
* Returns a UClassID for this ForwardCharacterIterator ("poor man's
* RTTI").<P> Despite the fact that this function is public,
* DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
* @Returns a UClassID for this ForwardCharacterIterator
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
/**
* Gets the current code unit for returning and advances to the next code unit
* in the iteration range
* (toward endIndex()). If there are
* no more code units to return, returns DONE.
* @return the current code unit.
* @stable ICU 2.0
*/
virtual UChar nextPostInc(void) = 0;
/**
* Gets the current code point for returning and advances to the next code point
* in the iteration range
* (toward endIndex()). If there are
* no more code points to return, returns DONE.
* @return the current code point.
* @stable ICU 2.0
*/
virtual UChar32 next32PostInc(void) = 0;
/**
* Returns FALSE if there are no more code units or code points
* at or after the current position in the iteration range.
* This is used with nextPostInc() or next32PostInc() in forward
* iteration.
* @returns FALSE if there are no more code units or code points
* at or after the current position in the iteration range.
* @stable ICU 2.0
*/
virtual UBool hasNext() = 0;
protected:
/** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/
ForwardCharacterIterator() : UObject() {}
/** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/
ForwardCharacterIterator(const ForwardCharacterIterator &other) : UObject(other) {}
/**
* Assignment operator to be overridden in the implementing class.
* @stable ICU 2.0
*/
ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; }
/** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/
ForwardCharacterIterator() : UObject() {}
/** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/
ForwardCharacterIterator(const ForwardCharacterIterator &other) : UObject(other) {}
/**
* Assignment operator to be overridden in the implementing class.
* @stable ICU 2.0
*/
ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; }
};
/**
@ -351,361 +351,361 @@ protected:
*/
class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
public:
/**
* Origin enumeration for the move() and move32() functions.
* @stable ICU 2.0
*/
enum EOrigin { kStart, kCurrent, kEnd };
/**
* Origin enumeration for the move() and move32() functions.
* @stable ICU 2.0
*/
enum EOrigin { kStart, kCurrent, kEnd };
/**
* Returns a pointer to a new CharacterIterator of the same
* concrete class as this one, and referring to the same
* character in the same text-storage object as this one. The
* caller is responsible for deleting the new clone.
* @return a pointer to a new CharacterIterator
* @stable ICU 2.0
*/
virtual CharacterIterator* clone(void) const = 0;
/**
* Returns a pointer to a new CharacterIterator of the same
* concrete class as this one, and referring to the same
* character in the same text-storage object as this one. The
* caller is responsible for deleting the new clone.
* @return a pointer to a new CharacterIterator
* @stable ICU 2.0
*/
virtual CharacterIterator* clone(void) const = 0;
/**
* Sets the iterator to refer to the first code unit in its
* iteration range, and returns that code unit.
* This can be used to begin an iteration with next().
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
virtual UChar first(void) = 0;
/**
* Sets the iterator to refer to the first code unit in its
* iteration range, and returns that code unit.
* This can be used to begin an iteration with next().
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
virtual UChar first(void) = 0;
/**
* Sets the iterator to refer to the first code unit in its
* iteration range, returns that code unit, and moves the position
* to the second code unit. This is an alternative to setToStart()
* for forward iteration with nextPostInc().
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
virtual UChar firstPostInc(void);
/**
* Sets the iterator to refer to the first code unit in its
* iteration range, returns that code unit, and moves the position
* to the second code unit. This is an alternative to setToStart()
* for forward iteration with nextPostInc().
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
virtual UChar firstPostInc(void);
/**
* Sets the iterator to refer to the first code point in its
* iteration range, and returns that code unit,
* This can be used to begin an iteration with next32().
* Note that an iteration with next32PostInc(), beginning with,
* e.g., setToStart() or firstPostInc(), is more efficient.
* @return the first code point in its iteration range.
* @stable ICU 2.0
*/
virtual UChar32 first32(void) = 0;
/**
* Sets the iterator to refer to the first code point in its
* iteration range, and returns that code unit,
* This can be used to begin an iteration with next32().
* Note that an iteration with next32PostInc(), beginning with,
* e.g., setToStart() or firstPostInc(), is more efficient.
* @return the first code point in its iteration range.
* @stable ICU 2.0
*/
virtual UChar32 first32(void) = 0;
/**
* Sets the iterator to refer to the first code point in its
* iteration range, returns that code point, and moves the position
* to the second code point. This is an alternative to setToStart()
* for forward iteration with next32PostInc().
* @return the first code point in its iteration range.
* @stable ICU 2.0
*/
virtual UChar32 first32PostInc(void);
/**
* Sets the iterator to refer to the first code point in its
* iteration range, returns that code point, and moves the position
* to the second code point. This is an alternative to setToStart()
* for forward iteration with next32PostInc().
* @return the first code point in its iteration range.
* @stable ICU 2.0
*/
virtual UChar32 first32PostInc(void);
/**
* Sets the iterator to refer to the first code unit or code point in its
* iteration range. This can be used to begin a forward
* iteration with nextPostInc() or next32PostInc().
* @return the start position of the iteration range
* @stable ICU 2.0
*/
inline int32_t setToStart();
/**
* Sets the iterator to refer to the first code unit or code point in its
* iteration range. This can be used to begin a forward
* iteration with nextPostInc() or next32PostInc().
* @return the start position of the iteration range
* @stable ICU 2.0
*/
inline int32_t setToStart();
/**
* Sets the iterator to refer to the last code unit in its
* iteration range, and returns that code unit.
* This can be used to begin an iteration with previous().
* @return the last code unit.
* @stable ICU 2.0
*/
virtual UChar last(void) = 0;
/**
* Sets the iterator to refer to the last code unit in its
* iteration range, and returns that code unit.
* This can be used to begin an iteration with previous().
* @return the last code unit.
* @stable ICU 2.0
*/
virtual UChar last(void) = 0;
/**
* Sets the iterator to refer to the last code point in its
* iteration range, and returns that code unit.
* This can be used to begin an iteration with previous32().
* @return the last code point.
* @stable ICU 2.0
*/
virtual UChar32 last32(void) = 0;
/**
* Sets the iterator to refer to the last code point in its
* iteration range, and returns that code unit.
* This can be used to begin an iteration with previous32().
* @return the last code point.
* @stable ICU 2.0
*/
virtual UChar32 last32(void) = 0;
/**
* Sets the iterator to the end of its iteration range, just behind
* the last code unit or code point. This can be used to begin a backward
* iteration with previous() or previous32().
* @return the end position of the iteration range
* @stable ICU 2.0
*/
inline int32_t setToEnd();
/**
* Sets the iterator to the end of its iteration range, just behind
* the last code unit or code point. This can be used to begin a backward
* iteration with previous() or previous32().
* @return the end position of the iteration range
* @stable ICU 2.0
*/
inline int32_t setToEnd();
/**
* Sets the iterator to refer to the "position"-th code unit
* in the text-storage object the iterator refers to, and
* returns that code unit.
* @param position the "position"-th code unit in the text-storage object
* @return the "position"-th code unit.
* @stable ICU 2.0
*/
virtual UChar setIndex(int32_t position) = 0;
/**
* Sets the iterator to refer to the "position"-th code unit
* in the text-storage object the iterator refers to, and
* returns that code unit.
* @param position the "position"-th code unit in the text-storage object
* @return the "position"-th code unit.
* @stable ICU 2.0
*/
virtual UChar setIndex(int32_t position) = 0;
/**
* Sets the iterator to refer to the beginning of the code point
* that contains the "position"-th code unit
* in the text-storage object the iterator refers to, and
* returns that code point.
* The current position is adjusted to the beginning of the code point
* (its first code unit).
* @param position the "position"-th code unit in the text-storage object
* @return the "position"-th code point.
* @stable ICU 2.0
*/
virtual UChar32 setIndex32(int32_t position) = 0;
/**
* Sets the iterator to refer to the beginning of the code point
* that contains the "position"-th code unit
* in the text-storage object the iterator refers to, and
* returns that code point.
* The current position is adjusted to the beginning of the code point
* (its first code unit).
* @param position the "position"-th code unit in the text-storage object
* @return the "position"-th code point.
* @stable ICU 2.0
*/
virtual UChar32 setIndex32(int32_t position) = 0;
/**
* Returns the code unit the iterator currently refers to.
* @return the current code unit.
* @stable ICU 2.0
*/
virtual UChar current(void) const = 0;
/**
* Returns the code unit the iterator currently refers to.
* @return the current code unit.
* @stable ICU 2.0
*/
virtual UChar current(void) const = 0;
/**
* Returns the code point the iterator currently refers to.
* @return the current code point.
* @stable ICU 2.0
*/
virtual UChar32 current32(void) const = 0;
/**
* Returns the code point the iterator currently refers to.
* @return the current code point.
* @stable ICU 2.0
*/
virtual UChar32 current32(void) const = 0;
/**
* Advances to the next code unit in the iteration range
* (toward endIndex()), and returns that code unit. If there are
* no more code units to return, returns DONE.
* @return the next code unit.
* @stable ICU 2.0
*/
virtual UChar next(void) = 0;
/**
* Advances to the next code unit in the iteration range
* (toward endIndex()), and returns that code unit. If there are
* no more code units to return, returns DONE.
* @return the next code unit.
* @stable ICU 2.0
*/
virtual UChar next(void) = 0;
/**
* Advances to the next code point in the iteration range
* (toward endIndex()), and returns that code point. If there are
* no more code points to return, returns DONE.
* Note that iteration with "pre-increment" semantics is less
* efficient than iteration with "post-increment" semantics
* that is provided by next32PostInc().
* @return the next code point.
* @stable ICU 2.0
*/
virtual UChar32 next32(void) = 0;
/**
* Advances to the next code point in the iteration range
* (toward endIndex()), and returns that code point. If there are
* no more code points to return, returns DONE.
* Note that iteration with "pre-increment" semantics is less
* efficient than iteration with "post-increment" semantics
* that is provided by next32PostInc().
* @return the next code point.
* @stable ICU 2.0
*/
virtual UChar32 next32(void) = 0;
/**
* Advances to the previous code unit in the iteration range
* (toward startIndex()), and returns that code unit. If there are
* no more code units to return, returns DONE.
* @return the previous code unit.
* @stable ICU 2.0
*/
virtual UChar previous(void) = 0;
/**
* Advances to the previous code unit in the iteration range
* (toward startIndex()), and returns that code unit. If there are
* no more code units to return, returns DONE.
* @return the previous code unit.
* @stable ICU 2.0
*/
virtual UChar previous(void) = 0;
/**
* Advances to the previous code point in the iteration range
* (toward startIndex()), and returns that code point. If there are
* no more code points to return, returns DONE.
* @return the previous code point.
* @stable ICU 2.0
*/
virtual UChar32 previous32(void) = 0;
/**
* Advances to the previous code point in the iteration range
* (toward startIndex()), and returns that code point. If there are
* no more code points to return, returns DONE.
* @return the previous code point.
* @stable ICU 2.0
*/
virtual UChar32 previous32(void) = 0;
/**
* Returns FALSE if there are no more code units or code points
* before the current position in the iteration range.
* This is used with previous() or previous32() in backward
* iteration.
* @return FALSE if there are no more code units or code points
* before the current position in the iteration range, return TRUE otherwise.
* @stable ICU 2.0
*/
virtual UBool hasPrevious() = 0;
/**
* Returns FALSE if there are no more code units or code points
* before the current position in the iteration range.
* This is used with previous() or previous32() in backward
* iteration.
* @return FALSE if there are no more code units or code points
* before the current position in the iteration range, return TRUE otherwise.
* @stable ICU 2.0
*/
virtual UBool hasPrevious() = 0;
/**
* Returns the numeric index in the underlying text-storage
* object of the character returned by first(). Since it's
* possible to create an iterator that iterates across only
* part of a text-storage object, this number isn't
* necessarily 0.
* @returns the numeric index in the underlying text-storage
* object of the character returned by first().
* @stable ICU 2.0
*/
inline int32_t startIndex(void) const;
/**
* Returns the numeric index in the underlying text-storage
* object of the character returned by first(). Since it's
* possible to create an iterator that iterates across only
* part of a text-storage object, this number isn't
* necessarily 0.
* @returns the numeric index in the underlying text-storage
* object of the character returned by first().
* @stable ICU 2.0
*/
inline int32_t startIndex(void) const;
/**
* Returns the numeric index in the underlying text-storage
* object of the position immediately BEYOND the character
* returned by last().
* @return the numeric index in the underlying text-storage
* object of the position immediately BEYOND the character
* returned by last().
* @stable ICU 2.0
*/
inline int32_t endIndex(void) const;
/**
* Returns the numeric index in the underlying text-storage
* object of the position immediately BEYOND the character
* returned by last().
* @return the numeric index in the underlying text-storage
* object of the position immediately BEYOND the character
* returned by last().
* @stable ICU 2.0
*/
inline int32_t endIndex(void) const;
/**
* Returns the numeric index in the underlying text-storage
* object of the character the iterator currently refers to
* (i.e., the character returned by current()).
* @return the numberic index in the text-storage object of
* the character the iterator currently refers to
* @stable ICU 2.0
*/
inline int32_t getIndex(void) const;
/**
* Returns the numeric index in the underlying text-storage
* object of the character the iterator currently refers to
* (i.e., the character returned by current()).
* @return the numberic index in the text-storage object of
* the character the iterator currently refers to
* @stable ICU 2.0
*/
inline int32_t getIndex(void) const;
/**
* Returns the length of the entire text in the underlying
* text-storage object.
* @return the length of the entire text in the text-storage object
* @stable ICU 2.0
*/
inline int32_t getLength() const;
/**
* Returns the length of the entire text in the underlying
* text-storage object.
* @return the length of the entire text in the text-storage object
* @stable ICU 2.0
*/
inline int32_t getLength() const;
/**
* Moves the current position relative to the start or end of the
* iteration range, or relative to the current position itself.
* The movement is expressed in numbers of code units forward
* or backward by specifying a positive or negative delta.
* @delta the position relative to origin. A positive delta means forward;
* a negative delta means backward.
* @origin Origin enumeration {kStart, kCurrent, kEnd}
* @return the new position
* @stable ICU 2.0
*/
virtual int32_t move(int32_t delta, EOrigin origin) = 0;
/**
* Moves the current position relative to the start or end of the
* iteration range, or relative to the current position itself.
* The movement is expressed in numbers of code units forward
* or backward by specifying a positive or negative delta.
* @delta the position relative to origin. A positive delta means forward;
* a negative delta means backward.
* @origin Origin enumeration {kStart, kCurrent, kEnd}
* @return the new position
* @stable ICU 2.0
*/
virtual int32_t move(int32_t delta, EOrigin origin) = 0;
/**
* Moves the current position relative to the start or end of the
* iteration range, or relative to the current position itself.
* The movement is expressed in numbers of code points forward
* or backward by specifying a positive or negative delta.
* @delta the position relative to origin. A positive delta means forward;
* a negative delta means backward.
* @origin Origin enumeration {kStart, kCurrent, kEnd}
* @return the new position
* @stable ICU 2.0
*/
virtual int32_t move32(int32_t delta, EOrigin origin) = 0;
/**
* Moves the current position relative to the start or end of the
* iteration range, or relative to the current position itself.
* The movement is expressed in numbers of code points forward
* or backward by specifying a positive or negative delta.
* @delta the position relative to origin. A positive delta means forward;
* a negative delta means backward.
* @origin Origin enumeration {kStart, kCurrent, kEnd}
* @return the new position
* @stable ICU 2.0
*/
virtual int32_t move32(int32_t delta, EOrigin origin) = 0;
/**
* Copies the text under iteration into the UnicodeString
* referred to by "result".
* @param result Receives a copy of the text under iteration.
* @stable ICU 2.0
*/
virtual void getText(UnicodeString& result) = 0;
/**
* Copies the text under iteration into the UnicodeString
* referred to by "result".
* @param result Receives a copy of the text under iteration.
* @stable ICU 2.0
*/
virtual void getText(UnicodeString& result) = 0;
protected:
/**
* Empty constructor.
* @stable ICU 2.0
*/
CharacterIterator();
/**
* Empty constructor.
* @stable ICU 2.0
*/
CharacterIterator();
/**
* Constructor, just setting the length field in this base class.
* @stable ICU 2.0
*/
CharacterIterator(int32_t length);
/**
* Constructor, just setting the length field in this base class.
* @stable ICU 2.0
*/
CharacterIterator(int32_t length);
/**
* Constructor, just setting the length and position fields in this base class.
* @stable ICU 2.0
*/
CharacterIterator(int32_t length, int32_t position);
/**
* Constructor, just setting the length and position fields in this base class.
* @stable ICU 2.0
*/
CharacterIterator(int32_t length, int32_t position);
/**
* Constructor, just setting the length, start, end, and position fields in this base class.
* @stable ICU 2.0
*/
CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
/**
* Constructor, just setting the length, start, end, and position fields in this base class.
* @stable ICU 2.0
*/
CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
/**
* Copy constructor.
*
* @param that The CharacterIterator to be copied
* @stable ICU 2.0
*/
CharacterIterator(const CharacterIterator &that);
/**
* Copy constructor.
*
* @param that The CharacterIterator to be copied
* @stable ICU 2.0
*/
CharacterIterator(const CharacterIterator &that);
/**
* Assignment operator. Sets this CharacterIterator to have the same behavior,
* as the one passed in.
* @param that The CharacterIterator passed in.
* @return the newly set CharacterIterator.
* @stable ICU 2.0
*/
CharacterIterator &operator=(const CharacterIterator &that);
/**
* Assignment operator. Sets this CharacterIterator to have the same behavior,
* as the one passed in.
* @param that The CharacterIterator passed in.
* @return the newly set CharacterIterator.
* @stable ICU 2.0
*/
CharacterIterator &operator=(const CharacterIterator &that);
/**
* Base class text length field.
* Necessary this for correct getText() and hashCode().
* @stable ICU 2.0
*/
int32_t textLength;
/**
* Base class text length field.
* Necessary this for correct getText() and hashCode().
* @stable ICU 2.0
*/
int32_t textLength;
/**
* Base class field for the current position.
* @stable ICU 2.0
*/
int32_t pos;
/**
* Base class field for the current position.
* @stable ICU 2.0
*/
int32_t pos;
/**
* Base class field for the start of the iteration range.
* @stable ICU 2.0
*/
int32_t begin;
/**
* Base class field for the start of the iteration range.
* @stable ICU 2.0
*/
int32_t begin;
/**
* Base class field for the end of the iteration range.
* @stable ICU 2.0
*/
int32_t end;
/**
* Base class field for the end of the iteration range.
* @stable ICU 2.0
*/
int32_t end;
};
inline UBool
ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const {
return !operator==(that);
return !operator==(that);
}
inline int32_t
CharacterIterator::setToStart() {
return move(0, kStart);
return move(0, kStart);
}
inline int32_t
CharacterIterator::setToEnd() {
return move(0, kEnd);
return move(0, kEnd);
}
inline int32_t
CharacterIterator::startIndex(void) const {
return begin;
return begin;
}
inline int32_t
CharacterIterator::endIndex(void) const {
return end;
return end;
}
inline int32_t
CharacterIterator::getIndex(void) const {
return pos;
return pos;
}
inline int32_t
CharacterIterator::getLength(void) const {
return textLength;
return textLength;
}
U_NAMESPACE_END

View file

@ -84,11 +84,6 @@ private:
DictionaryBasedBreakIteratorTables *fTables;
/**
* Class ID
*/
static const char fgClassID;
/**=======================================================================
* Create a dictionary based break boundary detection iterator.
* @param tablesImage The location for the dictionary to be loaded into memory
@ -175,6 +170,19 @@ public:
*/
virtual int32_t preceding(int32_t offset);
/**
* Returns the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID(). For example:
*
* Base* polymorphic_pointer = createPolymorphicObject();
* if (polymorphic_pointer->getDynamicClassID() ==
* Derived::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
@ -188,19 +196,6 @@ public:
*/
virtual UClassID getDynamicClassID(void) const;
/**
* Returns the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID(). For example:
*
* Base* polymorphic_pointer = createPolymorphicObject();
* if (polymorphic_pointer->getDynamicClassID() ==
* Derived::getStaticClassID()) ...
*
* @return The class ID for all objects of this class.
* @stable ICU 2.0
*/
static inline UClassID getStaticClassID(void);
protected:
//=======================================================================
// implementation
@ -270,14 +265,6 @@ private:
friend class BreakIterator;
};
inline UClassID
DictionaryBasedBreakIterator::getStaticClassID(void)
{ return (UClassID)(&fgClassID); }
inline UClassID
DictionaryBasedBreakIterator::getDynamicClassID(void) const
{ return DictionaryBasedBreakIterator::getStaticClassID(); }
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */

View file

@ -558,19 +558,19 @@ public:
*/
static const char* const* getISOLanguages();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
protected: /* only protected for testing purposes. DO NOT USE. */
/**
@ -611,25 +611,11 @@ private:
UBool fIsBogus;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
static const Locale &getLocale(int locid);
friend void locale_set_default_internal(const char *);
};
inline UClassID
Locale::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
Locale::getDynamicClassID() const
{ return Locale::getStaticClassID(); }
inline UBool
Locale::operator!=(const Locale& other) const
{

View file

@ -691,19 +691,19 @@ public:
*/
void getText(UnicodeString& result);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @return a UClassID for the actual class.
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
* @returns a UClassID for this class.
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @return a UClassID for the actual class.
* @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
private:
//-------------------------------------------------------------------------
@ -739,25 +739,12 @@ private:
UnicodeString buffer;
int32_t bufferPos;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
//-------------------------------------------------------------------------
// Inline implementations
//-------------------------------------------------------------------------
inline UClassID
Normalizer::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
Normalizer::getDynamicClassID() const
{ return Normalizer::getStaticClassID(); }
inline UBool
Normalizer::operator!= (const Normalizer& other) const
{ return ! operator==(other); }

View file

@ -71,7 +71,7 @@ public:
* Destructor
* @stable ICU 2.0
*/
~ParsePosition() {}
virtual ~ParsePosition();
/**
* Assignment operator
@ -125,19 +125,19 @@ public:
*/
int32_t getErrorIndex(void) const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
private:
/**
@ -153,21 +153,8 @@ private:
*/
int32_t errorIndex;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
inline UClassID
ParsePosition::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
ParsePosition::getDynamicClassID() const
{ return ParsePosition::getStaticClassID(); }
inline ParsePosition&
ParsePosition::operator=(const ParsePosition& copy)
{

View file

@ -93,13 +93,6 @@ protected:
static UBool fTrace;
private:
/**
* Class ID
*/
static const char fgClassID;
protected:
//=======================================================================
// constructors
@ -360,7 +353,7 @@ public:
* other classes have different class IDs.
* @stable ICU 2.0
*/
inline virtual UClassID getDynamicClassID(void) const;
virtual UClassID getDynamicClassID(void) const;
/**
* Returns the class ID for this class. This is useful only for
@ -373,7 +366,7 @@ public:
* @return The class ID for all objects of this class.
* @stable ICU 2.0
*/
inline static UClassID getStaticClassID(void);
static UClassID getStaticClassID(void);
/*
* Create a clone (copy) of this break iterator in memory provided
@ -475,24 +468,16 @@ protected:
};
//----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Inline Functions Definitions ...
//
//----------------------------------------------------------------------------------
//------------------------------------------------------------------------------
inline UBool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const {
return !operator==(that);
}
inline UClassID RuleBasedBreakIterator::getStaticClassID(void) {
return (UClassID)(&fgClassID);
}
inline UClassID RuleBasedBreakIterator::getDynamicClassID(void) const {
return RuleBasedBreakIterator::getStaticClassID();
}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */

View file

@ -235,8 +235,6 @@ protected:
inline Replaceable::Replaceable() {}
inline Replaceable::~Replaceable() {}
inline int32_t
Replaceable::length() const {
return getLength();

View file

@ -416,14 +416,14 @@ public:
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
private:
ResourceBundle(); // default constructor not implemented
@ -432,20 +432,7 @@ private:
void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
Locale *locName;
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
inline UClassID
ResourceBundle::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
ResourceBundle::getDynamicClassID() const
{ return ResourceBundle::getStaticClassID(); }
U_NAMESPACE_END
#endif

View file

@ -153,7 +153,7 @@ public:
* @return a class ID for this class
* @stable ICU 2.0
*/
static inline UClassID getStaticClassID(void);
static UClassID getStaticClassID(void);
protected:
/**
@ -176,17 +176,7 @@ protected:
*/
UnicodeString text;
private:
static const char fgClassID;
};
inline UClassID
StringCharacterIterator::getStaticClassID(void)
{ return (UClassID)(&fgClassID); }
inline UClassID
StringCharacterIterator::getDynamicClassID(void) const
{ return StringCharacterIterator::getStaticClassID(); }
U_NAMESPACE_END
#endif

View file

@ -344,19 +344,19 @@ public:
*/
virtual void getText(UnicodeString& result);
/**
* Return a class ID for this object (not really public)
* @return a class ID for this object.
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const;
/**
* Return a class ID for this class (not really public)
* @return a class ID for this class
* @stable ICU 2.0
*/
static inline UClassID getStaticClassID(void);
static UClassID getStaticClassID(void);
/**
* Return a class ID for this object (not really public)
* @return a class ID for this object.
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const;
protected:
/**
@ -370,17 +370,7 @@ protected:
*/
const UChar* text;
private:
static const char fgClassID;
};
inline UClassID
UCharCharacterIterator::getStaticClassID(void)
{ return (UClassID)(&fgClassID); }
inline UClassID
UCharCharacterIterator::getDynamicClassID(void) const
{ return UCharCharacterIterator::getStaticClassID(); }
U_NAMESPACE_END
#endif

View file

@ -85,40 +85,41 @@ public:
* UnicodeFunctor API. Nothing to do.
* @draft ICU 2.4
*/
virtual void setData(const TransliterationRuleData*) {}
virtual void setData(const TransliterationRuleData*);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const = 0;
virtual UClassID getDynamicClassID() const = 0;
/**
/*
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
/* static UClassID getStaticClassID() { return (UClassID)&fgClassID; }*/
protected:
/**
/*
* Since this class has pure virtual functions,
* a constructor can't be used.
* @stable ICU 2.0
*/
UnicodeFilter();
/* 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;
/* static const char fgClassID;*/
};
inline UnicodeFilter::UnicodeFilter() {}
inline UnicodeFilter::~UnicodeFilter() {}
/*inline UnicodeFilter::UnicodeFilter() {}*/
U_NAMESPACE_END

View file

@ -27,7 +27,7 @@ class TransliterationRuleData;
*/
class U_COMMON_API UnicodeFunctor : public UObject {
public:
public:
/**
* Destructor
@ -67,7 +67,7 @@ class U_COMMON_API UnicodeFunctor : public UObject {
*/
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>
@ -78,7 +78,7 @@ class U_COMMON_API UnicodeFunctor : public UObject {
* @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) { return (UClassID)&fgClassID; }*/
/**
* Returns a unique class ID <b>polymorphically</b>. This method
@ -115,24 +115,25 @@ class U_COMMON_API UnicodeFunctor : public UObject {
*/
virtual void setData(const TransliterationRuleData*) = 0;
protected:
protected:
/**
* Since this class has pure virtual functions,
* a constructor can't be used.
* @stable ICU 2.0
*/
UnicodeFunctor();
/*UnicodeFunctor();*/
private:
private:
/**
/*
* Class identifier for subclasses of UnicodeFunctor that do not
* define their class (anonymous subclasses).
*/
static const char fgClassID;
/*static const char fgClassID;*/
};
inline UnicodeFunctor::UnicodeFunctor() {}
inline UnicodeFunctor::~UnicodeFunctor() {}
/*inline UnicodeFunctor::UnicodeFunctor() {}*/
U_NAMESPACE_END

View file

@ -66,7 +66,7 @@ public:
* Destructor.
* @draft ICU 2.4
*/
virtual inline ~UnicodeMatcher() {};
virtual ~UnicodeMatcher();
/**
* Return a UMatchDegree value indicating the degree of match for

View file

@ -1115,8 +1115,6 @@ private:
private:
static const char fgClassID;
//----------------------------------------------------------------
// RuleBasedTransliterator support
//----------------------------------------------------------------
@ -1330,14 +1328,6 @@ private:
static const CaseEquivClass* getCaseMapOf(UChar folded);
};
inline UClassID
UnicodeSet::getStaticClassID(void)
{ return (UClassID)&fgClassID; }
inline UClassID
UnicodeSet::getDynamicClassID(void) const
{ return UnicodeSet::getStaticClassID(); }
inline UBool UnicodeSet::operator!=(const UnicodeSet& o) const {
return !operator==(o);
}

View file

@ -2813,19 +2813,19 @@ public:
*/
UChar32 unescapeAt(int32_t &offset) const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
//========================================
// Implementation methods
@ -3067,11 +3067,6 @@ private:
uint16_t fFlags; // bit flags: see constants above
UChar fStackBuffer [ US_STACKBUF_SIZE ]; // buffer for small strings
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
U_NAMESPACE_END
@ -3145,14 +3140,6 @@ UnicodeString::getArrayStart() const
//========================================
// Read-only implementation methods
//========================================
inline UClassID
UnicodeString::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
UnicodeString::getDynamicClassID() const
{ return UnicodeString::getStaticClassID(); }
inline int32_t
UnicodeString::length() const
{ return fLength; }

View file

@ -160,14 +160,14 @@ public:
*
* @draft ICU 2.2
*/
virtual inline ~UObject() {}
virtual ~UObject();
/**
* ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const = 0;
virtual UClassID getDynamicClassID() const = 0;
protected:
// the following functions are protected to prevent instantiation and
@ -214,6 +214,23 @@ protected:
*/
};
/**
* This is a simple macro to add ICU RTTI to an ICU object implementation.
* This does not go into the header. This should only be used in *.cpp files.
*
* @param myClass The name of the class that needs RTTI defined.
* @internal
*/
#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \
UClassID myClass::getStaticClassID() { \
static const char classID = 0; \
return (UClassID)&classID; \
} \
UClassID myClass::getDynamicClassID() const \
{ return myClass::getStaticClassID(); }
U_NAMESPACE_END
#endif

View file

@ -204,19 +204,19 @@ class U_COMMON_API UnicodeSetIterator : public UObject {
*/
void reset();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID();
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual UClassID getDynamicClassID() const;
// ======================= PRIVATES ===========================
@ -270,23 +270,8 @@ class U_COMMON_API UnicodeSetIterator : public UObject {
*/
virtual void loadRange(int32_t range);
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 UClassID
UnicodeSetIterator::getStaticClassID()
{ return (UClassID)&fgClassID; }
inline UClassID
UnicodeSetIterator::getDynamicClassID() const
{ return UnicodeSetIterator::getStaticClassID(); }
inline UBool UnicodeSetIterator::isString() const {
return codepoint == (UChar32)IS_STRING;
}

View file

@ -1,5 +1,7 @@
/*
* Copyright (C) 2001, International Business Machines Corporation and others. All Rights Reserved.
**********************************************************************
* Copyright (c) 2001-2003, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 07/18/01 aliu Creation.
@ -11,7 +13,11 @@
U_NAMESPACE_BEGIN
const char UnicodeFilter::fgClassID=0;
/* Define this here due to the lack of another file.
It can't be defined in the header */
UnicodeMatcher::~UnicodeMatcher() {}
UnicodeFilter::~UnicodeFilter() {}
/**
* UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
@ -21,6 +27,8 @@ UnicodeMatcher* UnicodeFilter::toMatcher() const {
return (UnicodeMatcher*) this;
}
void UnicodeFilter::setData(const TransliterationRuleData*) {}
/**
* Default implementation of UnicodeMatcher::matches() for Unicode
* filters. Matches a single code point at offset (either one or

View file

@ -1,19 +1,15 @@
/*
**********************************************************************
* Copyright (c) 2002, International Business Machines
* Copyright (c) 2002-2003, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* $Source: /xsrl/Nsvn/icu/icu/source/common/unifunct.cpp,v $
* $Date: 2002/05/29 18:33:33 $
* $Revision: 1.1 $
**********************************************************************
*/
#include "unicode/unifunct.h"
U_NAMESPACE_BEGIN
const char UnicodeFunctor::fgClassID = 0;
UnicodeFunctor::~UnicodeFunctor() {}
UnicodeMatcher* UnicodeFunctor::toMatcher() const {
return 0;

View file

@ -141,7 +141,8 @@ static const UChar CATEGORY_CLOSE[] = {COLON, SET_CLOSE, 0x0000}; /* ":]" */
U_NAMESPACE_BEGIN
const char ParsePosition::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ParsePosition)
ParsePosition::~ParsePosition() {}
/**
* Minimum value that can be stored in a UnicodeSet.
@ -153,7 +154,7 @@ const UChar32 UnicodeSet::MIN_VALUE = UNICODESET_LOW;
*/
const UChar32 UnicodeSet::MAX_VALUE = UNICODESET_HIGH - 1;
const char UnicodeSet::fgClassID = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeSet)
static UnicodeSet* INCLUSIONS = NULL; // cached uprv_getInclusions()

View file

@ -101,7 +101,11 @@ U_CDECL_END
U_NAMESPACE_BEGIN
const char UnicodeString::fgClassID=0;
/* The Replaceable virtual destructor can't be defined in the header
due to how AIX works with multiple definitions of virtual functions.
*/
Replaceable::~Replaceable() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeString)
//========================================
// Reference Counting functions, put at top of file so that optimizing compilers

View file

@ -77,6 +77,11 @@ void UMemory::operator delete[](void *p) {
}
}
/* Can't define virtual functions in header.
This is defined here to create one function definition for AIX.
*/
UObject::~UObject() {}
U_NAMESPACE_END
#endif

View file

@ -3,8 +3,6 @@
* Copyright (c) 2002, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* $Source: /xsrl/Nsvn/icu/icu/source/common/usetiter.cpp,v $
**********************************************************************
*/
#include "unicode/usetiter.h"
#include "unicode/uniset.h"
@ -13,7 +11,7 @@
U_NAMESPACE_BEGIN
const char UnicodeSetIterator::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeSetIterator)
/**
* Create an iterator

View file

@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN
#define HINT_KEY_POINTER (1)
#define HINT_KEY_INTEGER (0)
const char UVector::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector)
UVector::UVector(UErrorCode &status) :
count(0),
@ -465,7 +465,7 @@ void UVector::sortedInsert(UHashTok tok, USortComparator *compare, UErrorCode& e
}
}
const char UStack::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UStack)
UStack::UStack(UErrorCode &status) :
UVector(status)

View file

@ -250,14 +250,14 @@ public:
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
virtual UClassID getDynamicClassID() const;
private:
void _init(int32_t initialCapacity, UErrorCode &status);
@ -272,11 +272,6 @@ private:
// Disallow
UVector& operator=(const UVector&);
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};
@ -330,14 +325,14 @@ public:
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
virtual UClassID getDynamicClassID() const;
private:
// Disallow
@ -345,12 +340,6 @@ private:
// Disallow
UStack& operator=(const UStack&);
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
};

View file

@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN
* token is assumed to be an integer. This is needed for iSeries
*/
const char UVector32::fgClassID=0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector32)
UVector32::UVector32(UErrorCode &status) :
count(0),

View file

@ -166,14 +166,14 @@ public:
*
* @draft ICU 2.2
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
static UClassID getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 2.2
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
virtual UClassID getDynamicClassID() const;
private:
void _init(int32_t initialCapacity, UErrorCode &status);
@ -184,12 +184,6 @@ private:
// Disallow
UVector32& operator=(const UVector32&);
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
// API Functions for Stack operations.
// In the original UVector, these were in a separate derived class, UStack.