+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
-* Copyright (c) 2001-2004, International Business Machines
+* Copyright (c) 2001-2012, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
#include "unicode/unifilt.h"
#include "unicode/rep.h"
+#include "unicode/utf16.h"
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(UnicodeFilter)
UnicodeFilter::~UnicodeFilter() {}
/**
- * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
- * and return the pointer.
+ * UnicodeFunctor API.
+ * Note that UnicodeMatcher is a base class of UnicodeFilter.
*/
UnicodeMatcher* UnicodeFilter::toMatcher() const {
- return (UnicodeMatcher*) this;
+ return const_cast<UnicodeFilter *>(this);
}
void UnicodeFilter::setData(const TransliterationRuleData*) {}
UChar32 c;
if (offset < limit &&
contains(c = text.char32At(offset))) {
- offset += UTF_CHAR_LENGTH(c);
+ offset += U16_LENGTH(c);
return U_MATCH;
}
if (offset > limit &&
// the lead surrogate).
--offset;
if (offset >= 0) {
- offset -= UTF_CHAR_LENGTH(text.char32At(offset)) - 1;
+ offset -= U16_LENGTH(text.char32At(offset)) - 1;
}
return U_MATCH;
}