mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-2580 replace RES_ UResType constant names with URES_ names
X-SVN-Rev: 11564
This commit is contained in:
parent
6df7e25b4b
commit
912673a5e4
10 changed files with 234 additions and 191 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1997-2002, International Business Machines
|
||||
* Copyright (C) 1997-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
|
@ -57,22 +57,68 @@ typedef struct UResourceBundle UResourceBundle;
|
|||
|
||||
/**
|
||||
* Numeric constants for types of resource items.
|
||||
* @see ures_getType
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef enum {
|
||||
RES_NONE=-1,
|
||||
RES_STRING=0,
|
||||
RES_BINARY=1,
|
||||
RES_TABLE=2,
|
||||
/* this resource is an alias - contains a string
|
||||
* that is the name of resource containing data
|
||||
*/
|
||||
RES_ALIAS=3,
|
||||
/** Resource type constant for "no resource". @draft ICU 2.6 */
|
||||
URES_NONE=-1,
|
||||
|
||||
RES_INT=7,
|
||||
RES_ARRAY=8,
|
||||
/** Resource type constant for 16-bit Unicode strings. @draft ICU 2.6 */
|
||||
URES_STRING=0,
|
||||
|
||||
RES_INT_VECTOR=14,
|
||||
/** Resource type constant for binary data. @draft ICU 2.6 */
|
||||
URES_BINARY=1,
|
||||
|
||||
/** Resource type constant for tables of key-value pairs. @draft ICU 2.6 */
|
||||
URES_TABLE=2,
|
||||
|
||||
/**
|
||||
* Resource type constant for aliases;
|
||||
* internally stores a string which identifies the actual resource
|
||||
* storing the data (can be in a different resource bundle).
|
||||
* Resolved internally before delivering the actual resource through the API.
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
URES_ALIAS=3,
|
||||
|
||||
/**
|
||||
* Resource type constant for a single 28-bit integer, interpreted as
|
||||
* signed or unsigned by the ures_getInt() or ures_getUInt() function.
|
||||
* @see ures_getInt
|
||||
* @see ures_getUInt
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
URES_INT=7,
|
||||
|
||||
/** Resource type constant for arrays of resources. @draft ICU 2.6 */
|
||||
URES_ARRAY=8,
|
||||
|
||||
/**
|
||||
* Resource type constant for vectors of 32-bit integers.
|
||||
* @see ures_getIntVector
|
||||
* @draft ICU 2.6
|
||||
*/
|
||||
URES_INT_VECTOR=14,
|
||||
|
||||
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_NONE=URES_NONE,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_STRING=URES_STRING,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_BINARY=URES_BINARY,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_TABLE=URES_TABLE,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_ALIAS=URES_ALIAS,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_INT=URES_INT,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_ARRAY=URES_ARRAY,
|
||||
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
||||
RES_INT_VECTOR=URES_INT_VECTOR,
|
||||
/** @deprecated ICU 2.6 Not used. */
|
||||
RES_RESERVED=15
|
||||
} UResType;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1997-2002, International Business Machines Corporation and *
|
||||
* Copyright (C) 1997-2003, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*
|
||||
|
@ -518,7 +518,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
|||
if(status == NULL || U_FAILURE(*status)) {
|
||||
return resB;
|
||||
}
|
||||
if(RES_GET_TYPE(r) == RES_ALIAS) { /* This is an alias, need to exchange with real data */
|
||||
if(RES_GET_TYPE(r) == URES_ALIAS) { /* This is an alias, need to exchange with real data */
|
||||
if(noAlias < URES_MAX_ALIAS_LEVEL) {
|
||||
int32_t len = 0;
|
||||
const UChar *alias = res_getAlias(rdata, r, &len);
|
||||
|
@ -584,7 +584,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
|||
} else if(index != -1) {
|
||||
/* if there is no key, but there is an index, try to get by the index */
|
||||
/* here we have either a table or an array, so get the element */
|
||||
if(RES_GET_TYPE(r) == RES_TABLE) {
|
||||
if(RES_GET_TYPE(r) == URES_TABLE) {
|
||||
r = res_getTableItemByIndex(&(mainRes->fResData), r, index, &aKey);
|
||||
} else { /* array */
|
||||
r = res_getArrayItem(&(mainRes->fResData), r, index);
|
||||
|
@ -742,13 +742,13 @@ U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_
|
|||
}
|
||||
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_STRING:
|
||||
case URES_STRING:
|
||||
return res_getString(&(resB->fResData), resB->fRes, len);
|
||||
case RES_INT:
|
||||
case RES_INT_VECTOR:
|
||||
case RES_BINARY:
|
||||
case RES_ARRAY:
|
||||
case RES_TABLE:
|
||||
case URES_INT:
|
||||
case URES_INT_VECTOR:
|
||||
case URES_BINARY:
|
||||
case URES_ARRAY:
|
||||
case URES_TABLE:
|
||||
default:
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
}
|
||||
|
@ -766,13 +766,13 @@ U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int3
|
|||
return NULL;
|
||||
}
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_BINARY:
|
||||
case URES_BINARY:
|
||||
return res_getBinary(&(resB->fResData), resB->fRes, len);
|
||||
case RES_INT:
|
||||
case RES_STRING:
|
||||
case RES_INT_VECTOR:
|
||||
case RES_ARRAY:
|
||||
case RES_TABLE:
|
||||
case URES_INT:
|
||||
case URES_STRING:
|
||||
case URES_INT_VECTOR:
|
||||
case URES_ARRAY:
|
||||
case URES_TABLE:
|
||||
default:
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
}
|
||||
|
@ -790,13 +790,13 @@ U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, i
|
|||
return NULL;
|
||||
}
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
return res_getIntVector(&(resB->fResData), resB->fRes, len);
|
||||
case RES_INT:
|
||||
case RES_STRING:
|
||||
case RES_ARRAY:
|
||||
case RES_BINARY:
|
||||
case RES_TABLE:
|
||||
case URES_INT:
|
||||
case URES_STRING:
|
||||
case URES_ARRAY:
|
||||
case URES_BINARY:
|
||||
case URES_TABLE:
|
||||
default:
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *st
|
|||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0xffffffff;
|
||||
}
|
||||
if(RES_GET_TYPE(resB->fRes) != RES_INT) {
|
||||
if(RES_GET_TYPE(resB->fRes) != URES_INT) {
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
@ -829,7 +829,7 @@ U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *
|
|||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0xffffffff;
|
||||
}
|
||||
if(RES_GET_TYPE(resB->fRes) != RES_INT) {
|
||||
if(RES_GET_TYPE(resB->fRes) != URES_INT) {
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *
|
|||
|
||||
U_CAPI UResType U_EXPORT2 ures_getType(UResourceBundle *resB) {
|
||||
if(resB == NULL) {
|
||||
return RES_NONE;
|
||||
return URES_NONE;
|
||||
}
|
||||
return (UResType) (RES_GET_TYPE(resB->fRes));
|
||||
}
|
||||
|
@ -890,23 +890,23 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t*
|
|||
} else {
|
||||
resB->fIndex++;
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_INT:
|
||||
case RES_BINARY:
|
||||
case RES_STRING:
|
||||
case URES_INT:
|
||||
case URES_BINARY:
|
||||
case URES_STRING:
|
||||
return res_getString(&(resB->fResData), resB->fRes, len);
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, key);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return res_getString(&(resB->fResData), r, len);
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return res_getString(&(resB->fResData), r, len);
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
|
@ -936,23 +936,23 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UR
|
|||
} else {
|
||||
resB->fIndex++;
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_INT:
|
||||
case RES_BINARY:
|
||||
case RES_STRING:
|
||||
case URES_INT:
|
||||
case URES_BINARY:
|
||||
case URES_STRING:
|
||||
return ures_copyResb(fillIn, resB, status);
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, &key);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
default:
|
||||
/*return NULL;*/
|
||||
return fillIn;
|
||||
|
@ -978,23 +978,23 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, i
|
|||
|
||||
if(indexR >= 0 && resB->fSize > indexR) {
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_INT:
|
||||
case RES_BINARY:
|
||||
case RES_STRING:
|
||||
case URES_INT:
|
||||
case URES_BINARY:
|
||||
case URES_STRING:
|
||||
return ures_copyResb(fillIn, resB, status);
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexR, &key);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
r = res_getArrayItem(&(resB->fResData), resB->fRes, indexR);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
default:
|
||||
/*return NULL;*/
|
||||
return fillIn;
|
||||
|
@ -1020,23 +1020,23 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB,
|
|||
|
||||
if(indexS >= 0 && resB->fSize > indexS) {
|
||||
switch(RES_GET_TYPE(resB->fRes)) {
|
||||
case RES_INT:
|
||||
case RES_BINARY:
|
||||
case RES_STRING:
|
||||
case URES_INT:
|
||||
case URES_BINARY:
|
||||
case URES_STRING:
|
||||
return res_getString(&(resB->fResData), resB->fRes, len);
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexS, &key);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return res_getString(&(resB->fResData), r, len);
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
r = res_getArrayItem(&(resB->fResData), resB->fRes, indexS);
|
||||
if(r == RES_BOGUS && resB->fHasFallback) {
|
||||
/* TODO: do the fallback */
|
||||
}
|
||||
return res_getString(&(resB->fResData), r, len);
|
||||
/*case RES_INT_VECTOR:*/
|
||||
/*case URES_INT_VECTOR:*/
|
||||
/*default:*/
|
||||
/*return;*/
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
|
|||
return fillIn;
|
||||
}
|
||||
|
||||
if(RES_GET_TYPE(resB->fRes) == RES_TABLE) {
|
||||
if(RES_GET_TYPE(resB->fRes) == URES_TABLE) {
|
||||
int32_t t;
|
||||
res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
|
||||
if(res == RES_BOGUS) {
|
||||
|
@ -1162,7 +1162,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
|
|||
#if 0
|
||||
/* this is a kind of TODO item. If we have an array with an index table, we could do this. */
|
||||
/* not currently */
|
||||
else if(RES_GET_TYPE(resB->fRes) == RES_ARRAY && resB->fHasFallback == TRUE) {
|
||||
else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
|
||||
/* here should go a first attempt to locate the key using index table */
|
||||
const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
|
||||
if(U_SUCCESS(*status)) {
|
||||
|
@ -1191,7 +1191,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if(RES_GET_TYPE(resB->fRes) == RES_TABLE) {
|
||||
if(RES_GET_TYPE(resB->fRes) == URES_TABLE) {
|
||||
int32_t t=0;
|
||||
|
||||
res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
|
||||
|
@ -1202,9 +1202,9 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
|
|||
const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
|
||||
if(U_SUCCESS(*status)) {
|
||||
switch (RES_GET_TYPE(res)) {
|
||||
case RES_STRING:
|
||||
case RES_TABLE:
|
||||
case RES_ARRAY:
|
||||
case URES_STRING:
|
||||
case URES_TABLE:
|
||||
case URES_ARRAY:
|
||||
return res_getString(rd, res, len);
|
||||
default:
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
|
@ -1217,9 +1217,9 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
|
|||
}
|
||||
} else {
|
||||
switch (RES_GET_TYPE(res)) {
|
||||
case RES_STRING:
|
||||
case RES_TABLE:
|
||||
case RES_ARRAY:
|
||||
case URES_STRING:
|
||||
case URES_TABLE:
|
||||
case URES_ARRAY:
|
||||
return res_getString(&(resB->fResData), res, len);
|
||||
default:
|
||||
*status = U_RESOURCE_TYPE_MISMATCH;
|
||||
|
@ -1229,7 +1229,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
|
|||
#if 0
|
||||
/* this is a kind of TODO item. If we have an array with an index table, we could do this. */
|
||||
/* not currently */
|
||||
else if(RES_GET_TYPE(resB->fRes) == RES_ARRAY && resB->fHasFallback == TRUE) {
|
||||
else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
|
||||
/* here should go a first attempt to locate the key using index table */
|
||||
const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
|
||||
if(U_SUCCESS(*status)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1999-2002, International Business Machines Corporation *
|
||||
* Copyright (C) 1999-2003, International Business Machines Corporation *
|
||||
* and others. All Rights Reserved. *
|
||||
* *
|
||||
*******************************************************************************
|
||||
|
@ -212,7 +212,7 @@ res_load(ResourceData *pResData,
|
|||
pResData->rootRes=*pResData->pRoot;
|
||||
|
||||
/* currently, we accept only resources that have a Table as their roots */
|
||||
if(RES_GET_TYPE(pResData->rootRes)!=RES_TABLE) {
|
||||
if(RES_GET_TYPE(pResData->rootRes)!=URES_TABLE) {
|
||||
udata_close(pResData->data);
|
||||
pResData->data=NULL;
|
||||
return FALSE;
|
||||
|
@ -231,7 +231,7 @@ res_unload(ResourceData *pResData) {
|
|||
|
||||
U_CFUNC const UChar *
|
||||
res_getString(const ResourceData *pResData, const Resource res, int32_t *pLength) {
|
||||
if(res!=RES_BOGUS && RES_GET_TYPE(res)==RES_STRING) {
|
||||
if(res!=RES_BOGUS && RES_GET_TYPE(res)==URES_STRING) {
|
||||
int32_t *p=(int32_t *)RES_GET_POINTER(pResData->pRoot, res);
|
||||
if (pLength) {
|
||||
*pLength=*p;
|
||||
|
@ -247,7 +247,7 @@ res_getString(const ResourceData *pResData, const Resource res, int32_t *pLength
|
|||
|
||||
U_CFUNC const UChar *
|
||||
res_getAlias(const ResourceData *pResData, const Resource res, int32_t *pLength) {
|
||||
if(res!=RES_BOGUS && RES_GET_TYPE(res)==RES_ALIAS) {
|
||||
if(res!=RES_BOGUS && RES_GET_TYPE(res)==URES_ALIAS) {
|
||||
int32_t *p=(int32_t *)RES_GET_POINTER(pResData->pRoot, res);
|
||||
if (pLength) {
|
||||
*pLength=*p;
|
||||
|
@ -279,7 +279,7 @@ res_getBinary(const ResourceData *pResData, const Resource res, int32_t *pLength
|
|||
|
||||
U_CFUNC const int32_t *
|
||||
res_getIntVector(const ResourceData *pResData, const Resource res, int32_t *pLength) {
|
||||
if(res!=RES_BOGUS && RES_GET_TYPE(res)==RES_INT_VECTOR) {
|
||||
if(res!=RES_BOGUS && RES_GET_TYPE(res)==URES_INT_VECTOR) {
|
||||
int32_t *p=(int32_t *)RES_GET_POINTER(pResData->pRoot, res);
|
||||
*pLength=*p++;
|
||||
if (*pLength == 0) {
|
||||
|
@ -295,13 +295,13 @@ res_getIntVector(const ResourceData *pResData, const Resource res, int32_t *pLen
|
|||
U_CFUNC int32_t
|
||||
res_countArrayItems(const ResourceData *pResData, const Resource res) {
|
||||
if(res!=RES_BOGUS) {
|
||||
if(RES_GET_TYPE(res)==RES_STRING) {
|
||||
if(RES_GET_TYPE(res)==URES_STRING) {
|
||||
return 1;
|
||||
} else if(RES_GET_TYPE(res)==RES_ARRAY) {
|
||||
} else if(RES_GET_TYPE(res)==URES_ARRAY) {
|
||||
Resource *p=RES_GET_POINTER(pResData->pRoot, res);
|
||||
int32_t count=*(int32_t *)p;
|
||||
return count;
|
||||
} else if(RES_GET_TYPE(res)==RES_TABLE) {
|
||||
} else if(RES_GET_TYPE(res)==URES_TABLE) {
|
||||
return res_getTableSize(pResData, res);
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ res_findResource(const ResourceData *pResData, Resource r, const char** path, co
|
|||
int32_t indexR = 0, keyLen = 0;
|
||||
UResType type = RES_GET_TYPE(t1);
|
||||
|
||||
while(nextSepP && *pathP && t1 != RES_BOGUS && (type == RES_TABLE || type == RES_ARRAY)) {
|
||||
while(nextSepP && *pathP && t1 != RES_BOGUS && (type == URES_TABLE || type == URES_ARRAY)) {
|
||||
/* Iteration stops if: the path has been consumed, we found a non-existing
|
||||
* resource (t1 == RES_BOGUS) or we found a scalar resource (including alias)
|
||||
*/
|
||||
|
@ -350,7 +350,7 @@ res_findResource(const ResourceData *pResData, Resource r, const char** path, co
|
|||
|
||||
/* if the resource is a table */
|
||||
/* try the key based access */
|
||||
if(type == RES_TABLE) {
|
||||
if(type == URES_TABLE) {
|
||||
t2 = _res_findTableItemN(pResData->pRoot, t1, pathP, keyLen, key);
|
||||
if(t2 == RES_BOGUS) {
|
||||
/* if we fail to get the resource by key, maybe we got an index */
|
||||
|
@ -360,7 +360,7 @@ res_findResource(const ResourceData *pResData, Resource r, const char** path, co
|
|||
t2 = res_getTableItemByIndex(pResData, t1, indexR, key);
|
||||
}
|
||||
}
|
||||
} else if(type == RES_ARRAY) {
|
||||
} else if(type == URES_ARRAY) {
|
||||
t2 = _res_getArrayItem(pResData->pRoot, t1, indexR);
|
||||
*key = NULL;
|
||||
} else { /* can't do much here, except setting t2 to bogus */
|
||||
|
@ -409,4 +409,3 @@ res_getTableSize(const ResourceData *pResData, Resource table) {
|
|||
uint16_t *p=(uint16_t *)RES_GET_POINTER(pResData->pRoot, table);
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2000, International Business Machines
|
||||
* Copyright (C) 1999-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -223,7 +223,7 @@ void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErro
|
|||
const char *key = ures_getKey(resource);
|
||||
|
||||
switch(ures_getType(resource)) {
|
||||
case RES_STRING :
|
||||
case URES_STRING :
|
||||
{
|
||||
int32_t len=0;
|
||||
const UChar*thestr = ures_getString(resource, &len, status);
|
||||
|
@ -250,7 +250,7 @@ void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErro
|
|||
free(string);
|
||||
}
|
||||
break;
|
||||
case RES_INT :
|
||||
case URES_INT :
|
||||
printIndent(out, indent);
|
||||
if(key != NULL) {
|
||||
u_fprintf(out, "%s", key);
|
||||
|
@ -262,7 +262,7 @@ void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErro
|
|||
}
|
||||
u_fprintf(out, "\n");
|
||||
break;
|
||||
case RES_BINARY :
|
||||
case URES_BINARY :
|
||||
{
|
||||
int32_t len = 0;
|
||||
const int8_t *data = (const int8_t *)ures_getBinary(resource, &len, status);
|
||||
|
@ -291,7 +291,7 @@ void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErro
|
|||
}
|
||||
}
|
||||
break;
|
||||
case RES_INT_VECTOR :
|
||||
case URES_INT_VECTOR :
|
||||
{
|
||||
int32_t len = 0;
|
||||
const int32_t *data = ures_getIntVector(resource, &len, status);
|
||||
|
@ -318,8 +318,8 @@ void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErro
|
|||
}
|
||||
}
|
||||
break;
|
||||
case RES_TABLE :
|
||||
case RES_ARRAY :
|
||||
case URES_TABLE :
|
||||
case URES_ARRAY :
|
||||
{
|
||||
UResourceBundle *t = NULL;
|
||||
ures_resetIterator(resource);
|
||||
|
@ -329,7 +329,7 @@ void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErro
|
|||
}
|
||||
u_fprintf(out, "{");
|
||||
if(VERBOSE) {
|
||||
if(ures_getType(resource) == RES_TABLE) {
|
||||
if(ures_getType(resource) == URES_TABLE) {
|
||||
u_fprintf(out, " // TABLE");
|
||||
} else {
|
||||
u_fprintf(out, " // ARRAY");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2001, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2003, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/********************************************************************************
|
||||
|
@ -1310,7 +1310,7 @@ TestKeyInRootRecursive(UResourceBundle *root, UResourceBundle *currentBundle, co
|
|||
ures_getType(subBundle));
|
||||
continue;
|
||||
}
|
||||
else if (ures_getType(subBundle) == RES_INT_VECTOR) {
|
||||
else if (ures_getType(subBundle) == URES_INT_VECTOR) {
|
||||
int32_t minSize;
|
||||
int32_t subBundleSize;
|
||||
int32_t idx;
|
||||
|
@ -1350,12 +1350,12 @@ TestKeyInRootRecursive(UResourceBundle *root, UResourceBundle *currentBundle, co
|
|||
locale);
|
||||
}
|
||||
}
|
||||
else if (ures_getType(subBundle) == RES_ARRAY) {
|
||||
else if (ures_getType(subBundle) == URES_ARRAY) {
|
||||
UResourceBundle *subSubBundle = ures_getByIndex(subBundle, 0, NULL, &errorCode);
|
||||
UResourceBundle *subSubRootBundle = ures_getByIndex(subRootBundle, 0, NULL, &errorCode);
|
||||
|
||||
if (U_SUCCESS(errorCode)
|
||||
&& (ures_getType(subSubBundle) == RES_ARRAY || ures_getType(subSubRootBundle) == RES_ARRAY))
|
||||
&& (ures_getType(subSubBundle) == URES_ARRAY || ures_getType(subSubRootBundle) == URES_ARRAY))
|
||||
{
|
||||
/* TODO: Properly check for 2D arrays and zoneStrings */
|
||||
if (subBundleKey != NULL && strcmp(subBundleKey, "zoneStrings") == 0) {
|
||||
|
@ -1497,7 +1497,7 @@ TestKeyInRootRecursive(UResourceBundle *root, UResourceBundle *currentBundle, co
|
|||
ures_close(subSubBundle);
|
||||
ures_close(subSubRootBundle);
|
||||
}
|
||||
else if (ures_getType(subBundle) == RES_STRING) {
|
||||
else if (ures_getType(subBundle) == URES_STRING) {
|
||||
int32_t len = 0;
|
||||
const UChar *string = ures_getString(subBundle, &len, &errorCode);
|
||||
if (U_FAILURE(errorCode) || string == NULL) {
|
||||
|
@ -1546,11 +1546,11 @@ TestKeyInRootRecursive(UResourceBundle *root, UResourceBundle *currentBundle, co
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (ures_getType(subBundle) == RES_TABLE) {
|
||||
else if (ures_getType(subBundle) == URES_TABLE) {
|
||||
/* Here is one of the recursive parts */
|
||||
TestKeyInRootRecursive(subRootBundle, subBundle, locale);
|
||||
}
|
||||
else if (ures_getType(subBundle) == RES_BINARY || ures_getType(subBundle) == RES_INT) {
|
||||
else if (ures_getType(subBundle) == URES_BINARY || ures_getType(subBundle) == URES_INT) {
|
||||
/* Can't do anything to check it */
|
||||
/* We'll assume it's all correct */
|
||||
if (strcmp(subBundleKey, "LocaleID") != 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2001, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2003, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/********************************************************************************
|
||||
|
@ -391,7 +391,7 @@ static void TestNewTypes() {
|
|||
strcpy(action, "getting and testing of string with embeded zero");
|
||||
res = ures_getByKey(theBundle, "zerotest", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_STRING);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_STRING);
|
||||
zeroString=ures_getString(res, &len, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -407,7 +407,7 @@ static void TestNewTypes() {
|
|||
strcpy(action, "getting and testing of binary type");
|
||||
res = ures_getByKey(theBundle, "binarytest", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_BINARY);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_BINARY);
|
||||
binResult=(uint8_t*)ures_getBinary(res, &len, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -420,7 +420,7 @@ static void TestNewTypes() {
|
|||
strcpy(action, "getting and testing of imported binary type");
|
||||
res = ures_getByKey(theBundle, "importtest", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_BINARY);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_BINARY);
|
||||
binResult=(uint8_t*)ures_getBinary(res, &len, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -433,7 +433,7 @@ static void TestNewTypes() {
|
|||
strcpy(action, "getting and testing of integer types");
|
||||
res = ures_getByKey(theBundle, "one", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_INT);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_INT);
|
||||
intResult=ures_getInt(res, &status);
|
||||
uintResult = ures_getUInt(res, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -445,7 +445,7 @@ static void TestNewTypes() {
|
|||
strcpy(action, "getting minusone");
|
||||
res = ures_getByKey(theBundle, "minusone", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_INT);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_INT);
|
||||
intResult=ures_getInt(res, &status);
|
||||
uintResult = ures_getUInt(res, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -458,7 +458,7 @@ static void TestNewTypes() {
|
|||
strcpy(action, "getting plusone");
|
||||
res = ures_getByKey(theBundle, "plusone", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_INT);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_INT);
|
||||
intResult=ures_getInt(res, &status);
|
||||
uintResult = ures_getUInt(res, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -469,7 +469,7 @@ static void TestNewTypes() {
|
|||
|
||||
res = ures_getByKey(theBundle, "onehundredtwentythree", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_INT);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_INT);
|
||||
intResult=ures_getInt(res, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -581,7 +581,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of explicit string of zero length string");
|
||||
res = ures_getByKey(theBundle, "emptyexplicitstring", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_STRING);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_STRING);
|
||||
zeroString=ures_getString(res, &len, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -596,7 +596,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of normal string of zero length string");
|
||||
res = ures_getByKey(theBundle, "emptystring", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_STRING);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_STRING);
|
||||
zeroString=ures_getString(res, &len, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -611,7 +611,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of empty int");
|
||||
res = ures_getByKey(theBundle, "emptyint", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_INT);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_INT);
|
||||
intResult=ures_getInt(res, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -625,7 +625,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of zero length intvector");
|
||||
res = ures_getByKey(theBundle, "emptyintv", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_INT_VECTOR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_INT_VECTOR);
|
||||
|
||||
if(U_FAILURE(status)){
|
||||
log_err("Couldn't get emptyintv key %s\n", u_errorName(status));
|
||||
|
@ -641,7 +641,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of zero length emptybin");
|
||||
res = ures_getByKey(theBundle, "emptybin", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_BINARY);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_BINARY);
|
||||
|
||||
if(U_FAILURE(status)){
|
||||
log_err("Couldn't get emptybin key %s\n", u_errorName(status));
|
||||
|
@ -657,7 +657,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of zero length emptyarray");
|
||||
res = ures_getByKey(theBundle, "emptyarray", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_ARRAY);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_ARRAY);
|
||||
|
||||
if(U_FAILURE(status)){
|
||||
log_err("Couldn't get emptyarray key %s\n", u_errorName(status));
|
||||
|
@ -673,7 +673,7 @@ static void TestEmptyTypes() {
|
|||
strcpy(action, "getting and testing of zero length emptytable");
|
||||
res = ures_getByKey(theBundle, "emptytable", res, &status);
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(res), RES_TABLE);
|
||||
CONFIRM_INT_EQ(ures_getType(res), URES_TABLE);
|
||||
|
||||
if(U_FAILURE(status)){
|
||||
log_err("Couldn't get emptytable key %s\n", u_errorName(status));
|
||||
|
@ -744,11 +744,11 @@ static void TestBinaryCollationData(){
|
|||
coll = ures_getByKey(teRes, "CollationElements", coll, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(coll), RES_TABLE);
|
||||
CONFIRM_INT_EQ(ures_getType(coll), URES_TABLE);
|
||||
binColl=ures_getByKey(coll, "%%CollationBin", binColl, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_INT_EQ(ures_getType(binColl), RES_BINARY);
|
||||
CONFIRM_INT_EQ(ures_getType(binColl), URES_BINARY);
|
||||
binResult=(uint8_t*)ures_getBinary(binColl, &len, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -859,7 +859,7 @@ static void TestAPI() {
|
|||
}
|
||||
ures_getByKey(teRes, "string_only_in_te", teFillin, &status);
|
||||
teFillin2=ures_getNextResource(teFillin, teFillin2, &status);
|
||||
if(ures_getType(teFillin2) != RES_STRING){
|
||||
if(ures_getType(teFillin2) != URES_STRING){
|
||||
log_err("ERROR: getType for getNextResource after ures_openFillIn failed\n");
|
||||
}
|
||||
teFillin2=ures_getNextResource(teFillin, teFillin2, &status);
|
||||
|
@ -964,10 +964,10 @@ static void TestErrorConditions(){
|
|||
if(ures_getSize(NULL) != 0){
|
||||
log_err("ERROR: ures_getSize() should return 0 when UResourceBundle=NULL. Got =%d\n", ures_getSize(NULL));
|
||||
}
|
||||
/*Test ures_getType() with UResourceBundle = NULL should return RES_BOGUS or -1*/
|
||||
/*Test ures_getType() with UResourceBundle = NULL should return URES_NONE==-1*/
|
||||
status=U_ZERO_ERROR;
|
||||
if(ures_getType(NULL) != RES_NONE){
|
||||
log_err("ERROR: ures_getType() should return RES_NONE when UResourceBundle=NULL. Got =%d\n", ures_getType(NULL));
|
||||
if(ures_getType(NULL) != URES_NONE){
|
||||
log_err("ERROR: ures_getType() should return URES_NONE when UResourceBundle=NULL. Got =%d\n", ures_getType(NULL));
|
||||
}
|
||||
/*Test ures_getKey() with UResourceBundle = NULL*/
|
||||
status=U_ZERO_ERROR;
|
||||
|
@ -1420,7 +1420,7 @@ static UBool testTag(const char* frag,
|
|||
CONFIRM_ErrorCode(status,expected_resource_status);
|
||||
if (U_SUCCESS(status)) {
|
||||
/*confirm the resource type is an array*/
|
||||
CONFIRM_INT_EQ(ures_getType(array), RES_ARRAY);
|
||||
CONFIRM_INT_EQ(ures_getType(array), URES_ARRAY);
|
||||
/*confirm the size*/
|
||||
count=ures_getSize(array);
|
||||
CONFIRM_INT_GE(count,1);
|
||||
|
@ -1500,7 +1500,7 @@ static UBool testTag(const char* frag,
|
|||
if (U_SUCCESS(status))
|
||||
{
|
||||
/*confirm the resource type is an 2darray*/
|
||||
CONFIRM_INT_EQ(ures_getType(array2d), RES_ARRAY);
|
||||
CONFIRM_INT_EQ(ures_getType(array2d), URES_ARRAY);
|
||||
row_count=ures_getSize(array2d);
|
||||
CONFIRM_INT_GE(row_count,1);
|
||||
|
||||
|
@ -1510,7 +1510,7 @@ static UBool testTag(const char* frag,
|
|||
CONFIRM_ErrorCode(status, expected_resource_status);
|
||||
if(U_SUCCESS(status)){
|
||||
/*confirm the resourcetype of each table row is an array*/
|
||||
CONFIRM_INT_EQ(ures_getType(tableRow), RES_ARRAY);
|
||||
CONFIRM_INT_EQ(ures_getType(tableRow), URES_ARRAY);
|
||||
column_count=ures_getSize(tableRow);
|
||||
CONFIRM_INT_GE(column_count,1);
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ static UBool testTag(const char* frag,
|
|||
CONFIRM_ErrorCode(status, expected_resource_status);
|
||||
if (U_SUCCESS(status)) {
|
||||
UResType bundleType=ures_getType(tags);
|
||||
CONFIRM_INT_EQ(bundleType, RES_TABLE);
|
||||
CONFIRM_INT_EQ(bundleType, URES_TABLE);
|
||||
|
||||
tag_count=ures_getSize(tags);
|
||||
CONFIRM_INT_GE((int32_t)tag_count, (int32_t)0);
|
||||
|
@ -1634,7 +1634,7 @@ static UBool testTag(const char* frag,
|
|||
tagelement=ures_getByKey(tags, item_tag, tagelement, &status);
|
||||
if(!U_FAILURE(status)){
|
||||
UResType elementType=ures_getType(tagelement);
|
||||
CONFIRM_INT_EQ(elementType, RES_STRING);
|
||||
CONFIRM_INT_EQ(elementType, URES_STRING);
|
||||
if(strcmp(ures_getKey(tagelement), item_tag) == 0){
|
||||
record_pass();
|
||||
}else{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2002, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2003, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
|
@ -319,7 +319,7 @@ NewResourceBundleTest::TestIteration()
|
|||
if(U_SUCCESS(err)){
|
||||
expected=element;
|
||||
if(bundle.getSize() > 1){
|
||||
CONFIRM_EQ(bundle.getType(), RES_ARRAY);
|
||||
CONFIRM_EQ(bundle.getType(), URES_ARRAY);
|
||||
expected+=itoa(row, buf);
|
||||
ResourceBundle rowbundle=bundle.get(row, err);
|
||||
if(!U_FAILURE(err) && rowbundle.getSize()>1){
|
||||
|
@ -338,7 +338,7 @@ NewResourceBundleTest::TestIteration()
|
|||
}
|
||||
}
|
||||
else{
|
||||
CONFIRM_EQ(bundle.getType(), (int32_t)RES_STRING);
|
||||
CONFIRM_EQ(bundle.getType(), (int32_t)URES_STRING);
|
||||
}
|
||||
}
|
||||
CONFIRM_EQ(got, expected);
|
||||
|
@ -492,7 +492,7 @@ NewResourceBundleTest::TestOtherAPI(){
|
|||
if(U_SUCCESS(err)){
|
||||
expected=element;
|
||||
if(ures_getSize(bundle) > 1){
|
||||
CONFIRM_EQ(ures_getType(bundle), RES_ARRAY);
|
||||
CONFIRM_EQ(ures_getType(bundle), URES_ARRAY);
|
||||
expected+=itoa(row, buf);
|
||||
rowbundle=ures_getByIndex(bundle, row, rowbundle, &err);
|
||||
if(!U_FAILURE(err) && ures_getSize(rowbundle)>1){
|
||||
|
@ -516,7 +516,7 @@ NewResourceBundleTest::TestOtherAPI(){
|
|||
}
|
||||
}
|
||||
else{
|
||||
CONFIRM_EQ(ures_getType(bundle), (int32_t)RES_STRING);
|
||||
CONFIRM_EQ(ures_getType(bundle), (int32_t)URES_STRING);
|
||||
}
|
||||
}
|
||||
CONFIRM_EQ(got, expected);
|
||||
|
@ -675,7 +675,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
{
|
||||
//confirm the resource type is an array
|
||||
UResType bundleType=array.getType();
|
||||
CONFIRM_EQ(bundleType, RES_ARRAY);
|
||||
CONFIRM_EQ(bundleType, URES_ARRAY);
|
||||
|
||||
count=array.getSize();
|
||||
CONFIRM_GE(count,1);
|
||||
|
@ -750,7 +750,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
{
|
||||
//confirm the resource type is an 2darray
|
||||
UResType bundleType=array2d.getType();
|
||||
CONFIRM_EQ(bundleType, RES_ARRAY);
|
||||
CONFIRM_EQ(bundleType, URES_ARRAY);
|
||||
|
||||
row_count=array2d.getSize();
|
||||
CONFIRM_GE(row_count,1);
|
||||
|
@ -761,7 +761,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
if(U_SUCCESS(status)){
|
||||
//confirm the resourcetype of each table row is an array
|
||||
UResType rowType=tablerow.getType();
|
||||
CONFIRM_EQ(rowType, RES_ARRAY);
|
||||
CONFIRM_EQ(rowType, URES_ARRAY);
|
||||
|
||||
column_count=tablerow.getSize();
|
||||
CONFIRM_GE(column_count,1);
|
||||
|
@ -837,7 +837,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
|
||||
if (U_SUCCESS(status)) {
|
||||
UResType bundleType=tags.getType();
|
||||
CONFIRM_EQ(bundleType, RES_TABLE);
|
||||
CONFIRM_EQ(bundleType, URES_TABLE);
|
||||
|
||||
tag_count=tags.getSize();
|
||||
CONFIRM_GE((int32_t)tag_count, (int32_t)0);
|
||||
|
@ -897,7 +897,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
ResourceBundle tagelement=tags.get(item_tag, status);
|
||||
if(!U_FAILURE(status)){
|
||||
UResType elementType=tagelement.getType();
|
||||
CONFIRM_EQ(elementType, (int32_t)RES_STRING);
|
||||
CONFIRM_EQ(elementType, (int32_t)URES_STRING);
|
||||
const char* key=tagelement.getKey();
|
||||
CONFIRM_EQ((UnicodeString)key, (UnicodeString)item_tag);
|
||||
UnicodeString t=tagelement.getString(status);
|
||||
|
@ -977,7 +977,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
strcpy(action, "getting and testing of string with embeded zero");
|
||||
ResourceBundle res = theBundle.get("zerotest", status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_STRING);
|
||||
CONFIRM_EQ(res.getType(), URES_STRING);
|
||||
UnicodeString zeroString=res.getString(status);
|
||||
len = zeroString.length();
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -994,7 +994,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
strcpy(action, "getting and testing of binary type");
|
||||
res = theBundle.get("binarytest", status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_BINARY);
|
||||
CONFIRM_EQ(res.getType(), URES_BINARY);
|
||||
binResult=(uint8_t*)res.getBinary(len, status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -1007,7 +1007,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
strcpy(action, "getting and testing of imported binary type");
|
||||
res = theBundle.get("importtest",status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_BINARY);
|
||||
CONFIRM_EQ(res.getType(), URES_BINARY);
|
||||
binResult=(uint8_t*)res.getBinary(len, status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
|
@ -1020,7 +1020,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
strcpy(action, "getting and testing of integer types");
|
||||
res = theBundle.get("one", status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_INT);
|
||||
CONFIRM_EQ(res.getType(), URES_INT);
|
||||
intResult=res.getInt(status);
|
||||
uintResult = res.getUInt(status);
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -1032,7 +1032,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
strcpy(action, "getting minusone");
|
||||
res = theBundle.get((const char*)"minusone", status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_INT);
|
||||
CONFIRM_EQ(res.getType(), URES_INT);
|
||||
intResult=res.getInt(status);
|
||||
uintResult = res.getUInt(status);
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -1045,7 +1045,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
strcpy(action, "getting plusone");
|
||||
res = theBundle.get("plusone",status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_INT);
|
||||
CONFIRM_EQ(res.getType(), URES_INT);
|
||||
intResult=res.getInt(status);
|
||||
uintResult = res.getUInt(status);
|
||||
if(U_SUCCESS(status)){
|
||||
|
@ -1056,7 +1056,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
|
||||
res = theBundle.get("onehundredtwentythree",status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
CONFIRM_EQ(res.getType(), RES_INT);
|
||||
CONFIRM_EQ(res.getType(), URES_INT);
|
||||
intResult=res.getInt(status);
|
||||
if(U_SUCCESS(status)){
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -99,9 +99,9 @@ static uint32_t array_write(UNewDataMemory *mem, struct SResource *res,
|
|||
i = 0;
|
||||
|
||||
while (current != NULL) {
|
||||
if (current->fType == RES_INT) {
|
||||
if (current->fType == URES_INT) {
|
||||
resources[i] = (current->fType << 28) | (current->u.fIntValue.fValue & 0xFFFFFFF);
|
||||
} else if (current->fType == RES_BINARY) {
|
||||
} else if (current->fType == URES_BINARY) {
|
||||
uint32_t uo = usedOffset;
|
||||
|
||||
usedOffset = res_write(mem, current, usedOffset, status);
|
||||
|
@ -207,9 +207,9 @@ static uint32_t table_write(UNewDataMemory *mem, struct SResource *res,
|
|||
/* where the key is plus root pointer */
|
||||
keys[i] = (uint16_t) (current->fKey + sizeof(uint32_t));
|
||||
|
||||
if (current->fType == RES_INT) {
|
||||
if (current->fType == URES_INT) {
|
||||
resources[i] = (current->fType << 28) | (current->u.fIntValue.fValue & 0xFFFFFFF);
|
||||
} else if (current->fType == RES_BINARY) {
|
||||
} else if (current->fType == URES_BINARY) {
|
||||
uint32_t uo = usedOffset;
|
||||
|
||||
usedOffset = res_write(mem, current, usedOffset, status);
|
||||
|
@ -250,19 +250,19 @@ uint32_t res_write(UNewDataMemory *mem, struct SResource *res,
|
|||
|
||||
if (res != NULL) {
|
||||
switch (res->fType) {
|
||||
case RES_STRING:
|
||||
case URES_STRING:
|
||||
return string_write (mem, res, usedOffset, status);
|
||||
case RES_ALIAS:
|
||||
case URES_ALIAS:
|
||||
return alias_write (mem, res, usedOffset, status);
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
return intvector_write (mem, res, usedOffset, status);
|
||||
case RES_BINARY:
|
||||
case URES_BINARY:
|
||||
return bin_write (mem, res, usedOffset, status);
|
||||
case RES_INT:
|
||||
case URES_INT:
|
||||
return int_write (mem, res, usedOffset, status);
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
return array_write (mem, res, usedOffset, status);
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
return table_write (mem, res, usedOffset, status);
|
||||
|
||||
default:
|
||||
|
@ -347,7 +347,7 @@ void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *out
|
|||
|
||||
usedOffset = sizeof(uint32_t) + bundle->fKeyPoint + pad ; /*this is how much root and keys are taking up*/
|
||||
|
||||
root = ((usedOffset + bundle->fRoot->u.fTable.fChildrenSize) >> 2) | (RES_TABLE << 28); /* we're gonna put the main table at the end */
|
||||
root = ((usedOffset + bundle->fRoot->u.fTable.fChildrenSize) >> 2) | (URES_TABLE << 28); /* we're gonna put the main table at the end */
|
||||
|
||||
udata_write32(mem, root);
|
||||
|
||||
|
@ -375,7 +375,7 @@ struct SResource* table_open(struct SRBRoot *bundle, char *tag, UErrorCode *stat
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_TABLE;
|
||||
res->fType = URES_TABLE;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -408,7 +408,7 @@ struct SResource* array_open(struct SRBRoot *bundle, char *tag, UErrorCode *stat
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_ARRAY;
|
||||
res->fType = URES_ARRAY;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -441,7 +441,7 @@ struct SResource *string_open(struct SRBRoot *bundle, char *tag, UChar *value, i
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_STRING;
|
||||
res->fType = URES_STRING;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -481,7 +481,7 @@ struct SResource *alias_open(struct SRBRoot *bundle, char *tag, UChar *value, in
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_ALIAS;
|
||||
res->fType = URES_ALIAS;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -521,7 +521,7 @@ struct SResource* intvector_open(struct SRBRoot *bundle, char *tag, UErrorCode *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_INT_VECTOR;
|
||||
res->fType = URES_INT_VECTOR;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -558,7 +558,7 @@ struct SResource *int_open(struct SRBRoot *bundle, char *tag, int32_t value, UEr
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_INT;
|
||||
res->fType = URES_INT;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -587,7 +587,7 @@ struct SResource *bin_open(struct SRBRoot *bundle, const char *tag, uint32_t len
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res->fType = RES_BINARY;
|
||||
res->fType = URES_BINARY;
|
||||
res->fKey = bundle_addtag(bundle, tag, status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -722,25 +722,25 @@ void bin_close(struct SResource *binres, UErrorCode *status) {
|
|||
void res_close(struct SResource *res, UErrorCode *status) {
|
||||
if (res != NULL) {
|
||||
switch(res->fType) {
|
||||
case RES_STRING:
|
||||
case URES_STRING:
|
||||
string_close(res, status);
|
||||
break;
|
||||
case RES_ALIAS:
|
||||
case URES_ALIAS:
|
||||
alias_close(res, status);
|
||||
break;
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
intvector_close(res, status);
|
||||
break;
|
||||
case RES_BINARY:
|
||||
case URES_BINARY:
|
||||
bin_close(res, status);
|
||||
break;
|
||||
case RES_INT:
|
||||
case URES_INT:
|
||||
int_close(res, status);
|
||||
break;
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
array_close(res, status);
|
||||
break;
|
||||
case RES_TABLE :
|
||||
case URES_TABLE :
|
||||
table_close(res, status);
|
||||
break;
|
||||
default:
|
||||
|
@ -801,9 +801,9 @@ void table_add(struct SResource *table, struct SResource *res, int linenumber, U
|
|||
|
||||
table->u.fTable.fChildrenSize += res->fSize + calcPadding(res->fSize);
|
||||
|
||||
if (res->fType == RES_TABLE) {
|
||||
if (res->fType == URES_TABLE) {
|
||||
table->u.fTable.fChildrenSize += res->u.fTable.fChildrenSize;
|
||||
} else if (res->fType == RES_ARRAY) {
|
||||
} else if (res->fType == URES_ARRAY) {
|
||||
table->u.fTable.fChildrenSize += res->u.fArray.fChildrenSize;
|
||||
}
|
||||
|
||||
|
@ -863,9 +863,9 @@ void array_add(struct SResource *array, struct SResource *res, UErrorCode *statu
|
|||
array->fSize += sizeof(uint32_t);
|
||||
array->u.fArray.fChildrenSize += res->fSize + calcPadding(res->fSize);
|
||||
|
||||
if (res->fType == RES_TABLE) {
|
||||
if (res->fType == URES_TABLE) {
|
||||
array->u.fArray.fChildrenSize += res->u.fTable.fChildrenSize;
|
||||
} else if (res->fType == RES_ARRAY) {
|
||||
} else if (res->fType == URES_ARRAY) {
|
||||
array->u.fArray.fChildrenSize += res->u.fArray.fChildrenSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -396,7 +396,7 @@ array_write_java( struct SResource *res, UErrorCode *status) {
|
|||
current = res->u.fArray.fFirst;
|
||||
i = 0;
|
||||
while(current != NULL){
|
||||
if(current->fType!=RES_STRING){
|
||||
if(current->fType!=URES_STRING){
|
||||
allStrings = FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ array_write_java( struct SResource *res, UErrorCode *status) {
|
|||
}
|
||||
first=current;
|
||||
while (current != NULL) {
|
||||
/*if(current->fType==RES_STRING){
|
||||
/*if(current->fType==URES_STRING){
|
||||
write_tabs(out);
|
||||
}*/
|
||||
res_write_java(current, status);
|
||||
|
@ -694,25 +694,25 @@ res_write_java(struct SResource *res,UErrorCode *status) {
|
|||
|
||||
if (res != NULL) {
|
||||
switch (res->fType) {
|
||||
case RES_STRING:
|
||||
case URES_STRING:
|
||||
string_write_java (res, status);
|
||||
return;
|
||||
case RES_ALIAS:
|
||||
case URES_ALIAS:
|
||||
alias_write_java (res, status);
|
||||
return;
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
intvector_write_java (res, status);
|
||||
return;
|
||||
case RES_BINARY:
|
||||
case URES_BINARY:
|
||||
bin_write_java (res, status);
|
||||
return;
|
||||
case RES_INT:
|
||||
case URES_INT:
|
||||
int_write_java (res, status);
|
||||
return;
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
array_write_java (res, status);
|
||||
return;
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
table_write_java (res, status);
|
||||
return;
|
||||
|
||||
|
@ -803,4 +803,3 @@ bundle_write_java(struct SRBRoot *bundle, const char *outputDir,const char* outp
|
|||
|
||||
ucnv_close(conv);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002, International Business Machines
|
||||
* Copyright (C) 2002-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -477,25 +477,25 @@ res_write_xml(struct SResource *res,UErrorCode *status) {
|
|||
|
||||
if (res != NULL) {
|
||||
switch (res->fType) {
|
||||
case RES_STRING:
|
||||
case URES_STRING:
|
||||
string_write_xml (res, status);
|
||||
return;
|
||||
case RES_ALIAS:
|
||||
case URES_ALIAS:
|
||||
alias_write_xml (res, status);
|
||||
return;
|
||||
case RES_INT_VECTOR:
|
||||
case URES_INT_VECTOR:
|
||||
intvector_write_xml (res, status);
|
||||
return;
|
||||
case RES_BINARY:
|
||||
case URES_BINARY:
|
||||
bin_write_xml (res, status);
|
||||
return;
|
||||
case RES_INT:
|
||||
case URES_INT:
|
||||
int_write_xml (res, status);
|
||||
return;
|
||||
case RES_ARRAY:
|
||||
case URES_ARRAY:
|
||||
array_write_xml (res, status);
|
||||
return;
|
||||
case RES_TABLE:
|
||||
case URES_TABLE:
|
||||
table_write_xml (res, status);
|
||||
return;
|
||||
|
||||
|
@ -563,4 +563,3 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
|
|||
ucnv_close(conv);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue