X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..4f1e1a09ce4daed860e35d359ce2fceccb0764e8:/icuSources/i18n/quant.cpp diff --git a/icuSources/i18n/quant.cpp b/icuSources/i18n/quant.cpp index 81bc0b55..acf579e1 100644 --- a/icuSources/i18n/quant.cpp +++ b/icuSources/i18n/quant.cpp @@ -1,5 +1,9 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* -* Copyright (C) 2001, International Business Machines Corporation and others. All Rights Reserved. +********************************************************************** +* Copyright (C) 2001-2012, International Business Machines +* Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description * 07/26/01 aliu Creation. @@ -16,7 +20,7 @@ U_NAMESPACE_BEGIN -const char Quantifier::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Quantifier) Quantifier::Quantifier(UnicodeFunctor *adoptedMatcher, uint32_t _minCount, uint32_t _maxCount) { @@ -29,6 +33,7 @@ Quantifier::Quantifier(UnicodeFunctor *adoptedMatcher, Quantifier::Quantifier(const Quantifier& o) : UnicodeFunctor(o), + UnicodeMatcher(o), matcher(o.matcher->clone()), minCount(o.minCount), maxCount(o.maxCount) @@ -51,7 +56,10 @@ UnicodeFunctor* Quantifier::clone() const { * and return the pointer. */ UnicodeMatcher* Quantifier::toMatcher() const { - return (UnicodeMatcher*) this; + Quantifier *nonconst_this = const_cast(this); + UnicodeMatcher *nonconst_base = static_cast(nonconst_this); + + return nonconst_base; } UMatchDegree Quantifier::matches(const Replaceable& text, @@ -91,7 +99,7 @@ UMatchDegree Quantifier::matches(const Replaceable& text, */ UnicodeString& Quantifier::toPattern(UnicodeString& result, UBool escapeUnprintable) const { - result.truncate(0); + result.truncate(0); matcher->toMatcher()->toPattern(result, escapeUnprintable); if (minCount == 0) { if (maxCount == 1) { @@ -125,7 +133,7 @@ UBool Quantifier::matchesIndexValue(uint8_t v) const { */ void Quantifier::addMatchSetTo(UnicodeSet& toUnionTo) const { if (maxCount > 0) { - matcher->toMatcher()->addMatchSetTo(toUnionTo); + matcher->toMatcher()->addMatchSetTo(toUnionTo); } } @@ -133,7 +141,7 @@ void Quantifier::addMatchSetTo(UnicodeSet& toUnionTo) const { * Implement UnicodeFunctor */ void Quantifier::setData(const TransliterationRuleData* d) { - matcher->setData(d); + matcher->setData(d); } U_NAMESPACE_END