ICU-4741 implement multi-level fallback

X-SVN-Rev: 18487
This commit is contained in:
Ram Viswanadha 2005-09-01 22:27:16 +00:00
parent cebc60a530
commit 1ca738302f
2 changed files with 33 additions and 9 deletions

View File

@ -2488,8 +2488,12 @@ ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){
if(res1==NULL || res2==NULL){
return res1==res2; /* pointer comparision */
}
if(uprv_strcmp(res1->fKey, res2->fKey)!=0){
return FALSE;
if(res1->fKey==NULL|| res2->fKey==NULL){
return (res1->fKey==res2->fKey);
}else{
if(uprv_strcmp(res1->fKey, res2->fKey)!=0){
return FALSE;
}
}
if(uprv_strcmp(res1->fData->fName, res2->fData->fName)!=0){
return FALSE;
@ -2524,8 +2528,19 @@ ures_clone(const UResourceBundle* res, UErrorCode* status){
return NULL;
}
bundle = ures_open(res->fData->fPath, res->fData->fName, status);
ret = ures_findSubResource(bundle, res->fResPath, NULL, status);
ures_close(bundle);
if(res->fResPath!=NULL){
ret = ures_findSubResource(bundle, res->fResPath, NULL, status);
ures_close(bundle);
}else{
ret = bundle;
}
return ret;
}
U_INTERNAL const UResourceBundle* U_EXPORT2
ures_getParentBundle(const UResourceBundle* res){
if(res==NULL){
return NULL;
}
return res->fParentRes;
}
/* eof */

View File

@ -167,20 +167,29 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
/**
* Test if 2 resource bundles are equal
* @param res1
* @param res2
* @param status error code
* @internal ICU 3.0
* @internal ICU 3.6
*/
U_INTERNAL UBool U_EXPORT2
ures_equal(const UResourceBundle* res1, const UResourceBundle* res2);
/**
* Test if 2 resource bundles are equal
* @param res2
* Clones the given resource bundle
* @param res
* @param status error code
* @internal ICU 3.0
* @internal ICU 3.6
*/
U_INTERNAL UResourceBundle* U_EXPORT2
ures_clone(const UResourceBundle* res1, UErrorCode* status);
ures_clone(const UResourceBundle* res, UErrorCode* status);
/**
* Returns the parent bundle. Internal. DONOT close the returned bundle!!!
* @param res
* @internal ICU 3.6
*/
U_INTERNAL const UResourceBundle* U_EXPORT2
ures_getParentBundle(const UResourceBundle* res);
#endif /*URESIMP_H*/