2 **********************************************************************
3 * Copyright (c) 2001-2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 04/02/2001 aliu Creation.
8 **********************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_TRANSLITERATION
16 #include "unicode/unifilt.h"
18 static const UChar CURR_ID
[] = {65, 110, 121, 45, 0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x00}; /* "Any-Remove" */
22 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RemoveTransliterator
)
27 static Transliterator
* RemoveTransliterator_create(const UnicodeString
& /*ID*/,
28 Transliterator::Token
/*context*/) {
29 /* We don't need the ID or context. We just remove data */
30 return new RemoveTransliterator();
34 * System registration hook.
36 void RemoveTransliterator::registerIDs() {
38 Transliterator::_registerFactory(UnicodeString(TRUE
, ::CURR_ID
, -1),
39 RemoveTransliterator_create
, integerToken(0));
41 Transliterator::_registerSpecialInverse(UNICODE_STRING_SIMPLE("Remove"),
42 UNICODE_STRING_SIMPLE("Null"), FALSE
);
45 RemoveTransliterator::RemoveTransliterator() : Transliterator(UnicodeString(TRUE
, ::CURR_ID
, -1), 0) {}
47 RemoveTransliterator::~RemoveTransliterator() {}
49 Transliterator
* RemoveTransliterator::clone(void) const {
50 Transliterator
* result
= new RemoveTransliterator();
51 if (result
!= NULL
&& getFilter() != 0) {
52 result
->adoptFilter((UnicodeFilter
*)(getFilter()->clone()));
57 void RemoveTransliterator::handleTransliterate(Replaceable
& text
, UTransPosition
& index
,
58 UBool
/*isIncremental*/) const {
59 // Our caller (filteredTransliterate) has already narrowed us
60 // to an unfiltered run. Delete it.
62 text
.handleReplaceBetween(index
.start
, index
.limit
, empty
);
63 int32_t len
= index
.limit
- index
.start
;
64 index
.contextLimit
-= len
;
69 #endif /* #if !UCONFIG_NO_TRANSLITERATION */