+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
-* Copyright (C) 2001, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
#include "unicode/unifilt.h"
#include "unicode/uchar.h"
+#include "unicode/utf16.h"
#include "uni2name.h"
#include "cstring.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN
-const char UnicodeNameTransliterator::fgClassID=0;
-
-const char UnicodeNameTransliterator::_ID[] = "Any-Name";
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeNameTransliterator)
static const UChar OPEN_DELIM[] = {92,78,123,0}; // "\N{"
static const UChar CLOSE_DELIM = 125; // "}"
* Constructs a transliterator.
*/
UnicodeNameTransliterator::UnicodeNameTransliterator(UnicodeFilter* adoptedFilter) :
- Transliterator(_ID, adoptedFilter) {
+ Transliterator(UNICODE_STRING("Any-Name", 8), adoptedFilter) {
}
/**
/**
* Assignment operator.
*/
-UnicodeNameTransliterator& UnicodeNameTransliterator::operator=(
+/*UnicodeNameTransliterator& UnicodeNameTransliterator::operator=(
const UnicodeNameTransliterator& o) {
Transliterator::operator=(o);
return *this;
-}
+}*/
/**
* Transliterator API.
while (cursor < limit) {
UChar32 c = text.char32At(cursor);
- int32_t clen = UTF_CHAR_LENGTH(c);
+ int32_t clen = U16_LENGTH(c);
status = U_ZERO_ERROR;
if ((len = u_charName(c, U_EXTENDED_CHAR_NAME, buf, maxLen, &status)) >0 && !U_FAILURE(status)) {
str.truncate(OPEN_DELIM_LEN);
- str.append(UnicodeString(buf, len, "")).append(CLOSE_DELIM);
+ str.append(UnicodeString(buf, len, US_INV)).append(CLOSE_DELIM);
text.handleReplaceBetween(cursor, cursor+clen, str);
len += OPEN_DELIM_LEN + 1; // adjust for delimiters
cursor += len; // advance cursor and adjust for new text