/*
**********************************************************************
-* Copyright (c) 2001-2004, International Business Machines Corporation
+* Copyright (c) 2001-2012, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
* Date Name Description
#include "rbt_data.h"
#include "util.h"
#include "unicode/uniset.h"
+#include "unicode/utf16.h"
U_NAMESPACE_BEGIN
-static const UChar EMPTY[] = { 0 }; // empty string: ""
-
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringMatcher)
StringMatcher::StringMatcher(const UnicodeString& theString,
* and return the pointer.
*/
UnicodeMatcher* StringMatcher::toMatcher() const {
- return (UnicodeMatcher*) this;
+ StringMatcher *nonconst_this = const_cast<StringMatcher *>(this);
+ UnicodeMatcher *nonconst_base = static_cast<UnicodeMatcher *>(nonconst_this);
+
+ return nonconst_base;
}
/**
* and return the pointer.
*/
UnicodeReplacer* StringMatcher::toReplacer() const {
- return (UnicodeReplacer*) this;
+ StringMatcher *nonconst_this = const_cast<StringMatcher *>(this);
+ UnicodeReplacer *nonconst_base = static_cast<UnicodeReplacer *>(nonconst_this);
+
+ return nonconst_base;
}
/**
*/
void StringMatcher::addMatchSetTo(UnicodeSet& toUnionTo) const {
UChar32 ch;
- for (int32_t i=0; i<pattern.length(); i+=UTF_CHAR_LENGTH(ch)) {
+ for (int32_t i=0; i<pattern.length(); i+=U16_LENGTH(ch)) {
ch = pattern.char32At(i);
const UnicodeMatcher* matcher = data->lookupMatcher(ch);
if (matcher == NULL) {
}
}
- text.handleReplaceBetween(start, limit, EMPTY); // delete original text
+ text.handleReplaceBetween(start, limit, UnicodeString()); // delete original text
return outLen;
}
if (f != NULL) {
f->setData(data);
}
- i += UTF_CHAR_LENGTH(c);
- }
+ i += U16_LENGTH(c);
+ }
}
U_NAMESPACE_END