ICU-170 use UnicodeString::length() instead of the deprecated size()
X-SVN-Rev: 339
This commit is contained in:
parent
1e7ac47da4
commit
54ba2e3819
@ -43,7 +43,7 @@ UnicodeConverterCPP::UnicodeConverterCPP(const UnicodeString& name, UErrorCode&
|
||||
{
|
||||
char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
|
||||
int i;
|
||||
name.extract(0, i = name.size(), myName);
|
||||
name.extract(0, i = name.length(), myName);
|
||||
myName[i]='\0';
|
||||
myUnicodeConverter = ucnv_open(myName, &err);
|
||||
}
|
||||
@ -139,7 +139,7 @@ UnicodeConverterCPP::fromUnicodeString(char* target,
|
||||
ucnv_reset(&myConverter);
|
||||
|
||||
|
||||
mySourceLength = source.size();
|
||||
mySourceLength = source.length();
|
||||
mySource = source.getUChars();
|
||||
myTarget = target;
|
||||
ucnv_fromUnicode(&myConverter,
|
||||
@ -211,7 +211,7 @@ UnicodeConverterCPP::toUnicodeString(UnicodeString& target,
|
||||
&err);
|
||||
|
||||
/*appends what we got thus far to the UnicodeString*/
|
||||
target.replace((UTextOffset)target.size(),
|
||||
target.replace((UTextOffset)target.length(),
|
||||
myTargetUCharsAlias - myTargetUChars,
|
||||
myTargetUChars,
|
||||
myTargetUCharsAlias - myTargetUChars);
|
||||
|
@ -15,10 +15,10 @@ void T_fillOutputParams(const UnicodeString* temp,
|
||||
UErrorCode* status)
|
||||
{
|
||||
|
||||
const int32_t actual = temp->size();
|
||||
const int32_t actual = temp->length();
|
||||
const bool_t overflowed = actual >= resultLength;
|
||||
const int32_t returnedSize = icu_min(actual, resultLength-1);
|
||||
if ((temp->size() < resultLength) && (result != temp->getUChars()) && (returnedSize > 0)) {
|
||||
if ((temp->length() < resultLength) && (result != temp->getUChars()) && (returnedSize > 0)) {
|
||||
u_strcpy(result, temp->getUChars());
|
||||
}
|
||||
|
||||
|
@ -172,20 +172,20 @@ Locale::Locale( const UnicodeString& newLanguage,
|
||||
UnicodeString newVariantCopy(newVariant);
|
||||
|
||||
|
||||
if (newCountry.size() > 0 ||
|
||||
newVariantCopy.size() > 0 )
|
||||
if (newCountry.length() > 0 ||
|
||||
newVariantCopy.length() > 0 )
|
||||
{
|
||||
togo += sep;
|
||||
togo += newCountry;
|
||||
}
|
||||
|
||||
int vsize = newVariantCopy.size();
|
||||
int vsize = newVariantCopy.length();
|
||||
if (vsize > 0)
|
||||
{
|
||||
int i = 0;
|
||||
//We need to trim variant codes : (_*)$var(_*) --> $var
|
||||
while ((i<vsize) && newVariantCopy[i] == sep) newVariantCopy.remove(i++, 1);
|
||||
i = newVariantCopy.size() - 1;
|
||||
i = newVariantCopy.length() - 1;
|
||||
while (i && (newVariantCopy[i] == sep)) newVariantCopy.remove(i--, 1);
|
||||
|
||||
togo += sep ;
|
||||
@ -331,7 +331,7 @@ Locale::setHashCode()
|
||||
fullNameUString += UnicodeString(country, "");
|
||||
fullNameUString += UnicodeString(variant, "");
|
||||
const UChar *key = fullNameUString.getUChars();
|
||||
int32_t len = fullNameUString.size();
|
||||
int32_t len = fullNameUString.length();
|
||||
int32_t hash = 0;
|
||||
const UChar *limit = key + len;
|
||||
int32_t inc = (len >= 128 ? len/64 : 1);
|
||||
@ -431,7 +431,7 @@ Locale::getISO3Language(UnicodeString& lang, UErrorCode& status) const
|
||||
return lang;
|
||||
|
||||
lang = uloc_getISO3Language(fullName);
|
||||
if (lang.size() == 0)
|
||||
if (lang.length() == 0)
|
||||
status = U_MISSING_RESOURCE_ERROR;
|
||||
|
||||
return lang;
|
||||
@ -452,7 +452,7 @@ Locale::getISO3Country(UnicodeString& cntry, UErrorCode& status) const
|
||||
return cntry;
|
||||
|
||||
cntry = uloc_getISO3Country(fullName);
|
||||
if (cntry.size() == 0)
|
||||
if (cntry.length() == 0)
|
||||
status = U_MISSING_RESOURCE_ERROR;
|
||||
|
||||
return cntry;
|
||||
@ -778,7 +778,7 @@ Locale::getLanguagesForCountry(const UnicodeString& country, int32_t& count)
|
||||
break;
|
||||
UnicodeString compressedValues;
|
||||
compressedCtry2LangMapping.extractBetween(i, j, compressedValues);
|
||||
UnicodeString *values = new UnicodeString[compressedValues.size() / 2];
|
||||
UnicodeString *values = new UnicodeString[compressedValues.length() / 2];
|
||||
int32_t valLen = sizeof(values) / sizeof(values[0]);
|
||||
for (int32_t k = 0; k < valLen; ++k)
|
||||
compressedValues.extractBetween(k * 2, (k * 2) + 2, values[k]);
|
||||
|
@ -188,14 +188,14 @@ Normalizer::compose(const UnicodeString& source,
|
||||
uint16_t minDecomp = compat ? 0 : DecompData::MAX_COMPAT;
|
||||
|
||||
UTextOffset i = 0;
|
||||
while (i < source.size() || explodePos != EMPTY) {
|
||||
while (i < source.length() || explodePos != EMPTY) {
|
||||
// Get the next char from either the buffer or the source
|
||||
UChar ch;
|
||||
if (explodePos == EMPTY) {
|
||||
ch = source[i++];
|
||||
} else {
|
||||
ch = explodeBuf[explodePos++];
|
||||
if (explodePos >= explodeBuf.size()) {
|
||||
if (explodePos >= explodeBuf.length()) {
|
||||
explodePos = EMPTY;
|
||||
explodeBuf.truncate(0);
|
||||
}
|
||||
@ -209,7 +209,7 @@ Normalizer::compose(const UnicodeString& source,
|
||||
if (type == ComposeData::BASE) {
|
||||
classesSeen = 0;
|
||||
baseIndex = index;
|
||||
basePos = result.size();
|
||||
basePos = result.length();
|
||||
result += ch;
|
||||
}
|
||||
else if (type == ComposeData::COMBINING || type == ComposeData::NON_COMPOSING_COMBINING)
|
||||
@ -244,7 +244,7 @@ Normalizer::compose(const UnicodeString& source,
|
||||
// base character. There are only four characters in Unicode that have
|
||||
// this problem. If they are fixed in Unicode 3.0, this code can go away.
|
||||
//
|
||||
UTextOffset len = result.size();
|
||||
UTextOffset len = result.length();
|
||||
if (len - basePos > 1) {
|
||||
for (UTextOffset j = basePos+1; j < len; j++) {
|
||||
explodeBuf += result[j];
|
||||
@ -273,7 +273,7 @@ Normalizer::compose(const UnicodeString& source,
|
||||
else if (type == ComposeData::INITIAL_JAMO) {
|
||||
classesSeen = 0;
|
||||
baseIndex = ComposeData::INITIAL_JAMO_INDEX;
|
||||
basePos = result.size();
|
||||
basePos = result.length();
|
||||
result += ch;
|
||||
}
|
||||
else if (type == ComposeData::MEDIAL_JAMO && classesSeen == 0
|
||||
@ -345,14 +345,14 @@ UChar Normalizer::nextCompose()
|
||||
uint16_t index = charInfo >> ComposeData::INDEX_SHIFT;
|
||||
|
||||
if (type == ComposeData::BASE) {
|
||||
if (buffer.size() > 0 && chFromText && explodePos == EMPTY) {
|
||||
if (buffer.length() > 0 && chFromText && explodePos == EMPTY) {
|
||||
// When we hit a base char in the source text, we can return the text
|
||||
// that's been composed so far. We'll re-process this char next time through.
|
||||
break;
|
||||
}
|
||||
classesSeen = 0;
|
||||
baseIndex = index;
|
||||
basePos = buffer.size();
|
||||
basePos = buffer.length();
|
||||
buffer += ch;
|
||||
lastBase = ch;
|
||||
}
|
||||
@ -390,7 +390,7 @@ UChar Normalizer::nextCompose()
|
||||
// base character. There are only four characters in Unicode that have
|
||||
// this problem. If they are fixed in Unicode 3.0, this code can go away.
|
||||
//
|
||||
UTextOffset len = buffer.size();
|
||||
UTextOffset len = buffer.length();
|
||||
if (len - basePos > 1) {
|
||||
for (UTextOffset j = basePos+1; j < len; j++) {
|
||||
explodeBuf += buffer[j];
|
||||
@ -417,14 +417,14 @@ UChar Normalizer::nextCompose()
|
||||
explodePos = 0;
|
||||
}
|
||||
else if (type == ComposeData::INITIAL_JAMO) {
|
||||
if (buffer.size() > 0 && chFromText && explodePos == EMPTY) {
|
||||
if (buffer.length() > 0 && chFromText && explodePos == EMPTY) {
|
||||
// When we hit a base char in the source text, we can return the text
|
||||
// that's been composed so far. We'll re-process this char next time through.
|
||||
break;
|
||||
}
|
||||
classesSeen = 0;
|
||||
baseIndex = ComposeData::INITIAL_JAMO_INDEX;
|
||||
basePos = buffer.size();
|
||||
basePos = buffer.length();
|
||||
buffer += ch;
|
||||
}
|
||||
else if (type == ComposeData::MEDIAL_JAMO && classesSeen == 0
|
||||
@ -461,15 +461,15 @@ UChar Normalizer::nextCompose()
|
||||
chFromText = TRUE;
|
||||
} else {
|
||||
ch = explodeBuf[explodePos++];
|
||||
if (explodePos >= explodeBuf.size()) {
|
||||
if (explodePos >= explodeBuf.length()) {
|
||||
explodePos = EMPTY;
|
||||
explodeBuf.truncate(0);
|
||||
}
|
||||
chFromText = FALSE;
|
||||
}
|
||||
}
|
||||
if (buffer.size() > 0) {
|
||||
bufferLimit = buffer.size() - 1;
|
||||
if (buffer.length() > 0) {
|
||||
bufferLimit = buffer.length() - 1;
|
||||
ch = buffer[0];
|
||||
} else {
|
||||
ch = DONE;
|
||||
@ -514,7 +514,7 @@ UChar Normalizer::prevCompose()
|
||||
}
|
||||
}
|
||||
// If there's more than one character in the buffer, compose it all at once....
|
||||
if (buffer.size() > 0) {
|
||||
if (buffer.length() > 0) {
|
||||
// TODO: The performance of this is awful; add a way to compose
|
||||
// a UnicodeString& in place.
|
||||
UnicodeString composed;
|
||||
@ -522,8 +522,8 @@ UChar Normalizer::prevCompose()
|
||||
buffer.truncate(0);
|
||||
buffer += composed;
|
||||
|
||||
if (buffer.size() > 1) {
|
||||
bufferLimit = bufferPos = buffer.size() - 1;
|
||||
if (buffer.length() > 1) {
|
||||
bufferLimit = bufferPos = buffer.length() - 1;
|
||||
ch = buffer[bufferPos];
|
||||
} else {
|
||||
ch = buffer[0];
|
||||
@ -538,7 +538,7 @@ UChar Normalizer::prevCompose()
|
||||
|
||||
void Normalizer::bubbleAppend(UnicodeString& target, UChar ch, uint32_t cclass) {
|
||||
UTextOffset i;
|
||||
for (i = target.size() - 1; i > 0; --i) {
|
||||
for (i = target.length() - 1; i > 0; --i) {
|
||||
uint32_t iClass = getComposeClass(target[i]);
|
||||
|
||||
if (iClass == 1 || iClass <= cclass) { // 1 means combining class 0
|
||||
@ -602,7 +602,7 @@ Normalizer::decompose(const UnicodeString& source,
|
||||
|
||||
result.truncate(0);
|
||||
|
||||
for (UTextOffset i = 0; i < source.size(); ++i) {
|
||||
for (UTextOffset i = 0; i < source.length(); ++i) {
|
||||
UChar ch = source[i];
|
||||
|
||||
uint16_t offset = ucmp16_getu(DecompData::offsets, ch);
|
||||
@ -666,14 +666,14 @@ UChar Normalizer::nextDecomp()
|
||||
buffer += ch;
|
||||
}
|
||||
|
||||
if (buffer.size() > 1 && needToReorder) {
|
||||
if (buffer.length() > 1 && needToReorder) {
|
||||
// If there is more than one combining character in the buffer,
|
||||
// put them into the canonical order.
|
||||
// But we don't need to sort if only characters are the ones that
|
||||
// resulted from decomosing the base character.
|
||||
fixCanonical(buffer);
|
||||
}
|
||||
bufferLimit = buffer.size() - 1;
|
||||
bufferLimit = buffer.length() - 1;
|
||||
ch = buffer[0];
|
||||
} else {
|
||||
// Just use this character, but first advance to the next one
|
||||
@ -683,7 +683,7 @@ UChar Normalizer::nextDecomp()
|
||||
if (hangul && ch >= HANGUL_BASE && ch < HANGUL_LIMIT) {
|
||||
initBuffer();
|
||||
hangulToJamo(ch, buffer, minDecomp);
|
||||
bufferLimit = buffer.size() - 1;
|
||||
bufferLimit = buffer.length() - 1;
|
||||
ch = buffer[0];
|
||||
}
|
||||
}
|
||||
@ -733,18 +733,18 @@ UChar Normalizer::prevDecomp() {
|
||||
text->next();
|
||||
}
|
||||
|
||||
if (buffer.size() > 1) {
|
||||
if (buffer.length() > 1) {
|
||||
// If there is more than one combining character in the buffer,
|
||||
// put them into the canonical order.
|
||||
fixCanonical(buffer);
|
||||
}
|
||||
bufferLimit = bufferPos = buffer.size() - 1;
|
||||
bufferLimit = bufferPos = buffer.length() - 1;
|
||||
ch = buffer[bufferPos];
|
||||
}
|
||||
else if (hangul && ch >= HANGUL_BASE && ch < HANGUL_LIMIT) {
|
||||
initBuffer();
|
||||
hangulToJamo(ch, buffer, minDecomp);
|
||||
bufferLimit = bufferPos = buffer.size() - 1;
|
||||
bufferLimit = bufferPos = buffer.length() - 1;
|
||||
ch = buffer[bufferPos];
|
||||
}
|
||||
return ch;
|
||||
@ -762,7 +762,7 @@ uint8_t Normalizer::getClass(UChar ch) {
|
||||
* @param result the string to fix.
|
||||
*/
|
||||
void Normalizer::fixCanonical(UnicodeString& result) {
|
||||
UTextOffset i = result.size() - 1;
|
||||
UTextOffset i = result.length() - 1;
|
||||
uint8_t currentType = getClass(result[i]);
|
||||
uint8_t lastType;
|
||||
|
||||
@ -781,7 +781,7 @@ void Normalizer::fixCanonical(UnicodeString& result) {
|
||||
result[i+1] = temp;
|
||||
|
||||
// if not at end, backup (one further, to compensate for for-loop)
|
||||
if (i < result.size() - 2) {
|
||||
if (i < result.length() - 2) {
|
||||
i += 2;
|
||||
}
|
||||
// reset type, since we swapped.
|
||||
@ -1159,7 +1159,7 @@ void Normalizer::jamoAppend(UChar ch, uint16_t decompLimit, UnicodeString& dest)
|
||||
|
||||
void Normalizer::jamoToHangul(UnicodeString& buffer, UTextOffset start) {
|
||||
UTextOffset out = start;
|
||||
UTextOffset limit = buffer.size() - 1;
|
||||
UTextOffset limit = buffer.length() - 1;
|
||||
|
||||
UTextOffset in;
|
||||
uint16_t l, v, t;
|
||||
@ -1188,7 +1188,7 @@ void Normalizer::jamoToHangul(UnicodeString& buffer, UTextOffset start) {
|
||||
buffer[out++] = ch;
|
||||
}
|
||||
}
|
||||
while (in < buffer.size()) {
|
||||
while (in < buffer.length()) {
|
||||
buffer[out++] = buffer[in++];
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ ResourceBundle::LocaleFallbackIterator::nextLocale(UErrorCode& status)
|
||||
if(status != U_USING_DEFAULT_ERROR)
|
||||
status = U_USING_FALLBACK_ERROR;
|
||||
|
||||
if(fLocale.size() == 0) {
|
||||
if(fLocale.length() == 0) {
|
||||
if(fUseDefaultLocale && !fTriedDefaultLocale) {
|
||||
fLocale = fDefaultLocale;
|
||||
fTriedDefaultLocale = TRUE;
|
||||
@ -249,7 +249,7 @@ ResourceBundle::LocaleFallbackIterator::nextLocale(UErrorCode& status)
|
||||
void
|
||||
ResourceBundle::LocaleFallbackIterator::chopLocale()
|
||||
{
|
||||
int32_t size = fLocale.size();
|
||||
int32_t size = fLocale.length();
|
||||
int32_t i;
|
||||
|
||||
for(i = size - 1; i > 0; i--)
|
||||
@ -381,7 +381,7 @@ ResourceBundle::constructForLocale(const PathInfo& path,
|
||||
// fRealLocale can be inited in three ways, see 1), 2), 3)
|
||||
UnicodeString returnedLocale;
|
||||
locale.getName(returnedLocale);
|
||||
if (returnedLocale.size()!=0) {
|
||||
if (returnedLocale.length()!=0) {
|
||||
// 1) Desired Locale has a name
|
||||
fRealLocale = Locale(returnedLocale);
|
||||
} else {
|
||||
@ -922,8 +922,8 @@ ResourceBundle::getVersionNumber() const
|
||||
// the end).
|
||||
int32_t len = icu_strlen(ICU_VERSION);
|
||||
int32_t minor_len = 0;
|
||||
if(U_SUCCESS(status) && minor_version.size() > 0)
|
||||
minor_len = minor_version.size();
|
||||
if(U_SUCCESS(status) && minor_version.length() > 0)
|
||||
minor_len = minor_version.length();
|
||||
len += (minor_len > 0) ? minor_len : 1 /*==icu_strlen(kDefaultMinorVersion)*/;
|
||||
++len; // Add length of separator
|
||||
|
||||
@ -1289,7 +1289,7 @@ ResourceBundle::PathInfo::openFile(const UnicodeString& localeName) const
|
||||
{
|
||||
if(fWPrefix) {
|
||||
//use the wide version of fopen in TPlatformUtilities.
|
||||
int32_t nameSize = localeName.size();
|
||||
int32_t nameSize = localeName.length();
|
||||
char* temp = new char[nameSize + 1];
|
||||
localeName.extract(0, nameSize, temp);
|
||||
temp[nameSize] = 0;
|
||||
@ -1328,7 +1328,7 @@ ResourceBundle::PathInfo::openFile(const UnicodeString& localeName) const
|
||||
else {
|
||||
//open file using standard char* routines
|
||||
UnicodeString workingName(makeCacheKey(localeName));
|
||||
int32_t size = workingName.size();
|
||||
int32_t size = workingName.length();
|
||||
char* returnVal = new char[size + 1];
|
||||
workingName.extract(0, size, returnVal, "");
|
||||
returnVal[size] = 0;
|
||||
|
@ -1296,7 +1296,7 @@ T_UnicodeString_getUChars(const UnicodeString *s)
|
||||
U_CFUNC int32_t
|
||||
T_UnicodeString_extract(const UnicodeString *s, char *dst)
|
||||
{
|
||||
return s->extract(0,s->size(),dst,"");
|
||||
return s->extract(0, s->length(), dst, "");
|
||||
}
|
||||
|
||||
|
||||
|
@ -671,7 +671,7 @@ int32_t Calendar::stringToDayNumber(const UnicodeString& string, UErrorCode& sta
|
||||
// ResourceBundle returns all data in string form, so we have to convert it here.)
|
||||
if (U_FAILURE(status)) return 0;
|
||||
|
||||
int32_t len = string.size();
|
||||
int32_t len = string.length();
|
||||
char *number = new char[1 + len];
|
||||
if (number == 0) { status = U_MEMORY_ALLOCATION_ERROR; return 0; }
|
||||
char *end;
|
||||
|
@ -240,11 +240,11 @@ ChoiceFormat::applyPattern(const UnicodeString& newPattern,
|
||||
double startValue = 0;
|
||||
double oldStartValue = icu_getNaN();
|
||||
bool_t inQuote = FALSE;
|
||||
for(int i = 0; i < newPattern.size(); ++i) {
|
||||
for(int i = 0; i < newPattern.length(); ++i) {
|
||||
UChar ch = newPattern[i];
|
||||
if(ch == 0x0027 /*'\''*/) {
|
||||
// Check for "''" indicating a literal quote
|
||||
if((i+1) < newPattern.size() && newPattern[i+1] == ch) {
|
||||
if((i+1) < newPattern.length() && newPattern[i+1] == ch) {
|
||||
segments[part] += ch;
|
||||
++i;
|
||||
}
|
||||
@ -367,7 +367,7 @@ ChoiceFormat::toPattern(UnicodeString& result) const
|
||||
if (text.indexOf(0x0027 /*'\''*/) < 0)
|
||||
result += text;
|
||||
else {
|
||||
for (int j = 0; j < text.size(); ++j) {
|
||||
for (int j = 0; j < text.length(); ++j) {
|
||||
UChar c = text[j];
|
||||
result += c;
|
||||
if (c == 0x0027 /*'\''*/)
|
||||
@ -532,13 +532,13 @@ ChoiceFormat::parse(const UnicodeString& text,
|
||||
double tempNumber = 0.0;
|
||||
for (int i = 0; i < fCount; ++i) {
|
||||
UnicodeString tempString = fChoiceFormats[i];
|
||||
if(text.compareBetween(start, tempString.size(), tempString, 0, tempString.size()) == 0) {
|
||||
status.setIndex(start + tempString.size());
|
||||
if(text.compareBetween(start, tempString.length(), tempString, 0, tempString.length()) == 0) {
|
||||
status.setIndex(start + tempString.length());
|
||||
tempNumber = fChoiceLimits[i];
|
||||
if (status.getIndex() > furthest) {
|
||||
furthest = status.getIndex();
|
||||
bestNumber = tempNumber;
|
||||
if (furthest == text.size())
|
||||
if (furthest == text.length())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ CollationElementIterator::CollationElementIterator( const UnicodeString& sourceT
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sourceText.size() != 0 ) {
|
||||
if ( sourceText.length() != 0 ) {
|
||||
//
|
||||
// A CollationElementIterator is really a two-layered beast.
|
||||
// Internally it uses a Normalizer to munge the source text
|
||||
|
@ -228,7 +228,7 @@ DecimalFormatSymbols::initialize(const UnicodeString* numberElements, const Unic
|
||||
// if the resource data specified the empty string as the monetary decimal
|
||||
// separator, that means we should just use the regular separator as the
|
||||
// monetary separator
|
||||
if(currencyElements[2].size() == 0)
|
||||
if(currencyElements[2].length() == 0)
|
||||
fMonetarySeparator = fDecimalSeparator;
|
||||
else
|
||||
fMonetarySeparator = currencyElements[2][(UTextOffset)0];
|
||||
|
@ -522,13 +522,13 @@ DecimalFormat::format( double number,
|
||||
if (icu_isNaN(number))
|
||||
{
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
|
||||
UnicodeString nan;
|
||||
result += fSymbols->getNaN(nan);
|
||||
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
|
||||
addPadding(result, FALSE, FALSE /*ignored*/);
|
||||
return result;
|
||||
@ -566,13 +566,13 @@ DecimalFormat::format( double number,
|
||||
result += (isNegative ? fNegativePrefix : fPositivePrefix);
|
||||
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
|
||||
UnicodeString inf;
|
||||
result += fSymbols->getInfinity(inf);
|
||||
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
|
||||
result += (isNegative ? fNegativeSuffix : fPositiveSuffix);
|
||||
|
||||
@ -678,7 +678,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
{
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
fieldPosition.setEndIndex(-1);
|
||||
}
|
||||
else if (fieldPosition.getField() == NumberFormat::kFractionField)
|
||||
@ -731,13 +731,13 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
{
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
|
||||
result += (decimal);
|
||||
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kFractionField)
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
}
|
||||
// Restores the digit character or pads the buffer with zeros.
|
||||
UChar c = ((i < fDigitList->fCount) ?
|
||||
@ -750,13 +750,13 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
{
|
||||
if (fieldPosition.getEndIndex() < 0)
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
}
|
||||
else if (fieldPosition.getField() == NumberFormat::kFractionField)
|
||||
{
|
||||
if (fieldPosition.getBeginIndex() < 0)
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
}
|
||||
|
||||
// The exponent is output using the pattern-specified minimum
|
||||
@ -793,7 +793,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
{
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
|
||||
// Output the integer portion. Here 'count' is the total
|
||||
// number of integer digits we will display, including both
|
||||
@ -815,7 +815,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
digitIndex = fDigitList->fDecimalAt - count;
|
||||
}
|
||||
|
||||
int32_t sizeBeforeIntegerPart = result.size();
|
||||
int32_t sizeBeforeIntegerPart = result.length();
|
||||
|
||||
int32_t i;
|
||||
for (i=count-1; i>=0; --i)
|
||||
@ -842,7 +842,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kIntegerField)
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
|
||||
// Determine whether or not there are any printable fractional
|
||||
// digits. If we've used up the digits we know there aren't.
|
||||
@ -852,7 +852,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
// If there is no fraction present, and we haven't printed any
|
||||
// integer digits, then print a zero. Otherwise we won't print
|
||||
// _any_ digits, and we won't be able to parse this string.
|
||||
if (!fractionPresent && result.size() == sizeBeforeIntegerPart)
|
||||
if (!fractionPresent && result.length() == sizeBeforeIntegerPart)
|
||||
result += (zero);
|
||||
|
||||
// Output the decimal separator if we always do so.
|
||||
@ -861,7 +861,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kFractionField)
|
||||
fieldPosition.setBeginIndex(result.size());
|
||||
fieldPosition.setBeginIndex(result.length());
|
||||
|
||||
for (i=0; i < getMaximumFractionDigits(); ++i)
|
||||
{
|
||||
@ -897,7 +897,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
|
||||
// Record field information for caller.
|
||||
if (fieldPosition.getField() == NumberFormat::kFractionField)
|
||||
fieldPosition.setEndIndex(result.size());
|
||||
fieldPosition.setEndIndex(result.length());
|
||||
}
|
||||
|
||||
result += (isNegative ? fNegativeSuffix : fPositiveSuffix);
|
||||
@ -919,7 +919,7 @@ DecimalFormat::subformat(UnicodeString& result,
|
||||
void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes,
|
||||
bool_t isNegative) const {
|
||||
if (fFormatWidth > 0) {
|
||||
int32_t len = fFormatWidth - result.size();
|
||||
int32_t len = fFormatWidth - result.length();
|
||||
if (len > 0) {
|
||||
UChar* padding = (UChar*) icu_malloc(sizeof(UChar) * len);
|
||||
for (int32_t i=0; i<len; ++i) {
|
||||
@ -928,8 +928,8 @@ void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes,
|
||||
switch (fPadPosition) {
|
||||
case kPadAfterPrefix:
|
||||
if (hasAffixes) {
|
||||
result.insert(isNegative ? fNegativePrefix.size()
|
||||
: fPositivePrefix.size(),
|
||||
result.insert(isNegative ? fNegativePrefix.length()
|
||||
: fPositivePrefix.length(),
|
||||
padding, len);
|
||||
break;
|
||||
} // else fall through to next case
|
||||
@ -938,9 +938,9 @@ void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes,
|
||||
break;
|
||||
case kPadBeforeSuffix:
|
||||
if (hasAffixes) {
|
||||
result.insert(result.size() -
|
||||
(isNegative ? fNegativeSuffix.size()
|
||||
: fPositiveSuffix.size()),
|
||||
result.insert(result.length() -
|
||||
(isNegative ? fNegativeSuffix.length()
|
||||
: fPositiveSuffix.length()),
|
||||
padding, len);
|
||||
break;
|
||||
} // else fall through to next case
|
||||
@ -976,7 +976,7 @@ DecimalFormat::parse(const UnicodeString& text,
|
||||
int32_t backup = parsePosition.getIndex();
|
||||
int32_t i = backup;
|
||||
if (fFormatWidth > 0) {
|
||||
while (i < text.size() && text[(UTextOffset) i] == fPad) {
|
||||
while (i < text.length() && text[(UTextOffset) i] == fPad) {
|
||||
++i;
|
||||
}
|
||||
parsePosition.setIndex(i);
|
||||
@ -986,9 +986,9 @@ DecimalFormat::parse(const UnicodeString& text,
|
||||
UnicodeString nan;
|
||||
fSymbols->getNaN(nan);
|
||||
// If the text is composed of the representation of NaN, returns NaN.
|
||||
if (text.compare(parsePosition.getIndex(), nan.size(), nan,
|
||||
0, nan.size()) == 0) {
|
||||
parsePosition.setIndex(parsePosition.getIndex() + nan.size());
|
||||
if (text.compare(parsePosition.getIndex(), nan.length(), nan,
|
||||
0, nan.length()) == 0) {
|
||||
parsePosition.setIndex(parsePosition.getIndex() + nan.length());
|
||||
result.setDouble(icu_getNaN());
|
||||
return;
|
||||
}
|
||||
@ -1002,7 +1002,7 @@ DecimalFormat::parse(const UnicodeString& text,
|
||||
return;
|
||||
} else if (fFormatWidth < 0) {
|
||||
i = parsePosition.getIndex();
|
||||
while (i < text.size() && text[(UTextOffset) i] == fPad) {
|
||||
while (i < text.length() && text[(UTextOffset) i] == fPad) {
|
||||
++i;
|
||||
}
|
||||
parsePosition.setIndex(i);
|
||||
@ -1063,23 +1063,23 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
int32_t backup;
|
||||
|
||||
// check for positivePrefix; take longest
|
||||
bool_t gotPositive = text.compare(position,fPositivePrefix.size(),fPositivePrefix,0,
|
||||
fPositivePrefix.size()) == 0;
|
||||
bool_t gotNegative = text.compare(position,fNegativePrefix.size(),fNegativePrefix,0,
|
||||
fNegativePrefix.size()) == 0;
|
||||
bool_t gotPositive = text.compare(position,fPositivePrefix.length(),fPositivePrefix,0,
|
||||
fPositivePrefix.length()) == 0;
|
||||
bool_t gotNegative = text.compare(position,fNegativePrefix.length(),fNegativePrefix,0,
|
||||
fNegativePrefix.length()) == 0;
|
||||
// If the number is positive and negative at the same time,
|
||||
// 1. the number is positive if the positive prefix is longer
|
||||
// 2. the number is negative if the negative prefix is longer
|
||||
if (gotPositive && gotNegative) {
|
||||
if (fPositivePrefix.size() > fNegativePrefix.size())
|
||||
if (fPositivePrefix.length() > fNegativePrefix.length())
|
||||
gotNegative = FALSE;
|
||||
else if (fPositivePrefix.size() < fNegativePrefix.size())
|
||||
else if (fPositivePrefix.length() < fNegativePrefix.length())
|
||||
gotPositive = FALSE;
|
||||
}
|
||||
if(gotPositive)
|
||||
position += fPositivePrefix.size();
|
||||
position += fPositivePrefix.length();
|
||||
else if(gotNegative)
|
||||
position += fNegativePrefix.size();
|
||||
position += fNegativePrefix.length();
|
||||
else {
|
||||
parsePosition.setErrorIndex(position);
|
||||
return FALSE;
|
||||
@ -1088,11 +1088,11 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
status[fgStatusInfinite] = FALSE;
|
||||
UnicodeString inf;
|
||||
fSymbols->getInfinity(inf);
|
||||
if (!isExponent && text.compare(position,inf.size(),inf,0,
|
||||
inf.size()) == 0)
|
||||
if (!isExponent && text.compare(position,inf.length(),inf,0,
|
||||
inf.length()) == 0)
|
||||
{
|
||||
// Found a infinite number.
|
||||
position += inf.size();
|
||||
position += inf.length();
|
||||
status[fgStatusInfinite] = TRUE;
|
||||
} else {
|
||||
// We now have a string of digits, possibly with grouping symbols,
|
||||
@ -1120,7 +1120,7 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
int32_t digitCount = 0;
|
||||
|
||||
backup = -1;
|
||||
for (; position < text.size(); ++position)
|
||||
for (; position < text.length(); ++position)
|
||||
{
|
||||
UChar ch = text[(UTextOffset)position];
|
||||
|
||||
@ -1192,7 +1192,7 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
// Parse sign, if present
|
||||
bool_t negExp = FALSE;
|
||||
int32_t pos = position + 1; // position + exponentSep.length();
|
||||
if (pos < text.size()) {
|
||||
if (pos < text.length()) {
|
||||
ch = text[(UTextOffset) pos];
|
||||
if (ch == fSymbols->getPlusSign()) {
|
||||
++pos;
|
||||
@ -1204,7 +1204,7 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
|
||||
DigitList exponentDigits;
|
||||
exponentDigits.fCount = 0;
|
||||
while (pos < text.size()) {
|
||||
while (pos < text.length()) {
|
||||
digit = text[(UTextOffset) pos] - zero;
|
||||
//~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~
|
||||
// TEMPORARY WORKAROUND
|
||||
@ -1264,17 +1264,17 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
|
||||
// check for positiveSuffix
|
||||
if (gotPositive)
|
||||
gotPositive = text.compare(position,fPositiveSuffix.size(),fPositiveSuffix,0,
|
||||
fPositiveSuffix.size()) == 0;
|
||||
gotPositive = text.compare(position,fPositiveSuffix.length(),fPositiveSuffix,0,
|
||||
fPositiveSuffix.length()) == 0;
|
||||
if (gotNegative)
|
||||
gotNegative = text.compare(position,fNegativeSuffix.size(),fNegativeSuffix,0,
|
||||
fNegativeSuffix.size()) == 0;
|
||||
gotNegative = text.compare(position,fNegativeSuffix.length(),fNegativeSuffix,0,
|
||||
fNegativeSuffix.length()) == 0;
|
||||
|
||||
// if both match, take longest
|
||||
if (gotPositive && gotNegative) {
|
||||
if (fPositiveSuffix.size() > fNegativeSuffix.size())
|
||||
if (fPositiveSuffix.length() > fNegativeSuffix.length())
|
||||
gotNegative = FALSE;
|
||||
else if (fPositiveSuffix.size() < fNegativeSuffix.size())
|
||||
else if (fPositiveSuffix.length() < fNegativeSuffix.length())
|
||||
gotPositive = FALSE;
|
||||
}
|
||||
|
||||
@ -1285,8 +1285,8 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
|
||||
}
|
||||
|
||||
parsePosition.setIndex(position +
|
||||
(gotPositive ? fPositiveSuffix.size() :
|
||||
fNegativeSuffix.size())); // mark success!
|
||||
(gotPositive ? fPositiveSuffix.length() :
|
||||
fNegativeSuffix.length())); // mark success!
|
||||
|
||||
status[fgStatusPositive] = gotPositive;
|
||||
|
||||
@ -1781,7 +1781,7 @@ void DecimalFormat::expandAffixes() {
|
||||
void DecimalFormat::expandAffix(const UnicodeString& pattern,
|
||||
UnicodeString& affix) const {
|
||||
affix.remove();
|
||||
for (int i=0; i<pattern.size(); ) {
|
||||
for (int i=0; i<pattern.length(); ) {
|
||||
UChar c = pattern.charAt(i++);
|
||||
if (c == kQuote) {
|
||||
c = pattern.charAt(i++);
|
||||
@ -1789,7 +1789,7 @@ void DecimalFormat::expandAffix(const UnicodeString& pattern,
|
||||
case kCurrencySign:
|
||||
{
|
||||
UnicodeString s;
|
||||
if (i<pattern.size() &&
|
||||
if (i<pattern.length() &&
|
||||
pattern.charAt(i) == kCurrencySign) {
|
||||
++i;
|
||||
affix += fSymbols->getInternationalCurrencySymbol(s);
|
||||
@ -1839,11 +1839,11 @@ void DecimalFormat::appendAffix(UnicodeString& buffer,
|
||||
appendAffix(buffer, expAffix, localized);
|
||||
} else {
|
||||
int i;
|
||||
for (int pos=0; pos<affixPattern->size(); pos=i) {
|
||||
for (int pos=0; pos<affixPattern->length(); pos=i) {
|
||||
i = affixPattern->indexOf(kQuote, pos);
|
||||
if (i < 0) {
|
||||
UnicodeString s;
|
||||
affixPattern->extractBetween(pos, affixPattern->size(), s);
|
||||
affixPattern->extractBetween(pos, affixPattern->length(), s);
|
||||
appendAffix(buffer, s, localized);
|
||||
break;
|
||||
}
|
||||
@ -1858,7 +1858,7 @@ void DecimalFormat::appendAffix(UnicodeString& buffer,
|
||||
buffer.append(c);
|
||||
// Fall through and append another kQuote below
|
||||
} else if (c == kCurrencySign &&
|
||||
i<affixPattern->size() &&
|
||||
i<affixPattern->length() &&
|
||||
affixPattern->charAt(i) == kCurrencySign) {
|
||||
++i;
|
||||
buffer.append(c);
|
||||
@ -1924,7 +1924,7 @@ DecimalFormat::appendAffix( UnicodeString& buffer,
|
||||
if (affix.indexOf(0x0027 /*'\''*/) < 0)
|
||||
buffer += affix;
|
||||
else {
|
||||
for (int32_t j = 0; j < affix.size(); ++j) {
|
||||
for (int32_t j = 0; j < affix.length(); ++j) {
|
||||
UChar c = affix[j];
|
||||
buffer += c;
|
||||
if (c == 0x0027 /*'\''*/) buffer += c;
|
||||
@ -2171,7 +2171,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
int32_t start = pos;
|
||||
bool_t isPartDone = FALSE;
|
||||
|
||||
for (; !isPartDone && pos < pattern.size(); ++pos) {
|
||||
for (; !isPartDone && pos < pattern.length(); ++pos) {
|
||||
UChar ch = pattern[(UTextOffset) pos];
|
||||
switch (subpart) {
|
||||
case 0: // Pattern proper subpart (between prefix & suffix)
|
||||
@ -2244,7 +2244,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
return;
|
||||
}
|
||||
// Check for positive prefix
|
||||
if ((pos+1) < pattern.size()
|
||||
if ((pos+1) < pattern.length()
|
||||
&& pattern[(UTextOffset) (pos+1)] == plus) {
|
||||
expSignAlways = TRUE;
|
||||
++pos;
|
||||
@ -2252,7 +2252,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
// Use lookahead to parse out the exponential part of the
|
||||
// pattern, then jump into suffix subpart.
|
||||
expDigits = 0;
|
||||
while (++pos < pattern.size() &&
|
||||
while (++pos < pattern.length() &&
|
||||
pattern[(UTextOffset) pos] == zeroDigit) {
|
||||
++expDigits;
|
||||
}
|
||||
@ -2292,7 +2292,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
} else if (ch == kCurrencySign) {
|
||||
// Use lookahead to determine if the currency sign is
|
||||
// doubled or not.
|
||||
bool_t doubled = (pos + 1) < pattern.size() &&
|
||||
bool_t doubled = (pos + 1) < pattern.length() &&
|
||||
pattern[(UTextOffset) (pos+1)] == kCurrencySign;
|
||||
affix->append(kQuote); // Encode currency
|
||||
if (doubled) {
|
||||
@ -2305,7 +2305,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
// A quote outside quotes indicates either the opening
|
||||
// quote or two quotes, which is a quote literal. That is,
|
||||
// we have the first quote in 'do' or o''clock.
|
||||
if ((pos+1) < pattern.size() &&
|
||||
if ((pos+1) < pattern.length() &&
|
||||
pattern[(UTextOffset) (pos+1)] == kQuote) {
|
||||
++pos;
|
||||
affix->append(kQuote); // Encode quote
|
||||
@ -2345,7 +2345,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
// Fall through to append(ch)
|
||||
} else if (ch == padEscape) {
|
||||
if (padPos >= 0 || // Multiple pad specifiers
|
||||
(pos+1) == pattern.size()) { // Nothing after padEscape
|
||||
(pos+1) == pattern.length()) { // Nothing after padEscape
|
||||
debug("Multiple pad specifiers")
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
@ -2373,7 +2373,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
// quote or two quotes, which is a quote literal. That is,
|
||||
// we have the second quote in 'do' or 'don''t'.
|
||||
if (ch == kQuote) {
|
||||
if ((pos+1) < pattern.size() &&
|
||||
if ((pos+1) < pattern.length() &&
|
||||
pattern[(UTextOffset) (pos+1)] == kQuote) {
|
||||
++pos;
|
||||
affix->append(kQuote); // Encode quote
|
||||
@ -2389,11 +2389,11 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
}
|
||||
|
||||
if (sub0Limit == 0) {
|
||||
sub0Limit = pattern.size();
|
||||
sub0Limit = pattern.length();
|
||||
}
|
||||
|
||||
if (sub2Limit == 0) {
|
||||
sub2Limit = pattern.size();
|
||||
sub2Limit = pattern.length();
|
||||
}
|
||||
|
||||
/* Handle patterns with no '0' pattern character. These patterns
|
||||
@ -2513,7 +2513,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
}
|
||||
}
|
||||
|
||||
if (pattern.size() == 0) {
|
||||
if (pattern.length() == 0) {
|
||||
delete fNegPrefixPattern;
|
||||
delete fNegSuffixPattern;
|
||||
fNegPrefixPattern = NULL;
|
||||
|
@ -160,7 +160,7 @@ MergeCollation::getPattern(UnicodeString& result, bool_t withWhiteSpace) const
|
||||
{
|
||||
// if the entry is an expanding ligature, queue up the entries until
|
||||
// the last same ligature has been processed.
|
||||
if (entry->extension.size() != 0)
|
||||
if (entry->extension.length() != 0)
|
||||
{
|
||||
if (extList == NULL)
|
||||
{
|
||||
@ -268,7 +268,7 @@ void MergeCollation::addPattern(const UnicodeString& pattern,
|
||||
Normalizer::EMode decompMode,
|
||||
UErrorCode& success)
|
||||
{
|
||||
if (U_FAILURE(success) || (pattern.size() == 0))
|
||||
if (U_FAILURE(success) || (pattern.length() == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -319,7 +319,7 @@ const PatternEntry* MergeCollation::getItemAt(UTextOffset index) const {
|
||||
const PatternEntry* MergeCollation::findLastWithNoExtension(int32_t i) const {
|
||||
for (--i;i >= 0; --i) {
|
||||
PatternEntry* entry = patterns->at(i);
|
||||
if ((entry != 0) && (entry->extension.size() == 0)) {
|
||||
if ((entry != 0) && (entry->extension.length() == 0)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
@ -350,7 +350,7 @@ void MergeCollation::fixEntry(PatternEntry* newEntry,
|
||||
// replace the previous one. This will improve the single
|
||||
// char entries dramatically which is the majority of the
|
||||
// entries.
|
||||
if (newEntry->chars.size() == 1)
|
||||
if (newEntry->chars.length() == 1)
|
||||
{
|
||||
UChar c = newEntry->chars[0];
|
||||
int32_t statusIndex = c >> BYTEPOWER;
|
||||
@ -401,7 +401,7 @@ void MergeCollation::fixEntry(PatternEntry* newEntry,
|
||||
}
|
||||
|
||||
// Do not change the last entry if the new entry is a expanding character
|
||||
if (excess.size() != 0)
|
||||
if (excess.length() != 0)
|
||||
{
|
||||
// newEntry.extension = excess + newEntry.extensions;
|
||||
newEntry->extension.insert(0, excess);
|
||||
@ -451,7 +451,7 @@ MergeCollation::findLastEntry(const PatternEntry* lastEntry,
|
||||
|
||||
// If the last entry is a single char entry and has been installed,
|
||||
// that means the last index is the real last index.
|
||||
if (lastEntry->chars.size() == 1)
|
||||
if (lastEntry->chars.length() == 1)
|
||||
{
|
||||
int32_t index = lastEntry->chars[0] >> BYTEPOWER;
|
||||
|
||||
@ -497,11 +497,11 @@ MergeCollation::findLastEntry(const PatternEntry* lastEntry,
|
||||
// be 'Q'. We save the characters that didn't match ("uestion-mark" in
|
||||
// this case), and then return the next index.
|
||||
//
|
||||
if (entry->chars.compareBetween(0, entry->chars.size(),
|
||||
lastEntry->chars,0,entry->chars.size()) == 0)
|
||||
if (entry->chars.compareBetween(0, entry->chars.length(),
|
||||
lastEntry->chars,0,entry->chars.length()) == 0)
|
||||
{
|
||||
lastEntry->chars.extractBetween(entry->chars.size(),
|
||||
lastEntry->chars.size(),
|
||||
lastEntry->chars.extractBetween(entry->chars.length(),
|
||||
lastEntry->chars.length(),
|
||||
buffer);
|
||||
excess += buffer;
|
||||
break;
|
||||
|
@ -220,11 +220,11 @@ MessageFormat::applyPattern(const UnicodeString& newPattern,
|
||||
bool_t inQuote = FALSE;
|
||||
int32_t braceStack = 0;
|
||||
fMaxOffset = -1;
|
||||
for (int i = 0; i < newPattern.size(); ++i) {
|
||||
for (int i = 0; i < newPattern.length(); ++i) {
|
||||
UChar ch = newPattern[i];
|
||||
if (part == 0) {
|
||||
if (ch == 0x0027 /*'\''*/) {
|
||||
if (i + 1 < newPattern.size()
|
||||
if (i + 1 < newPattern.length()
|
||||
&& newPattern[i+1] == 0x0027 /*'\''*/) {
|
||||
segments[part] += ch; // handle doubles
|
||||
++i;
|
||||
@ -402,7 +402,7 @@ MessageFormat::toPattern(UnicodeString& result) const
|
||||
}
|
||||
result += 0x007D /*'}'*/;
|
||||
}
|
||||
copyAndFixQuotes(fPattern, lastOffset, fPattern.size(), result);
|
||||
copyAndFixQuotes(fPattern, lastOffset, fPattern.length(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -661,7 +661,7 @@ MessageFormat::format(const Formattable* arguments,
|
||||
}
|
||||
buffer.remove();
|
||||
// Appends the rest of the pattern characters after the real last offset.
|
||||
fPattern.extract(lastOffset, fPattern.size(), buffer);
|
||||
fPattern.extract(lastOffset, fPattern.length(), buffer);
|
||||
result += buffer;
|
||||
return result;
|
||||
}
|
||||
@ -724,11 +724,11 @@ MessageFormat::parse(const UnicodeString& source,
|
||||
// if at end, use longest possible match
|
||||
// otherwise uses first match to intervening string
|
||||
// does NOT recursively try all possibilities
|
||||
int32_t tempLength = (i != fMaxOffset) ? fOffsets[i+1] : fPattern.size();
|
||||
int32_t tempLength = (i != fMaxOffset) ? fOffsets[i+1] : fPattern.length();
|
||||
|
||||
int32_t next;
|
||||
if (patternOffset >= tempLength) {
|
||||
next = source.size();
|
||||
next = source.length();
|
||||
}
|
||||
else {
|
||||
UnicodeString buffer;
|
||||
@ -777,7 +777,7 @@ MessageFormat::parse(const UnicodeString& source,
|
||||
sourceOffset = tempStatus.getIndex(); // update
|
||||
}
|
||||
}
|
||||
int32_t len = fPattern.size() - patternOffset;
|
||||
int32_t len = fPattern.length() - patternOffset;
|
||||
if (len == 0 ||
|
||||
fPattern.compare(patternOffset, len, source, sourceOffset, len) == 0) {
|
||||
status.setIndex(sourceOffset + len);
|
||||
@ -948,7 +948,7 @@ MessageFormat::makeFormat(int32_t position,
|
||||
return;
|
||||
}
|
||||
fMaxOffset = offsetNumber;
|
||||
fOffsets[offsetNumber] = segments[0].size();
|
||||
fOffsets[offsetNumber] = segments[0].length();
|
||||
fArgumentNumbers[offsetNumber] = argumentNumber;
|
||||
|
||||
// now get the format
|
||||
|
@ -140,7 +140,7 @@ void PatternEntry::addToBuffer(UnicodeString& toAddTo,
|
||||
bool_t showWhiteSpace,
|
||||
const PatternEntry* lastEntry) const
|
||||
{
|
||||
if (showWhiteSpace && toAddTo.size() > 0)
|
||||
if (showWhiteSpace && toAddTo.length() > 0)
|
||||
// Adds new line before each primary strength entry.
|
||||
if (strength == Collator::PRIMARY || lastEntry != NULL)
|
||||
toAddTo += 0x000A/*'\n'*/;
|
||||
@ -169,7 +169,7 @@ void PatternEntry::addToBuffer(UnicodeString& toAddTo,
|
||||
appendQuoted(chars,toAddTo);
|
||||
// If there's an expending char and needs to be shown,
|
||||
// append that after the entry
|
||||
if (showExtension && extension.size() != 0) {
|
||||
if (showExtension && extension.length() != 0) {
|
||||
toAddTo += 0x002F/*'/'*/;
|
||||
appendQuoted(extension,toAddTo);
|
||||
}
|
||||
@ -249,7 +249,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
|
||||
newChars.remove();
|
||||
newExtensions.remove();
|
||||
|
||||
while (index < pattern.size())
|
||||
while (index < pattern.length())
|
||||
{
|
||||
UChar ch = pattern[index];
|
||||
|
||||
@ -261,7 +261,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((newChars.size() == 0) || inChars)
|
||||
if ((newChars.length() == 0) || inChars)
|
||||
{
|
||||
newChars += ch;
|
||||
}
|
||||
@ -338,7 +338,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
|
||||
inQuote = TRUE;
|
||||
ch = pattern[++index];
|
||||
|
||||
if (newChars.size() == 0)
|
||||
if (newChars.length() == 0)
|
||||
{
|
||||
newChars += ch;
|
||||
}
|
||||
@ -394,7 +394,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (newChars.size() == 0)
|
||||
if (newChars.length() == 0)
|
||||
{
|
||||
status = U_INVALID_FORMAT_ERROR;
|
||||
return NULL;
|
||||
|
@ -404,19 +404,19 @@ SimpleDateFormat::format(UDate date, UnicodeString& toAppendTo, FieldPosition& p
|
||||
UnicodeString str;
|
||||
|
||||
// loop through the pattern string character by character
|
||||
for (int32_t i = 0; i < fPattern.size() && U_SUCCESS(status); ++i) {
|
||||
for (int32_t i = 0; i < fPattern.length() && U_SUCCESS(status); ++i) {
|
||||
UChar ch = fPattern[i];
|
||||
|
||||
// Use subFormat() to format a repeated pattern character
|
||||
// when a different pattern or non-pattern character is seen
|
||||
if (ch != prevCh && count > 0) {
|
||||
toAppendTo += subFormat(str, prevCh, count, toAppendTo.size(), pos, status);
|
||||
toAppendTo += subFormat(str, prevCh, count, toAppendTo.length(), pos, status);
|
||||
count = 0;
|
||||
}
|
||||
if (ch == 0x0027 /*'\''*/) {
|
||||
// Consecutive single quotes are a single quote literal,
|
||||
// either outside of quotes or between quotes
|
||||
if ((i+1) < fPattern.size() && fPattern[i+1] == 0x0027 /*'\''*/) {
|
||||
if ((i+1) < fPattern.length() && fPattern[i+1] == 0x0027 /*'\''*/) {
|
||||
toAppendTo += 0x0027 /*'\''*/;
|
||||
++i;
|
||||
} else {
|
||||
@ -438,7 +438,7 @@ SimpleDateFormat::format(UDate date, UnicodeString& toAppendTo, FieldPosition& p
|
||||
|
||||
// Format the last item in the pattern, if any
|
||||
if (count > 0) {
|
||||
toAppendTo += subFormat(str, prevCh, count, toAppendTo.size(), pos, status);
|
||||
toAppendTo += subFormat(str, prevCh, count, toAppendTo.length(), pos, status);
|
||||
}
|
||||
|
||||
// and if something failed (e.g., an invalid format character), reset our FieldPosition
|
||||
@ -659,7 +659,7 @@ SimpleDateFormat::subFormat(UnicodeString& result,
|
||||
if (pos.getField() == fgPatternIndexToDateFormatField[patternCharIndex]) {
|
||||
if (pos.getBeginIndex() == 0 && pos.getEndIndex() == 0) {
|
||||
pos.setBeginIndex(beginOffset);
|
||||
pos.setEndIndex(beginOffset + result.size());
|
||||
pos.setEndIndex(beginOffset + result.length());
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,7 +730,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
|
||||
|
||||
// loop through the pattern string character by character, using it to control how
|
||||
// we match characters in the input
|
||||
for (int32_t i = 0; i < fPattern.size();++i) {
|
||||
for (int32_t i = 0; i < fPattern.length();++i) {
|
||||
UChar ch = fPattern[i];
|
||||
|
||||
// if we're inside a quoted string, match characters exactly until we hit
|
||||
@ -746,7 +746,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
|
||||
// a quote literal we need to match.
|
||||
if (count == 0)
|
||||
{
|
||||
if(start > text.size() || ch != text[start])
|
||||
if(start > text.length() || ch != text[start])
|
||||
{
|
||||
pos.setIndex(oldStart);
|
||||
pos.setErrorIndex(start);
|
||||
@ -761,7 +761,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
|
||||
else
|
||||
{
|
||||
// pattern uses text following from 1st single quote.
|
||||
if (start >= text.size() || ch != text[start]) {
|
||||
if (start >= text.length() || ch != text[start]) {
|
||||
// Check for cases like: 'at' in pattern vs "xt"
|
||||
// in time text, where 'a' doesn't match with 'x'.
|
||||
// If fail to match, return null.
|
||||
@ -801,7 +801,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
|
||||
// for example, 'o''clock'. We need to parse this as
|
||||
// representing a single quote within the quote.
|
||||
int32_t startOffset = start;
|
||||
if (start >= text.size() || ch != text[start])
|
||||
if (start >= text.length() || ch != text[start])
|
||||
{
|
||||
pos.setErrorIndex(startOffset);
|
||||
pos.setIndex(oldStart);
|
||||
@ -857,7 +857,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
|
||||
// {sfb} correct Date?
|
||||
return 0;
|
||||
}
|
||||
if (start >= text.size() || ch != text[start]) {
|
||||
if (start >= text.length() || ch != text[start]) {
|
||||
// handle cases like: 'MMMM dd' in pattern vs. "janx20"
|
||||
// in time text, where ' ' doesn't match with 'x'.
|
||||
pos.setErrorIndex(start);
|
||||
@ -873,7 +873,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
|
||||
// otherwise, match characters exactly
|
||||
else
|
||||
{
|
||||
if (start >= text.size() || ch != text[start]) {
|
||||
if (start >= text.length() || ch != text[start]) {
|
||||
// handle cases like: 'MMMM dd' in pattern vs.
|
||||
// "jan,,,20" in time text, where " " doesn't
|
||||
// match with ",,,".
|
||||
@ -997,7 +997,7 @@ int32_t SimpleDateFormat::matchString(const UnicodeString& text,
|
||||
|
||||
for (; i < count; ++i)
|
||||
{
|
||||
int32_t length = data[i].size();
|
||||
int32_t length = data[i].length();
|
||||
// Always compare if we have no match yet; otherwise only compare
|
||||
// against potentially better matches (longer strings).
|
||||
|
||||
@ -1082,7 +1082,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
||||
// If there are any spaces here, skip over them. If we hit the end
|
||||
// of the string, then fail.
|
||||
for (;;) {
|
||||
if (pos.getIndex() >= text.size())
|
||||
if (pos.getIndex() >= text.length())
|
||||
return -start;
|
||||
UChar c = text[pos.getIndex()];
|
||||
if (c != 0x0020 /*' '*/ && c != 0x0009 /*'\t'*/)
|
||||
@ -1104,7 +1104,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
||||
// but that's going to be difficult.
|
||||
if (obeyCount)
|
||||
{
|
||||
if ((start+count) > text.size())
|
||||
if ((start+count) > text.length())
|
||||
return -start;
|
||||
UnicodeString temp;
|
||||
text.extractBetween(0, start + count, temp);
|
||||
@ -1216,12 +1216,12 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
||||
UnicodeString lcaseGMT(fgGmt);
|
||||
lcaseGMT.toLower();
|
||||
|
||||
if ((text.size() - start) > fgGmt.size() &&
|
||||
(lcaseText.compare(start, lcaseGMT.size(), lcaseGMT, 0, lcaseGMT.size())) == 0)
|
||||
if ((text.length() - start) > fgGmt.length() &&
|
||||
(lcaseText.compare(start, lcaseGMT.length(), lcaseGMT, 0, lcaseGMT.length())) == 0)
|
||||
{
|
||||
fCalendar->set(Calendar::DST_OFFSET, 0);
|
||||
|
||||
pos.setIndex(start + fgGmt.size());
|
||||
pos.setIndex(start + fgGmt.length());
|
||||
|
||||
if( text[pos.getIndex()] == 0x002B /*'+'*/ )
|
||||
sign = 1;
|
||||
@ -1285,7 +1285,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
||||
UnicodeString s2(fSymbols->fZoneStrings[i][j]);
|
||||
s2.toLower();
|
||||
|
||||
if ((s1.compare(start, s2.size(), s2, 0, s2.size())) == 0)
|
||||
if ((s1.compare(start, s2.length(), s2, 0, s2.length())) == 0)
|
||||
break;
|
||||
}
|
||||
if (j <= 4)
|
||||
@ -1296,7 +1296,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
||||
// use the correct DST SAVINGS for the zone.
|
||||
delete tz;
|
||||
fCalendar->set(Calendar::DST_OFFSET, j >= 3 ? U_MILLIS_PER_HOUR : 0);
|
||||
return (start + fSymbols->fZoneStrings[i][j].size());
|
||||
return (start + fSymbols->fZoneStrings[i][j].length());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1367,7 +1367,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
||||
// Handle "generic" fields
|
||||
if (obeyCount)
|
||||
{
|
||||
if ((start+count) > text.size())
|
||||
if ((start+count) > text.length())
|
||||
return -start;
|
||||
UnicodeString s;
|
||||
// {sfb} old code had extract, make sure it works
|
||||
@ -1404,7 +1404,7 @@ void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern,
|
||||
|
||||
translatedPattern.remove();
|
||||
bool_t inQuote = FALSE;
|
||||
for (UTextOffset i = 0; i < originalPattern.size(); ++i) {
|
||||
for (UTextOffset i = 0; i < originalPattern.length(); ++i) {
|
||||
UChar c = originalPattern[i];
|
||||
if (inQuote) {
|
||||
if (c == 0x0027 /*'\''*/)
|
||||
|
@ -229,7 +229,7 @@ int32_t
|
||||
CollationKey::storeUnicodeString(int32_t cursor, const UnicodeString &value)
|
||||
{
|
||||
UTextOffset input = 0;
|
||||
int32_t charCount = value.size();
|
||||
int32_t charCount = value.length();
|
||||
|
||||
while (input < charCount)
|
||||
{
|
||||
@ -242,7 +242,7 @@ CollationKey::storeUnicodeString(int32_t cursor, const UnicodeString &value)
|
||||
CollationKey&
|
||||
CollationKey::copyUnicodeString(const UnicodeString &value)
|
||||
{
|
||||
int32_t charCount = value.size();
|
||||
int32_t charCount = value.length();
|
||||
|
||||
// We allocate enough space for two null bytes at the end.
|
||||
ensureCapacity((charCount * 2) + 2);
|
||||
|
@ -553,7 +553,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale,
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (localeName.size() == 0)
|
||||
if (localeName.length() == 0)
|
||||
{
|
||||
if (next == eDone)
|
||||
{
|
||||
@ -949,8 +949,8 @@ RuleBasedCollator::compare( const UnicodeString& source,
|
||||
UnicodeString target_togo;
|
||||
UTextOffset begin=0;
|
||||
|
||||
source.extract(begin, icu_min(length,source.size()), source_togo);
|
||||
target.extract(begin, icu_min(length,target.size()), target_togo);
|
||||
source.extract(begin, icu_min(length,source.length()), source_togo);
|
||||
target.extract(begin, icu_min(length,target.length()), target_togo);
|
||||
return (RuleBasedCollator::compare(source_togo, target_togo));
|
||||
}
|
||||
|
||||
@ -1362,7 +1362,7 @@ RuleBasedCollator::getCollationKey( const UnicodeString& source,
|
||||
CollationKey& sortkey,
|
||||
UErrorCode& status) const
|
||||
{
|
||||
return RuleBasedCollator::getCollationKey(source.getUChars(), source.size(), sortkey, status);
|
||||
return RuleBasedCollator::getCollationKey(source.getUChars(), source.length(), sortkey, status);
|
||||
}
|
||||
|
||||
CollationKey&
|
||||
@ -1466,7 +1466,7 @@ RuleBasedCollator::getCollationKey( const UChar* source,
|
||||
|
||||
if (U_SUCCESS(status))
|
||||
{
|
||||
totalIdent = decomp.size() + 1;
|
||||
totalIdent = decomp.length() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1607,7 +1607,7 @@ RuleBasedCollator::build(const UnicodeString& pattern,
|
||||
UnicodeString expChars;
|
||||
UnicodeString groupChars;
|
||||
|
||||
if (pattern.size() == 0)
|
||||
if (pattern.length() == 0)
|
||||
{
|
||||
status = U_INVALID_FORMAT_ERROR;
|
||||
return;
|
||||
@ -1645,16 +1645,16 @@ RuleBasedCollator::build(const UnicodeString& pattern,
|
||||
entry->getChars(groupChars);
|
||||
|
||||
// check if french secondary needs to be turned on
|
||||
if ((groupChars.size() > 1) &&
|
||||
(groupChars[groupChars.size()-(T_INT32(1))] == 0x0040))
|
||||
if ((groupChars.length() > 1) &&
|
||||
(groupChars[groupChars.length()-(T_INT32(1))] == 0x0040))
|
||||
{
|
||||
data->isFrenchSec = TRUE;
|
||||
groupChars.remove(groupChars.size()-(T_INT32(1)));
|
||||
groupChars.remove(groupChars.length()-(T_INT32(1)));
|
||||
}
|
||||
|
||||
order = increment((Collator::ECollationStrength)entry->getStrength(), order);
|
||||
|
||||
if (entry->getExtension(expChars).size() != 0)
|
||||
if (entry->getExtension(expChars).length() != 0)
|
||||
{
|
||||
// encountered an expanding character, where one character on input
|
||||
// expands to several sort elements (e.g. 'ö' --> 'o' 'e')
|
||||
@ -1664,7 +1664,7 @@ RuleBasedCollator::build(const UnicodeString& pattern,
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (groupChars.size() > 1)
|
||||
else if (groupChars.length() > 1)
|
||||
{
|
||||
// encountered a contracting character, where several characters on input
|
||||
// contract into one sort order. For example, "ch" is treated as a single
|
||||
@ -1750,7 +1750,7 @@ RuleBasedCollator::build(const UnicodeString& pattern,
|
||||
bool_t allThere = TRUE;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < decomp.size(); i += 1)
|
||||
for (i = 0; i < decomp.length(); i += 1)
|
||||
{
|
||||
if (getCharOrder(decomp[i]) == UNMAPPED)
|
||||
{
|
||||
@ -1914,7 +1914,7 @@ RuleBasedCollator::addExpandOrder( const UnicodeString& contractChars,
|
||||
int32_t tableIndex = addExpansion(anOrder, expandChars);
|
||||
|
||||
// And add its index into the main mapping table
|
||||
if (contractChars.size() > 1)
|
||||
if (contractChars.length() > 1)
|
||||
{
|
||||
addContractOrder(contractChars, tableIndex, status);
|
||||
}
|
||||
@ -1939,7 +1939,7 @@ int32_t RuleBasedCollator::addExpansion(int32_t anOrder, const UnicodeString &ex
|
||||
// If anOrder is valid, we want to add it at the beginning of the list
|
||||
int32_t offset = (anOrder == UNMAPPED) ? 0 : 1;
|
||||
|
||||
VectorOfInt *valueList = new VectorOfInt(expandChars.size() + offset);
|
||||
VectorOfInt *valueList = new VectorOfInt(expandChars.length() + offset);
|
||||
|
||||
if (offset == 1)
|
||||
{
|
||||
@ -1947,7 +1947,7 @@ int32_t RuleBasedCollator::addExpansion(int32_t anOrder, const UnicodeString &ex
|
||||
}
|
||||
|
||||
int32_t i;
|
||||
for (i = 0; i < expandChars.size(); i += 1)
|
||||
for (i = 0; i < expandChars.length(); i += 1)
|
||||
{
|
||||
UChar ch = expandChars[i];
|
||||
int32_t mapValue = getCharOrder(ch);
|
||||
@ -2140,7 +2140,7 @@ RuleBasedCollator::hashCode() const
|
||||
{
|
||||
int32_t value = 0;
|
||||
int32_t c;
|
||||
int32_t count = getRules().size();
|
||||
int32_t count = getRules().length();
|
||||
UTextOffset pos = count - 1;
|
||||
|
||||
if (count > 64)
|
||||
@ -2410,7 +2410,7 @@ RuleBasedCollator::createPathName( const UnicodeString& prefix,
|
||||
workingName += name;
|
||||
workingName += suffix;
|
||||
|
||||
size = workingName.size();
|
||||
size = workingName.length();
|
||||
returnVal = new char[size + 1];
|
||||
workingName.extract(0, size, returnVal, "");
|
||||
returnVal[size] = 0;
|
||||
@ -2425,7 +2425,7 @@ RuleBasedCollator::chopLocale(UnicodeString& localeName)
|
||||
// For instance, "de_CH" becomes "de", and "de" becomes "".
|
||||
// "" remains "".
|
||||
|
||||
int32_t size = localeName.size();
|
||||
int32_t size = localeName.length();
|
||||
int32_t i;
|
||||
|
||||
for (i = size - 1; i > 0; i--)
|
||||
|
@ -537,7 +537,7 @@ TimeZone::createCustomTimeZone(const UnicodeString& id)
|
||||
UnicodeString idUppercase = id;
|
||||
idUppercase.toUpper();
|
||||
|
||||
if (id.size() > GMT_ID_LENGTH &&
|
||||
if (id.length() > GMT_ID_LENGTH &&
|
||||
idUppercase.startsWith(GMT_ID))
|
||||
{
|
||||
ParsePosition pos(GMT_ID_LENGTH);
|
||||
@ -564,7 +564,7 @@ TimeZone::createCustomTimeZone(const UnicodeString& id)
|
||||
if (pos.getIndex() == start) return 0;
|
||||
offset = n.getLong();
|
||||
|
||||
if (pos.getIndex() < id.size() &&
|
||||
if (pos.getIndex() < id.length() &&
|
||||
id[pos.getIndex()] == 0x003A /*':'*/)
|
||||
{
|
||||
// hh:mm
|
||||
|
@ -271,7 +271,7 @@ ucol_getRules( const UCollator *coll,
|
||||
int32_t *length)
|
||||
{
|
||||
const UnicodeString& rules = ((RuleBasedCollator*)coll)->getRules();
|
||||
*length = rules.size();
|
||||
*length = rules.length();
|
||||
return rules.getUChars();
|
||||
}
|
||||
|
||||
|
@ -51,10 +51,10 @@ findKeyword(const UnicodeString& s,
|
||||
// If so, the string contains a modifier, and we only want to
|
||||
// parse the type
|
||||
int32_t commaPos = buffer.indexOf(0x002C);
|
||||
commaPos = (commaPos == -1 ? buffer.size() : commaPos);
|
||||
commaPos = (commaPos == -1 ? buffer.length() : commaPos);
|
||||
buffer.truncate(commaPos);
|
||||
if(buffer == list[i]) {
|
||||
kwLen = list[i].size();
|
||||
kwLen = list[i].length();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -538,12 +538,12 @@ unum_getSymbols(const UNumberFormat* fmt,
|
||||
syms->minusSign = dfs->getMinusSign();
|
||||
|
||||
dfs->getCurrencySymbol(temp);
|
||||
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE);
|
||||
len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
|
||||
u_strncpy(syms->currency, temp.getUChars(), len);
|
||||
syms->currency[len > 0 ? len + 1 : 0] = 0x0000;
|
||||
|
||||
dfs->getInternationalCurrencySymbol(temp);
|
||||
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE);
|
||||
len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
|
||||
u_strncpy(syms->intlCurrency, temp.getUChars(), len);
|
||||
syms->intlCurrency[len > 0 ? len + 1 : 0] = 0x0000;
|
||||
|
||||
@ -553,12 +553,12 @@ unum_getSymbols(const UNumberFormat* fmt,
|
||||
syms->padEscape = dfs->getPadEscape();
|
||||
|
||||
dfs->getInfinity(temp);
|
||||
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE);
|
||||
len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
|
||||
u_strncpy(syms->infinity, temp.getUChars(), len);
|
||||
syms->infinity[len > 0 ? len + 1 : 0] = 0x0000;
|
||||
|
||||
dfs->getNaN(temp);
|
||||
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE);
|
||||
len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
|
||||
u_strncpy(syms->naN, temp.getUChars(), len);
|
||||
syms->naN[len > 0 ? len + 1 : 0] = 0x0000;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ CollationAPITest::TestProperty( char* par )
|
||||
|
||||
logln("Default collation property test ended.");
|
||||
logln("Collator::getRules() testing ...");
|
||||
doAssert(((RuleBasedCollator*)col)->getRules().size() != 0, "getRules() result incorrect" );
|
||||
doAssert(((RuleBasedCollator*)col)->getRules().length() != 0, "getRules() result incorrect" );
|
||||
logln("getRules tests end.");
|
||||
|
||||
delete col; col = 0;
|
||||
|
@ -89,12 +89,12 @@ void CharIterTest::TestIteration() {
|
||||
c = iter.first();
|
||||
i = 0;
|
||||
|
||||
if (iter.startIndex() != 0 || iter.endIndex() != text.size())
|
||||
if (iter.startIndex() != 0 || iter.endIndex() != text.length())
|
||||
errln("startIndex() or endIndex() failed");
|
||||
|
||||
logln("Testing forward iteration...");
|
||||
do {
|
||||
if (c == CharacterIterator::DONE && i != text.size())
|
||||
if (c == CharacterIterator::DONE && i != text.length())
|
||||
errln("Iterator reached end prematurely");
|
||||
else if (c != text[i])
|
||||
errln((UnicodeString)"Character mismatch at position " + i +
|
||||
@ -113,7 +113,7 @@ void CharIterTest::TestIteration() {
|
||||
} while (c != CharacterIterator::DONE);
|
||||
|
||||
c = iter.last();
|
||||
i = text.size() - 1;
|
||||
i = text.length() - 1;
|
||||
|
||||
logln("Testing backward iteration...");
|
||||
do {
|
||||
|
@ -477,7 +477,7 @@ void ConvertTest::TestConvert()
|
||||
|
||||
logln("\n---Testing UChar* RoundTrip ...");
|
||||
// uniString3->remove();
|
||||
uniString3->replace(0, uniString3->size(), my_ucs_file_buffer, i);
|
||||
uniString3->replace(0, uniString3->length(), my_ucs_file_buffer, i);
|
||||
//uniString3 = new UnicodeString(my_ucs_file_buffer,i);
|
||||
|
||||
/*checks if Uni1 == Uni3*/
|
||||
@ -499,7 +499,7 @@ void ConvertTest::TestConvert()
|
||||
|
||||
|
||||
SJIS.toUnicodeString(myString, mySJIS, 12, err);
|
||||
if (U_FAILURE(err)||(myString.size()!=10)) errln("toUnicodeString test failed");
|
||||
if (U_FAILURE(err)||(myString.length()!=10)) errln("toUnicodeString test failed");
|
||||
else logln("toUnicodeString test ok");
|
||||
|
||||
fclose(ucs_file_in);
|
||||
@ -516,7 +516,7 @@ void ConvertTest::TestConvert()
|
||||
|
||||
void WriteToFile(const UnicodeString *a, FILE *myfile)
|
||||
{
|
||||
uint32_t size = a->size();
|
||||
uint32_t size = a->length();
|
||||
uint16_t i = 0;
|
||||
UChar b = 0xFEFF;
|
||||
|
||||
|
@ -189,7 +189,7 @@ void DateFormatRegressionTest::Test4052408()
|
||||
pos.getBeginIndex() + ", " +
|
||||
pos.getEndIndex());
|
||||
UnicodeString exp = expected[i];
|
||||
if((exp.size() == 0 && str.size() == 0) || str == exp)
|
||||
if((exp.length() == 0 && str.length() == 0) || str == exp)
|
||||
logln(" ok");
|
||||
else {
|
||||
logln(UnicodeString(" expected ") + exp);
|
||||
|
@ -305,7 +305,7 @@ int32_t DateFormatRoundTripTest::getField(UDate d, int32_t f) {
|
||||
UnicodeString& DateFormatRoundTripTest::escape(const UnicodeString& src, UnicodeString& dst )
|
||||
{
|
||||
dst.remove();
|
||||
for (int32_t i = 0; i < src.size(); ++i) {
|
||||
for (int32_t i = 0; i < src.length(); ++i) {
|
||||
UChar c = src[i];
|
||||
if(c < 0x0080)
|
||||
dst += c;
|
||||
|
@ -114,7 +114,7 @@ void DateFormatTest::TestWallyWedel()
|
||||
{
|
||||
//fmtDstOffset = fmtOffset->substring(3);
|
||||
fmtDstOffset = new UnicodeString();
|
||||
fmtOffset.extract(3, fmtOffset.size(), *fmtDstOffset);
|
||||
fmtOffset.extract(3, fmtOffset.length(), *fmtDstOffset);
|
||||
}
|
||||
/*
|
||||
* Show our result.
|
||||
@ -193,7 +193,7 @@ UnicodeString&
|
||||
DateFormatTest::escape(UnicodeString& s)
|
||||
{
|
||||
UnicodeString buf;
|
||||
for (int32_t i=0; i<s.size(); ++i)
|
||||
for (int32_t i=0; i<s.length(); ++i)
|
||||
{
|
||||
UChar c = s[(UTextOffset)i];
|
||||
if (c <= (UChar)0x7F) buf += c;
|
||||
@ -579,7 +579,7 @@ DateFormatTest::TestQuotePattern161()
|
||||
UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString);
|
||||
UnicodeString exp("08/13/1997 at 10:42:28 AM ");
|
||||
logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString);
|
||||
if (0 != dateString.compareBetween(0, exp.size(), exp, 0, exp.size())) errln((UnicodeString)"FAIL: Expected " + exp);
|
||||
if (0 != dateString.compareBetween(0, exp.length(), exp, 0, exp.length())) errln((UnicodeString)"FAIL: Expected " + exp);
|
||||
delete formatter;
|
||||
if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
|
||||
}
|
||||
@ -621,7 +621,7 @@ DateFormatTest::TestBadInput135()
|
||||
{
|
||||
UnicodeString format; full->format(when, format);
|
||||
logln(prefix + "OK: " + format);
|
||||
if (0!=format.compareBetween(0, expected.size(), expected, 0, expected.size()))
|
||||
if (0!=format.compareBetween(0, expected.length(), expected, 0, expected.length()))
|
||||
errln((UnicodeString)"FAIL: Expected " + expected);
|
||||
}
|
||||
//}
|
||||
@ -708,7 +708,7 @@ DateFormatTest::TestBadInput135a()
|
||||
if (parsePosition.getIndex() != 0) {
|
||||
UnicodeString s1, s2;
|
||||
s.extract(0, parsePosition.getIndex(), s1);
|
||||
s.extract(parsePosition.getIndex(), s.size(), s2);
|
||||
s.extract(parsePosition.getIndex(), s.length(), s2);
|
||||
if (date == 0) errln((UnicodeString)"ERROR: null result fmt=\"" +
|
||||
parseFormats[index] +
|
||||
"\" pos=" + parsePosition.getIndex() + " " +
|
||||
|
@ -300,7 +300,7 @@ IntlTest::prettify(const UnicodeString &source,
|
||||
target.remove();
|
||||
target += "\"";
|
||||
|
||||
for (i = 0; i < source.size(); i += 1)
|
||||
for (i = 0; i < source.length(); i += 1)
|
||||
{
|
||||
UChar ch = source[i];
|
||||
|
||||
@ -710,7 +710,7 @@ void IntlTest::LL_message( UnicodeString message, bool_t newline )
|
||||
int32_t saveFlags = stream.flags();
|
||||
stream << hex;
|
||||
|
||||
int32_t len = message.size();
|
||||
int32_t len = message.length();
|
||||
UTextOffset pos = 0;
|
||||
bool_t gen = FALSE;
|
||||
do{
|
||||
|
@ -129,12 +129,12 @@ void CollationIteratorTest::TestOffset(char *par)
|
||||
|
||||
int32_t offset = iter->getOffset();
|
||||
|
||||
if (offset != test1.size())
|
||||
if (offset != test1.length())
|
||||
{
|
||||
UnicodeString msg1("offset at end != length: ");
|
||||
UnicodeString msg2(" vs ");
|
||||
|
||||
errln(msg1 + offset + msg2 + test1.size());
|
||||
errln(msg1 + offset + msg2 + test1.length());
|
||||
}
|
||||
|
||||
// Now set the offset back to the beginning and see if it works
|
||||
|
@ -752,14 +752,14 @@ void IntlTestTextBoundary::TestLineInvariants()
|
||||
// it doesn't break around the non-breaking characters
|
||||
UnicodeString noBreak = CharsToUnicodeString("\\u00a0\\u2007\\u2011\\ufeff");
|
||||
UnicodeString work("aaa");
|
||||
for (i = 0; i < testChars.size(); i++) {
|
||||
for (i = 0; i < testChars.length(); i++) {
|
||||
UChar c = testChars[i];
|
||||
if (c == '\r' || c == '\n' || c == 0x2029 || c == 0x2028 || c == 0x0003)
|
||||
continue;
|
||||
work[0] = c;
|
||||
for (j = 0; j < noBreak.size(); j++) {
|
||||
for (j = 0; j < noBreak.length(); j++) {
|
||||
work[1] = noBreak[j];
|
||||
for (k = 0; k < testChars.size(); k++) {
|
||||
for (k = 0; k < testChars.length(); k++) {
|
||||
work[2] = testChars[k];
|
||||
e->setText(&work);
|
||||
for (int l = e->first(); l != BreakIterator::DONE; l = e->next())
|
||||
@ -777,11 +777,11 @@ void IntlTestTextBoundary::TestLineInvariants()
|
||||
// it does break after hyphens (unless they're followed by a digit, a non-spacing mark,
|
||||
// a currency symbol, a non-breaking space, or a line or paragraph separator)
|
||||
UnicodeString dashes = CharsToUnicodeString("-\\u00ad\\u2010\\u2012\\u2013\\u2014");
|
||||
for (i = 0; i < testChars.size(); i++) {
|
||||
for (i = 0; i < testChars.length(); i++) {
|
||||
work[0] = testChars[i];
|
||||
for (j = 0; j < dashes.size(); j++) {
|
||||
for (j = 0; j < dashes.length(); j++) {
|
||||
work[1] = dashes[j];
|
||||
for (k = 0; k < testChars.size(); k++) {
|
||||
for (k = 0; k < testChars.length(); k++) {
|
||||
UChar c = testChars[k];
|
||||
if (Unicode::getType(c) == Unicode::DECIMAL_DIGIT_NUMBER ||
|
||||
Unicode::getType(c) == Unicode::OTHER_NUMBER ||
|
||||
@ -915,7 +915,7 @@ void IntlTestTextBoundary::TestJapaneseLineBreak()
|
||||
|
||||
UTextOffset i;
|
||||
|
||||
for (i = 0; i < precedingChars.size(); i++) {
|
||||
for (i = 0; i < precedingChars.length(); i++) {
|
||||
testString[1] = precedingChars[i];
|
||||
iter->adoptText(it);
|
||||
int32_t j = iter->first();
|
||||
@ -931,7 +931,7 @@ void IntlTestTextBoundary::TestJapaneseLineBreak()
|
||||
+ "' (" + ((int)(precedingChars[i])) + ")");
|
||||
}
|
||||
|
||||
for (i = 0; i < followingChars.size(); i++) {
|
||||
for (i = 0; i < followingChars.length(); i++) {
|
||||
testString[1] = followingChars[i];
|
||||
it = new StringCharacterIterator(testString);
|
||||
iter->adoptText(it);
|
||||
@ -1053,7 +1053,7 @@ void IntlTestTextBoundary::doForwardSelectionTest(BreakIterator& iterator,
|
||||
CharacterIterator *itSource = 0;
|
||||
CharacterIterator *itTarget = 0;
|
||||
|
||||
logln("doForwardSelectionTest text of length: "+testText.size());
|
||||
logln("doForwardSelectionTest text of length: "+testText.length());
|
||||
|
||||
// check to make sure setText() and getText() work right
|
||||
iterator.setText(&testText);
|
||||
@ -1074,7 +1074,7 @@ void IntlTestTextBoundary::doForwardSelectionTest(BreakIterator& iterator,
|
||||
errln((UnicodeString)"current() failed: it returned " + iterator.current() + " and offset was " + offset);
|
||||
|
||||
expectedResult = result->elementAt(forwardSelectionCounter);
|
||||
forwardSelectionOffset += expectedResult.size();
|
||||
forwardSelectionOffset += expectedResult.length();
|
||||
testText.extractBetween(lastOffset, offset, selectionResult);
|
||||
if (offset != forwardSelectionOffset) {
|
||||
errln((UnicodeString)"\n*** Selection #" +
|
||||
@ -1082,11 +1082,11 @@ void IntlTestTextBoundary::doForwardSelectionTest(BreakIterator& iterator,
|
||||
"\nExpected : " +
|
||||
expectedResult +
|
||||
" - length : " +
|
||||
expectedResult.size() +
|
||||
expectedResult.length() +
|
||||
"\nSelected : " +
|
||||
selectionResult +
|
||||
" - length : " +
|
||||
selectionResult.size());
|
||||
selectionResult.length());
|
||||
}
|
||||
logln((UnicodeString)"#" + forwardSelectionCounter + " ["+lastOffset+", "+offset+"] : " + selectionResult);
|
||||
|
||||
@ -1105,7 +1105,7 @@ void IntlTestTextBoundary::doBackwardSelectionTest(BreakIterator& iterator,
|
||||
Vector* result)
|
||||
{
|
||||
int32_t backwardSelectionCounter = (result->size() - 1);
|
||||
int32_t neededOffset = testText.size();
|
||||
int32_t neededOffset = testText.length();
|
||||
int32_t lastOffset = iterator.last();
|
||||
iterator.setText(&testText);
|
||||
int32_t offset = iterator.previous();
|
||||
@ -1116,7 +1116,7 @@ void IntlTestTextBoundary::doBackwardSelectionTest(BreakIterator& iterator,
|
||||
while(offset != BreakIterator::DONE)
|
||||
{
|
||||
expectedResult = (UnicodeString)result->elementAt(backwardSelectionCounter);
|
||||
neededOffset -= expectedResult.size();
|
||||
neededOffset -= expectedResult.length();
|
||||
testText.extractBetween(offset, lastOffset, selectionResult);
|
||||
if(offset != neededOffset) {
|
||||
errln(
|
||||
@ -1161,16 +1161,16 @@ void IntlTestTextBoundary::doFirstSelectionTest(BreakIterator& iterator,
|
||||
"\nExpexcted : " +
|
||||
expectedFirstSelection +
|
||||
" - length : " +
|
||||
expectedFirstSelection.size() +
|
||||
expectedFirstSelection.length() +
|
||||
"\nSelected : " +
|
||||
tempFirst +
|
||||
" - length : " +
|
||||
tempFirst.size() +
|
||||
tempFirst.length() +
|
||||
"\n");
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
else if (selectionStart != 0 || testText.size() != 0) {
|
||||
else if (selectionStart != 0 || testText.length() != 0) {
|
||||
errln((UnicodeString)"\n### Error in TTestFindWord::doFirstSelectionTest. Could not get first selection.\n"+
|
||||
"start = "+selectionStart+" end = "+selectionEnd);
|
||||
success = FALSE;
|
||||
@ -1208,16 +1208,16 @@ void IntlTestTextBoundary::doLastSelectionTest(BreakIterator& iterator,
|
||||
"\nExpexcted : " +
|
||||
expectedLastSelection +
|
||||
" - length : " +
|
||||
expectedLastSelection.size() +
|
||||
expectedLastSelection.length() +
|
||||
"\nSelected : " +
|
||||
tempLast +
|
||||
" - length : " +
|
||||
tempLast.size() +
|
||||
tempLast.length() +
|
||||
"\n");
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
else if (selectionEnd != 0 || testText.size() != 0) {
|
||||
else if (selectionEnd != 0 || testText.length() != 0) {
|
||||
errln((UnicodeString)"\n### Error in TTestFindWord::doLastSelectionTest. Could not get last selection."+
|
||||
"["+selectionStart+","+selectionEnd+"]");
|
||||
success = FALSE;
|
||||
@ -1242,7 +1242,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
|
||||
Vector* result)
|
||||
{
|
||||
int32_t arrayCount = result->size();
|
||||
int32_t textLength = testText.size();
|
||||
int32_t textLength = testText.length();
|
||||
iterator.setText(&testText);
|
||||
for(UTextOffset offset = 0; offset < textLength; offset++) {
|
||||
int32_t selBegin = iterator.preceding(offset);
|
||||
@ -1253,7 +1253,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
|
||||
int32_t pos = 0;
|
||||
if (selBegin != BreakIterator::DONE) {
|
||||
while (pos < selBegin && entry < arrayCount) {
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).size();
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).length();
|
||||
++entry;
|
||||
}
|
||||
if (pos != selBegin) {
|
||||
@ -1261,7 +1261,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).size();
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).length();
|
||||
++entry;
|
||||
}
|
||||
}
|
||||
@ -1271,7 +1271,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).size();
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).length();
|
||||
++entry;
|
||||
}
|
||||
}
|
||||
@ -1290,7 +1290,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
|
||||
Vector* result)
|
||||
{
|
||||
int32_t arrayCount = result->size();
|
||||
int32_t textLength = testText.size();
|
||||
int32_t textLength = testText.length();
|
||||
iterator.setText(&testText);
|
||||
for(UTextOffset offset = textLength - 1; offset >= 0; offset--) {
|
||||
int32_t selBegin = iterator.preceding(offset);
|
||||
@ -1301,7 +1301,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
|
||||
int32_t pos = 0;
|
||||
if (selBegin != BreakIterator::DONE) {
|
||||
while (pos < selBegin && entry < arrayCount) {
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).size();
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).length();
|
||||
++entry;
|
||||
}
|
||||
if (pos != selBegin) {
|
||||
@ -1309,7 +1309,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).size();
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).length();
|
||||
++entry;
|
||||
}
|
||||
}
|
||||
@ -1319,7 +1319,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).size();
|
||||
pos += ((UnicodeString)(result->elementAt(entry))).length();
|
||||
++entry;
|
||||
}
|
||||
}
|
||||
@ -1337,7 +1337,7 @@ void IntlTestTextBoundary::TestBug4153072() {
|
||||
BreakIterator *iter = BreakIterator::createWordInstance();
|
||||
UnicodeString str("...Hello, World!...");
|
||||
int32_t begin = 3;
|
||||
int32_t end = str.size() - 3;
|
||||
int32_t end = str.length() - 3;
|
||||
bool_t gotException = FALSE;
|
||||
bool_t dummy;
|
||||
|
||||
@ -1363,7 +1363,7 @@ void IntlTestTextBoundary::doMultipleSelectionTest(BreakIterator& iterator,
|
||||
int32_t testOffset;
|
||||
int32_t count = 0;
|
||||
|
||||
logln("doMultipleSelectionTest text of length: "+testText.size());
|
||||
logln("doMultipleSelectionTest text of length: "+testText.length());
|
||||
|
||||
if (*testIterator != iterator)
|
||||
errln("clone() or operator!= failed: two clones compared unequal");
|
||||
@ -1410,11 +1410,11 @@ void IntlTestTextBoundary::doBreakInvariantTest(BreakIterator& tb, UnicodeString
|
||||
UnicodeString breaks = CharsToUnicodeString("\r\n\\u2029\\u2028");
|
||||
UTextOffset i, j;
|
||||
|
||||
for (i = 0; i < breaks.size(); i++) {
|
||||
for (i = 0; i < breaks.length(); i++) {
|
||||
work[1] = breaks[i];
|
||||
for (j = 0; j < testChars.size(); j++) {
|
||||
for (j = 0; j < testChars.length(); j++) {
|
||||
work[0] = testChars[j];
|
||||
for (int k = 0; k < testChars.size(); k++) {
|
||||
for (int k = 0; k < testChars.length(); k++) {
|
||||
UChar c = testChars[k];
|
||||
|
||||
// if a cr is followed by lf, ps, ls or etx, don't do the check (that's
|
||||
@ -1449,9 +1449,9 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
|
||||
UTextOffset i, j;
|
||||
|
||||
// a break should never occur between CR and LF
|
||||
for (i = 0; i < testChars.size(); i++) {
|
||||
for (i = 0; i < testChars.length(); i++) {
|
||||
work[0] = testChars[i];
|
||||
for (j = 0; j < testChars.size(); j++) {
|
||||
for (j = 0; j < testChars.length(); j++) {
|
||||
work[3] = testChars[j];
|
||||
tb.setText(&work);
|
||||
for (int32_t k = tb.first(); k != BreakIterator::DONE; k = tb.next())
|
||||
@ -1469,12 +1469,12 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
|
||||
// character is CR, LF, PS, or LS
|
||||
work.remove();
|
||||
work += "aaaa";
|
||||
for (i = 0; i < testChars.size(); i++) {
|
||||
for (i = 0; i < testChars.length(); i++) {
|
||||
UChar c = testChars[i];
|
||||
if (c == '\n' || c == '\r' || c == 0x2029 || c == 0x2028 || c == 0x0003)
|
||||
continue;
|
||||
work[1] = c;
|
||||
for (j = 0; j < testChars.size(); j++) {
|
||||
for (j = 0; j < testChars.length(); j++) {
|
||||
c = testChars[j];
|
||||
if ((Unicode::getType(c) != Unicode::NON_SPACING_MARK) &&
|
||||
(Unicode::getType(c) != Unicode::ENCLOSING_MARK))
|
||||
@ -1500,7 +1500,7 @@ void IntlTestTextBoundary::sample(BreakIterator& tb,
|
||||
UnicodeString substring;
|
||||
bool_t verboseWas = verbose;
|
||||
verbose = TRUE;
|
||||
logln("-------------------------"+title+" length = "+text.size());
|
||||
logln("-------------------------"+title+" length = "+text.length());
|
||||
tb.setText(&text);
|
||||
int32_t start = tb.first();
|
||||
int32_t end;
|
||||
|
@ -151,7 +151,7 @@ void LocaleTest::TestBasicGetters() {
|
||||
if (testLocale.getCountry(temp) != (dataTable[CTRY][i]))
|
||||
errln(" Country code mismatch: " + temp + " versus "
|
||||
+ dataTable[CTRY][i]);
|
||||
if (testLocale.getVariant(temp).size() != 0)
|
||||
if (testLocale.getVariant(temp).length() != 0)
|
||||
errln(" Variant code mismatch: " + temp + " versus \"\"");
|
||||
}
|
||||
|
||||
@ -496,27 +496,27 @@ void LocaleTest::doTestDisplayNames(Locale& inLocale,
|
||||
UnicodeString expectedName;
|
||||
|
||||
expectedLang = dataTable[compareIndex][i];
|
||||
if (expectedLang.size() == 0 && defaultIsFrench)
|
||||
if (expectedLang.length() == 0 && defaultIsFrench)
|
||||
expectedLang = dataTable[DLANG_FR][i];
|
||||
if (expectedLang.size() == 0)
|
||||
if (expectedLang.length() == 0)
|
||||
expectedLang = dataTable[DLANG_EN][i];
|
||||
|
||||
expectedCtry = dataTable[compareIndex + 1][i];
|
||||
if (expectedCtry.size() == 0 && defaultIsFrench)
|
||||
if (expectedCtry.length() == 0 && defaultIsFrench)
|
||||
expectedCtry = dataTable[DCTRY_FR][i];
|
||||
if (expectedCtry.size() == 0)
|
||||
if (expectedCtry.length() == 0)
|
||||
expectedCtry = dataTable[DCTRY_EN][i];
|
||||
|
||||
expectedVar = dataTable[compareIndex + 2][i];
|
||||
if (expectedVar.size() == 0 && defaultIsFrench)
|
||||
if (expectedVar.length() == 0 && defaultIsFrench)
|
||||
expectedVar = dataTable[DVAR_FR][i];
|
||||
if (expectedVar.size() == 0)
|
||||
if (expectedVar.length() == 0)
|
||||
expectedVar = dataTable[DVAR_EN][i];
|
||||
|
||||
expectedName = dataTable[compareIndex + 3][i];
|
||||
if (expectedName.size() == 0 && defaultIsFrench)
|
||||
if (expectedName.length() == 0 && defaultIsFrench)
|
||||
expectedName = dataTable[DNAME_FR][i];
|
||||
if (expectedName.size() == 0)
|
||||
if (expectedName.length() == 0)
|
||||
expectedName = dataTable[DNAME_EN][i];
|
||||
|
||||
if (testLang != expectedLang)
|
||||
@ -703,7 +703,7 @@ LocaleTest::TestGetLangsAndCountries()
|
||||
UnicodeString lc(test[i]);
|
||||
if (test[i] != lc.toLower())
|
||||
errln(test[i] + " is not all lower case.");
|
||||
if (test[i].size() != 2)
|
||||
if (test[i].length() != 2)
|
||||
errln(test[i] + " is not two characters long.");
|
||||
if (i > 0 && test[i].compare(test[i - 1]) <= 0)
|
||||
errln(test[i] + " appears in an out-of-order position in the list.");
|
||||
@ -732,7 +732,7 @@ LocaleTest::TestGetLangsAndCountries()
|
||||
UnicodeString uc(test[i]);
|
||||
if (test[i] != uc.toUpper())
|
||||
errln(test[i] + " is not all upper case.");
|
||||
if (test[i].size() != 2)
|
||||
if (test[i].length() != 2)
|
||||
errln(test[i] + " is not two characters long.");
|
||||
if (i > 0 && test[i].compare(test[i - 1]) <= 0)
|
||||
errln(test[i] + " appears in an out-of-order position in the list.");
|
||||
|
@ -292,7 +292,7 @@ NumberFormatRoundTripTest::escape(UnicodeString& s)
|
||||
{
|
||||
UnicodeString copy(s);
|
||||
s.remove();
|
||||
for(int i = 0; i < copy.size(); ++i) {
|
||||
for(int i = 0; i < copy.length(); ++i) {
|
||||
UChar c = copy[i];
|
||||
if(c < 0x00FF)
|
||||
s += c;
|
||||
|
@ -157,7 +157,7 @@ NumberFormatTest::TestExponential()
|
||||
if (af.getType() == Formattable::kLong) a = af.getLong();
|
||||
else if (af.getType() == Formattable::kDouble) a = af.getDouble();
|
||||
else errln((UnicodeString)"FAIL: Non-numeric Formattable returned");
|
||||
if (pos.getIndex() == s.size())
|
||||
if (pos.getIndex() == s.length())
|
||||
{
|
||||
logln((UnicodeString)" -parse-> " + a);
|
||||
if (a != valParse[v+ival])
|
||||
@ -179,7 +179,7 @@ NumberFormatTest::TestExponential()
|
||||
int32_t a;
|
||||
if (af.getType() == Formattable::kLong) a = af.getLong();
|
||||
else errln((UnicodeString)"FAIL: Non-long Formattable returned");
|
||||
if (pos.getIndex() == s.size())
|
||||
if (pos.getIndex() == s.length())
|
||||
{
|
||||
logln((UnicodeString)" -parse-> " + a);
|
||||
if (a != lvalParse[v+ilval])
|
||||
@ -269,7 +269,7 @@ UnicodeString&
|
||||
NumberFormatTest::escape(UnicodeString& s)
|
||||
{
|
||||
UnicodeString buf;
|
||||
for (int32_t i=0; i<s.size(); ++i)
|
||||
for (int32_t i=0; i<s.length(); ++i)
|
||||
{
|
||||
UChar c = s[(UTextOffset)i];
|
||||
if (c <= (UChar)0x7F) buf += c;
|
||||
|
@ -121,7 +121,7 @@ static UnicodeString str(const char *input)
|
||||
|
||||
while ((index = result.indexOf("\\u")) != -1)
|
||||
{
|
||||
if (index + 6 <= result.size())
|
||||
if (index + 6 <= result.length())
|
||||
{
|
||||
UChar c = 0;
|
||||
for (int i = index + 2; i < index + 6; i++) {
|
||||
@ -258,11 +258,11 @@ void NumberFormatRegressionTest::Test4087535 ()
|
||||
UnicodeString buffer;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
buffer = df->format(n, buffer, pos);
|
||||
if (buffer.size() == 0)
|
||||
if (buffer.length() == 0)
|
||||
errln(/*n + */": '" + buffer + "'");
|
||||
n = 0.1;
|
||||
buffer = df->format(n, buffer, pos);
|
||||
if (buffer.size() == 0)
|
||||
if (buffer.length() == 0)
|
||||
errln(/*n + */": '" + buffer + "'");
|
||||
|
||||
delete df;
|
||||
@ -1445,16 +1445,16 @@ void NumberFormatRegressionTest::Test4122840()
|
||||
symbols->setDecimalSeparator(symbols->getMonetaryDecimalSeparator());
|
||||
|
||||
UnicodeString buf(pattern);
|
||||
for (int j = 0; j < buf.size(); j++) {
|
||||
for (int j = 0; j < buf.length(); j++) {
|
||||
if (buf[j] == 0x00a4 ) {
|
||||
if(buf[j + 1] == 0x00a4) {
|
||||
// {sfb} added to support double currency marker (intl currency sign)
|
||||
buf.replace(j, /*j+*/2, symbols->getInternationalCurrencySymbol(temp));
|
||||
j += symbols->getInternationalCurrencySymbol(temp).size() - 1 + 1;
|
||||
j += symbols->getInternationalCurrencySymbol(temp).length() - 1 + 1;
|
||||
}
|
||||
else {
|
||||
buf.replace(j, /*j+*/1, symbols->getCurrencySymbol(temp));
|
||||
j += symbols->getCurrencySymbol(temp).size() - 1;
|
||||
j += symbols->getCurrencySymbol(temp).length() - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ static UChar toHexString(int32_t i) { return i + (i < 10 ? '0' : ('A' - 10)); }
|
||||
UnicodeString
|
||||
TransliteratorTest::escape(const UnicodeString& s) {
|
||||
UnicodeString buf;
|
||||
for (int32_t i=0; i<s.size(); ++i)
|
||||
for (int32_t i=0; i<s.length(); ++i)
|
||||
{
|
||||
UChar c = s[(UTextOffset)i];
|
||||
if (' ' <= c && c <= (UChar)0x7F) {
|
||||
|
@ -444,11 +444,11 @@ UnicodeString showDifference(const UnicodeString& expected, const UnicodeString&
|
||||
{
|
||||
UnicodeString res;
|
||||
res = expected + "<Expected\n";
|
||||
if(expected.size() != result.size())
|
||||
if(expected.length() != result.length())
|
||||
res += " [ Different lengths ] \n";
|
||||
else
|
||||
{
|
||||
for(int32_t i=0;i<expected.size();i++)
|
||||
for(int32_t i=0;i<expected.length();i++)
|
||||
{
|
||||
if(expected[i] == result[i])
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ static UnicodeString str(const char *input)
|
||||
|
||||
while ((index = result.indexOf("\\u")) != -1)
|
||||
{
|
||||
if (index + 6 <= result.size())
|
||||
if (index + 6 <= result.length())
|
||||
{
|
||||
UChar c = 0;
|
||||
for (int i = index + 2; i < index + 6; i++) {
|
||||
@ -267,7 +267,7 @@ UnicodeString BasicNormalizerTest::hex(UChar ch) {
|
||||
|
||||
UnicodeString BasicNormalizerTest::hex(const UnicodeString& s) {
|
||||
UnicodeString result;
|
||||
for (int i = 0; i < s.size(); ++i) {
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
if (i != 0) result += ',';
|
||||
appendHex(s[i], 4, result);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ static UChar toHexString(int32_t i) { return i + (i < 10 ? '0' : ('A' - 10)); }
|
||||
UnicodeString
|
||||
UnicodeSetTest::escape(const UnicodeString& s) {
|
||||
UnicodeString buf;
|
||||
for (int32_t i=0; i<s.size(); ++i)
|
||||
for (int32_t i=0; i<s.length(); ++i)
|
||||
{
|
||||
UChar c = s[(UTextOffset)i];
|
||||
if (' ' <= c && c <= (UChar)0x7F) {
|
||||
|
@ -82,10 +82,10 @@ UnicodeStringTest::TestBasicManipulation()
|
||||
if (test2 != expectedValue)
|
||||
errln("operator+=() failed: expected \"" + expectedValue + "\"\n,got \"" + test2 + "\"");
|
||||
|
||||
if (test1.size() != 70)
|
||||
errln("size() failed: expected 70, got " + test1.size());
|
||||
if (test2.size() != 30)
|
||||
errln("size() failed: expected 30, got " + test2.size());
|
||||
if (test1.length() != 70)
|
||||
errln("length() failed: expected 70, got " + test1.length());
|
||||
if (test2.length() != 30)
|
||||
errln("length() failed: expected 30, got " + test2.length());
|
||||
}
|
||||
|
||||
void
|
||||
@ -225,7 +225,7 @@ UnicodeStringTest::TestRemoveReplace()
|
||||
" expected \"The SPAM in SPAM SPAM SPAM on the SPAM\",\n"
|
||||
" got \"" + test1 + "\"");
|
||||
|
||||
for (UTextOffset i = 0; i < test1.size(); i++)
|
||||
for (UTextOffset i = 0; i < test1.length(); i++)
|
||||
if (test5[i] != 'S' && test5[i] != 'P' && test5[i] != 'A' && test5[i] != 'M' && test5[i] != ' ')
|
||||
test1[i] = 'x';
|
||||
|
||||
@ -235,7 +235,7 @@ UnicodeStringTest::TestRemoveReplace()
|
||||
" got \"" + test1 + "\"");
|
||||
|
||||
test1.remove();
|
||||
if (test1.size() != 0)
|
||||
if (test1.length() != 0)
|
||||
errln("Remove() failed: expected empty string, got \"" + test1 + "\"");
|
||||
}
|
||||
|
||||
@ -301,14 +301,14 @@ UnicodeStringTest::TestCaseConversion()
|
||||
if (test3 != expectedResult)
|
||||
errln("toUpper failed: expected \"" + expectedResult + "\", got \"" + test3 + "\".");
|
||||
|
||||
test4.replace(0, test4.size(), uppercaseGreek);
|
||||
test4.replace(0, test4.length(), uppercaseGreek);
|
||||
|
||||
test4.toLower(Locale("el", "GR"));
|
||||
expectedResult = lowercaseGreek;
|
||||
if (test4 != expectedResult)
|
||||
errln("toLower failed: expected \"" + expectedResult + "\", got \"" + test4 + "\".");
|
||||
|
||||
test4.replace(0, test4.size(), lowercaseGreek);
|
||||
test4.replace(0, test4.length(), lowercaseGreek);
|
||||
|
||||
test4.toUpper();
|
||||
expectedResult = uppercaseGreek;
|
||||
@ -326,14 +326,14 @@ UnicodeStringTest::TestSearching()
|
||||
uint16_t occurrences = 0;
|
||||
UTextOffset startPos = 0;
|
||||
for ( ;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
startPos != -1 && startPos < test1.length();
|
||||
(startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
|
||||
;
|
||||
if (occurrences != 6)
|
||||
errln("indexOf failed: expected to find 6 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 10;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
startPos != -1 && startPos < test1.length();
|
||||
(startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
|
||||
;
|
||||
if (occurrences != 4)
|
||||
@ -341,28 +341,28 @@ UnicodeStringTest::TestSearching()
|
||||
|
||||
UTextOffset endPos = 28;
|
||||
for ( occurrences = 0, startPos = 5;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
startPos != -1 && startPos < test1.length();
|
||||
(startPos = test1.indexOf(test2, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
|
||||
;
|
||||
if (occurrences != 4)
|
||||
errln("indexOf with starting and ending offsets failed: expected to find 4 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 0;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
startPos != -1 && startPos < test1.length();
|
||||
(startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
|
||||
;
|
||||
if (occurrences != 16)
|
||||
errln("indexOf with character failed: expected to find 16 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 10;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
startPos != -1 && startPos < test1.length();
|
||||
(startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
|
||||
;
|
||||
if (occurrences != 12)
|
||||
errln("indexOf with character & start offset failed: expected to find 12 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 5, endPos = 28;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
startPos != -1 && startPos < test1.length();
|
||||
(startPos = test1.indexOf(testChar, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
|
||||
;
|
||||
if (occurrences != 10)
|
||||
@ -553,16 +553,16 @@ UnicodeStringTest::TestMiscellaneous()
|
||||
errln("getUChars() affected the string!");
|
||||
|
||||
UTextOffset i;
|
||||
for (i = 0; i < test2.size(); i++)
|
||||
for (i = 0; i < test2.length(); i++)
|
||||
if (test2[i] != test4[i])
|
||||
errln(UnicodeString("getUChars() failed: strings differ at position ") + i);
|
||||
|
||||
test4 = test1.orphanStorage();
|
||||
|
||||
if (test1.size() != 0)
|
||||
if (test1.length() != 0)
|
||||
errln("orphanStorage() failed: orphaned string's contents is " + test1);
|
||||
|
||||
for (i = 0; i < test2.size(); i++)
|
||||
for (i = 0; i < test2.length(); i++)
|
||||
if (test2[i] != test4[i])
|
||||
errln(UnicodeString("orphanStorage() failed: strings differ at position ") + i);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user