Home | History | Annotate | Download | only in common

Lines Matching refs:resB

103     UResourceDataEntry *resB = resBundle->fData;
107 if(resB != NULL) {
108 if(resB->fBogus == U_ZERO_ERROR) { /* if this resource is real, */
109 *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag); /* try to get data from there */
113 while(*res == RES_BOGUS && resB->fParent != NULL) { /* Otherwise, we'll look in parents */
114 resB = resB->fParent;
115 if(resB->fBogus == U_ZERO_ERROR) {
117 *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag);
124 if(uprv_strcmp(resB->fName, uloc_getDefault())==0 || uprv_strcmp(resB->fName, kRootLocaleName)==0) {
130 *realData = resB;
131 return (&(resB->fData));
168 UResourceDataEntry *resB;
189 resB = (UResourceDataEntry *) e->value.pointer;
199 if (resB->fCountExisting == 0) {
203 free_entry(resB);
223 UResourceDataEntry *resB;
234 resB = (UResourceDataEntry *) e->value.pointer;
237 (void*)resB, resB->fCountExisting,
238 resB->fName?resB->fName:"NULL",
239 resB->fPath?resB->fPath:"NULL",
240 (void*)resB->fPool,
241 (void*)resB->fAlias,
242 (void*)resB->fParent);
496 static void ures_setIsStackObject( UResourceBundle* resB, UBool state) {
498 resB->fMagic1 = 0;
499 resB->fMagic2 = 0;
501 resB->fMagic1 = MAGIC1;
502 resB->fMagic2 = MAGIC2;
506 static UBool ures_isStackObject(const UResourceBundle* resB) {
507 return((resB->fMagic1 == MAGIC1 && resB->fMagic2 == MAGIC2)?FALSE:TRUE);
511 U_CFUNC void ures_initStackObject(UResourceBundle* resB) {
512 uprv_memset(resB, 0, sizeof(UResourceBundle));
513 ures_setIsStackObject(resB, TRUE);
700 static void entryCloseInt(UResourceDataEntry *resB) {
701 UResourceDataEntry *p = resB;
703 while(resB != NULL) {
704 p = resB->fParent;
705 resB->fCountExisting--;
710 if(resB->fCountExisting <= 0) {
711 uhash_remove(cache, resB);
712 if(resB->fBogus == U_ZERO_ERROR) {
713 res_unload(&(resB->fData));
715 if(resB->fName != NULL) {
716 uprv_free(resB->fName);
718 if(resB->fPath != NULL) {
719 uprv_free(resB->fPath);
721 uprv_free(resB);
725 resB = p;
733 static void entryClose(UResourceDataEntry *resB) {
735 entryCloseInt(resB);
740 U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
741 if(resB->fResPath == NULL) {
742 resB->fResPath = resB->fResBuf;
743 *(resB->fResPath) = 0;
745 resB->fResPathLen = uprv_strlen(toAdd);
746 if(RES_BUFSIZE <= resB->fResPathLen+1) {
747 if(resB->fResPath == resB->fResBuf) {
748 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
750 resB->fResPath = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
753 uprv_strcpy(resB->fResPath, toAdd);
756 static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd, UErrorCode *status) {
757 int32_t resPathLenOrig = resB->fResPathLen;
758 if(resB->fResPath == NULL) {
759 resB->fResPath = resB->fResBuf;
760 *(resB->fResPath) = 0;
761 resB->fResPathLen = 0;
763 resB->fResPathLen += lenToAdd;
764 if(RES_BUFSIZE <= resB->fResPathLen+1) {
765 if(resB->fResPath == resB->fResBuf) {
766 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
768 if (resB->fResPath == NULL) {
772 uprv_strcpy(resB->fResPath, resB->fResBuf);
774 char *temp = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
780 resB->fResPath = temp;
783 uprv_strcpy(resB->fResPath + resPathLenOrig, toAdd);
786 static void ures_freeResPath(UResourceBundle *resB) {
787 if (resB->fResPath && resB->fResPath != resB->fResBuf) {
788 uprv_free(resB->fResPath);
790 resB->fResPath = NULL;
791 resB->fResPathLen = 0;
795 ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj)
797 if(resB != NULL) {
798 if(resB->fData != NULL) {
799 entryClose(resB->fData);
801 if(resB->fVersion != NULL) {
802 uprv_free(resB->fVersion);
804 ures_freeResPath(resB);
806 if(ures_isStackObject(resB) == FALSE && freeBundleObj) {
807 uprv_free(resB);
812 uprv_memset(resB, -1, sizeof(UResourceBundle));
819 ures_close(UResourceBundle* resB)
821 ures_closeBundle(resB, TRUE);
827 UResourceBundle *resB, UErrorCode *status)
830 return resB;
923 UResourceBundle *result = resB;
976 result = init_resb_result(&(mainRes->fResData), r, temp, -1, mainRes->fData, mainRes, noAlias+1, resB, status);
979 result = resB;
1008 resB = init_resb_result(&(dataEntry->fData), r, temp, -1, dataEntry, result, noAlias+1, resB, status);
1009 result = resB;
1024 result = resB;
1044 return resB;
1048 return resB;
1051 if(resB == NULL) {
1052 resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
1054 if (resB == NULL) {
1058 ures_setIsStackObject(resB, FALSE);
1059 resB->fResPath = NULL;
1060 resB->fResPathLen = 0;
1062 if(resB->fData != NULL) {
1063 entryClose(resB->fData);
1065 if(resB->fVersion != NULL) {
1066 uprv_free(resB->fVersion);
1075 if(ures_isStackObject(resB) != FALSE) {
1076 ures_initStackObject(resB);
1079 if(parent != resB) {
1080 ures_freeResPath(resB);
1083 resB->fData = realData;
1084 entryIncrease(resB->fData);
1085 resB->fHasFallback = FALSE;
1086 resB->fIsTopLevel = FALSE;
1087 resB->fIndex = -1;
1088 resB->fKey = key;
1089 /*resB->fParentRes = parent;*/
1090 resB->fTopLevelData = parent->fTopLevelData;
1091 if(parent->fResPath && parent != resB) {
1092 ures_appendResPath(resB, parent->fResPath, parent->fResPathLen, status);
1095 ures_appendResPath(resB, key, (int32_t)uprv_strlen(key), status);
1096 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1097 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1102 ures_appendResPath(resB, buf, len, status);
1103 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1104 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1109 int32_t usedLen = ((resB->fResBuf == resB->fResPath) ? resB->fResPathLen : 0);
1110 uprv_memset(resB->fResBuf + usedLen, 0, sizeof(resB->fResBuf) - usedLen);
1113 resB->fVersion = NULL;
1114 resB->fRes = r;
1115 /*resB->fParent = parent->fRes;*/
1116 uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData));
1117 resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes);
1118 return resB;
1157 U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) {
1162 if(resB == NULL) {
1166 s = res_getString(&(resB->fResData), resB->fRes, len);
1236 ures_getUTF8String(const UResourceBundle *resB,
1241 const UChar *s16 = ures_getString(resB, &length16, status);
1245 U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len,
1251 if(resB == NULL) {
1255 p = res_getBinary(&(resB->fResData), resB->fRes, len);
1262 U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len,
1268 if(resB == NULL) {
1272 p = res_getIntVector(&(resB->fResData), resB->fRes, len);
1281 U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *status) {
1285 if(resB == NULL) {
1289 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1293 return RES_GET_INT(resB->fRes);
1296 U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
1300 if(resB == NULL) {
1304 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1308 return RES_GET_UINT(resB->fRes);
1311 U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
1312 if(resB == NULL) {
1315 return res_getPublicType(resB->fRes);
1318 U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) {
1319 if(resB == NULL) {
1323 return(resB->fKey);
1326 U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
1327 if(resB == NULL) {
1331 return resB->fSize;
1334 static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
1337 UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, NULL, status);
1342 return res_getString(&(resB->fResData), r, len);
1346 U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resB){
1347 if(resB == NULL) {
1350 resB->fIndex = -1;
1353 U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
1354 if(resB == NULL) {
1357 return (UBool)(resB->fIndex < resB->fSize-1);
1360 U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB
1366 if(resB == NULL) {
1371 if(resB->fIndex == resB->fSize-1) {
1374 resB->fIndex++;
1375 switch(RES_GET_TYPE(resB->fRes)) {
1378 return res_getString(&(resB->fResData), resB->fRes, len);
1382 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, key);
1383 if(r == RES_BOGUS && resB->fHasFallback) {
1386 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1389 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1390 if(r == RES_BOGUS && resB->fHasFallback) {
1393 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1395 return ures_getStringWithAlias(resB, resB->fRes, resB->fIndex, len, status);
1408 U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UResourceBundle *fillIn, UErrorCode *status) {
1416 if(resB == NULL) {
1422 if(resB->fIndex == resB->fSize-1) {
1426 resB->fIndex++;
1427 switch(RES_GET_TYPE(resB->fRes)) {
1433 return ures_copyResb(fillIn, resB, status);
1437 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, &key);
1438 if(r == RES_BOGUS && resB->fHasFallback) {
1441 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1444 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1445 if(r == RES_BOGUS && resB->fHasFallback) {
1448 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1458 U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) {
1466 if(resB == NULL) {
1472 if(indexR >= 0 && resB->fSize > indexR) {
1473 switch(RES_GET_TYPE(resB->fRes)) {
1479 return ures_copyResb(fillIn, resB, status);
1483 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexR, &key);
1484 if(r == RES_BOGUS && resB->fHasFallback) {
1487 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1490 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexR);
1491 if(r == RES_BOGUS && resB->fHasFallback) {
1494 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1506 U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) {
1513 if(resB == NULL) {
1518 if(indexS >= 0 && resB->fSize > indexS) {
1519 switch(RES_GET_TYPE(resB->fRes)) {
1522 return res_getString(&(resB->fResData), resB->fRes, len);
1526 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexS, &key);
1527 if(r == RES_BOGUS && resB->fHasFallback) {
1530 return ures_getStringWithAlias(resB, r, indexS, len, status);
1533 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexS);
1534 if(r == RES_BOGUS && resB->fHasFallback) {
1537 return ures_getStringWithAlias(resB, r, indexS, len, status);
1539 return ures_getStringWithAlias(resB, resB->fRes, indexS, len, status);
1557 ures_getUTF8StringByIndex(const UResourceBundle *resB,
1563 const UChar *s16 = ures_getStringByIndex(resB, idx, &length16, status);
1567 /*U_CAPI const char *ures_getResPath(UResourceBundle *resB) {
1568 return resB->fResPath;
1627 ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status)
1641 res = res_findResource(&(resB->fResData), resB->fRes, &path, &key);
1643 result = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1644 resB = result;
1654 ures_getStringByKeyWithFallback(const UResourceBundle *resB,
1662 ures_getByKeyWithFallback(resB, inKey, &stack, status);
1669 ures_getByKeyWithFallback(const UResourceBundle *resB,
1682 if(resB == NULL) {
1687 type = RES_GET_TYPE(resB->fRes);
1690 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1692 UResourceDataEntry *dataEntry = resB->fData;
1695 const char* resPath = resB->fResPath;
1696 int32_t len = resB->fResPathLen;
1711 helper = init_resb_result(&(dataEntry->fData), res, NULL, -1, dataEntry, resB, 0, helper, status);
1712 /*helper = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, helper, status);*/
1726 /*const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);*/
1728 /* check if resB->fResPath gives the right name here */
1735 fillIn = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, fillIn, status);
1740 fillIn = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1751 U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) {
1760 if(resB == NULL) {
1765 type = RES_GET_TYPE(resB->fRes);
1768 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1771 if(resB->fHasFallback == TRUE) {
1772 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1774 /* check if resB->fResPath gives the right name here */
1775 return init_resb_result(rd, res, key, -1, realData, resB, 0, fillIn, status);
1783 return init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1789 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
1791 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1793 return init_resb_result(rd, res, key, realData, resB, fillIn, status);
1805 U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) {
1814 if(resB == NULL) {
1819 type = RES_GET_TYPE(resB->fRes);
1823 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1827 if(resB->fHasFallback == TRUE) {
1828 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1837 resB, inKey, NULL, status);
1855 return res_getString(&(resB->fResData), res, len);
1859 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
1872 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
1874 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1889 ures_getUTF8StringByKey(const UResourceBundle *resB,
1895 const UChar *s16 = ures_getStringByKey(resB, key, &length16, status);
1952 U_CFUNC const char* ures_getName(const UResourceBundle* resB) {
1953 if(resB == NULL) {
1957 return resB->fData->fName;
1961 U_CFUNC const char* ures_getPath(const UResourceBundle* resB) {
1962 if(resB == NULL) {
1966 return resB->fData->fPath;
2222 U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo) {
2223 if (!resB) return;
2225 u_versionFromString(versionInfo, ures_getVersionNumberInternal(resB));