2001-04-04 06:46:17 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
|
|
|
* Copyright (c) 2001, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 04/02/2001 aliu Creation.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
2001-11-16 23:51:15 +00:00
|
|
|
#include "remtrans.h"
|
2001-04-04 06:46:17 +00:00
|
|
|
|
2001-11-29 18:03:51 +00:00
|
|
|
static const UChar ID[] = {65, 110, 121, 45, 0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x00}; /* "Any-Remove" */
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2001-11-29 18:03:51 +00:00
|
|
|
/**
|
|
|
|
* System registration hook.
|
|
|
|
*/
|
|
|
|
void RemoveTransliterator::registerIDs() {
|
|
|
|
|
|
|
|
Transliterator::_registerFactory(::ID, _create, integerToken(0));
|
|
|
|
|
2002-01-22 00:27:49 +00:00
|
|
|
Transliterator::_registerSpecialInverse(UNICODE_STRING_SIMPLE("Remove"),
|
|
|
|
UNICODE_STRING_SIMPLE("Null"), FALSE);
|
2001-11-29 18:03:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Factory method
|
|
|
|
*/
|
|
|
|
Transliterator* RemoveTransliterator::_create(const UnicodeString& ID,
|
|
|
|
Token /*context*/) {
|
|
|
|
return new RemoveTransliterator();
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveTransliterator::RemoveTransliterator() : Transliterator(::ID, 0) {}
|
|
|
|
|
|
|
|
RemoveTransliterator::~RemoveTransliterator() {}
|
2001-04-04 06:46:17 +00:00
|
|
|
|
|
|
|
Transliterator* RemoveTransliterator::clone(void) const {
|
|
|
|
return new RemoveTransliterator();
|
|
|
|
}
|
|
|
|
|
2001-07-17 23:36:41 +00:00
|
|
|
void RemoveTransliterator::handleTransliterate(Replaceable& text, UTransPosition& index,
|
2001-04-04 06:46:17 +00:00
|
|
|
UBool /*isIncremental*/) const {
|
2001-07-17 23:36:41 +00:00
|
|
|
// Our caller (filteredTransliterate) has already narrowed us
|
|
|
|
// to an unfiltered run. Delete it.
|
2001-04-04 06:46:17 +00:00
|
|
|
UnicodeString empty;
|
2001-07-17 23:36:41 +00:00
|
|
|
text.handleReplaceBetween(index.start, index.limit, empty);
|
|
|
|
int32_t len = index.limit - index.start;
|
|
|
|
index.contextLimit -= len;
|
|
|
|
index.limit -= len;
|
2001-04-04 06:46:17 +00:00
|
|
|
}
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_END
|
|
|
|
|