]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/remtrans.cpp
ICU-6.2.14.tar.gz
[apple/icu.git] / icuSources / i18n / remtrans.cpp
1 /*
2 **********************************************************************
3 * Copyright (c) 2001-2003, 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 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RemoveTransliterator)
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 /* We don't need the ID or context. We just remove data */
40 return new RemoveTransliterator();
41 }
42
43 RemoveTransliterator::RemoveTransliterator() : Transliterator(::ID, 0) {}
44
45 RemoveTransliterator::~RemoveTransliterator() {}
46
47 Transliterator* RemoveTransliterator::clone(void) const {
48 return new RemoveTransliterator();
49 }
50
51 void RemoveTransliterator::handleTransliterate(Replaceable& text, UTransPosition& index,
52 UBool /*isIncremental*/) const {
53 // Our caller (filteredTransliterate) has already narrowed us
54 // to an unfiltered run. Delete it.
55 UnicodeString empty;
56 text.handleReplaceBetween(index.start, index.limit, empty);
57 int32_t len = index.limit - index.start;
58 index.contextLimit -= len;
59 index.limit -= len;
60 }
61 U_NAMESPACE_END
62
63 #endif /* #if !UCONFIG_NO_TRANSLITERATION */