From a3adeb863217d8d9735e638c598e4328df431ac9 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Fri, 4 Oct 2002 18:06:33 +0000 Subject: [PATCH] ICU-2244 change internal classes to inherit UMemory, not UObject X-SVN-Rev: 9967 --- icu4c/source/i18n/rbt_data.cpp | 6 ++---- icu4c/source/i18n/rbt_data.h | 23 ++--------------------- icu4c/source/i18n/rbt_pars.cpp | 26 +------------------------- icu4c/source/i18n/rbt_pars.h | 22 +--------------------- icu4c/source/i18n/rbt_rule.cpp | 6 ++---- icu4c/source/i18n/rbt_rule.h | 22 ++-------------------- icu4c/source/i18n/rbt_set.cpp | 6 ++---- icu4c/source/i18n/rbt_set.h | 22 ++-------------------- 8 files changed, 14 insertions(+), 119 deletions(-) diff --git a/icu4c/source/i18n/rbt_data.cpp b/icu4c/source/i18n/rbt_data.cpp index ac13e62a92a..42fa1ab96bc 100644 --- a/icu4c/source/i18n/rbt_data.cpp +++ b/icu4c/source/i18n/rbt_data.cpp @@ -20,10 +20,8 @@ U_NAMESPACE_BEGIN -const char TransliterationRuleData::fgClassID=0; - TransliterationRuleData::TransliterationRuleData(UErrorCode& status) - : UObject(), ruleSet(status), + : UMemory(), ruleSet(status), variableNames(0), variables(0) { if (U_FAILURE(status)) { @@ -43,7 +41,7 @@ TransliterationRuleData::TransliterationRuleData(UErrorCode& status) } TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData& other) : - UObject(other), ruleSet(other.ruleSet), + UMemory(other), ruleSet(other.ruleSet), variablesBase(other.variablesBase), variablesLength(other.variablesLength) { diff --git a/icu4c/source/i18n/rbt_data.h b/icu4c/source/i18n/rbt_data.h index daeb8753ada..9ceaf812ba8 100644 --- a/icu4c/source/i18n/rbt_data.h +++ b/icu4c/source/i18n/rbt_data.h @@ -40,7 +40,7 @@ class Hashtable; * data structure handles this. See the parsing code for more * details. */ -class U_I18N_API TransliterationRuleData : public UObject { +class U_I18N_API TransliterationRuleData : public UMemory { public: @@ -129,27 +129,8 @@ public: */ UnicodeReplacer* lookupReplacer(UChar32 standIn) 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. - * - * @draft ICU 2.2 - */ - static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } - private: - - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; + TransliterationRuleData &operator=(const TransliterationRuleData &other); // forbid copying of this class }; U_NAMESPACE_END diff --git a/icu4c/source/i18n/rbt_pars.cpp b/icu4c/source/i18n/rbt_pars.cpp index c06b6ff0d1a..20b33db127e 100644 --- a/icu4c/source/i18n/rbt_pars.cpp +++ b/icu4c/source/i18n/rbt_pars.cpp @@ -224,7 +224,7 @@ UBool ParseData::isReplacer(UChar32 ch) { * parse half of a rule. It is tightly coupled to the method * RuleBasedTransliterator.Parser.parseRule(). */ -class RuleHalf : public UObject { +class RuleHalf : public UMemory { public: @@ -298,34 +298,12 @@ public: return parser.syntaxError(code, rule, start); } - /** - * 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. - * - * @draft ICU 2.2 - */ - static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } - private: // Disallowed methods; no impl. RuleHalf(const RuleHalf&); RuleHalf& operator=(const RuleHalf&); - - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; }; -const char RuleHalf::fgClassID=0; - RuleHalf::RuleHalf(TransliteratorParser& p) : ec(U_ZERO_ERROR), parser(p) @@ -797,8 +775,6 @@ UBool RuleHalf::isValidInput(TransliteratorParser& transParser) { // PUBLIC API //---------------------------------------------------------------------- -const char TransliteratorParser::fgClassID=0; - /** * Constructor. */ diff --git a/icu4c/source/i18n/rbt_pars.h b/icu4c/source/i18n/rbt_pars.h index ff07230f4cf..053d7fff0ff 100644 --- a/icu4c/source/i18n/rbt_pars.h +++ b/icu4c/source/i18n/rbt_pars.h @@ -27,7 +27,7 @@ class ParsePosition; class UVector; class StringMatcher; -class TransliteratorParser : public UObject { +class TransliteratorParser : public UMemory { public: @@ -182,20 +182,6 @@ public: */ TransliterationRuleData* orphanData(); - /** - * 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. - * - * @draft ICU 2.2 - */ - static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } - private: /** @@ -354,12 +340,6 @@ private: * Assignment operator */ TransliteratorParser& operator=(const TransliteratorParser&); - - /** - * 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 diff --git a/icu4c/source/i18n/rbt_rule.cpp b/icu4c/source/i18n/rbt_rule.cpp index 0222068aaf0..cf1c06af9d8 100644 --- a/icu4c/source/i18n/rbt_rule.cpp +++ b/icu4c/source/i18n/rbt_rule.cpp @@ -26,8 +26,6 @@ static const UChar FORWARD_OP[] = {32,62,32,0}; // " > " U_NAMESPACE_BEGIN -const char TransliterationRule::fgClassID=0; - /** * Construct a new rule with the given input, output text, and other * attributes. A cursor position may be specified for the output text. @@ -62,7 +60,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input, UBool anchorStart, UBool anchorEnd, const TransliterationRuleData* theData, UErrorCode& status) : - UObject(), + UMemory(), segments(0), data(theData) { @@ -160,7 +158,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input, * Copy constructor. */ TransliterationRule::TransliterationRule(TransliterationRule& other) : - UObject(other), + UMemory(other), anteContext(NULL), key(NULL), postContext(NULL), diff --git a/icu4c/source/i18n/rbt_rule.h b/icu4c/source/i18n/rbt_rule.h index def92fd977e..0816956ce81 100644 --- a/icu4c/source/i18n/rbt_rule.h +++ b/icu4c/source/i18n/rbt_rule.h @@ -52,7 +52,7 @@ class UnicodeFunctor; * * @author Alan Liu */ -class TransliterationRule : public UObject { +class TransliterationRule : public UMemory { private: @@ -281,20 +281,6 @@ public: */ virtual UnicodeString& toRule(UnicodeString& pat, UBool escapeUnprintable) 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. - * - * @draft ICU 2.2 - */ - static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } - /** * Union the set of all characters that may be modified by this rule @@ -312,11 +298,7 @@ public: friend class StringMatcher; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; + TransliterationRule &operator=(const TransliterationRule &other); // forbid copying of this class }; U_NAMESPACE_END diff --git a/icu4c/source/i18n/rbt_set.cpp b/icu4c/source/i18n/rbt_set.cpp index 3a860f7133d..2d637065766 100644 --- a/icu4c/source/i18n/rbt_set.cpp +++ b/icu4c/source/i18n/rbt_set.cpp @@ -156,12 +156,10 @@ static void maskingError(const U_NAMESPACE_QUALIFIER TransliterationRule& rule1, U_NAMESPACE_BEGIN -const char TransliterationRuleSet::fgClassID=0; - /** * Construct a new empty rule set. */ -TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) : UObject() { +TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) : UMemory() { ruleVector = new UVector(&_deleteRule, NULL, status); rules = NULL; maxContextLength = 0; @@ -174,7 +172,7 @@ TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) : UObject() { * Copy constructor. */ TransliterationRuleSet::TransliterationRuleSet(const TransliterationRuleSet& other) : - UObject(other), + UMemory(other), ruleVector(0), rules(0), maxContextLength(other.maxContextLength) { diff --git a/icu4c/source/i18n/rbt_set.h b/icu4c/source/i18n/rbt_set.h index c908aa994ad..3a7c5d219b8 100644 --- a/icu4c/source/i18n/rbt_set.h +++ b/icu4c/source/i18n/rbt_set.h @@ -29,7 +29,7 @@ class UnicodeSet; * A set of rules for a RuleBasedTransliterator. * @author Alan Liu */ -class U_I18N_API TransliterationRuleSet : public UObject { +class U_I18N_API TransliterationRuleSet : public UMemory { /** * Vector of rules, in the order added. This is used while the * rule set is getting built. After that, freeze() reorders and @@ -144,20 +144,6 @@ public: virtual UnicodeString& toRules(UnicodeString& result, UBool escapeUnprintable) 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. - * - * @draft ICU 2.2 - */ - static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } - /** * Return the set of all characters that may be modified * (getTarget=false) or emitted (getTarget=true) by this set. @@ -167,11 +153,7 @@ public: private: - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; + TransliterationRuleSet &operator=(const TransliterationRuleSet &other); // forbid copying of this class }; U_NAMESPACE_END