diff --git a/icu4c/source/common/iculserv.h b/icu4c/source/common/iculserv.h index cc7b9d6aad..a6ad1b0f37 100644 --- a/icu4c/source/common/iculserv.h +++ b/icu4c/source/common/iculserv.h @@ -157,12 +157,12 @@ class U_COMMON_API LocaleKey : public ICUServiceKey { /** * UObject boilerplate. */ - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; } - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); } #ifdef SERVICE_DEBUG @@ -278,12 +278,12 @@ protected: /** * UObject boilerplate. */ - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; } - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); } #ifdef SERVICE_DEBUG @@ -348,12 +348,12 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory { /** * UObject boilerplate. */ - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; } - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); } #ifdef SERVICE_DEBUG diff --git a/icu4c/source/common/icunotif.h b/icu4c/source/common/icunotif.h index f769f4fbbd..28d1013b50 100644 --- a/icu4c/source/common/icunotif.h +++ b/icu4c/source/common/icunotif.h @@ -36,12 +36,12 @@ class U_COMMON_API EventListener : public UObject { virtual ~EventListener() {} public: - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; } - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); } public: diff --git a/icu4c/source/common/icuserv.h b/icu4c/source/common/icuserv.h index 183d987971..13d3f088e0 100644 --- a/icu4c/source/common/icuserv.h +++ b/icu4c/source/common/icuserv.h @@ -187,15 +187,15 @@ class U_COMMON_API ICUServiceKey : public UObject { /** * UObject RTTI boilerplate. */ - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; } /** * UObject RTTI boilerplate. */ - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); } #ifdef SERVICE_DEBUG @@ -347,15 +347,15 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { /** * UObject RTTI boilerplate. */ - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; } /** * UObject RTTI boilerplate. */ - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); } #ifdef SERVICE_DEBUG @@ -380,33 +380,33 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { * acceptsListener and notifyListener as appropriate.
*/ class U_COMMON_API ServiceListener : public EventListener { - public: - /** - *This method is called when the service changes. At the time of the - * call this listener is registered with the service. It must - * not modify the notifier in the context of this call.
- * - * @param service the service that changed. - */ - virtual void serviceChanged(const ICUService& service) const = 0; - - public: - /** - * UObject RTTI boilerplate. - */ - virtual UClassID getDynamicClassID() const { - return getStaticClassID(); - } - - /** - * UObject RTTI boilerplate. - */ - static UClassID getStaticClassID() { - return (UClassID)&fgClassID; - } - - private: - static const char fgClassID; +public: + /** + *This method is called when the service changes. At the time of the + * call this listener is registered with the service. It must + * not modify the notifier in the context of this call.
+ * + * @param service the service that changed. + */ + virtual void serviceChanged(const ICUService& service) const = 0; + +public: + /** + * UObject RTTI boilerplate. + */ + static inline UClassID getStaticClassID() { + return (UClassID)&fgClassID; + } + + /** + * UObject RTTI boilerplate. + */ + virtual UClassID getDynamicClassID() const { + return getStaticClassID(); + } + +private: + static const char fgClassID; }; /* diff --git a/icu4c/source/common/nameprep.h b/icu4c/source/common/nameprep.h index 4c174aa452..82b33abe0d 100644 --- a/icu4c/source/common/nameprep.h +++ b/icu4c/source/common/nameprep.h @@ -60,13 +60,6 @@ public : virtual inline UBool isNotProhibited(UChar32 ch); - /** - * ICU "poor man's RTTI", returns a UClassID for the actual class. - * - * @draft ICU 2.6 - */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } - /** * ICU "poor man's RTTI", returns a UClassID for this class. * @@ -74,6 +67,13 @@ public : */ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @draft ICU 2.6 + */ + virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + private: /** * The address of this static class variable serves as this class's ID diff --git a/icu4c/source/common/uvector.h b/icu4c/source/common/uvector.h index faf71bb83b..30c82aa13d 100644 --- a/icu4c/source/common/uvector.h +++ b/icu4c/source/common/uvector.h @@ -245,13 +245,6 @@ public: */ void sortedInsert(int32_t obj, USortComparator *compare, UErrorCode& ec); - /** - * ICU "poor man's RTTI", returns a UClassID for the actual class. - * - * @draft ICU 2.2 - */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } - /** * ICU "poor man's RTTI", returns a UClassID for this class. * @@ -259,6 +252,13 @@ public: */ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @draft ICU 2.2 + */ + virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + private: void _init(int32_t initialCapacity, UErrorCode &status); @@ -325,13 +325,6 @@ public: int32_t search(void* obj) const; - /** - * ICU "poor man's RTTI", returns a UClassID for the actual class. - * - * @draft ICU 2.2 - */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } - /** * ICU "poor man's RTTI", returns a UClassID for this class. * @@ -339,6 +332,13 @@ public: */ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @draft ICU 2.2 + */ + virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + private: // Disallow UStack(const UStack&);