/*
-**********************************************************************
-* Copyright (c) 2001, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* Date Name Description
-* 11/19/2001 aliu Creation.
-**********************************************************************
-*/
+ **********************************************************************
+ * Copyright (c) 2001-2008, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ * Date Name Description
+ * 11/19/2001 aliu Creation.
+ **********************************************************************
+ */
#include "unicode/utypes.h"
END
};
-const char UnescapeTransliterator::fgClassID=0;
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnescapeTransliterator)
+
+static UChar* copySpec(const UChar* spec) {
+ int32_t len = 0;
+ while (spec[len] != END) {
+ ++len;
+ }
+ ++len;
+ UChar *result = (UChar *)uprv_malloc(len*sizeof(UChar));
+ // Check for memory allocation error.
+ if (result != NULL) {
+ uprv_memcpy(result, spec, len*sizeof(result[0]));
+ }
+ return result;
+}
/**
* Factory methods. Ignore the context.
*/
-Transliterator* UnescapeTransliterator::_createUnicode(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createUnicode(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_Unicode);
}
-Transliterator* UnescapeTransliterator::_createJava(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createJava(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_Java);
}
-Transliterator* UnescapeTransliterator::_createC(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createC(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_C);
}
-Transliterator* UnescapeTransliterator::_createXML(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createXML(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_XML);
}
-Transliterator* UnescapeTransliterator::_createXML10(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createXML10(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_XML10);
}
-Transliterator* UnescapeTransliterator::_createPerl(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createPerl(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_Perl);
}
-Transliterator* UnescapeTransliterator::_createAny(const UnicodeString& ID, Token /*context*/) {
+static Transliterator* _createAny(const UnicodeString& ID, Transliterator::Token /*context*/) {
return new UnescapeTransliterator(ID, SPEC_Any);
}
void UnescapeTransliterator::registerIDs() {
Token t = integerToken(0);
- Transliterator::_registerFactory("Hex-Any/Unicode", _createUnicode, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any/Unicode"), _createUnicode, t);
- Transliterator::_registerFactory("Hex-Any/Java", _createJava, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any/Java"), _createJava, t);
- Transliterator::_registerFactory("Hex-Any/C", _createC, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any/C"), _createC, t);
- Transliterator::_registerFactory("Hex-Any/XML", _createXML, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any/XML"), _createXML, t);
- Transliterator::_registerFactory("Hex-Any/XML10", _createXML10, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any/XML10"), _createXML10, t);
- Transliterator::_registerFactory("Hex-Any/Perl", _createPerl, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any/Perl"), _createPerl, t);
- Transliterator::_registerFactory("Hex-Any", _createAny, t);
+ Transliterator::_registerFactory(UNICODE_STRING_SIMPLE("Hex-Any"), _createAny, t);
}
/**
return new UnescapeTransliterator(*this);
}
-UChar* UnescapeTransliterator::copySpec(const UChar* spec) {
- int32_t len = 0;
- while (spec[len] != END) {
- ++len;
- }
- ++len;
- UChar *result = (UChar *)uprv_malloc(len*sizeof(UChar));
- uprv_memcpy(result, spec, len*sizeof(result[0]));
- return result;
-}
-
/**
* Implements {@link Transliterator#handleTransliterate}.
*/