1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2001-2011, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * Date Name Description
9 * 04/02/2001 aliu Creation.
10 **********************************************************************
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_TRANSLITERATION
18 #include "unicode/unifilt.h"
20 static const UChar CURR_ID[] = {65, 110, 121, 45, 0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x00}; /* "Any-Remove" */
24 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RemoveTransliterator)
29 static Transliterator* RemoveTransliterator_create(const UnicodeString& /*ID*/,
30 Transliterator::Token /*context*/) {
31 /* We don't need the ID or context. We just remove data */
32 return new RemoveTransliterator();
36 * System registration hook.
38 void RemoveTransliterator::registerIDs() {
40 Transliterator::_registerFactory(UnicodeString(TRUE, ::CURR_ID, -1),
41 RemoveTransliterator_create, integerToken(0));
43 Transliterator::_registerSpecialInverse(UNICODE_STRING_SIMPLE("Remove"),
44 UNICODE_STRING_SIMPLE("Null"), FALSE);
47 RemoveTransliterator::RemoveTransliterator() : Transliterator(UnicodeString(TRUE, ::CURR_ID, -1), 0) {}
49 RemoveTransliterator::~RemoveTransliterator() {}
51 Transliterator* RemoveTransliterator::clone(void) const {
52 Transliterator* result = new RemoveTransliterator();
53 if (result != NULL && getFilter() != 0) {
54 result->adoptFilter((UnicodeFilter*)(getFilter()->clone()));
59 void RemoveTransliterator::handleTransliterate(Replaceable& text, UTransPosition& index,
60 UBool /*isIncremental*/) const {
61 // Our caller (filteredTransliterate) has already narrowed us
62 // to an unfiltered run. Delete it.
64 text.handleReplaceBetween(index.start, index.limit, empty);
65 int32_t len = index.limit - index.start;
66 index.contextLimit -= len;
71 #endif /* #if !UCONFIG_NO_TRANSLITERATION */