/*
**********************************************************************
- * Copyright (c) 2001-2004, International Business Machines
+ * Copyright (c) 2001-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
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);
}
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}.
*/