2
**********************************************************************
3
* Copyright (C) 2001, International Business Machines
4
* Corporation and others. All Rights Reserved.
5
**********************************************************************
6
* Date Name Description
7
* 05/24/01 aliu Creation.
8
**********************************************************************
10
// THIS CLASS IS CURRENTLY UNUSED
14
#include "unicode/unifilt.h"
19
* Constructs a transliterator. For use by subclasses.
21
TransformTransliterator::TransformTransliterator(const UnicodeString& id,
22
UnicodeFilter* adoptedFilter) :
23
Transliterator(id, adoptedFilter) {
27
* Implements {@link Transliterator#handleTransliterate}.
28
* Ignore isIncremental since we don't need the context, and
29
* we work on codepoints.
31
void TransformTransliterator::handleTransliterate(Replaceable& text, UTransPosition& offsets,
32
UBool /*isIncremental*/) const {
35
for (start = offsets.start; start < offsets.limit; ++start) {
36
// Scan for the first character that is != its transform.
37
// If there are none, we fall out without doing anything.
38
UChar32 c = text.charAt(start);
39
if (hasTransform(c)) {
40
// There is a transforming character at start.
42
int32_t len = offsets.limit - start;
45
// Temporary string used to do transformations
47
for (int32_t i=start; i<offsets.limit; ++i) {
48
str.append(text.charAt(i));
51
// Transform the characters
53
text.handleReplaceBetween(start, start + len, str);
54
start += str.length();
56
int32_t lenDelta = str.length() - len;
57
offsets.limit += lenDelta;
58
offsets.contextLimit += lenDelta;
59
offsets.start = offsets.limit;
63
// assert(start == offsets.limit);
64
offsets.start = offsets.limit;
70
// THIS CLASS IS CURRENTLY UNUSED