Lines Matching full:resb
104 UResourceDataEntry *resB = resBundle->fData;
108 if(resB != NULL) {
109 if(resB->fBogus == U_ZERO_ERROR) { /* if this resource is real, */
110 *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag); /* try to get data from there */
114 while(*res == RES_BOGUS && resB->fParent != NULL) { /* Otherwise, we'll look in parents */
115 resB = resB->fParent;
116 if(resB->fBogus == U_ZERO_ERROR) {
118 *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag);
125 if(uprv_strcmp(resB->fName, uloc_getDefault())==0 || uprv_strcmp(resB->fName, kRootLocaleName)==0) {
131 *realData = resB;
132 return (&(resB->fData));
169 UResourceDataEntry *resB;
190 resB = (UResourceDataEntry *) e->value.pointer;
200 if (resB->fCountExisting == 0) {
204 free_entry(resB);
224 UResourceDataEntry *resB;
235 resB = (UResourceDataEntry *) e->value.pointer;
238 (void*)resB, resB->fCountExisting,
239 resB->fName?resB->fName:"NULL",
240 resB->fPath?resB->fPath:"NULL",
241 (void*)resB->fPool,
242 (void*)resB->fAlias,
243 (void*)resB->fParent);
494 static void ures_setIsStackObject( UResourceBundle* resB, UBool state) {
496 resB->fMagic1 = 0;
497 resB->fMagic2 = 0;
499 resB->fMagic1 = MAGIC1;
500 resB->fMagic2 = MAGIC2;
504 static UBool ures_isStackObject(const UResourceBundle* resB) {
505 return((resB->fMagic1 == MAGIC1 && resB->fMagic2 == MAGIC2)?FALSE:TRUE);
509 U_CFUNC void ures_initStackObject(UResourceBundle* resB) {
510 uprv_memset(resB, 0, sizeof(UResourceBundle));
511 ures_setIsStackObject(resB, TRUE);
711 static void entryCloseInt(UResourceDataEntry *resB) {
712 UResourceDataEntry *p = resB;
714 while(resB != NULL) {
715 p = resB->fParent;
716 resB->fCountExisting--;
721 if(resB->fCountExisting <= 0) {
722 uhash_remove(cache, resB);
723 if(resB->fBogus == U_ZERO_ERROR) {
724 res_unload(&(resB->fData));
726 if(resB->fName != NULL) {
727 uprv_free(resB->fName);
729 if(resB->fPath != NULL) {
730 uprv_free(resB->fPath);
732 uprv_free(resB);
736 resB = p;
744 static void entryClose(UResourceDataEntry *resB) {
746 entryCloseInt(resB);
751 U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
752 if(resB->fResPath == NULL) {
753 resB->fResPath = resB->fResBuf;
754 *(resB->fResPath) = 0;
756 resB->fResPathLen = uprv_strlen(toAdd);
757 if(RES_BUFSIZE <= resB->fResPathLen+1) {
758 if(resB->fResPath == resB->fResBuf) {
759 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
761 resB->fResPath = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
764 uprv_strcpy(resB->fResPath, toAdd);
767 static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd, UErrorCode *status) {
768 int32_t resPathLenOrig = resB->fResPathLen;
769 if(resB->fResPath == NULL) {
770 resB->fResPath = resB->fResBuf;
771 *(resB->fResPath) = 0;
772 resB->fResPathLen = 0;
774 resB->fResPathLen += lenToAdd;
775 if(RES_BUFSIZE <= resB->fResPathLen+1) {
776 if(resB->fResPath == resB->fResBuf) {
777 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
779 if (resB->fResPath == NULL) {
783 uprv_strcpy(resB->fResPath, resB->fResBuf);
785 char *temp = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
791 resB->fResPath = temp;
794 uprv_strcpy(resB->fResPath + resPathLenOrig, toAdd);
797 static void ures_freeResPath(UResourceBundle *resB) {
798 if (resB->fResPath && resB->fResPath != resB->fResBuf) {
799 uprv_free(resB->fResPath);
801 resB->fResPath = NULL;
802 resB->fResPathLen = 0;
806 ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj)
808 if(resB != NULL) {
809 if(resB->fData != NULL) {
810 entryClose(resB->fData);
812 if(resB->fVersion != NULL) {
813 uprv_free(resB->fVersion);
815 ures_freeResPath(resB);
817 if(ures_isStackObject(resB) == FALSE && freeBundleObj) {
818 uprv_free(resB);
823 uprv_memset(resB, -1, sizeof(UResourceBundle));
830 ures_close(UResourceBundle* resB)
832 ures_closeBundle(resB, TRUE);
838 UResourceBundle *resB, UErrorCode *status)
841 return resB;
934 UResourceBundle *result = resB;
987 result = init_resb_result(&(mainRes->fResData), r, temp, -1, mainRes->fData, mainRes, noAlias+1, resB, status);
990 result = resB;
1019 resB = init_resb_result(&(dataEntry->fData), r, temp, -1, dataEntry, result, noAlias+1, resB, status);
1020 result = resB;
1035 result = resB;
1055 return resB;
1059 return resB;
1062 if(resB == NULL) {
1063 resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
1065 if (resB == NULL) {
1069 ures_setIsStackObject(resB, FALSE);
1070 resB->fResPath = NULL;
1071 resB->fResPathLen = 0;
1073 if(resB->fData != NULL) {
1074 entryClose(resB->fData);
1076 if(resB->fVersion != NULL) {
1077 uprv_free(resB->fVersion);
1086 if(ures_isStackObject(resB) != FALSE) {
1087 ures_initStackObject(resB);
1090 if(parent != resB) {
1091 ures_freeResPath(resB);
1094 resB->fData = realData;
1095 entryIncrease(resB->fData);
1096 resB->fHasFallback = FALSE;
1097 resB->fIsTopLevel = FALSE;
1098 resB->fIndex = -1;
1099 resB->fKey = key;
1100 /*resB->fParentRes = parent;*/
1101 resB->fTopLevelData = parent->fTopLevelData;
1102 if(parent->fResPath && parent != resB) {
1103 ures_appendResPath(resB, parent->fResPath, parent->fResPathLen, status);
1106 ures_appendResPath(resB, key, (int32_t)uprv_strlen(key), status);
1107 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1108 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1113 ures_appendResPath(resB, buf, len, status);
1114 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1115 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1120 int32_t usedLen = ((resB->fResBuf == resB->fResPath) ? resB->fResPathLen : 0);
1121 uprv_memset(resB->fResBuf + usedLen, 0, sizeof(resB->fResBuf) - usedLen);
1124 resB->fVersion = NULL;
1125 resB->fRes = r;
1126 /*resB->fParent = parent->fRes;*/
1127 uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData));
1128 resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes);
1129 return resB;
1168 U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) {
1173 if(resB == NULL) {
1177 s = res_getString(&(resB->fResData), resB->fRes, len);
1247 ures_getUTF8String(const UResourceBundle *resB,
1252 const UChar *s16 = ures_getString(resB, &length16, status);
1256 U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len,
1262 if(resB == NULL) {
1266 p = res_getBinary(&(resB->fResData), resB->fRes, len);
1273 U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len,
1279 if(resB == NULL) {
1283 p = res_getIntVector(&(resB->fResData), resB->fRes, len);
1292 U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *status) {
1296 if(resB == NULL) {
1300 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1304 return RES_GET_INT(resB->fRes);
1307 U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
1311 if(resB == NULL) {
1315 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1319 return RES_GET_UINT(resB->fRes);
1322 U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
1323 if(resB == NULL) {
1326 return res_getPublicType(resB->fRes);
1329 U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) {
1330 if(resB == NULL) {
1334 return(resB->fKey);
1337 resB) {
1338 if(resB == NULL) {
1342 return resB->fSize;
1345 static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
1348 UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, NULL, status);
1353 return res_getString(&(resB->fResData), r, len);
1357 U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resB){
1358 if(resB == NULL) {
1361 resB->fIndex = -1;
1364 U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
1365 if(resB == NULL) {
1368 return (UBool)(resB->fIndex < resB->fSize-1);
1371 U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) {
1377 if(resB == NULL) {
1382 if(resB->fIndex == resB->fSize-1) {
1385 resB->fIndex++;
1386 switch(RES_GET_TYPE(resB->fRes)) {
1389 return res_getString(&(resB->fResData), resB->fRes, len);
1393 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, key);
1394 if(r == RES_BOGUS && resB->fHasFallback) {
1397 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1400 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1401 if(r == RES_BOGUS && resB->fHasFallback) {
1404 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1406 return ures_getStringWithAlias(resB, resB->fRes, resB->fIndex, len, status);
1419 U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UResourceBundle *fillIn, UErrorCode *status) {
1427 if(resB == NULL) {
1433 if(resB->fIndex == resB->fSize-1) {
1437 resB->fIndex++;
1438 switch(RES_GET_TYPE(resB->fRes)) {
1444 return ures_copyResb(fillIn, resB, status);
1448 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, &key);
1449 if(r == RES_BOGUS && resB->fHasFallback) {
1452 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1455 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1456 if(r == RES_BOGUS && resB->fHasFallback) {
1459 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1469 U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) {
1477 if(resB == NULL) {
1483 if(indexR >= 0 && resB->fSize > indexR) {
1484 switch(RES_GET_TYPE(resB->fRes)) {
1490 return ures_copyResb(fillIn, resB, status);
1494 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexR, &key);
1495 if(r == RES_BOGUS && resB->fHasFallback) {
1498 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1501 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexR);
1502 if(r == RES_BOGUS && resB->fHasFallback) {
1505 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1517 U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) {
1524 if(resB == NULL) {
1529 if(indexS >= 0 && resB->fSize > indexS) {
1530 switch(RES_GET_TYPE(resB->fRes)) {
1533 return res_getString(&(resB->fResData), resB->fRes, len);
1537 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexS, &key);
1538 if(r == RES_BOGUS && resB->fHasFallback) {
1541 return ures_getStringWithAlias(resB, r, indexS, len, status);
1544 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexS);
1545 if(r == RES_BOGUS && resB->fHasFallback) {
1548 return ures_getStringWithAlias(resB, r, indexS, len, status);
1550 return ures_getStringWithAlias(resB, resB->fRes, indexS, len, status);
1568 ures_getUTF8StringByIndex(const UResourceBundle *resB,
1574 const UChar *s16 = ures_getStringByIndex(resB, idx, &length16, status);
1578 /*U_CAPI const char *ures_getResPath(UResourceBundle *resB) {
1579 return resB->fResPath;
1638 ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status)
1652 res = res_findResource(&(resB->fResData), resB->fRes, &path, &key);
1654 result = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1655 resB = result;
1665 ures_getStringByKeyWithFallback(const UResourceBundle *resB,
1673 ures_getByKeyWithFallback(resB, inKey, &stack, status);
1716 ures_getByKeyWithFallback(const UResourceBundle *resB,
1727 if(resB == NULL) {
1732 int32_t type = RES_GET_TYPE(resB->fRes);
1734 res = getTableItemByKeyPath(&(resB->fResData), resB->fRes, inKey);
1737 UResourceDataEntry *dataEntry = resB->fData;
1740 const char* resPath = resB->fResPath;
1741 int32_t len = resB->fResPathLen;
1757 helper = init_resb_result(&(dataEntry->fData), res, NULL, -1, dataEntry, resB, 0, helper, status);
1758 /*helper = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, helper, status);*/
1772 /*const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);*/
1774 /* check if resB->fResPath gives the right name here */
1781 fillIn = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, fillIn, status);
1786 fillIn = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1797 U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) {
1805 if(resB == NULL) {
1810 int32_t type = RES_GET_TYPE(resB->fRes);
1813 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1816 if(resB->fHasFallback == TRUE) {
1817 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1819 /* check if resB->fResPath gives the right name here */
1820 return init_resb_result(rd, res, key, -1, realData, resB, 0, fillIn, status);
1828 return init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1834 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
1836 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1838 return init_resb_result(rd, res, key, realData, resB, fillIn, status);
1850 U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) {
1858 if(resB == NULL) {
1863 int32_t type = RES_GET_TYPE(resB->fRes);
1867 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
1871 if(resB->fHasFallback == TRUE) {
1872 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1881 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
1899 return res_getString(&(resB->fResData), res, len);
1903 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
1916 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
1918 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
1933 ures_getUTF8StringByKey(const UResourceBundle *resB,
1939 const UChar *s16 = ures_getStringByKey(resB, key, &length16, status);
1996 U_CFUNC const char* ures_getName(const UResourceBundle* resB) {
1997 if(resB == NULL) {
2001 return resB->fData->fName;
2005 U_CFUNC const char* ures_getPath(const UResourceBundle* resB) {
2006 if(resB == NULL) {
2010 return resB->fData->fPath;
2273 U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo) {
2274 if (!resB) return;
2276 u_versionFromString(versionInfo, ures_getVersionNumberInternal(resB));