]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/remtrans.cpp
ICU-6.2.15.tar.gz
[apple/icu.git] / icuSources / i18n / remtrans.cpp
CommitLineData
b75a7d8f
A
1/*
2**********************************************************************
374ca955 3* Copyright (c) 2001-2003, International Business Machines
b75a7d8f
A
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
17static const UChar ID[] = {65, 110, 121, 45, 0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x00}; /* "Any-Remove" */
18
19U_NAMESPACE_BEGIN
20
374ca955 21UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RemoveTransliterator)
b75a7d8f
A
22
23/**
24 * System registration hook.
25 */
26void 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 */
374ca955 37Transliterator* RemoveTransliterator::_create(const UnicodeString& /*ID*/,
b75a7d8f 38 Token /*context*/) {
374ca955 39 /* We don't need the ID or context. We just remove data */
b75a7d8f
A
40 return new RemoveTransliterator();
41}
42
43RemoveTransliterator::RemoveTransliterator() : Transliterator(::ID, 0) {}
44
45RemoveTransliterator::~RemoveTransliterator() {}
46
47Transliterator* RemoveTransliterator::clone(void) const {
48 return new RemoveTransliterator();
49}
50
51void 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}
61U_NAMESPACE_END
62
63#endif /* #if !UCONFIG_NO_TRANSLITERATION */