ICU-1008 Less static initialization.
X-SVN-Rev: 5446
This commit is contained in:
parent
839e1a6152
commit
3ba6b49b18
@ -26,8 +26,15 @@ const char* HexToUnicodeTransliterator::_ID = "Hex-Any";
|
||||
* The multiple backslashes resolve to a single backslash
|
||||
* in the effective prefix.
|
||||
*/
|
||||
const UnicodeString HexToUnicodeTransliterator::DEFAULT_PATTERN =
|
||||
UNICODE_STRING("\\\\u0000;\\\\U0000;u+0000;U+0000", 29);
|
||||
static const UChar gDEFAULT_PATTERN[] = {
|
||||
0x5C, 0x5C, 0x75, 0x30, 0x30, 0x30, 0x30, 0x3B, /* "\\u0000;" */
|
||||
0x5C, 0x5C, 0x55, 0x30, 0x30, 0x30, 0x30, 0x3B, /* "\\U0000;" */
|
||||
0x75, 0x2B, 0x30, 0x30, 0x30, 0x30, 0x3B, /* "u+0000;" */
|
||||
0x55, 0x2B, 0x30, 0x30, 0x30, 0x30, 0 /* "U+0000" */
|
||||
}; /* "\\u0000;\\U0000;u+0000;U+0000" */
|
||||
|
||||
const UChar *HexToUnicodeTransliterator::DEFAULT_PATTERN = gDEFAULT_PATTERN;
|
||||
// UNICODE_STRING("\\\\u0000;\\\\U0000;u+0000;U+0000", 29);
|
||||
|
||||
/**
|
||||
* Constructs a transliterator.
|
||||
|
@ -20,7 +20,8 @@
|
||||
#include "unicode/parsepos.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "unicode/rbt.h"
|
||||
#include "unicode/unicode.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "unicode/uniset.h"
|
||||
|
||||
// Operators
|
||||
@ -28,7 +29,6 @@
|
||||
#define FORWARD_RULE_OP ((UChar)0x003E) /*>*/
|
||||
#define REVERSE_RULE_OP ((UChar)0x003C) /*<*/
|
||||
#define FWDREV_RULE_OP ((UChar)0x007E) /*~*/ // internal rep of <> op
|
||||
#define OPERATORS UNICODE_STRING("=><", 3)
|
||||
|
||||
// Other special characters
|
||||
#define QUOTE ((UChar)0x0027) /*'*/
|
||||
@ -53,7 +53,9 @@
|
||||
// trailing SymbolTable.SYMBOL_REF character.
|
||||
// private static final char ANCHOR_END = '$';
|
||||
|
||||
const UnicodeString TransliteratorParser::gOPERATORS = OPERATORS;
|
||||
static const UChar gOPERATORS[] = {
|
||||
0x3D, 0x3E, 0x3C, 0 // "=><"
|
||||
};
|
||||
|
||||
// These are also used in Transliterator::toRules()
|
||||
static const int32_t ID_TOKEN_LEN = 2;
|
||||
@ -124,8 +126,7 @@ UnicodeString ParseData::parseReference(const UnicodeString& text,
|
||||
UnicodeString result;
|
||||
while (i < limit) {
|
||||
UChar c = text.charAt(i);
|
||||
if ((i==start && !Unicode::isUnicodeIdentifierStart(c)) ||
|
||||
!Unicode::isUnicodeIdentifierPart(c)) {
|
||||
if ((i==start && !u_isIDStart(c)) || !u_isIDPart(c)) {
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
@ -387,8 +388,6 @@ public:
|
||||
|
||||
TransliteratorParser& parser;
|
||||
|
||||
static const UnicodeString gOperators;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Methods
|
||||
|
||||
@ -424,8 +423,6 @@ private:
|
||||
RuleHalf& operator=(const RuleHalf&);
|
||||
};
|
||||
|
||||
const UnicodeString RuleHalf::gOperators = OPERATORS;
|
||||
|
||||
RuleHalf::RuleHalf(TransliteratorParser& p) : parser(p) {
|
||||
cursor = -1;
|
||||
ante = -1;
|
||||
@ -459,13 +456,13 @@ int32_t RuleHalf::parse(const UnicodeString& rule, int32_t pos, int32_t limit) {
|
||||
|
||||
while (pos < limit && !done) {
|
||||
UChar c = rule.charAt(pos++);
|
||||
if (Unicode::isWhitespace(c)) {
|
||||
if (u_isWhitespace(c)) {
|
||||
// Ignore whitespace. Note that this is not Unicode
|
||||
// spaces, but Java spaces -- a subset, representing
|
||||
// whitespace likely to be seen in code.
|
||||
continue;
|
||||
}
|
||||
if (gOperators.indexOf(c) >= 0) {
|
||||
if (u_strchr(gOPERATORS, c) != NULL) {
|
||||
--pos; // Backup to point to operator
|
||||
break;
|
||||
}
|
||||
@ -876,7 +873,7 @@ void TransliteratorParser::parseRules(UnicodeString& idBlockResult,
|
||||
int32_t mode = 0;
|
||||
while (pos < limit && U_SUCCESS(status)) {
|
||||
UChar c = rules.charAt(pos++);
|
||||
if (Unicode::isWhitespace(c)) {
|
||||
if (u_isWhitespace(c)) {
|
||||
// Ignore leading whitespace.
|
||||
continue;
|
||||
}
|
||||
@ -897,7 +894,7 @@ void TransliteratorParser::parseRules(UnicodeString& idBlockResult,
|
||||
rules.compare(pos, ID_TOKEN_LEN, ID_TOKEN) == 0) {
|
||||
pos += ID_TOKEN_LEN;
|
||||
c = rules.charAt(pos);
|
||||
while (Unicode::isWhitespace(c) && pos < limit) {
|
||||
while (u_isWhitespace(c) && pos < limit) {
|
||||
++pos;
|
||||
c = rules.charAt(pos);
|
||||
}
|
||||
@ -987,8 +984,7 @@ int32_t TransliteratorParser::parseRule(int32_t pos, int32_t limit) {
|
||||
return start;
|
||||
}
|
||||
|
||||
if (pos == limit ||
|
||||
gOPERATORS.indexOf(op = rule.charAt(pos++)) < 0) {
|
||||
if (pos == limit || u_strchr(gOPERATORS, (op = rule.charAt(pos++))) == NULL) {
|
||||
return syntaxError(RuleBasedTransliterator::MISSING_OPERATOR, rule, start);
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,6 @@ class TransliteratorParser {
|
||||
*/
|
||||
UnicodeString undefinedVariableName;
|
||||
|
||||
static const UnicodeString gOPERATORS;
|
||||
|
||||
public:
|
||||
|
||||
static TransliterationRuleData*
|
||||
|
@ -22,7 +22,7 @@
|
||||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: hextouni.h,v $ $Revision: 1.8 $ $Date: 2001/03/22 00:09:10 $
|
||||
* @version $RCSfile: hextouni.h,v $ $Revision: 1.9 $ $Date: 2001/08/06 23:57:45 $
|
||||
* @draft
|
||||
*/
|
||||
class U_I18N_API HexToUnicodeTransliterator : public Transliterator {
|
||||
@ -35,7 +35,7 @@ class U_I18N_API HexToUnicodeTransliterator : public Transliterator {
|
||||
/**
|
||||
* The pattern used by the default constructor
|
||||
*/
|
||||
static const UnicodeString DEFAULT_PATTERN;
|
||||
static const UChar *DEFAULT_PATTERN;
|
||||
|
||||
// Character constants defined here to avoid ASCII dependency
|
||||
enum {
|
||||
|
Loading…
Reference in New Issue
Block a user