/*
**********************************************************************
-* Copyright (c) 2002, International Business Machines Corporation
+* Copyright (c) 2002-2012, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
* Date Name Description
U_NAMESPACE_BEGIN
-const char FunctionReplacer::fgClassID=0;
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(FunctionReplacer)
/**
* Construct a replacer that takes the output of the given
/**
* Copy constructor.
*/
-FunctionReplacer::FunctionReplacer(const FunctionReplacer& other) {
+FunctionReplacer::FunctionReplacer(const FunctionReplacer& other) :
+ UnicodeFunctor(other),
+ UnicodeReplacer(other)
+{
translit = other.translit->clone();
replacer = other.replacer->clone();
}
* and return the pointer.
*/
UnicodeReplacer* FunctionReplacer::toReplacer() const {
- return (UnicodeReplacer*) this;
+ FunctionReplacer *nonconst_this = const_cast<FunctionReplacer *>(this);
+ UnicodeReplacer *nonconst_base = static_cast<UnicodeReplacer *>(nonconst_this);
+
+ return nonconst_base;
}
/**
int32_t FunctionReplacer::replace(Replaceable& text,
int32_t start,
int32_t limit,
- int32_t& cursor) {
+ int32_t& cursor)
+{
// First delegate to subordinate replacer
int32_t len = replacer->toReplacer()->replace(text, start, limit, cursor);
rule.truncate(0);
rule.append(AMPERSAND);
rule.append(translit->getID());
- rule.append(OPEN);
+ rule.append(OPEN, 2);
rule.append(replacer->toReplacer()->toReplacerPattern(str, escapeUnprintable));
- rule.append(CLOSE);
+ rule.append(CLOSE, 2);
return rule;
}