2001-04-04 06:46:17 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2003-12-19 21:29:27 +00:00
|
|
|
* Copyright (c) 2001-2003, International Business Machines
|
2001-04-04 06:46:17 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 04/02/2001 aliu Creation.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
2002-09-20 01:54:48 +00:00
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_TRANSLITERATION
|
|
|
|
|
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
|
|
|
|
|
2003-08-31 20:53:46 +00:00
|
|
|
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RemoveTransliterator)
|
2002-06-29 00:04:16 +00:00
|
|
|
|
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
|
|
|
|
*/
|
2003-12-04 01:56:25 +00:00
|
|
|
Transliterator* RemoveTransliterator::_create(const UnicodeString& /*ID*/,
|
2001-11-29 18:03:51 +00:00
|
|
|
Token /*context*/) {
|
2003-12-04 01:56:25 +00:00
|
|
|
/* We don't need the ID or context. We just remove data */
|
2001-11-29 18:03:51 +00:00
|
|
|
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
|
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_TRANSLITERATION */
|