diff --git a/icu4c/source/i18n/anytrans.cpp b/icu4c/source/i18n/anytrans.cpp index cdfea1b4ff0..8acb84c6c35 100644 --- a/icu4c/source/i18n/anytrans.cpp +++ b/icu4c/source/i18n/anytrans.cpp @@ -170,7 +170,7 @@ void ScriptRunIterator::adjustLimit(int32_t delta) { //------------------------------------------------------------ // AnyTransliterator -const char AnyTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(AnyTransliterator) AnyTransliterator::AnyTransliterator(const UnicodeString& id, const UnicodeString& theTarget, diff --git a/icu4c/source/i18n/anytrans.h b/icu4c/source/i18n/anytrans.h index fbc781022d8..eeed8a50f63 100644 --- a/icu4c/source/i18n/anytrans.h +++ b/icu4c/source/i18n/anytrans.h @@ -4,7 +4,7 @@ * and others. All Rights Reserved. ***************************************************************** * $Source: /xsrl/Nsvn/icu/icu/source/i18n/anytrans.h,v $ -* $Revision: 1.4 $ +* $Revision: 1.5 $ ***************************************************************** * Date Name Description * 06/06/2002 aliu Creation. @@ -52,12 +52,6 @@ class U_I18N_API AnyTransliterator : public Transliterator { */ UScriptCode targetScript; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; - public: /** @@ -86,14 +80,14 @@ public: * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); private: diff --git a/icu4c/source/i18n/choicfmt.cpp b/icu4c/source/i18n/choicfmt.cpp index 09a849b708f..9b1fe39454d 100644 --- a/icu4c/source/i18n/choicfmt.cpp +++ b/icu4c/source/i18n/choicfmt.cpp @@ -39,7 +39,7 @@ U_NAMESPACE_BEGIN -const char ChoiceFormat::fgClassID = 0; // Value is irrelevant +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ChoiceFormat) // Special characters used by ChoiceFormat. There are two characters // used interchangeably to indicate <=. Either is parsed, but only @@ -52,8 +52,8 @@ const char ChoiceFormat::fgClassID = 0; // Value is irrelevant #define MINUS ((UChar)0x002D) /*-*/ #define INFINITY ((UChar)0x221E) -const UChar ChoiceFormat::fgPositiveInfinity[] = {INFINITY, 0}; -const UChar ChoiceFormat::fgNegativeInfinity[] = {MINUS, INFINITY, 0}; +static const UChar gPositiveInfinity[] = {INFINITY, 0}; +static const UChar gNegativeInfinity[] = {MINUS, INFINITY, 0}; #define POSITIVE_INF_STRLEN 1 #define NEGATIVE_INF_STRLEN 2 @@ -322,9 +322,9 @@ ChoiceFormat::applyPattern(const UnicodeString& pattern, double limit; buf.trim(); - if (!buf.compare(fgPositiveInfinity, POSITIVE_INF_STRLEN)) { + if (!buf.compare(gPositiveInfinity, POSITIVE_INF_STRLEN)) { limit = uprv_getInfinity(); - } else if (!buf.compare(fgNegativeInfinity, NEGATIVE_INF_STRLEN)) { + } else if (!buf.compare(gNegativeInfinity, NEGATIVE_INF_STRLEN)) { limit = -uprv_getInfinity(); } else { limit = stod(buf); diff --git a/icu4c/source/i18n/coleitr.cpp b/icu4c/source/i18n/coleitr.cpp index 991cb6ea8ad..fc89dad8352 100644 --- a/icu4c/source/i18n/coleitr.cpp +++ b/icu4c/source/i18n/coleitr.cpp @@ -38,7 +38,7 @@ U_NAMESPACE_BEGIN -const char CollationElementIterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationElementIterator) /* synwee : public can't remove */ int32_t const CollationElementIterator::NULLORDER = 0xffffffff; diff --git a/icu4c/source/i18n/cpdtrans.cpp b/icu4c/source/i18n/cpdtrans.cpp index abcf12ac4e2..e12103217f4 100644 --- a/icu4c/source/i18n/cpdtrans.cpp +++ b/icu4c/source/i18n/cpdtrans.cpp @@ -30,7 +30,7 @@ static const UChar EMPTY[] = {0}; //"" U_NAMESPACE_BEGIN -const char CompoundTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompoundTransliterator) /** * Constructs a new compound transliterator given an array of diff --git a/icu4c/source/i18n/cpdtrans.h b/icu4c/source/i18n/cpdtrans.h index cd2efc9e682..27b87eec538 100644 --- a/icu4c/source/i18n/cpdtrans.h +++ b/icu4c/source/i18n/cpdtrans.h @@ -188,14 +188,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: @@ -243,22 +243,8 @@ private: void freeTransliterators(void); void computeMaximumContextLength(void); - - /** - * 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 -CompoundTransliterator::getStaticClassID() -{ return (UClassID)&fgClassID; } - -inline UClassID -CompoundTransliterator::getDynamicClassID() const -{ return CompoundTransliterator::getStaticClassID(); } - U_NAMESPACE_END #endif /* #if !UCONFIG_NO_TRANSLITERATION */ diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 5ee57da41a6..d5f1e472c82 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -77,24 +77,29 @@ static void debugout(UnicodeString s) { // class DecimalFormat // ***************************************************************************** -const char DecimalFormat::fgClassID = 0; // Value is irrelevant +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DecimalFormat) // Constants for characters used in programmatic (unlocalized) patterns. -const UChar DecimalFormat::kPatternZeroDigit = 0x0030 /*'0'*/; -const UChar DecimalFormat::kPatternGroupingSeparator = 0x002C /*','*/; -const UChar DecimalFormat::kPatternDecimalSeparator = 0x002E /*'.'*/; -const UChar DecimalFormat::kPatternPerMill = 0x2030; -const UChar DecimalFormat::kPatternPercent = 0x0025 /*'%'*/; -const UChar DecimalFormat::kPatternDigit = 0x0023 /*'#'*/; -const UChar DecimalFormat::kPatternSeparator = 0x003B /*';'*/; -const UChar DecimalFormat::kPatternExponent = 0x0045 /*'E'*/; -const UChar DecimalFormat::kPatternPlus = 0x002B /*'+'*/; -const UChar DecimalFormat::kPatternMinus = 0x002D /*'-'*/; -const UChar DecimalFormat::kPatternPadEscape = 0x002A /*'*'*/; -const UChar DecimalFormat::kCurrencySign = 0x00A4; -const UChar DecimalFormat::kQuote = 0x0027 /*'\''*/; - -//const int8_t DecimalFormat::fgMaxDigit = 9; +#define kPatternZeroDigit ((UChar)0x0030) /*'0'*/ +#define kPatternGroupingSeparator ((UChar)0x002C) /*','*/ +#define kPatternDecimalSeparator ((UChar)0x002E) /*'.'*/ +#define kPatternPerMill ((UChar)0x2030) +#define kPatternPercent ((UChar)0x0025) /*'%'*/ +#define kPatternDigit ((UChar)0x0023) /*'#'*/ +#define kPatternSeparator ((UChar)0x003B) /*';'*/ +#define kPatternExponent ((UChar)0x0045) /*'E'*/ +#define kPatternPlus ((UChar)0x002B) /*'+'*/ +#define kPatternMinus ((UChar)0x002D) /*'-'*/ +#define kPatternPadEscape ((UChar)0x002A) /*'*'*/ +#define kQuote ((UChar)0x0027) /*'\''*/ +/** + * The CURRENCY_SIGN is the standard Unicode symbol for currency. It + * is used in patterns and substitued with either the currency symbol, + * or if it is doubled, with the international currency symbol. If the + * CURRENCY_SIGN is seen in a pattern, then the decimal separator is + * replaced with the monetary decimal separator. + */ +#define kCurrencySign ((UChar)0x00A4) const int32_t DecimalFormat::kDoubleIntegerDigits = 309; const int32_t DecimalFormat::kDoubleFractionDigits = 340; @@ -105,7 +110,7 @@ const int32_t DecimalFormat::kDoubleFractionDigits = 340; */ const char DecimalFormat::fgNumberPatterns[]="NumberPatterns"; -static const UChar kDefaultPad = 0x0020; /* */ +#define kDefaultPad ((UChar)0x0020) /* */ //------------------------------------------------------------------------------ // Constructs a DecimalFormat instance in the default locale. diff --git a/icu4c/source/i18n/esctrn.cpp b/icu4c/source/i18n/esctrn.cpp index 7a6241d039f..16273f6fa6f 100644 --- a/icu4c/source/i18n/esctrn.cpp +++ b/icu4c/source/i18n/esctrn.cpp @@ -27,7 +27,7 @@ static const UChar SEMI[] = {59,0}; // ";" static const UChar RBRACE[] = {125,0}; // "}" static const UChar EMPTY[] = {0}; // "" -const char EscapeTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EscapeTransliterator) /** * Factory methods diff --git a/icu4c/source/i18n/esctrn.h b/icu4c/source/i18n/esctrn.h index cacad829570..2c6be7cdc57 100644 --- a/icu4c/source/i18n/esctrn.h +++ b/icu4c/source/i18n/esctrn.h @@ -82,12 +82,6 @@ class U_I18N_API EscapeTransliterator : public Transliterator { */ EscapeTransliterator* supplementalHandler; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; - public: /** @@ -126,14 +120,14 @@ class U_I18N_API EscapeTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: diff --git a/icu4c/source/i18n/fmtable.cpp b/icu4c/source/i18n/fmtable.cpp index cda867e6d55..cb491bf5cb8 100644 --- a/icu4c/source/i18n/fmtable.cpp +++ b/icu4c/source/i18n/fmtable.cpp @@ -26,7 +26,7 @@ U_NAMESPACE_BEGIN -const char Formattable::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Formattable) // ------------------------------------- // default constructor. diff --git a/icu4c/source/i18n/funcrepl.cpp b/icu4c/source/i18n/funcrepl.cpp index 8b33196e3d8..742a14662db 100644 --- a/icu4c/source/i18n/funcrepl.cpp +++ b/icu4c/source/i18n/funcrepl.cpp @@ -22,7 +22,7 @@ static const UChar CLOSE[] = {32,41,0}; // " )" U_NAMESPACE_BEGIN -const char FunctionReplacer::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(FunctionReplacer) /** * Construct a replacer that takes the output of the given diff --git a/icu4c/source/i18n/funcrepl.h b/icu4c/source/i18n/funcrepl.h index cfb6a08dacb..1398d372dc0 100644 --- a/icu4c/source/i18n/funcrepl.h +++ b/icu4c/source/i18n/funcrepl.h @@ -45,12 +45,6 @@ class U_I18N_API FunctionReplacer : public UnicodeFunctor, public UnicodeReplace */ UnicodeFunctor* replacer; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; - public: /** @@ -111,14 +105,14 @@ class U_I18N_API FunctionReplacer : public UnicodeFunctor, public UnicodeReplace * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); }; U_NAMESPACE_END diff --git a/icu4c/source/i18n/msgfmt.cpp b/icu4c/source/i18n/msgfmt.cpp index 477a72debac..0928714ffdb 100644 --- a/icu4c/source/i18n/msgfmt.cpp +++ b/icu4c/source/i18n/msgfmt.cpp @@ -126,7 +126,7 @@ static const int32_t DEFAULT_INITIAL_CAPACITY = 10; U_NAMESPACE_BEGIN // ------------------------------------- -const char MessageFormat::fgClassID = 0; // Value is irrelevant +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MessageFormat) //-------------------------------------------------------------------- diff --git a/icu4c/source/i18n/name2uni.cpp b/icu4c/source/i18n/name2uni.cpp index 8a6f2d9ca8e..0f7a332baf7 100644 --- a/icu4c/source/i18n/name2uni.cpp +++ b/icu4c/source/i18n/name2uni.cpp @@ -22,7 +22,7 @@ U_NAMESPACE_BEGIN -const char NameUnicodeTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NameUnicodeTransliterator) const char NameUnicodeTransliterator::_ID[] = "Name-Any"; diff --git a/icu4c/source/i18n/name2uni.h b/icu4c/source/i18n/name2uni.h index cae743367a1..ef1ba57647d 100644 --- a/icu4c/source/i18n/name2uni.h +++ b/icu4c/source/i18n/name2uni.h @@ -24,14 +24,7 @@ U_NAMESPACE_BEGIN * @author Alan Liu */ class U_I18N_API NameUnicodeTransliterator : public Transliterator { - - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; - - public: +public: /** * Constructs a transliterator. @@ -65,14 +58,14 @@ class U_I18N_API NameUnicodeTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: diff --git a/icu4c/source/i18n/nortrans.cpp b/icu4c/source/i18n/nortrans.cpp index 19189c1e4ed..0937b410a87 100644 --- a/icu4c/source/i18n/nortrans.cpp +++ b/icu4c/source/i18n/nortrans.cpp @@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN -const char NormalizationTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NormalizationTransliterator) /** * System registration hook. diff --git a/icu4c/source/i18n/nortrans.h b/icu4c/source/i18n/nortrans.h index 1e76deb302f..7419a59abd0 100644 --- a/icu4c/source/i18n/nortrans.h +++ b/icu4c/source/i18n/nortrans.h @@ -35,12 +35,6 @@ class U_I18N_API NormalizationTransliterator : public Transliterator { */ int32_t options; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; - public: /** @@ -69,14 +63,14 @@ class U_I18N_API NormalizationTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: diff --git a/icu4c/source/i18n/numfmt.cpp b/icu4c/source/i18n/numfmt.cpp index 5987bb48ded..23f4bbcb177 100644 --- a/icu4c/source/i18n/numfmt.cpp +++ b/icu4c/source/i18n/numfmt.cpp @@ -57,8 +57,6 @@ static const UChar gLastResortScientificPat[] = { U_NAMESPACE_BEGIN -const char NumberFormat::fgClassID = 0; // Value is irrelevant - // 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 diff --git a/icu4c/source/i18n/olsontz.cpp b/icu4c/source/i18n/olsontz.cpp index aee44c247ff..7f6d85a147f 100644 --- a/icu4c/source/i18n/olsontz.cpp +++ b/icu4c/source/i18n/olsontz.cpp @@ -24,7 +24,7 @@ U_NAMESPACE_BEGIN static const int32_t ZEROS[] = {0,0}; -const char OlsonTimeZone::fgClassID = 0; // Value is irrelevant +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OlsonTimeZone) //---------------------------------------------------------------------- // Support methods diff --git a/icu4c/source/i18n/olsontz.h b/icu4c/source/i18n/olsontz.h index 0a2bdbddebe..1b8626728ec 100644 --- a/icu4c/source/i18n/olsontz.h +++ b/icu4c/source/i18n/olsontz.h @@ -61,7 +61,7 @@ class U_I18N_API OlsonTimeZone: public TimeZone { /** * TimeZone API. */ - static inline UClassID getStaticClassID(); + static UClassID getStaticClassID(); /** * TimeZone API. @@ -176,7 +176,6 @@ class U_I18N_API OlsonTimeZone: public TimeZone { */ SimpleTimeZone *finalZone; // owned, may be NULL - static const char fgClassID; }; inline int32_t @@ -195,16 +194,6 @@ OlsonTimeZone::dstOffset(int16_t index) const { return typeOffsets[(index << 1) + 1]; } -inline UClassID -OlsonTimeZone::getStaticClassID() { - return (UClassID)&fgClassID; -} - -inline UClassID -OlsonTimeZone::getDynamicClassID() const { - return OlsonTimeZone::getStaticClassID(); -} - U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING diff --git a/icu4c/source/i18n/quant.cpp b/icu4c/source/i18n/quant.cpp index 81bc0b55131..37ef6ebf683 100644 --- a/icu4c/source/i18n/quant.cpp +++ b/icu4c/source/i18n/quant.cpp @@ -16,7 +16,7 @@ U_NAMESPACE_BEGIN -const char Quantifier::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Quantifier) Quantifier::Quantifier(UnicodeFunctor *adoptedMatcher, uint32_t _minCount, uint32_t _maxCount) { diff --git a/icu4c/source/i18n/quant.h b/icu4c/source/i18n/quant.h index c627e08eab9..c206831631e 100644 --- a/icu4c/source/i18n/quant.h +++ b/icu4c/source/i18n/quant.h @@ -101,14 +101,14 @@ class Quantifier : public UnicodeFunctor, public UnicodeMatcher { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); private: @@ -119,12 +119,6 @@ class Quantifier : public UnicodeFunctor, public UnicodeMatcher { uint32_t minCount; uint32_t maxCount; - - /** - * 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/rbnf.cpp b/icu4c/source/i18n/rbnf.cpp index c53a7b0c169..2b9b4680f50 100644 --- a/icu4c/source/i18n/rbnf.cpp +++ b/icu4c/source/i18n/rbnf.cpp @@ -45,7 +45,9 @@ static const UChar gSemiPercent[] = #define kHalfMaxDouble (double)(1 << kSomeNumberOfBitsDiv2) #define kMaxDouble (kHalfMaxDouble * kHalfMaxDouble) -const char RuleBasedNumberFormat::fgClassID = 0; +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedNumberFormat) RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, const Locale& alocale, UParseError& perror, UErrorCode& status) : ruleSets(NULL) @@ -730,5 +732,7 @@ RuleBasedNumberFormat::getDecimalFormatSymbols() const return decimalFormatSymbols; } +U_NAMESPACE_END + /* U_HAVE_RBNF */ #endif diff --git a/icu4c/source/i18n/rematch.cpp b/icu4c/source/i18n/rematch.cpp index 7fc42a2be8d..53afade54e8 100644 --- a/icu4c/source/i18n/rematch.cpp +++ b/icu4c/source/i18n/rematch.cpp @@ -2122,7 +2122,7 @@ breakFromLoop: -const char RegexMatcher::fgClassID = 0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegexMatcher) U_NAMESPACE_END diff --git a/icu4c/source/i18n/remtrans.cpp b/icu4c/source/i18n/remtrans.cpp index 04c7372cfae..d6d5a4b08e2 100644 --- a/icu4c/source/i18n/remtrans.cpp +++ b/icu4c/source/i18n/remtrans.cpp @@ -18,7 +18,7 @@ static const UChar ID[] = {65, 110, 121, 45, 0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, U_NAMESPACE_BEGIN -const char RemoveTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RemoveTransliterator) /** * System registration hook. diff --git a/icu4c/source/i18n/remtrans.h b/icu4c/source/i18n/remtrans.h index 78add4b684d..aa6dd386e64 100644 --- a/icu4c/source/i18n/remtrans.h +++ b/icu4c/source/i18n/remtrans.h @@ -64,14 +64,14 @@ public: * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); private: @@ -79,12 +79,6 @@ public: * Factory method */ static Transliterator* _create(const UnicodeString& ID, Token context); - - /** - * 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/repattrn.cpp b/icu4c/source/i18n/repattrn.cpp index f1c8d6c33aa..9a5df9b590b 100644 --- a/icu4c/source/i18n/repattrn.cpp +++ b/icu4c/source/i18n/repattrn.cpp @@ -588,7 +588,7 @@ void RegexPattern::dump() const { -const char RegexPattern::fgClassID = 0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegexPattern) //---------------------------------------------------------------------------------- // diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp index a8387677c14..1c2dd544ecc 100644 --- a/icu4c/source/i18n/smpdtfmt.cpp +++ b/icu4c/source/i18n/smpdtfmt.cpp @@ -48,16 +48,19 @@ U_NAMESPACE_BEGIN +/** + * Last-resort string to use for "GMT" when constructing time zone strings. + */ // For time zones that have no names, use strings GMT+minutes and // GMT-minutes. For instance, in France the time zone is GMT+60. // Also accepted are GMT+H:MM or GMT-H:MM. -const UChar SimpleDateFormat::fgGmt[] = {0x0047, 0x004D, 0x0054, 0x0000}; // "GMT" -const UChar SimpleDateFormat::fgGmtPlus[] = {0x0047, 0x004D, 0x0054, 0x002B, 0x0000}; // "GMT+" -const UChar SimpleDateFormat::fgGmtMinus[] = {0x0047, 0x004D, 0x0054, 0x002D, 0x0000}; // "GMT-" +static const UChar gGmt[] = {0x0047, 0x004D, 0x0054, 0x0000}; // "GMT" +static const UChar gGmtPlus[] = {0x0047, 0x004D, 0x0054, 0x002B, 0x0000}; // "GMT+" +static const UChar gGmtMinus[] = {0x0047, 0x004D, 0x0054, 0x002D, 0x0000}; // "GMT-" // This is a pattern-of-last-resort used when we can't load a usable pattern out // of a resource. -const UChar SimpleDateFormat::fgDefaultPattern[] = +static const UChar gDefaultPattern[] = { 0x79, 0x79, 0x79, 0x79, 0x4D, 0x4D, 0x64, 0x64, 0x20, 0x68, 0x68, 0x3A, 0x6D, 0x6D, 0x20, 0x61, 0 }; /* "yyyyMMdd hh:mm a" */ @@ -71,9 +74,9 @@ static const UChar SUPPRESS_NEGATIVE_PREFIX[] = {0xAB00, 0}; * These are the tags we expect to see in normal resource bundle files associated * with a locale. */ -const char SimpleDateFormat::fgDateTimePatternsTag[]="DateTimePatterns"; +static const char gDateTimePatternsTag[]="DateTimePatterns"; -const char SimpleDateFormat::fgClassID = 0; // Value is irrelevant +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleDateFormat) /** * This value of defaultCenturyStart indicates that the system default is to be @@ -179,7 +182,7 @@ SimpleDateFormat::SimpleDateFormat(EStyle timeStyle, */ SimpleDateFormat::SimpleDateFormat(const Locale& locale, UErrorCode& status) -: fPattern(fgDefaultPattern), +: fPattern(gDefaultPattern), fLocale(locale), fSymbols(NULL) { @@ -281,7 +284,7 @@ void SimpleDateFormat::construct(EStyle timeStyle, initializeCalendar(NULL, locale, status); // use Date Format Symbols' helper function to do the actual load. - ResourceBundle dateTimePatterns = DateFormatSymbols::getData(resources, fgDateTimePatternsTag, fCalendar?fCalendar->getType():NULL, status); + ResourceBundle dateTimePatterns = DateFormatSymbols::getData(resources, gDateTimePatternsTag, fCalendar?fCalendar->getType():NULL, status); if (U_FAILURE(status)) return; if (dateTimePatterns.getSize() <= kDateTime) @@ -667,11 +670,11 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo, cal.get(UCAL_DST_OFFSET, status); if (value < 0) { - appendTo += fgGmtMinus; + appendTo += gGmtMinus; value = -value; // suppress the '-' sign for text display. } else - appendTo += fgGmtPlus; + appendTo += gGmtPlus; zeroPaddingNumber(appendTo, (int32_t)(value/U_MILLIS_PER_HOUR), 2, 2); appendTo += (UChar)0x003A /*':'*/; @@ -1224,7 +1227,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC // characters of GMT+/-HH:MM etc. UnicodeString lcaseText(text); - UnicodeString lcaseGMT(fgGmt); + UnicodeString lcaseGMT(gGmt); int32_t sign = 0; int32_t offset; int32_t gmtLen = lcaseGMT.length(); diff --git a/icu4c/source/i18n/sortkey.cpp b/icu4c/source/i18n/sortkey.cpp index a07ae9da962..625468418e3 100644 --- a/icu4c/source/i18n/sortkey.cpp +++ b/icu4c/source/i18n/sortkey.cpp @@ -43,7 +43,7 @@ U_NAMESPACE_BEGIN #define kInvalidHashCode ((int32_t)0) #define kEmptyHashCode ((int32_t)1) -const char CollationKey::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationKey) CollationKey::CollationKey() : UObject(), fBogus(FALSE), fCount(0), fCapacity(0), diff --git a/icu4c/source/i18n/strmatch.cpp b/icu4c/source/i18n/strmatch.cpp index bfd2e672189..109cf8a8fd6 100644 --- a/icu4c/source/i18n/strmatch.cpp +++ b/icu4c/source/i18n/strmatch.cpp @@ -19,7 +19,7 @@ U_NAMESPACE_BEGIN const UChar EMPTY[] = { 0 }; // empty string: "" -const char StringMatcher::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringMatcher) StringMatcher::StringMatcher(const UnicodeString& theString, int32_t start, @@ -193,13 +193,13 @@ UBool StringMatcher::matchesIndexValue(uint8_t v) const { void StringMatcher::addMatchSetTo(UnicodeSet& toUnionTo) const { UChar32 ch; for (int32_t i=0; ilookupMatcher(ch); - if (matcher == NULL) { - toUnionTo.add(ch); - } else { - matcher->addMatchSetTo(toUnionTo); - } + ch = pattern.char32At(i); + const UnicodeMatcher* matcher = data->lookupMatcher(ch); + if (matcher == NULL) { + toUnionTo.add(ch); + } else { + matcher->addMatchSetTo(toUnionTo); + } } } diff --git a/icu4c/source/i18n/strmatch.h b/icu4c/source/i18n/strmatch.h index ba5edba0d3d..02250f3f5ce 100644 --- a/icu4c/source/i18n/strmatch.h +++ b/icu4c/source/i18n/strmatch.h @@ -198,14 +198,14 @@ class StringMatcher : public UnicodeFunctor, public UnicodeMatcher, public Unico * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); /** * Union the set of all characters that may output by this object @@ -244,11 +244,6 @@ class StringMatcher : public UnicodeFunctor, public UnicodeMatcher, public Unico */ int32_t matchLimit; - /** - * 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/stsearch.cpp b/icu4c/source/i18n/stsearch.cpp index a717b1765c7..a3f9b499d0f 100644 --- a/icu4c/source/i18n/stsearch.cpp +++ b/icu4c/source/i18n/stsearch.cpp @@ -17,7 +17,7 @@ U_NAMESPACE_BEGIN -const char StringSearch::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringSearch) // public constructors and destructors ----------------------------------- @@ -395,14 +395,14 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status) m_search_->matchedLength)) #endif ) { - if (m_search_->matchedIndex == USEARCH_DONE) { - ucol_setOffset(m_strsrch_->textIter, - m_search_->textLength, &status); - } - else { - ucol_setOffset(m_strsrch_->textIter, - m_search_->matchedIndex, &status); - } + if (m_search_->matchedIndex == USEARCH_DONE) { + ucol_setOffset(m_strsrch_->textIter, + m_search_->textLength, &status); + } + else { + ucol_setOffset(m_strsrch_->textIter, + m_search_->matchedIndex, &status); + } return m_search_->matchedIndex; } } diff --git a/icu4c/source/i18n/titletrn.cpp b/icu4c/source/i18n/titletrn.cpp index 99e40dda9ff..917b9e6f36e 100644 --- a/icu4c/source/i18n/titletrn.cpp +++ b/icu4c/source/i18n/titletrn.cpp @@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN -const char TitlecaseTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TitlecaseTransliterator) /** * ID for this transliterator. diff --git a/icu4c/source/i18n/titletrn.h b/icu4c/source/i18n/titletrn.h index 4a5ac4164ce..1706a9653d3 100644 --- a/icu4c/source/i18n/titletrn.h +++ b/icu4c/source/i18n/titletrn.h @@ -67,14 +67,14 @@ class U_I18N_API TitlecaseTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: @@ -97,15 +97,9 @@ class U_I18N_API TitlecaseTransliterator : public Transliterator { * CALL. */ static void cleanup(); - private: +private: Locale loc; UChar* buffer; - - /** - * 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/tolowtrn.cpp b/icu4c/source/i18n/tolowtrn.cpp index 1187412eb46..af4728f87fe 100644 --- a/icu4c/source/i18n/tolowtrn.cpp +++ b/icu4c/source/i18n/tolowtrn.cpp @@ -20,7 +20,7 @@ U_NAMESPACE_BEGIN -const char LowercaseTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LowercaseTransliterator) const char LowercaseTransliterator::_ID[] = "Any-Lower"; diff --git a/icu4c/source/i18n/tolowtrn.h b/icu4c/source/i18n/tolowtrn.h index 791781aa99c..a73e1793f82 100644 --- a/icu4c/source/i18n/tolowtrn.h +++ b/icu4c/source/i18n/tolowtrn.h @@ -60,14 +60,14 @@ class U_I18N_API LowercaseTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: @@ -84,17 +84,12 @@ class U_I18N_API LowercaseTransliterator : public Transliterator { UTransPosition& offsets, UBool isIncremental) const; - private: +private: Locale loc; UChar* buffer; static const char _ID[]; - /** - * 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/toupptrn.cpp b/icu4c/source/i18n/toupptrn.cpp index cf283566c29..52e9c43b899 100644 --- a/icu4c/source/i18n/toupptrn.cpp +++ b/icu4c/source/i18n/toupptrn.cpp @@ -20,7 +20,7 @@ U_NAMESPACE_BEGIN -const char UppercaseTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UppercaseTransliterator) const char UppercaseTransliterator::_ID[] = "Any-Upper"; diff --git a/icu4c/source/i18n/toupptrn.h b/icu4c/source/i18n/toupptrn.h index cf828b72406..40dd3923122 100644 --- a/icu4c/source/i18n/toupptrn.h +++ b/icu4c/source/i18n/toupptrn.h @@ -60,14 +60,14 @@ class U_I18N_API UppercaseTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: @@ -85,17 +85,12 @@ class U_I18N_API UppercaseTransliterator : public Transliterator { UTransPosition& offsets, UBool isIncremental) const; - private: +private: Locale loc; UChar* buffer; static const char _ID[]; - /** - * 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/translit.cpp b/icu4c/source/i18n/translit.cpp index a1f4813083a..78ec911e6c3 100644 --- a/icu4c/source/i18n/translit.cpp +++ b/icu4c/source/i18n/translit.cpp @@ -100,12 +100,6 @@ static const UChar EMPTY[] = {0}; //"" U_NAMESPACE_BEGIN -/** - * Class identifier for subclasses of Transliterator that do not - * define their class (anonymous subclasses). - */ -const char Transliterator::fgClassID = 0; // Value is irrelevant - /** * Return TRUE if the given UTransPosition is valid for text of * the given length. diff --git a/icu4c/source/i18n/unesctrn.cpp b/icu4c/source/i18n/unesctrn.cpp index ad8904bddaf..7236fb74201 100644 --- a/icu4c/source/i18n/unesctrn.cpp +++ b/icu4c/source/i18n/unesctrn.cpp @@ -73,7 +73,7 @@ static const UChar SPEC_Any[] = { END }; -const char UnescapeTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnescapeTransliterator) /** * Factory methods. Ignore the context. diff --git a/icu4c/source/i18n/unesctrn.h b/icu4c/source/i18n/unesctrn.h index 73f820c7621..67b22d68d7a 100644 --- a/icu4c/source/i18n/unesctrn.h +++ b/icu4c/source/i18n/unesctrn.h @@ -82,14 +82,14 @@ class U_I18N_API UnescapeTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: @@ -120,11 +120,6 @@ class U_I18N_API UnescapeTransliterator : public Transliterator { static UChar* copySpec(const UChar* spec); - /** - * 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/uni2name.cpp b/icu4c/source/i18n/uni2name.cpp index 324f2513e52..9538e3be517 100644 --- a/icu4c/source/i18n/uni2name.cpp +++ b/icu4c/source/i18n/uni2name.cpp @@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN -const char UnicodeNameTransliterator::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeNameTransliterator) const char UnicodeNameTransliterator::_ID[] = "Any-Name"; diff --git a/icu4c/source/i18n/uni2name.h b/icu4c/source/i18n/uni2name.h index d5cc88f3a17..53d498390f1 100644 --- a/icu4c/source/i18n/uni2name.h +++ b/icu4c/source/i18n/uni2name.h @@ -58,14 +58,14 @@ class U_I18N_API UnicodeNameTransliterator : public Transliterator { * * @draft ICU 2.2 */ - virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } + virtual UClassID getDynamicClassID() const; /** * 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(); protected: @@ -81,15 +81,10 @@ class U_I18N_API UnicodeNameTransliterator : public Transliterator { virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, UBool isIncremental) const; - private: +private: static const char _ID[]; - /** - * 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/unicode/choicfmt.h b/icu4c/source/i18n/unicode/choicfmt.h index 1a6011c05b2..8ec347fca7d 100644 --- a/icu4c/source/i18n/unicode/choicfmt.h +++ b/icu4c/source/i18n/unicode/choicfmt.h @@ -642,7 +642,7 @@ public: * @return The class ID for all objects of this class. * @stable ICU 2.0 */ - static inline UClassID getStaticClassID(void); + static UClassID getStaticClassID(void); private: // static cache management (thread-safe) @@ -666,13 +666,6 @@ private: */ static UnicodeString& dtos(double value, UnicodeString& string); - //static UMTX fgMutex; - //static NumberFormat* fgNumberFormat; - static const char fgClassID; - - static const UChar fgPositiveInfinity[]; - static const UChar fgNegativeInfinity[]; - ChoiceFormat(); // default constructor not implemented /** @@ -734,18 +727,6 @@ private: int32_t fCount; }; -inline UClassID -ChoiceFormat::getStaticClassID(void) -{ - return (UClassID)&fgClassID; -} - -inline UClassID -ChoiceFormat::getDynamicClassID() const -{ - return ChoiceFormat::getStaticClassID(); -} - inline UnicodeString& ChoiceFormat::format(const Formattable& obj, UnicodeString& appendTo, diff --git a/icu4c/source/i18n/unicode/coleitr.h b/icu4c/source/i18n/unicode/coleitr.h index 9a890266d21..3c2aafbe71a 100644 --- a/icu4c/source/i18n/unicode/coleitr.h +++ b/icu4c/source/i18n/unicode/coleitr.h @@ -121,248 +121,235 @@ U_NAMESPACE_BEGIN class U_I18N_API CollationElementIterator : public UObject { public: - // CollationElementIterator public data member ------------------------------ + // CollationElementIterator public data member ------------------------------ - /** - * NULLORDER indicates that an error has occured while processing - * @stable ICU 2.0 - */ - static int32_t const NULLORDER; + /** + * NULLORDER indicates that an error has occured while processing + * @stable ICU 2.0 + */ + static int32_t const NULLORDER; - // CollationElementIterator public constructor/destructor ------------------- + // CollationElementIterator public constructor/destructor ------------------- - /** - * Copy constructor. - * - * @param other the object to be copied from - * @stable ICU 2.0 - */ - CollationElementIterator(const CollationElementIterator& other); + /** + * Copy constructor. + * + * @param other the object to be copied from + * @stable ICU 2.0 + */ + CollationElementIterator(const CollationElementIterator& other); - /** - * Destructor - * @stable ICU 2.0 - */ - ~CollationElementIterator(); - - // CollationElementIterator public methods ---------------------------------- + /** + * Destructor + * @stable ICU 2.0 + */ + ~CollationElementIterator(); - /** - * Returns true if "other" is the same as "this" - * - * @param other the object to be compared - * @return true if "other" is the same as "this" - * @stable ICU 2.0 - */ - UBool operator==(const CollationElementIterator& other) const; + // CollationElementIterator public methods ---------------------------------- - /** - * Returns true if "other" is not the same as "this". - * - * @param other the object to be compared - * @return true if "other" is not the same as "this" - * @stable ICU 2.0 - */ - UBool operator!=(const CollationElementIterator& other) const; + /** + * Returns true if "other" is the same as "this" + * + * @param other the object to be compared + * @return true if "other" is the same as "this" + * @stable ICU 2.0 + */ + UBool operator==(const CollationElementIterator& other) const; - /** - * Resets the cursor to the beginning of the string. - * @stable ICU 2.0 - */ - void reset(void); - - /** - * Gets the ordering priority of the next character in the string. - * @param status the error code status. - * @return the next character's ordering. otherwise returns NULLORDER if an - * error has occured or if the end of string has been reached - * @stable ICU 2.0 - */ - int32_t next(UErrorCode& status); + /** + * Returns true if "other" is not the same as "this". + * + * @param other the object to be compared + * @return true if "other" is not the same as "this" + * @stable ICU 2.0 + */ + UBool operator!=(const CollationElementIterator& other) const; - /** - * Get the ordering priority of the previous collation element in the string. - * @param status the error code status. - * @return the previous element's ordering. otherwise returns NULLORDER if an - * error has occured or if the start of string has been reached - * @stable ICU 2.0 - */ - int32_t previous(UErrorCode& status); + /** + * Resets the cursor to the beginning of the string. + * @stable ICU 2.0 + */ + void reset(void); - /** - * Gets the primary order of a collation order. - * @param order the collation order - * @return the primary order of a collation order. - * @stable ICU 2.0 - */ - static int32_t primaryOrder(int32_t order); + /** + * Gets the ordering priority of the next character in the string. + * @param status the error code status. + * @return the next character's ordering. otherwise returns NULLORDER if an + * error has occured or if the end of string has been reached + * @stable ICU 2.0 + */ + int32_t next(UErrorCode& status); - /** - * Gets the secondary order of a collation order. - * @param order the collation order - * @return the secondary order of a collation order. - * @stable ICU 2.0 - */ - static int32_t secondaryOrder(int32_t order); + /** + * Get the ordering priority of the previous collation element in the string. + * @param status the error code status. + * @return the previous element's ordering. otherwise returns NULLORDER if an + * error has occured or if the start of string has been reached + * @stable ICU 2.0 + */ + int32_t previous(UErrorCode& status); - /** - * Gets the tertiary order of a collation order. - * @param order the collation order - * @return the tertiary order of a collation order. - * @stable ICU 2.0 - */ - static int32_t tertiaryOrder(int32_t order); + /** + * Gets the primary order of a collation order. + * @param order the collation order + * @return the primary order of a collation order. + * @stable ICU 2.0 + */ + static int32_t primaryOrder(int32_t order); - /** - * Return the maximum length of any expansion sequences that end with the - * specified comparison order. - * @param order a collation order returned by previous or next. - * @return maximum size of the expansion sequences ending with the collation - * element or 1 if collation element does not occur at the end of any - * expansion sequence - * @stable ICU 2.0 - */ - int32_t getMaxExpansion(int32_t order) const; + /** + * Gets the secondary order of a collation order. + * @param order the collation order + * @return the secondary order of a collation order. + * @stable ICU 2.0 + */ + static int32_t secondaryOrder(int32_t order); - /** - * Gets the comparison order in the desired strength. Ignore the other - * differences. - * @param order The order value - * @stable ICU 2.0 - */ - int32_t strengthOrder(int32_t order) const; + /** + * Gets the tertiary order of a collation order. + * @param order the collation order + * @return the tertiary order of a collation order. + * @stable ICU 2.0 + */ + static int32_t tertiaryOrder(int32_t order); - /** - * Sets the source string. - * @param str the source string. - * @param status the error code status. - * @stable ICU 2.0 - */ - void setText(const UnicodeString& str, UErrorCode& status); + /** + * Return the maximum length of any expansion sequences that end with the + * specified comparison order. + * @param order a collation order returned by previous or next. + * @return maximum size of the expansion sequences ending with the collation + * element or 1 if collation element does not occur at the end of any + * expansion sequence + * @stable ICU 2.0 + */ + int32_t getMaxExpansion(int32_t order) const; - /** - * Sets the source string. - * @param str the source character iterator. - * @param status the error code status. - * @stable ICU 2.0 - */ - void setText(CharacterIterator& str, UErrorCode& status); + /** + * Gets the comparison order in the desired strength. Ignore the other + * differences. + * @param order The order value + * @stable ICU 2.0 + */ + int32_t strengthOrder(int32_t order) const; - /** - * Checks if a comparison order is ignorable. - * @param order the collation order. - * @return TRUE if a character is ignorable, FALSE otherwise. - * @stable ICU 2.0 - */ - static UBool isIgnorable(int32_t order); + /** + * Sets the source string. + * @param str the source string. + * @param status the error code status. + * @stable ICU 2.0 + */ + void setText(const UnicodeString& str, UErrorCode& status); - /** - * Gets the offset of the currently processed character in the source string. - * @return the offset of the character. - * @stable ICU 2.0 - */ - int32_t getOffset(void) const; + /** + * Sets the source string. + * @param str the source character iterator. + * @param status the error code status. + * @stable ICU 2.0 + */ + void setText(CharacterIterator& str, UErrorCode& status); - /** - * Sets the offset of the currently processed character in the source string. - * @param newOffset the new offset. - * @param status the error code status. - * @return the offset of the character. - * @stable ICU 2.0 - */ - void setOffset(int32_t newOffset, UErrorCode& status); + /** + * Checks if a comparison order is ignorable. + * @param order the collation order. + * @return TRUE if a character is ignorable, FALSE otherwise. + * @stable ICU 2.0 + */ + static UBool isIgnorable(int32_t order); - /** - * ICU "poor man's RTTI", returns a UClassID for the actual class. - * - * @draft ICU 2.2 - */ - virtual inline UClassID getDynamicClassID() const; + /** + * Gets the offset of the currently processed character in the source string. + * @return the offset of the character. + * @stable ICU 2.0 + */ + int32_t getOffset(void) const; - /** - * ICU "poor man's RTTI", returns a UClassID for this class. - * - * @draft ICU 2.2 - */ - static inline UClassID getStaticClassID(); + /** + * Sets the offset of the currently processed character in the source string. + * @param newOffset the new offset. + * @param status the error code status. + * @return the offset of the character. + * @stable ICU 2.0 + */ + void setOffset(int32_t newOffset, UErrorCode& status); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @draft ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @draft ICU 2.2 + */ + static UClassID getStaticClassID(); protected: - // CollationElementIterator protected constructors -------------------------- - /** - * @stable ICU 2.0 - */ - friend class RuleBasedCollator; + // CollationElementIterator protected constructors -------------------------- + /** + * @stable ICU 2.0 + */ + friend class RuleBasedCollator; - /** - * CollationElementIterator constructor. This takes the source string and the - * collation object. The cursor will walk thru the source string based on the - * predefined collation rules. If the source string is empty, NULLORDER will - * be returned on the calls to next(). - * @param sourceText the source string. - * @param order the collation object. - * @param status the error code status. - * @stable ICU 2.0 - */ - CollationElementIterator(const UnicodeString& sourceText, - const RuleBasedCollator* order, UErrorCode& status); + /** + * CollationElementIterator constructor. This takes the source string and the + * collation object. The cursor will walk thru the source string based on the + * predefined collation rules. If the source string is empty, NULLORDER will + * be returned on the calls to next(). + * @param sourceText the source string. + * @param order the collation object. + * @param status the error code status. + * @stable ICU 2.0 + */ + CollationElementIterator(const UnicodeString& sourceText, + const RuleBasedCollator* order, UErrorCode& status); - /** - * CollationElementIterator constructor. This takes the source string and the - * collation object. The cursor will walk thru the source string based on the - * predefined collation rules. If the source string is empty, NULLORDER will - * be returned on the calls to next(). - * @param sourceText the source string. - * @param order the collation object. - * @param status the error code status. - * @stable ICU 2.0 - */ - CollationElementIterator(const CharacterIterator& sourceText, - const RuleBasedCollator* order, UErrorCode& status); - - // CollationElementIterator protected methods ------------------------------- + /** + * CollationElementIterator constructor. This takes the source string and the + * collation object. The cursor will walk thru the source string based on the + * predefined collation rules. If the source string is empty, NULLORDER will + * be returned on the calls to next(). + * @param sourceText the source string. + * @param order the collation object. + * @param status the error code status. + * @stable ICU 2.0 + */ + CollationElementIterator(const CharacterIterator& sourceText, + const RuleBasedCollator* order, UErrorCode& status); - /** - * Assignment operator - * - * @param other the object to be copied - * @stable ICU 2.0 - */ - const CollationElementIterator& - operator=(const CollationElementIterator& other); + // CollationElementIterator protected methods ------------------------------- + + /** + * Assignment operator + * + * @param other the object to be copied + * @stable ICU 2.0 + */ + const CollationElementIterator& + operator=(const CollationElementIterator& other); private: - CollationElementIterator(); // default constructor not implemented + CollationElementIterator(); // default constructor not implemented - // CollationElementIterator private data members ---------------------------- + // CollationElementIterator private data members ---------------------------- - /** - * Data wrapper for collation elements - */ - UCollationElements *m_data_; + /** + * Data wrapper for collation elements + */ + UCollationElements *m_data_; - /** - * Indicates if m_data_ belongs to this object. - */ - UBool isDataOwned_; + /** + * Indicates if m_data_ belongs to this object. + */ + UBool isDataOwned_; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; }; // CollationElementIterator inline method defination -------------------------- -inline UClassID -CollationElementIterator::getStaticClassID() -{ return (UClassID)&fgClassID; } - -inline UClassID -CollationElementIterator::getDynamicClassID() const -{ return CollationElementIterator::getStaticClassID(); } - /** * Get the primary order of a collation order. * @param order the collation order @@ -370,8 +357,8 @@ CollationElementIterator::getDynamicClassID() const */ inline int32_t CollationElementIterator::primaryOrder(int32_t order) { - order &= RuleBasedCollator::PRIMARYORDERMASK; - return (order >> RuleBasedCollator::PRIMARYORDERSHIFT); + order &= RuleBasedCollator::PRIMARYORDERMASK; + return (order >> RuleBasedCollator::PRIMARYORDERSHIFT); } /** @@ -381,8 +368,8 @@ inline int32_t CollationElementIterator::primaryOrder(int32_t order) */ inline int32_t CollationElementIterator::secondaryOrder(int32_t order) { - order = order & RuleBasedCollator::SECONDARYORDERMASK; - return (order >> RuleBasedCollator::SECONDARYORDERSHIFT); + order = order & RuleBasedCollator::SECONDARYORDERMASK; + return (order >> RuleBasedCollator::SECONDARYORDERSHIFT); } /** @@ -392,17 +379,17 @@ inline int32_t CollationElementIterator::secondaryOrder(int32_t order) */ inline int32_t CollationElementIterator::tertiaryOrder(int32_t order) { - return (order &= RuleBasedCollator::TERTIARYORDERMASK); + return (order &= RuleBasedCollator::TERTIARYORDERMASK); } inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const { - return ucol_getMaxExpansion(m_data_, (uint32_t)order); + return ucol_getMaxExpansion(m_data_, (uint32_t)order); } inline UBool CollationElementIterator::isIgnorable(int32_t order) { - return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE); + return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE); } U_NAMESPACE_END diff --git a/icu4c/source/i18n/unicode/coll.h b/icu4c/source/i18n/unicode/coll.h index fbb2adf27c1..595595bc6ed 100644 --- a/icu4c/source/i18n/unicode/coll.h +++ b/icu4c/source/i18n/unicode/coll.h @@ -652,13 +652,6 @@ public: * 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. - * Concrete subclasses of Format must implement getDynamicClassID() and also - * a static method and data member: - * static UClassID getStaticClassID() - * { - * return (UClassID)&fgClassID; - * } - * static char fgClassID; * @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. diff --git a/icu4c/source/i18n/unicode/decimfmt.h b/icu4c/source/i18n/unicode/decimfmt.h index 03313804773..1b4bcef3669 100644 --- a/icu4c/source/i18n/unicode/decimfmt.h +++ b/icu4c/source/i18n/unicode/decimfmt.h @@ -1088,7 +1088,7 @@ public: * @return The class ID for all objects of this class. * @stable ICU 2.0 */ - static inline UClassID getStaticClassID(void); + static UClassID getStaticClassID(void); /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. @@ -1104,8 +1104,6 @@ public: virtual UClassID getDynamicClassID(void) const; private: - static const char fgClassID; - DecimalFormat(); // default constructor not implemented /** @@ -1287,29 +1285,6 @@ private: int32_t fFormatWidth; EPadPosition fPadPosition; - // Constants for characters used in programmatic (unlocalized) patterns. - static const UChar kPatternZeroDigit; - static const UChar kPatternGroupingSeparator; - static const UChar kPatternDecimalSeparator; - static const UChar kPatternPerMill; - static const UChar kPatternPercent; - static const UChar kPatternDigit; - static const UChar kPatternSeparator; - static const UChar kPatternExponent; - static const UChar kPatternPlus; - static const UChar kPatternMinus; - static const UChar kPatternPadEscape; - - /** - * The CURRENCY_SIGN is the standard Unicode symbol for currency. It - * is used in patterns and substitued with either the currency symbol, - * or if it is doubled, with the international currency symbol. If the - * CURRENCY_SIGN is seen in a pattern, then the decimal separator is - * replaced with the monetary decimal separator. - */ - static const UChar kCurrencySign; - static const UChar kQuote; - protected: /** number of integer digits * @draft ICU 2.4 @@ -1321,14 +1296,6 @@ protected: static const int32_t kDoubleFractionDigits; }; -inline UClassID -DecimalFormat::getStaticClassID(void) -{ return (UClassID)&fgClassID; } - -inline UClassID -DecimalFormat::getDynamicClassID(void) const -{ return DecimalFormat::getStaticClassID(); } - inline UnicodeString& DecimalFormat::format(const Formattable& obj, UnicodeString& appendTo, diff --git a/icu4c/source/i18n/unicode/fmtable.h b/icu4c/source/i18n/unicode/fmtable.h index 02179ac9c7b..c9064c2f2bb 100644 --- a/icu4c/source/i18n/unicode/fmtable.h +++ b/icu4c/source/i18n/unicode/fmtable.h @@ -265,14 +265,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: /** @@ -306,20 +306,8 @@ private: } fValue; Type fType; - - /** - * 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 Formattable::getStaticClassID() -{ return (UClassID)&fgClassID; } - -inline UClassID Formattable::getDynamicClassID() const -{ return Formattable::getStaticClassID(); } - inline Formattable* Formattable::createArrayCopy(const Formattable* array, int32_t count) { diff --git a/icu4c/source/i18n/unicode/format.h b/icu4c/source/i18n/unicode/format.h index b773b7a0728..5deb93248b6 100644 --- a/icu4c/source/i18n/unicode/format.h +++ b/icu4c/source/i18n/unicode/format.h @@ -225,9 +225,6 @@ public: * Concrete subclasses of Format must implement getDynamicClassID() * and also a static method and data member: * - * static UClassID getStaticClassID() { return (UClassID)&fgClassID; } - * static char fgClassID; - * * @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. diff --git a/icu4c/source/i18n/unicode/msgfmt.h b/icu4c/source/i18n/unicode/msgfmt.h index 3fa678fd1a2..279c1037d15 100644 --- a/icu4c/source/i18n/unicode/msgfmt.h +++ b/icu4c/source/i18n/unicode/msgfmt.h @@ -593,10 +593,9 @@ public: * @return The class ID for all objects of this class. * @stable ICU 2.0 */ - static inline UClassID getStaticClassID(void); + static UClassID getStaticClassID(void); private: - static const char fgClassID; Locale fLocale; UnicodeString fPattern; @@ -768,15 +767,6 @@ private: friend class MessageFormatAdapter; // getFormatTypeList() access }; -inline UClassID -MessageFormat::getStaticClassID(void) -{ return (UClassID)&fgClassID; } - -inline UClassID -MessageFormat::getDynamicClassID() const -{ return MessageFormat::getStaticClassID(); } - - inline UnicodeString& MessageFormat::format(const Formattable& obj, UnicodeString& appendTo, diff --git a/icu4c/source/i18n/unicode/numfmt.h b/icu4c/source/i18n/unicode/numfmt.h index 8a515b2cacc..999b63206b5 100644 --- a/icu4c/source/i18n/unicode/numfmt.h +++ b/icu4c/source/i18n/unicode/numfmt.h @@ -589,19 +589,6 @@ public: public: - /** - * Return 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); - /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. * This method is to implement a simple version of RTTI, since not all @@ -640,7 +627,6 @@ private: static const int32_t fgMinIntegerDigits; private: - static const char fgClassID; enum EStyles { kNumberStyle, @@ -682,8 +668,8 @@ private: // ISO currency code UChar currency[4]; - friend class ICUNumberFormatFactory; // access to makeInstance, EStyles - friend class ICUNumberFormatService; + friend class ICUNumberFormatFactory; // access to makeInstance, EStyles + friend class ICUNumberFormatService; }; /** @@ -774,10 +760,6 @@ public: // ------------------------------------- -inline UClassID -NumberFormat::getStaticClassID(void) -{ return (UClassID)&fgClassID; } - inline UBool NumberFormat::isParseIntegerOnly() const { diff --git a/icu4c/source/i18n/unicode/rbnf.h b/icu4c/source/i18n/unicode/rbnf.h index 1103486263c..b65ca0a9e5c 100644 --- a/icu4c/source/i18n/unicode/rbnf.h +++ b/icu4c/source/i18n/unicode/rbnf.h @@ -787,31 +787,28 @@ public: */ virtual void setDefaultRuleSet(const UnicodeString& ruleSetName, UErrorCode& status); -private: - RuleBasedNumberFormat(); // default constructor not implemented - - void init(const UnicodeString& rules, UParseError& perror, UErrorCode& status); - void dispose(); - void stripWhitespace(UnicodeString& src); - void initDefaultRuleSet(); - void format(double number, NFRuleSet& ruleSet); - NFRuleSet* findRuleSet(const UnicodeString& name, UErrorCode& status) const; - - /* friend access */ - friend class NFSubstitution; - friend class NFRule; - friend class FractionalPartSubstitution; - - inline NFRuleSet * getDefaultRuleSet() const; - Collator * getCollator() const; - DecimalFormatSymbols * getDecimalFormatSymbols() const; - -private: - static const char fgClassID; - public: - static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; } - virtual UClassID getDynamicClassID(void) const { return getStaticClassID(); } + static UClassID getStaticClassID(void); + virtual UClassID getDynamicClassID(void) const; + +private: + RuleBasedNumberFormat(); // default constructor not implemented + + void init(const UnicodeString& rules, UParseError& perror, UErrorCode& status); + void dispose(); + void stripWhitespace(UnicodeString& src); + void initDefaultRuleSet(); + void format(double number, NFRuleSet& ruleSet); + NFRuleSet* findRuleSet(const UnicodeString& name, UErrorCode& status) const; + + /* friend access */ + friend class NFSubstitution; + friend class NFRule; + friend class FractionalPartSubstitution; + + inline NFRuleSet * getDefaultRuleSet() const; + Collator * getCollator() const; + DecimalFormatSymbols * getDecimalFormatSymbols() const; private: NFRuleSet **ruleSets; diff --git a/icu4c/source/i18n/unicode/regex.h b/icu4c/source/i18n/unicode/regex.h index a2dd88cb50d..7a4b91c90d1 100644 --- a/icu4c/source/i18n/unicode/regex.h +++ b/icu4c/source/i18n/unicode/regex.h @@ -338,14 +338,14 @@ public: * * @draft ICU 2.4 */ - virtual inline UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const; /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @draft ICU 2.4 */ - static inline UClassID getStaticClassID(); + static UClassID getStaticClassID(); private: // @@ -395,12 +395,6 @@ private: UChar32 fInitialChar; Regex8BitSet *fInitialChars8; - /** - * The address of this static class variable serves as this class's ID - * for ICU "poor man's RTTI". - */ - static const char fgClassID; - friend class RegexCompile; friend class RegexMatcher; @@ -786,14 +780,14 @@ public: * * @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 inline UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const; private: // Constructors and other object boilerplate are private. @@ -840,22 +834,8 @@ private: UErrorCode fDeferredStatus; // Save error state if that cannot be immediately // reported, or that permanently disables this matcher. - /** - * 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 RegexPattern::getStaticClassID() { return (UClassID)&fgClassID; } -inline UClassID RegexPattern::getDynamicClassID() const { return getStaticClassID(); } - -inline UClassID RegexMatcher::getStaticClassID() { return (UClassID)&fgClassID; } -inline UClassID RegexMatcher::getDynamicClassID() const { return getStaticClassID(); } - - U_NAMESPACE_END #endif // UCONFIG_NO_REGULAR_EXPRESSIONS #endif diff --git a/icu4c/source/i18n/unicode/search.h b/icu4c/source/i18n/unicode/search.h index 16b990e13cb..f301eae3878 100644 --- a/icu4c/source/i18n/unicode/search.h +++ b/icu4c/source/i18n/unicode/search.h @@ -100,7 +100,7 @@ public: * string accordingly without checking if the index is pointing to a * valid starting point to begin searching. * @param position within the text to be set. If position is less - * than or greater than the text range for searching, + * than or greater than the text range for searching, * an U_INDEX_OUTOFBOUNDS_ERROR will be returned * @param status for errors if it occurs * @stable ICU 2.0 @@ -307,7 +307,7 @@ public: * USEARCH_DONE will be returned and the iterator will be * adjusted to the index USEARCH_DONE * @param position where search if to start from. If position is less - * than or greater than the text range for searching, + * than or greater than the text range for searching, * an U_INDEX_OUTOFBOUNDS_ERROR will be returned * @param status for errors if it occurs * @return The character index of the first match following @@ -341,7 +341,7 @@ public: * USEARCH_DONE will be returned and the iterator will be * adjusted to the index USEARCH_DONE * @param position where search is to start from. If position is less - * than or greater than the text range for searching, + * than or greater than the text range for searching, * an U_INDEX_OUTOFBOUNDS_ERROR will be returned * @param status for errors if it occurs * @return The character index of the first match preceding @@ -440,7 +440,7 @@ protected: * is NULL, no break detection is attempted. * @see #handleNext * @see #handlePrev - * @stable ICU 2.0 + * @stable ICU 2.0 */ SearchIterator(const UnicodeString &text, BreakIterator *breakiter = NULL); @@ -462,7 +462,7 @@ protected: * is NULL, no break detection is attempted. * @see #handleNext * @see #handlePrev - * @stable ICU 2.0 + * @stable ICU 2.0 */ SearchIterator(CharacterIterator &text, BreakIterator *breakiter = NULL); @@ -472,7 +472,7 @@ protected: * Assignment operator. Sets this iterator to have the same behavior, * and iterate over the same text, as the one passed in. * @param that instance to be copied. - * @stable ICU 2.0 + * @stable ICU 2.0 */ SearchIterator & operator=(const SearchIterator &that); @@ -493,7 +493,7 @@ protected: * @return index at which the match starts, else if match is not found * USEARCH_DONE is returned * @see #setMatchLength - * @stable ICU 2.0 + * @stable ICU 2.0 */ virtual int32_t handleNext(int32_t position, UErrorCode &status) = 0; @@ -515,7 +515,7 @@ protected: * @return index at which the match starts, else if match is not found * USEARCH_DONE is returned * @see #setMatchLength - * @stable ICU 2.0 + * @stable ICU 2.0 */ virtual int32_t handlePrev(int32_t position, UErrorCode &status) = 0; @@ -528,7 +528,7 @@ protected: * @param length length of the matched text. * @see #handleNext * @see #handlePrev - * @stable ICU 2.0 + * @stable ICU 2.0 */ virtual void setMatchLength(int32_t length); @@ -540,7 +540,7 @@ protected: * @param position start offset of the matched text. * @see #handleNext * @see #handlePrev - * @stable ICU 2.0 + * @stable ICU 2.0 */ virtual void setMatchStart(int32_t position); diff --git a/icu4c/source/i18n/unicode/smpdtfmt.h b/icu4c/source/i18n/unicode/smpdtfmt.h index b8966c58e90..57ae973f3d8 100644 --- a/icu4c/source/i18n/unicode/smpdtfmt.h +++ b/icu4c/source/i18n/unicode/smpdtfmt.h @@ -557,7 +557,7 @@ public: * @return The class ID for all objects of this class. * @stable ICU 2.0 */ - static inline UClassID getStaticClassID(void); + static UClassID getStaticClassID(void); /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This @@ -584,12 +584,6 @@ public: virtual void adoptCalendar(Calendar* calendarToAdopt); private: - static const char fgClassID; - - static const char fgDateTimePatternsTag[]; // resource bundle tag for default date and time patterns - - static const UChar fgDefaultPattern[]; // date/time pattern of last resort - friend class DateFormat; void initializeDefaultCentury(void); @@ -762,16 +756,6 @@ private: */ void parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status); - - /** - * Last-resort string to use for "GMT" when constructing time zone strings. - */ - // For time zones that have no names, use strings GMT+minutes and - // GMT-minutes. For instance, in France the time zone is GMT+60. - static const UChar fgGmtPlus[]; - static const UChar fgGmtMinus[]; - static const UChar fgGmt[]; - /** * Used to map pattern characters to Calendar field identifiers. */ @@ -826,14 +810,6 @@ public: // TODO Not supposed to be public: make it private in 2.8! }; -inline UClassID -SimpleDateFormat::getStaticClassID(void) -{ return (UClassID)&fgClassID; } - -inline UClassID -SimpleDateFormat::getDynamicClassID(void) const -{ return SimpleDateFormat::getStaticClassID(); } - inline UDate SimpleDateFormat::get2DigitYearStart(UErrorCode& /*status*/) const { diff --git a/icu4c/source/i18n/unicode/sortkey.h b/icu4c/source/i18n/unicode/sortkey.h index 28fbfb0bb72..a4d24023201 100644 --- a/icu4c/source/i18n/unicode/sortkey.h +++ b/icu4c/source/i18n/unicode/sortkey.h @@ -226,14 +226,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: /** @@ -249,65 +249,52 @@ private: * Creates a collation key with a string. */ - /** - * If this CollationKey has capacity less than newSize, - * its internal capacity will be increased to newSize. - * @param newSize minimum size this CollationKey has to have - * @return this CollationKey - */ + /** + * If this CollationKey has capacity less than newSize, + * its internal capacity will be increased to newSize. + * @param newSize minimum size this CollationKey has to have + * @return this CollationKey + */ CollationKey& ensureCapacity(int32_t newSize); - /** - * Set the CollationKey to a "bogus" or invalid state - * @return this CollationKey - */ + /** + * Set the CollationKey to a "bogus" or invalid state + * @return this CollationKey + */ CollationKey& setToBogus(void); - /** - * Resets this CollationKey to an empty state - * @return this CollationKey - */ + /** + * Resets this CollationKey to an empty state + * @return this CollationKey + */ CollationKey& reset(void); - - /** - * Allow private access to RuleBasedCollator - */ + + /** + * Allow private access to RuleBasedCollator + */ friend class RuleBasedCollator; - /** - * Bogus status - */ + /** + * Bogus status + */ UBool fBogus; - /** - * Size of fBytes used to store the sortkey. i.e. up till the - * null-termination. - */ + /** + * Size of fBytes used to store the sortkey. i.e. up till the + * null-termination. + */ int32_t fCount; - /** - * Full size of the fBytes - */ + /** + * Full size of the fBytes + */ int32_t fCapacity; - /** - * Unique hash value of this CollationKey - */ + /** + * Unique hash value of this CollationKey + */ int32_t fHashCode; - /** - * Array to store the sortkey - */ + /** + * Array to store the sortkey + */ uint8_t* fBytes; - /** - * 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 -CollationKey::getStaticClassID() -{ return (UClassID)&fgClassID; } - -inline UClassID -CollationKey::getDynamicClassID() const -{ return CollationKey::getStaticClassID(); } - inline UBool CollationKey::operator!=(const CollationKey& other) const { diff --git a/icu4c/source/i18n/unicode/stsearch.h b/icu4c/source/i18n/unicode/stsearch.h index 3625c82be7e..2fbe798ea51 100644 --- a/icu4c/source/i18n/unicode/stsearch.h +++ b/icu4c/source/i18n/unicode/stsearch.h @@ -291,7 +291,7 @@ public: * string accordingly without checking if the index is pointing to a * valid starting point to begin searching. * @param position within the text to be set. If position is less - * than or greater than the text range for searching, + * than or greater than the text range for searching, * an U_INDEX_OUTOFBOUNDS_ERROR will be returned * @param status for errors if it occurs * @stable ICU 2.0 @@ -341,8 +341,8 @@ public: * Gets the collator used for the language rules. *

* Caller may modify but must not delete the RuleBasedCollator! - * Modifications to this collator will affect the original collator passed in to - * the StringSearch>/tt> constructor or to setCollator, if any. + * Modifications to this collator will affect the original collator passed in to + * the StringSearch>/tt> constructor or to setCollator, if any. * @return collator used for string search * @stable ICU 2.0 */ @@ -405,14 +405,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(); protected: @@ -492,21 +492,8 @@ private : */ UStringSearch *m_strsrch_; - /** - * 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 -StringSearch::getStaticClassID() -{ return (UClassID)&fgClassID; } - -inline UClassID -StringSearch::getDynamicClassID() const -{ return StringSearch::getStaticClassID(); } - U_NAMESPACE_END #endif /* #if !UCONFIG_NO_COLLATION */ diff --git a/icu4c/source/i18n/unicode/translit.h b/icu4c/source/i18n/unicode/translit.h index fdf2a8282a3..9a65e95d965 100644 --- a/icu4c/source/i18n/unicode/translit.h +++ b/icu4c/source/i18n/unicode/translit.h @@ -325,7 +325,7 @@ protected: * @draft ICU 2.4 */ Transliterator& operator=(const Transliterator&); - + /** * Create a transliterator from a basic ID. This is an ID * containing only the forward direction source, target, and @@ -541,7 +541,7 @@ protected: * incremental and non-incremental transliteration. Let * originalStart refer to the value of * pos.start upon entry. - * + * *

- * + * *

Implementations of this method should also obey the * following invariants:

* @@ -584,13 +584,13 @@ protected: *
  • Text before pos.contextStart and text after * pos.contextLimit should be ignored.
  • * - * + * *

    Subclasses may safely assume that all characters in * [pos.start, pos.limit) are filtered. * In other words, the filter has already been applied by the time * this method is called. See * filteredTransliterate(). - * + * *

    This method is not for public consumption. Calling * this method directly will transliterate * [pos.start, pos.limit) without @@ -598,19 +598,19 @@ protected: * transliterate() instead of this method. Subclass code * should call filteredTransliterate() instead of * this method.

    - * + * * @param text the buffer holding transliterated and * untransliterated text - * + * * @param pos the indices indicating the start, limit, context * start, and context limit of the text. - * + * * @param incremental if true, assume more text may be inserted at * pos.limit and act accordingly. Otherwise, * transliterate all text between pos.start and * pos.limit and move pos.start up to * pos.limit. - * + * * @see #transliterate * @draft ICU 2.4 */ @@ -644,7 +644,7 @@ private: * public API methods eventually call this method with a rollback argument * of TRUE. Other entities may call this method but rollback should be * FALSE. - * + * *

    If this transliterator has a filter, break up the input text into runs * of unfiltered characters. Pass each run to * .handleTransliterate(). @@ -808,7 +808,7 @@ public: * * @param ID a valid ID, as enumerated by getAvailableIDs() * @param dir either FORWARD or REVERSE. - * @param parseError Struct to recieve information on position + * @param parseError Struct to recieve information on position * of error if an error is encountered * @param status Output param to filled in with a success or an error. * @return A Transliterator object with the given ID @@ -845,7 +845,7 @@ public: * @param ID the id for the transliterator. * @param rules rules, separated by ';' * @param dir either FORWARD or REVERSE. - * @param parseError Struct to recieve information on position + * @param parseError Struct to recieve information on position * of error if an error is encountered * @param status Output param set to success/failure code. * @stable ICU 2.0 @@ -1034,7 +1034,7 @@ public: * Return the number of IDs currently registered with the system. * To retrieve the actual IDs, call getAvailableID(i) with * i from 0 to countAvailableIDs() - 1. - * @return the number of IDs currently registered with the system. + * @return the number of IDs currently registered with the system. * @stable ICU 2.0 */ static int32_t countAvailableIDs(void); @@ -1057,7 +1057,7 @@ public: * @stable ICU 2.0 */ static int32_t countAvailableSources(void); - + /** * Return a registered source specifier. * @param index which specifier to return, from 0 to n-1, where @@ -1069,7 +1069,7 @@ public: */ static UnicodeString& getAvailableSource(int32_t index, UnicodeString& result); - + /** * Return the number of registered target specifiers for a given * source specifier. @@ -1079,7 +1079,7 @@ public: * @stable ICU 2.0 */ static int32_t countAvailableTargets(const UnicodeString& source); - + /** * Return a registered target specifier for a given source. * @param index which specifier to return, from 0 to n-1, where @@ -1094,7 +1094,7 @@ public: static UnicodeString& getAvailableTarget(int32_t index, const UnicodeString& source, UnicodeString& result); - + /** * Return the number of registered variant specifiers for a given * source-target pair. @@ -1104,7 +1104,7 @@ public: */ static int32_t countAvailableVariants(const UnicodeString& source, const UnicodeString& target); - + /** * Return a registered variant specifier for a given source-target * pair. @@ -1130,43 +1130,43 @@ protected: * @internal */ static int32_t _countAvailableSources(void); - + /** * Non-mutexed internal method * @internal */ static UnicodeString& _getAvailableSource(int32_t index, - UnicodeString& result); - + UnicodeString& result); + /** * Non-mutexed internal method * @internal */ static int32_t _countAvailableTargets(const UnicodeString& source); - + /** * Non-mutexed internal method * @internal */ static UnicodeString& _getAvailableTarget(int32_t index, - const UnicodeString& source, - UnicodeString& result); - + const UnicodeString& source, + UnicodeString& result); + /** * Non-mutexed internal method * @internal */ static int32_t _countAvailableVariants(const UnicodeString& source, - const UnicodeString& target); - + const UnicodeString& target); + /** * Non-mutexed internal method * @internal */ static UnicodeString& _getAvailableVariant(int32_t index, - const UnicodeString& source, - const UnicodeString& target, - UnicodeString& result); + const UnicodeString& source, + const UnicodeString& target, + UnicodeString& result); protected: @@ -1180,33 +1180,15 @@ protected: public: - /** - * Return 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); - /** * 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. - * + * *

    Concrete subclasses of Transliterator that wish clients to * be able to identify them should implement getDynamicClassID() * and also a static method and data member: - * - *

    -     * static UClassID getStaticClassID() { return (UClassID)&fgClassID; }
    -     * static char fgClassID;
    -     * 
    * * Subclasses that do not implement this method will have a * dynamic class ID of Transliterator::getStatisClassID(). @@ -1218,23 +1200,11 @@ public: */ virtual UClassID getDynamicClassID(void) const = 0; -private: - - /** - * Class identifier for subclasses of Transliterator that do not - * define their class (anonymous subclasses). - */ - static const char fgClassID; - private: static UBool initializeRegistry(void); }; -inline UClassID -Transliterator::getStaticClassID(void) -{ return (UClassID)&fgClassID; } - inline int32_t Transliterator::getMaximumContextLength(void) const { return maximumContextLength; } diff --git a/icu4c/source/i18n/usearch.cpp b/icu4c/source/i18n/usearch.cpp index 17e4b7ea4dc..f98b393d107 100644 --- a/icu4c/source/i18n/usearch.cpp +++ b/icu4c/source/i18n/usearch.cpp @@ -39,13 +39,13 @@ static inline void setColEIterOffset(UCollationElements *elems, int32_t offset) { - collIterate *ci = &(elems->iteratordata_); - ci->pos = ci->string + offset; - ci->CEpos = ci->toReturn = ci->CEs; - if (ci->flags & UCOL_ITER_INNORMBUF) { - ci->flags = ci->origFlags; - } - ci->fcdPosition = NULL; + collIterate *ci = &(elems->iteratordata_); + ci->pos = ci->string + offset; + ci->CEpos = ci->toReturn = ci->CEs; + if (ci->flags & UCOL_ITER_INNORMBUF) { + ci->flags = ci->origFlags; + } + ci->fcdPosition = NULL; } /** @@ -404,7 +404,7 @@ inline void initialize(UStringSearch *strsrch, UErrorCode *status) int32_t cesize = pattern->CELength; int16_t minlength = cesize > expandlength - ? (int16_t)cesize - expandlength : 1; + ? (int16_t)cesize - expandlength : 1; pattern->defaultShiftSize = minlength; setShiftTable(pattern->shift, pattern->backShift, pattern->CE, cesize, expandlength, minlength, minlength); @@ -522,7 +522,7 @@ static inline int32_t getNextUStringSearchBaseOffset(UStringSearch *strsrch, int32_t textoffset) { - int32_t textlength = strsrch->search->textLength; + int32_t textlength = strsrch->search->textLength; if (strsrch->pattern.hasSuffixAccents && textoffset < textlength) { int32_t temp = textoffset; @@ -553,7 +553,7 @@ inline int32_t shiftForward(UStringSearch *strsrch, uint32_t ce, int32_t patternceindex) { - UPattern *pattern = &(strsrch->pattern); + UPattern *pattern = &(strsrch->pattern); if (ce != UCOL_NULLORDER) { int32_t shift = pattern->shift[hash(ce)]; // this is to adjust for characters in the middle of the @@ -745,9 +745,9 @@ UBool hasAccentsBeforeMatch(const UStringSearch *strsrch, int32_t start, uint32_t ignorable = TRUE; uint32_t firstce = strsrch->pattern.CE[0]; - setColEIterOffset(coleiter, start); + setColEIterOffset(coleiter, start); uint32_t ce = getCE(strsrch, ucol_next(coleiter, &status)); - if (U_FAILURE(status)) { + if (U_FAILURE(status)) { return TRUE; } while (ce != firstce) { @@ -759,26 +759,26 @@ UBool hasAccentsBeforeMatch(const UStringSearch *strsrch, int32_t start, return TRUE; } } - if (!ignorable && inNormBuf(coleiter)) { + if (!ignorable && inNormBuf(coleiter)) { // within normalization buffer, discontiguous handled here - return TRUE; + return TRUE; } - // within text + // within text int32_t temp = start; - // original code - // accent = (getFCD(strsrch->search->text, &temp, + // original code + // accent = (getFCD(strsrch->search->text, &temp, // strsrch->search->textLength) - // >> SECOND_LAST_BYTE_SHIFT_); - // however this code does not work well with VC7 .net in release mode. - // maybe the inlines for getFCD combined with shifting has bugs in - // VC7. anyways this is a work around. - UBool accent = getFCD(strsrch->search->text, &temp, + // >> SECOND_LAST_BYTE_SHIFT_); + // however this code does not work well with VC7 .net in release mode. + // maybe the inlines for getFCD combined with shifting has bugs in + // VC7. anyways this is a work around. + UBool accent = getFCD(strsrch->search->text, &temp, strsrch->search->textLength) > 0xFF; if (!accent) { - return checkExtraMatchAccents(strsrch, start, end, &status); + return checkExtraMatchAccents(strsrch, start, end, &status); } - if (!ignorable) { + if (!ignorable) { return TRUE; } if (start > 0) { @@ -993,13 +993,13 @@ UBool checkNextExactContractionMatch(UStringSearch *strsrch, const UChar *text = strsrch->search->text; // This part checks if either ends of the match contains potential // contraction. If so we'll have to iterate through them - // The start contraction needs to be checked since ucol_previous dumps - // all characters till the first safe character into the buffer. - // *start + 1 is used to test for the unsafe characters instead of *start - // because ucol_prev takes all unsafe characters till the first safe - // character ie *start. so by testing *start + 1, we can estimate if - // excess prefix characters has been included in the potential search - // results. + // The start contraction needs to be checked since ucol_previous dumps + // all characters till the first safe character into the buffer. + // *start + 1 is used to test for the unsafe characters instead of *start + // because ucol_prev takes all unsafe characters till the first safe + // character ie *start. so by testing *start + 1, we can estimate if + // excess prefix characters has been included in the potential search + // results. if ((*end < textlength && ucol_unsafeCP(text[*end], collator)) || (*start + 1 < textlength && ucol_unsafeCP(text[*start + 1], collator))) { @@ -1015,9 +1015,9 @@ UBool checkNextExactContractionMatch(UStringSearch *strsrch, // we are only looking for acute and ring \u030A and \u0301, we'll // have to skip the first ce in the expansion buffer. ucol_next(coleiter, status); - if (U_FAILURE(*status)) { - return FALSE; - } + if (U_FAILURE(*status)) { + return FALSE; + } if (ucol_getOffset(coleiter) != temp) { *start = temp; temp = ucol_getOffset(coleiter); @@ -1075,8 +1075,8 @@ inline UBool checkNextExactMatch(UStringSearch *strsrch, UCollationElements *coleiter = strsrch->textIter; int32_t start = getColElemIterOffset(coleiter, FALSE); - if (!checkNextExactContractionMatch(strsrch, &start, textoffset, status)) { - return FALSE; + if (!checkNextExactContractionMatch(strsrch, &start, textoffset, status)) { + return FALSE; } // this totally matches, however we need to check if it is repeating @@ -1085,16 +1085,16 @@ inline UBool checkNextExactMatch(UStringSearch *strsrch, hasAccentsBeforeMatch(strsrch, start, *textoffset) || !checkIdentical(strsrch, start, *textoffset) || hasAccentsAfterMatch(strsrch, start, *textoffset)) { - - (*textoffset) ++; + + (*textoffset) ++; *textoffset = getNextUStringSearchBaseOffset(strsrch, *textoffset); - return FALSE; + return FALSE; } // totally match, we will get rid of the ending ignorables. strsrch->search->matchedIndex = start; strsrch->search->matchedLength = *textoffset - start; - return TRUE; + return TRUE; } /** @@ -1638,7 +1638,7 @@ UBool checkNextCanonicalContractionMatch(UStringSearch *strsrch, const UChar *text = strsrch->search->text; // This part checks if either ends of the match contains potential // contraction. If so we'll have to iterate through them - if ((*end < textlength && ucol_unsafeCP(text[*end], collator)) || + if ((*end < textlength && ucol_unsafeCP(text[*end], collator)) || (*start + 1 < textlength && ucol_unsafeCP(text[*start + 1], collator))) { int32_t expansion = getExpansionPrefix(coleiter); @@ -1653,9 +1653,9 @@ UBool checkNextCanonicalContractionMatch(UStringSearch *strsrch, // we are only looking for acute and ring \u030A and \u0301, we'll // have to skip the first ce in the expansion buffer. ucol_next(coleiter, status); - if (U_FAILURE(*status)) { - return FALSE; - } + if (U_FAILURE(*status)) { + return FALSE; + } if (ucol_getOffset(coleiter) != temp) { *start = temp; temp = ucol_getOffset(coleiter); @@ -1835,9 +1835,9 @@ UBool checkPreviousExactContractionMatch(UStringSearch *strsrch, const UChar *text = strsrch->search->text; // This part checks if either if the start of the match contains potential // contraction. If so we'll have to iterate through them - // Since we used ucol_next while previously looking for the potential - // match, this guarantees that our end will not be a partial contraction, - // or a partial supplementary character. + // Since we used ucol_next while previously looking for the potential + // match, this guarantees that our end will not be a partial contraction, + // or a partial supplementary character. if (*start < textlength && ucol_unsafeCP(text[*start], collator)) { int32_t expansion = getExpansionSuffix(coleiter); UBool expandflag = expansion > 0; @@ -1851,9 +1851,9 @@ UBool checkPreviousExactContractionMatch(UStringSearch *strsrch, // we are only looking for A ring A\u030A, we'll have to skip the // last ce in the expansion buffer ucol_previous(coleiter, status); - if (U_FAILURE(*status)) { - return FALSE; - } + if (U_FAILURE(*status)) { + return FALSE; + } if (ucol_getOffset(coleiter) != temp) { *end = temp; temp = ucol_getOffset(coleiter); @@ -2267,11 +2267,11 @@ UBool checkPreviousCanonicalContractionMatch(UStringSearch *strsrch, int32_t temp = *end; const UCollator *collator = strsrch->collator; const UChar *text = strsrch->search->text; - // This part checks if either if the start of the match contains potential + // This part checks if either if the start of the match contains potential // contraction. If so we'll have to iterate through them - // Since we used ucol_next while previously looking for the potential - // match, this guarantees that our end will not be a partial contraction, - // or a partial supplementary character. + // Since we used ucol_next while previously looking for the potential + // match, this guarantees that our end will not be a partial contraction, + // or a partial supplementary character. if (*start < textlength && ucol_unsafeCP(text[*start], collator)) { int32_t expansion = getExpansionSuffix(coleiter); UBool expandflag = expansion > 0; @@ -2285,9 +2285,9 @@ UBool checkPreviousCanonicalContractionMatch(UStringSearch *strsrch, // we are only looking for A ring A\u030A, we'll have to skip the // last ce in the expansion buffer ucol_previous(coleiter, status); - if (U_FAILURE(*status)) { - return FALSE; - } + if (U_FAILURE(*status)) { + return FALSE; + } if (ucol_getOffset(coleiter) != temp) { *end = temp; temp = ucol_getOffset(coleiter); @@ -2739,10 +2739,10 @@ U_CAPI void U_EXPORT2 usearch_setText( UStringSearch *strsrch, strsrch->search->matchedLength = 0; strsrch->search->reset = TRUE; #if !UCONFIG_NO_BREAK_ITERATION - if (strsrch->search->breakIter != NULL) { - ubrk_setText(strsrch->search->breakIter, text, - textlength, status); - } + if (strsrch->search->breakIter != NULL) { + ubrk_setText(strsrch->search->breakIter, text, + textlength, status); + } #endif } } @@ -2787,7 +2787,7 @@ U_CAPI void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, uprv_init_collIterate(collator, strsrch->search->text, strsrch->search->textLength, &(strsrch->textIter->iteratordata_)); - strsrch->utilIter->iteratordata_.coll = collator; + strsrch->utilIter->iteratordata_.coll = collator; } } } @@ -2969,16 +2969,16 @@ U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, } } else { - if (search->matchedLength > 0) { - // if matchlength is 0 we are at the start of the iteration - if (search->isOverlap) { - ucol_setOffset(strsrch->textIter, offset + 1, status); - } - else { - ucol_setOffset(strsrch->textIter, - offset + search->matchedLength, status); - } - } + if (search->matchedLength > 0) { + // if matchlength is 0 we are at the start of the iteration + if (search->isOverlap) { + ucol_setOffset(strsrch->textIter, offset + 1, status); + } + else { + ucol_setOffset(strsrch->textIter, + offset + search->matchedLength, status); + } + } else { // for boundary check purposes. this will ensure that the // next match will not preceed the current offset @@ -2986,16 +2986,16 @@ U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, // in the code search->matchedIndex = offset - 1; } - - if (search->isCanonicalMatch) { - // can't use exact here since extra accents are allowed. - usearch_handleNextCanonical(strsrch, status); - } - else { - usearch_handleNextExact(strsrch, status); - } - } - + + if (search->isCanonicalMatch) { + // can't use exact here since extra accents are allowed. + usearch_handleNextCanonical(strsrch, status); + } + else { + usearch_handleNextExact(strsrch, status); + } + } + if (U_FAILURE(*status)) { return USEARCH_DONE; } @@ -3143,15 +3143,15 @@ UBool usearch_handleNextExact(UStringSearch *strsrch, UErrorCode *status) return FALSE; } - UCollationElements *coleiter = strsrch->textIter; + UCollationElements *coleiter = strsrch->textIter; int32_t textlength = strsrch->search->textLength; uint32_t *patternce = strsrch->pattern.CE; int32_t patterncelength = strsrch->pattern.CELength; int32_t textoffset = ucol_getOffset(coleiter); - // status used in setting coleiter offset, since offset is checked in - // shiftForward before setting the coleiter offset, status never - // a failure + // status used in setting coleiter offset, since offset is checked in + // shiftForward before setting the coleiter offset, status never + // a failure textoffset = shiftForward(strsrch, textoffset, UCOL_NULLORDER, patterncelength); while (textoffset <= textlength) @@ -3160,9 +3160,9 @@ UBool usearch_handleNextExact(UStringSearch *strsrch, UErrorCode *status) uint32_t targetce; UBool found = FALSE; uint32_t lastce = UCOL_NULLORDER; - - setColEIterOffset(coleiter, textoffset); - + + setColEIterOffset(coleiter, textoffset); + while (TRUE) { // finding the last pattern ce match, imagine composite characters // for example: search for pattern A in text \u00C0 @@ -3210,24 +3210,24 @@ UBool usearch_handleNextExact(UStringSearch *strsrch, UErrorCode *status) } if (!found) { - if (U_FAILURE(*status)) { - break; - } + if (U_FAILURE(*status)) { + break; + } textoffset = shiftForward(strsrch, textoffset, lastce, patternceindex); // status checked at loop. patternceindex = patterncelength; continue; } - - if (checkNextExactMatch(strsrch, &textoffset, status)) { + + if (checkNextExactMatch(strsrch, &textoffset, status)) { // status checked in ucol_setOffset - setColEIterOffset(coleiter, strsrch->search->matchedIndex); - return TRUE; + setColEIterOffset(coleiter, strsrch->search->matchedIndex); + return TRUE; } } setMatchNotFound(strsrch); - return FALSE; + return FALSE; } UBool usearch_handleNextCanonical(UStringSearch *strsrch, UErrorCode *status) @@ -3256,10 +3256,10 @@ UBool usearch_handleNextCanonical(UStringSearch *strsrch, UErrorCode *status) uint32_t targetce; UBool found = FALSE; uint32_t lastce = UCOL_NULLORDER; - - setColEIterOffset(coleiter, textoffset); - - while (TRUE) { + + setColEIterOffset(coleiter, textoffset); + + for (;;) { // finding the last pattern ce match, imagine composite characters // for example: search for pattern A in text \u00C0 // we'll have to skip \u0300 the grave first before we get to A @@ -3302,16 +3302,16 @@ UBool usearch_handleNextCanonical(UStringSearch *strsrch, UErrorCode *status) if (hasPatternAccents && !found) { strsrch->canonicalPrefixAccents[0] = 0; strsrch->canonicalSuffixAccents[0] = 0; - if (U_FAILURE(*status)) { - break; - } + if (U_FAILURE(*status)) { + break; + } found = doNextCanonicalMatch(strsrch, textoffset, status); } if (!found) { - if (U_FAILURE(*status)) { - break; - } + if (U_FAILURE(*status)) { + break; + } textoffset = shiftForward(strsrch, textoffset, lastce, patternceindex); // status checked at loop @@ -3357,10 +3357,10 @@ UBool usearch_handlePreviousExact(UStringSearch *strsrch, UErrorCode *status) UBool found = FALSE; uint32_t firstce = UCOL_NULLORDER; - // if status is a failure, ucol_setOffset does nothing + // if status is a failure, ucol_setOffset does nothing setColEIterOffset(coleiter, textoffset); - - while (TRUE) { + + for (;;) { // finding the first pattern ce match, imagine composite // characters. for example: search for pattern \u0300 in text // \u00C0, we'll have to skip A first before we get to @@ -3406,9 +3406,9 @@ UBool usearch_handlePreviousExact(UStringSearch *strsrch, UErrorCode *status) } if (!found) { - if (U_FAILURE(*status)) { - break; - } + if (U_FAILURE(*status)) { + break; + } textoffset = reverseShift(strsrch, textoffset, targetce, patternceindex); patternceindex = 0; @@ -3507,14 +3507,14 @@ UBool usearch_handlePreviousCanonical(UStringSearch *strsrch, if (hasPatternAccents && !found) { strsrch->canonicalPrefixAccents[0] = 0; strsrch->canonicalSuffixAccents[0] = 0; - if (U_FAILURE(*status)) { + if (U_FAILURE(*status)) { break; } found = doPreviousCanonicalMatch(strsrch, textoffset, status); } if (!found) { - if (U_FAILURE(*status)) { + if (U_FAILURE(*status)) { break; } textoffset = reverseShift(strsrch, textoffset, targetce, diff --git a/icu4c/source/test/intltest/uobjtest.cpp b/icu4c/source/test/intltest/uobjtest.cpp index 6f6c957aae0..78f7c465377 100644 --- a/icu4c/source/test/intltest/uobjtest.cpp +++ b/icu4c/source/test/intltest/uobjtest.cpp @@ -226,7 +226,7 @@ void UObjectTest::testIDs() #if !UCONFIG_NO_FORMATTING /* TESTCLASSID_FACTORY(NFSubstitution, NFSubstitution::makeSubstitution(8, */ /* TESTCLASSID_DEFAULT(DigitList); UMemory but not UObject*/ - TESTCLASSID_ABSTRACT(NumberFormat); + //TESTCLASSID_ABSTRACT(NumberFormat); TESTCLASSID_CTOR(DateFormatSymbols, (status)); TESTCLASSID_CTOR(DecimalFormatSymbols, (status)); #if UOBJTEST_TEST_INTERNALS @@ -301,7 +301,7 @@ void UObjectTest::testIDs() #if !UCONFIG_NO_TRANSLITERATION TESTCLASSID_FACTORY(TitlecaseTransliterator, Transliterator::createInstance(UnicodeString("Any-Title"), UTRANS_FORWARD, parseError, status)); - TESTCLASSID_ABSTRACT(Transliterator); + //TESTCLASSID_ABSTRACT(Transliterator); #if UOBJTEST_TEST_INTERNALS TESTCLASSID_CTOR(StringMatcher, (UnicodeString("x"), 0,0,0,TransliterationRuleData(status)));