ICU-4296 Reduce the number of function exports

X-SVN-Rev: 16947
This commit is contained in:
George Rhoten 2004-12-14 16:59:34 +00:00
parent 3daf3898fb
commit d251279960
4 changed files with 24 additions and 50 deletions

View File

@ -32,28 +32,28 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EscapeTransliterator)
/**
* Factory methods
*/
Transliterator* EscapeTransliterator::_createUnicode(const UnicodeString& ID, Token /*context*/) {
static Transliterator* _createUnicode(const UnicodeString& ID, Transliterator::Token /*context*/) {
// Unicode: "U+10FFFF" hex, min=4, max=6
return new EscapeTransliterator(ID, UNIPRE, EMPTY, 16, 4, TRUE, NULL);
}
Transliterator* EscapeTransliterator::_createJava(const UnicodeString& ID, Token /*context*/) {
static Transliterator* _createJava(const UnicodeString& ID, Transliterator::Token /*context*/) {
// Java: "\\uFFFF" hex, min=4, max=4
return new EscapeTransliterator(ID, BS_u, EMPTY, 16, 4, FALSE, NULL);
}
Transliterator* EscapeTransliterator::_createC(const UnicodeString& ID, Token /*context*/) {
static Transliterator* _createC(const UnicodeString& ID, Transliterator::Token /*context*/) {
// C: "\\uFFFF" hex, min=4, max=4; \\U0010FFFF hex, min=8, max=8
return new EscapeTransliterator(ID, BS_u, EMPTY, 16, 4, TRUE,
new EscapeTransliterator(EMPTY, BS_U, EMPTY, 16, 8, TRUE, NULL));
}
Transliterator* EscapeTransliterator::_createXML(const UnicodeString& ID, Token /*context*/) {
static Transliterator* _createXML(const UnicodeString& ID, Transliterator::Token /*context*/) {
// XML: "" hex, min=1, max=6
return new EscapeTransliterator(ID, XMLPRE, SEMI, 16, 1, TRUE, NULL);
}
Transliterator* EscapeTransliterator::_createXML10(const UnicodeString& ID, Token /*context*/) {
static Transliterator* _createXML10(const UnicodeString& ID, Transliterator::Token /*context*/) {
// XML10: "&1114111;" dec, min=1, max=7 (not really "Any-Hex")
return new EscapeTransliterator(ID, XML10PRE, SEMI, 10, 1, TRUE, NULL);
}
Transliterator* EscapeTransliterator::_createPerl(const UnicodeString& ID, Token /*context*/) {
static Transliterator* _createPerl(const UnicodeString& ID, Transliterator::Token /*context*/) {
// Perl: "\\x{263A}" hex, min=1, max=6
return new EscapeTransliterator(ID, PERLPRE, RBRACE, 16, 1, TRUE, NULL);
}

View File

@ -137,17 +137,6 @@ class U_I18N_API EscapeTransliterator : public Transliterator {
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
private:
/**
* Factory methods
*/
static Transliterator* _createUnicode(const UnicodeString& ID, Token context);
static Transliterator* _createJava(const UnicodeString& ID, Token context);
static Transliterator* _createC(const UnicodeString& ID, Token context);
static Transliterator* _createXML(const UnicodeString& ID, Token context);
static Transliterator* _createXML10(const UnicodeString& ID, Token context);
static Transliterator* _createPerl(const UnicodeString& ID, Token context);
};
U_NAMESPACE_END

View File

@ -75,28 +75,39 @@ static const UChar SPEC_Any[] = {
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));
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);
}
@ -151,17 +162,6 @@ Transliterator* UnescapeTransliterator::clone() const {
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}.
*/

View File

@ -105,21 +105,6 @@ class U_I18N_API UnescapeTransliterator : public Transliterator {
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
private:
/**
* Factory methods
*/
static Transliterator* _createUnicode(const UnicodeString& ID, Token context);
static Transliterator* _createJava(const UnicodeString& ID, Token context);
static Transliterator* _createC(const UnicodeString& ID, Token context);
static Transliterator* _createXML(const UnicodeString& ID, Token context);
static Transliterator* _createXML10(const UnicodeString& ID, Token context);
static Transliterator* _createPerl(const UnicodeString& ID, Token context);
static Transliterator* _createAny(const UnicodeString& ID, Token context);
static UChar* copySpec(const UChar* spec);
};
U_NAMESPACE_END