]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/remtrans.cpp
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / i18n / remtrans.cpp
1 /*
2 **********************************************************************
3 * Copyright (c) 2001, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 04/02/2001 aliu Creation.
8 **********************************************************************
9 */
10
11 #include "unicode/utypes.h"
12
13 #if !UCONFIG_NO_TRANSLITERATION
14
15 #include "remtrans.h"
16
17 static const UChar ID[] = {65, 110, 121, 45, 0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x00}; /* "Any-Remove" */
18
19 U_NAMESPACE_BEGIN
20
21 const char RemoveTransliterator::fgClassID=0;
22
23 /**
24 * System registration hook.
25 */
26 void RemoveTransliterator::registerIDs() {
27
28 Transliterator::_registerFactory(::ID, _create, integerToken(0));
29
30 Transliterator::_registerSpecialInverse(UNICODE_STRING_SIMPLE("Remove"),
31 UNICODE_STRING_SIMPLE("Null"), FALSE);
32 }
33
34 /**
35 * Factory method
36 */
37 Transliterator* RemoveTransliterator::_create(const UnicodeString& ID,
38 Token /*context*/) {
39 return new RemoveTransliterator();
40 }
41
42 RemoveTransliterator::RemoveTransliterator() : Transliterator(::ID, 0) {}
43
44 RemoveTransliterator::~RemoveTransliterator() {}
45
46 Transliterator* RemoveTransliterator::clone(void) const {
47 return new RemoveTransliterator();
48 }
49
50 void RemoveTransliterator::handleTransliterate(Replaceable& text, UTransPosition& index,
51 UBool /*isIncremental*/) const {
52 // Our caller (filteredTransliterate) has already narrowed us
53 // to an unfiltered run. Delete it.
54 UnicodeString empty;
55 text.handleReplaceBetween(index.start, index.limit, empty);
56 int32_t len = index.limit - index.start;
57 index.contextLimit -= len;
58 index.limit -= len;
59 }
60 U_NAMESPACE_END
61
62 #endif /* #if !UCONFIG_NO_TRANSLITERATION */