Lines Matching full: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);
499 static void ures_setIsStackObject( UResourceBundle* resB, UBool state) {
501 resB->fMagic1 = 0;
502 resB->fMagic2 = 0;
504 resB->fMagic1 = MAGIC1;
505 resB->fMagic2 = MAGIC2;
509 static UBool ures_isStackObject(const UResourceBundle* resB) {
510 return((resB->fMagic1 == MAGIC1 && resB->fMagic2 == MAGIC2)?FALSE:TRUE);
514 U_CFUNC void ures_initStackObject(UResourceBundle* resB) {
515 uprv_memset(resB, 0, sizeof(UResourceBundle));
516 ures_setIsStackObject(resB, TRUE);
717 static void entryCloseInt(UResourceDataEntry *resB) {
718 UResourceDataEntry *p = resB;
720 while(resB != NULL) {
721 p = resB->fParent;
722 resB->fCountExisting--;
727 if(resB->fCountExisting <= 0) {
728 uhash_remove(cache, resB);
729 if(resB->fBogus == U_ZERO_ERROR) {
730 res_unload(&(resB->fData));
732 if(resB->fName != NULL) {
733 uprv_free(resB->fName);
735 if(resB->fPath != NULL) {
736 uprv_free(resB->fPath);
738 uprv_free(resB);
742 resB = p;
750 static void entryClose(UResourceDataEntry *resB) {
752 entryCloseInt(resB);
757 U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
758 if(resB->fResPath == NULL) {
759 resB->fResPath = resB->fResBuf;
760 *(resB->fResPath) = 0;
762 resB->fResPathLen = uprv_strlen(toAdd);
763 if(RES_BUFSIZE <= resB->fResPathLen+1) {
764 if(resB->fResPath == resB->fResBuf) {
765 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
767 resB->fResPath = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
770 uprv_strcpy(resB->fResPath, toAdd);
773 static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd, UErrorCode *status) {
774 int32_t resPathLenOrig = resB->fResPathLen;
775 if(resB->fResPath == NULL) {
776 resB->fResPath = resB->fResBuf;
777 *(resB->fResPath) = 0;
778 resB->fResPathLen = 0;
780 resB->fResPathLen += lenToAdd;
781 if(RES_BUFSIZE <= resB->fResPathLen+1) {
782 if(resB->fResPath == resB->fResBuf) {
783 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
785 if (resB->fResPath == NULL) {
789 uprv_strcpy(resB->fResPath, resB->fResBuf);
791 char *temp = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
797 resB->fResPath = temp;
800 uprv_strcpy(resB->fResPath + resPathLenOrig, toAdd);
803 static void ures_freeResPath(UResourceBundle *resB) {
804 if (resB->fResPath && resB->fResPath != resB->fResBuf) {
805 uprv_free(resB->fResPath);
807 resB->fResPath = NULL;
808 resB->fResPathLen = 0;
812 ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj)
814 if(resB != NULL) {
815 if(resB->fData != NULL) {
816 entryClose(resB->fData);
818 if(resB->fVersion != NULL) {
819 uprv_free(resB->fVersion);
821 ures_freeResPath(resB);
823 if(ures_isStackObject(resB) == FALSE && freeBundleObj) {
824 uprv_free(resB);
829 uprv_memset(resB, -1, sizeof(UResourceBundle));
836 ures_close(UResourceBundle* resB)
838 ures_closeBundle(resB, TRUE);
844 UResourceBundle *resB, UErrorCode *status)
847 return resB;
940 UResourceBundle *result = resB;
993 result = init_resb_result(&(mainRes->fResData), r, temp, -1, mainRes->fData, mainRes, noAlias+1, resB, status);
996 result = resB;
1025 resB = init_resb_result(&(dataEntry->fData), r, temp, -1, dataEntry, result, noAlias+1, resB, status);
1026 result = resB;
1041 result = resB;
1061 return resB;
1065 return resB;
1068 if(resB == NULL) {
1069 resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
1071 if (resB == NULL) {
1075 ures_setIsStackObject(resB, FALSE);
1076 resB->fResPath = NULL;
1077 resB->fResPathLen = 0;
1079 if(resB->fData != NULL) {
1080 entryClose(resB->fData);
1082 if(resB->fVersion != NULL) {
1083 uprv_free(resB->fVersion);
1092 if(ures_isStackObject(resB) != FALSE) {
1093 ures_initStackObject(resB);
1096 if(parent != resB) {
1097 ures_freeResPath(resB);
1100 resB->fData = realData;
1101 entryIncrease(resB->fData);
1102 resB->fHasFallback = FALSE;
1103 resB->fIsTopLevel = FALSE;
1104 resB->fIndex = -1;
1105 resB->fKey = key;
1106 /*resB->fParentRes = parent;*/
1107 resB->fTopLevelData = parent->fTopLevelData;
1108 if(parent->fResPath && parent != resB) {
1109 ures_appendResPath(resB, parent->fResPath, parent->fResPathLen, status);
1112 ures_appendResPath(resB, key, (int32_t)uprv_strlen(key), status);
1113 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1114 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1119 ures_appendResPath(resB, buf, len, status);
1120 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1121 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1126 int32_t usedLen = ((resB->fResBuf == resB->fResPath) ? resB->fResPathLen : 0);
1127 uprv_memset(resB->fResBuf + usedLen, 0, sizeof(resB->fResBuf) - usedLen);
1130 resB->fVersion = NULL;
1131 resB->fRes = r;
1132 /*resB->fParent = parent->fRes;*/
1133 uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData));
1134 resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes);
1135 return resB;
1174 U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) {
1179 if(resB == NULL) {
1183 s = res_getString(&(resB->fResData), resB->fRes, len);
1253 ures_getUTF8String(const UResourceBundle *resB,
1258 const UChar *s16 = ures_getString(resB, &length16, status);
1262 U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len,
1268 if(resB == NULL) {
1272 p = res_getBinary(&(resB->fResData), resB->fRes, len);
1279 U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len,
1285 if(resB == NULL) {
1289 p = res_getIntVector(&(resB->fResData), resB->fRes, len);
1298 U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *status) {
1302 if(resB == NULL) {
1306 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1310 return RES_GET_INT(resB->fRes);
1313 U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
1317 if(resB == NULL) {
1321 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1325 return RES_GET_UINT(resB->fRes);
1328 U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
1329 if(resB == NULL) {
1332 return res_getPublicType(resB->fRes);
1335 resB) {
1336 if(resB == NULL) {
1340 return(resB->fKey);
1343 U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
1344 if(resB == NULL) {
1348 return resB->fSize;
1351 static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
1354 UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, NULL, status);
1359 return res_getString(&(resB->fResData), r, len);
1363 U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resB){
1364 if(resB == NULL) {
1367 resB->fIndex = -1;
1370 U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
1371 if(resB == NULL) {
1374 return (UBool)(resB->fIndex < resB->fSize-1);
1377 U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) {
1383 if(resB == NULL) {
1388 if(resB->fIndex == resB->fSize-1) {
1391 resB->fIndex++;
1392 switch(RES_GET_TYPE(resB->fRes)) {
1395 return res_getString(&(resB->fResData), resB->fRes, len);
1399 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, key);
1400 if(r == RES_BOGUS && resB->fHasFallback) {
1403 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1406 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1407 if(r == RES_BOGUS && resB->fHasFallback) {
1410 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1412 return ures_getStringWithAlias(resB, resB->fRes, resB->fIndex, len, status);
1425 U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UResourceBundle *fillIn, UErrorCode *status) {
1433 if(resB == NULL) {
1439 if(resB->fIndex == resB->fSize-1) {
1443 resB->fIndex++;
1444 switch(RES_GET_TYPE(resB->fRes)) {
1450 return ures_copyResb(fillIn, resB, status);
1454 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, &key);
1455 if(r == RES_BOGUS && resB->fHasFallback) {
1458 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1461 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1462 if(r == RES_BOGUS && resB->fHasFallback) {
1465 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1475 U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) {
1483 if(resB == NULL) {
1489 if(indexR >= 0 && resB->fSize > indexR) {
1490 switch(RES_GET_TYPE(resB->fRes)) {
1496 return ures_copyResb(fillIn, resB, status);
1500 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexR, &key);
1501 if(r == RES_BOGUS && resB->fHasFallback) {
1504 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1507 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexR);
1508 if(r == RES_BOGUS && resB->fHasFallback) {
1511 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1523 U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) {
1530 if(resB == NULL) {
1535 if(indexS >= 0 && resB->fSize > indexS) {
1536 switch(RES_GET_TYPE(resB->fRes)) {
1539 return res_getString(&(resB->fResData), resB->fRes, len);
1543 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexS, &key);
1544 if(r == RES_BOGUS && resB->fHasFallback) {
1547 return ures_getStringWithAlias(resB, r, indexS, len, status);
1550 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexS);
1551 if(r == RES_BOGUS && resB->fHasFallback) {
1554 return ures_getStringWithAlias(resB, r, indexS, len, status);
1556 return ures_getStringWithAlias(resB, resB->fRes, indexS, len, status);
1574 ures_getUTF8StringByIndex(const UResourceBundle *resB,
1580 const UChar *s16 = ures_getStringByIndex(resB, idx, &length16, status);
1584 /*U_CAPI const char *ures_getResPath(UResourceBundle *resB) {
1585 return resB->fResPath;
1644 ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status)
1658 res = res_findResource(&(resB->fResData), resB->fRes, &path, &key);
1660 result = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1661 resB = result;
1671 ures_getStringByKeyWithFallback(const UResourceBundle *resB,
1679 ures_getByKeyWithFallback(resB, inKey, &stack, status);
1686 ures_getByKeyWithFallback(const UResourceBundle *resB,
1699 if(resB == NULL) {
1704 type = RES_GET_TYPE(resB->fRes);
1707 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1709 UResourceDataEntry *dataEntry = resB->fData;
1712 const char* resPath = resB->fResPath;
1713 int32_t len = resB->fResPathLen;
1728 helper = init_resb_result(&(dataEntry->fData), res, NULL, -1, dataEntry, resB, 0, helper, status);
1729 /*helper = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, helper, status);*/
1743 /*const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);*/
1745 /* check if resB->fResPath gives the right name here */
1752 fillIn = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, fillIn, status);
1757 fillIn = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1768 U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) {
1777 if(resB == NULL) {
1782 type = RES_GET_TYPE(resB->fRes);
1785 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1788 if(resB->fHasFallback == TRUE) {
1789 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1791 /* check if resB->fResPath gives the right name here */
1792 return init_resb_result(rd, res, key, -1, realData, resB, 0, fillIn, status);
1800 return init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1806 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
1808 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1810 return init_resb_result(rd, res, key, realData, resB, fillIn, status);
1822 U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB
1831 if(resB == NULL) {
1836 type = RES_GET_TYPE(resB->fRes);
1840 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1844 if(resB->fHasFallback == TRUE) {
1845 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1854 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
1872 return res_getString(&(resB->fResData), res, len);
1876 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
1889 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
1891 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1906 ures_getUTF8StringByKey(const UResourceBundle *resB,
1912 const UChar *s16 = ures_getStringByKey(resB, key, &length16, status);
1969 U_CFUNC const char* ures_getName(const UResourceBundle* resB) {
1970 if(resB == NULL) {
1974 return resB->fData->fName;
1978 U_CFUNC const char* ures_getPath(const UResourceBundle* resB) {
1979 if(resB == NULL) {
1983 return resB->fData->fPath;
2239 U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo) {
2240 if (!resB) return;
2242 u_versionFromString(versionInfo, ures_getVersionNumberInternal(resB));