Home | History | Annotate | Download | only in common

Lines Matching refs:resB

107     UResourceDataEntry *resB = resBundle->fData;
111 if(resB != NULL) {
112 if(resB->fBogus == U_ZERO_ERROR) { /* if this resource is real, */
113 *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag); /* try to get data from there */
117 while(*res == RES_BOGUS && resB->fParent != NULL) { /* Otherwise, we'll look in parents */
118 resB = resB->fParent;
119 if(resB->fBogus == U_ZERO_ERROR) {
121 *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag);
128 if(uprv_strcmp(resB->fName, uloc_getDefault())==0 || uprv_strcmp(resB->fName, kRootLocaleName)==0) {
134 *realData = resB;
135 return (&(resB->fData));
172 UResourceDataEntry *resB;
193 resB = (UResourceDataEntry *) e->value.pointer;
203 if (resB->fCountExisting == 0) {
207 free_entry(resB);
227 UResourceDataEntry *resB;
238 resB = (UResourceDataEntry *) e->value.pointer;
241 (void*)resB, resB->fCountExisting,
242 resB->fName?resB->fName:"NULL",
243 resB->fPath?resB->fPath:"NULL",
244 (void*)resB->fPool,
245 (void*)resB->fAlias,
246 (void*)resB->fParent);
488 static void ures_setIsStackObject( UResourceBundle* resB, UBool state) {
490 resB->fMagic1 = 0;
491 resB->fMagic2 = 0;
493 resB->fMagic1 = MAGIC1;
494 resB->fMagic2 = MAGIC2;
498 static UBool ures_isStackObject(const UResourceBundle* resB) {
499 return((resB->fMagic1 == MAGIC1 && resB->fMagic2 == MAGIC2)?FALSE:TRUE);
503 U_CFUNC void ures_initStackObject(UResourceBundle* resB) {
504 uprv_memset(resB, 0, sizeof(UResourceBundle));
505 ures_setIsStackObject(resB, TRUE);
788 static void entryCloseInt(UResourceDataEntry *resB) {
789 UResourceDataEntry *p = resB;
791 while(resB != NULL) {
792 p = resB->fParent;
793 resB->fCountExisting--;
798 if(resB->fCountExisting <= 0) {
799 uhash_remove(cache, resB);
800 if(resB->fBogus == U_ZERO_ERROR) {
801 res_unload(&(resB->fData));
803 if(resB->fName != NULL) {
804 uprv_free(resB->fName);
806 if(resB->fPath != NULL) {
807 uprv_free(resB->fPath);
809 uprv_free(resB);
813 resB = p;
821 static void entryClose(UResourceDataEntry *resB) {
823 entryCloseInt(resB);
828 U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
829 if(resB->fResPath == NULL) {
830 resB->fResPath = resB->fResBuf;
831 *(resB->fResPath) = 0;
833 resB->fResPathLen = uprv_strlen(toAdd);
834 if(RES_BUFSIZE <= resB->fResPathLen+1) {
835 if(resB->fResPath == resB->fResBuf) {
836 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
838 resB->fResPath = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
841 uprv_strcpy(resB->fResPath, toAdd);
844 static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd, UErrorCode *status) {
845 int32_t resPathLenOrig = resB->fResPathLen;
846 if(resB->fResPath == NULL) {
847 resB->fResPath = resB->fResBuf;
848 *(resB->fResPath) = 0;
849 resB->fResPathLen = 0;
851 resB->fResPathLen += lenToAdd;
852 if(RES_BUFSIZE <= resB->fResPathLen+1) {
853 if(resB->fResPath == resB->fResBuf) {
854 resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
856 if (resB->fResPath == NULL) {
860 uprv_strcpy(resB->fResPath, resB->fResBuf);
862 char *temp = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
868 resB->fResPath = temp;
871 uprv_strcpy(resB->fResPath + resPathLenOrig, toAdd);
874 static void ures_freeResPath(UResourceBundle *resB) {
875 if (resB->fResPath && resB->fResPath != resB->fResBuf) {
876 uprv_free(resB->fResPath);
878 resB->fResPath = NULL;
879 resB->fResPathLen = 0;
883 ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj)
885 if(resB != NULL) {
886 if(resB->fData != NULL) {
887 entryClose(resB->fData);
889 if(resB->fVersion != NULL) {
890 uprv_free(resB->fVersion);
892 ures_freeResPath(resB);
894 if(ures_isStackObject(resB) == FALSE && freeBundleObj) {
895 uprv_free(resB);
900 uprv_memset(resB, -1, sizeof(UResourceBundle));
907 ures_close(UResourceBundle* resB)
909 ures_closeBundle(resB, TRUE);
915 UResourceBundle *resB, UErrorCode *status)
918 return resB;
1011 UResourceBundle *result = resB;
1064 result = init_resb_result(&(mainRes->fResData), r, temp, -1, mainRes->fData, mainRes, noAlias+1, resB, status);
1067 result = resB;
1096 resB = init_resb_result(&(dataEntry->fData), r, temp, -1, dataEntry, result, noAlias+1, resB, status);
1097 result = resB;
1112 result = resB;
1132 return resB;
1136 return resB;
1139 if(resB == NULL) {
1140 resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
1142 if (resB == NULL) {
1146 ures_setIsStackObject(resB, FALSE);
1147 resB->fResPath = NULL;
1148 resB->fResPathLen = 0;
1150 if(resB->fData != NULL) {
1151 entryClose(resB->fData);
1153 if(resB->fVersion != NULL) {
1154 uprv_free(resB->fVersion);
1163 if(ures_isStackObject(resB) != FALSE) {
1164 ures_initStackObject(resB);
1167 if(parent != resB) {
1168 ures_freeResPath(resB);
1171 resB->fData = realData;
1172 entryIncrease(resB->fData);
1173 resB->fHasFallback = FALSE;
1174 resB->fIsTopLevel = FALSE;
1175 resB->fIndex = -1;
1176 resB->fKey = key;
1177 /*resB->fParentRes = parent;*/
1178 resB->fTopLevelData = parent->fTopLevelData;
1179 if(parent->fResPath && parent != resB) {
1180 ures_appendResPath(resB, parent->fResPath, parent->fResPathLen, status);
1183 ures_appendResPath(resB, key, (int32_t)uprv_strlen(key), status);
1184 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1185 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1190 ures_appendResPath(resB, buf, len, status);
1191 if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
1192 ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
1197 int32_t usedLen = ((resB->fResBuf == resB->fResPath) ? resB->fResPathLen : 0);
1198 uprv_memset(resB->fResBuf + usedLen, 0, sizeof(resB->fResBuf) - usedLen);
1201 resB->fVersion = NULL;
1202 resB->fRes = r;
1203 /*resB->fParent = parent->fRes;*/
1204 uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData));
1205 resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes);
1206 return resB;
1245 U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) {
1250 if(resB == NULL) {
1254 s = res_getString(&(resB->fResData), resB->fRes, len);
1324 ures_getUTF8String(const UResourceBundle *resB,
1329 const UChar *s16 = ures_getString(resB, &length16, status);
1333 resB, int32_t* len,
1339 if(resB == NULL) {
1343 p = res_getBinary(&(resB->fResData), resB->fRes, len);
1350 U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len,
1356 if(resB == NULL) {
1360 p = res_getIntVector(&(resB->fResData), resB->fRes, len);
1369 U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *status) {
1373 if(resB == NULL) {
1377 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1381 return RES_GET_INT(resB->fRes);
1384 U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
1388 if(resB == NULL) {
1392 if(RES_GET_TYPE(resB->fRes) != URES_INT) {
1396 return RES_GET_UINT(resB->fRes);
1399 U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
1400 if(resB == NULL) {
1403 return res_getPublicType(resB->fRes);
1406 U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) {
1407 if(resB == NULL) {
1411 return(resB->fKey);
1414 U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
1415 if(resB == NULL) {
1419 return resB->fSize;
1422 static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
1425 UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, NULL, status);
1430 return res_getString(&(resB->fResData), r, len);
1434 U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resB){
1435 if(resB == NULL) {
1438 resB->fIndex = -1;
1441 U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
1442 if(resB == NULL) {
1445 return (UBool)(resB->fIndex < resB->fSize-1);
1448 U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) {
1454 if(resB == NULL) {
1459 if(resB->fIndex == resB->fSize-1) {
1462 resB->fIndex++;
1463 switch(RES_GET_TYPE(resB->fRes)) {
1466 return res_getString(&(resB->fResData), resB->fRes, len);
1470 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, key);
1471 if(r == RES_BOGUS && resB->fHasFallback) {
1474 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1477 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1478 if(r == RES_BOGUS && resB->fHasFallback) {
1481 return ures_getStringWithAlias(resB, r, resB->fIndex, len, status);
1483 return ures_getStringWithAlias(resB, resB->fRes, resB->fIndex, len, status);
1496 U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UResourceBundle *fillIn, UErrorCode *status) {
1504 if(resB == NULL) {
1510 if(resB->fIndex == resB->fSize-1) {
1514 resB->fIndex++;
1515 switch(RES_GET_TYPE(resB->fRes)) {
1521 return ures_copyResb(fillIn, resB, status);
1525 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, &key);
1526 if(r == RES_BOGUS && resB->fHasFallback) {
1529 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1532 r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex);
1533 if(r == RES_BOGUS && resB->fHasFallback) {
1536 return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status);
1546 U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) {
1554 if(resB == NULL) {
1560 if(indexR >= 0 && resB->fSize > indexR) {
1561 switch(RES_GET_TYPE(resB->fRes)) {
1567 return ures_copyResb(fillIn, resB, status);
1571 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexR, &key);
1572 if(r == RES_BOGUS && resB->fHasFallback) {
1575 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1578 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexR);
1579 if(r == RES_BOGUS && resB->fHasFallback) {
1582 return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status);
1594 U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) {
1601 if(resB == NULL) {
1606 if(indexS >= 0 && resB->fSize > indexS) {
1607 switch(RES_GET_TYPE(resB->fRes)) {
1610 return res_getString(&(resB->fResData), resB->fRes, len);
1614 r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexS, &key);
1615 if(r == RES_BOGUS && resB->fHasFallback) {
1618 return ures_getStringWithAlias(resB, r, indexS, len, status);
1621 r = res_getArrayItem(&(resB->fResData), resB->fRes, indexS);
1622 if(r == RES_BOGUS && resB->fHasFallback) {
1625 return ures_getStringWithAlias(resB, r, indexS, len, status);
1627 return ures_getStringWithAlias(resB, resB->fRes, indexS, len, status);
1645 ures_getUTF8StringByIndex(const UResourceBundle *resB,
1651 const UChar *s16 = ures_getStringByIndex(resB, idx, &length16, status);
1655 /*U_CAPI const char *ures_getResPath(UResourceBundle *resB) {
1656 return resB->fResPath;
1715 ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status)
1729 res = res_findResource(&(resB->fResData), resB->fRes, &path, &key);
1731 result = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
1732 resB = result;
1742 ures_getStringByKeyWithFallback(const UResourceBundle *resB,
1750 ures_getByKeyWithFallback(resB, inKey, &stack, status);
1800 ures_getByKeyWithFallback(const UResourceBundle *resB,
1811 if(resB == NULL) {
1816 int32_t type = RES_GET_TYPE(resB->fRes);
1818 res = getTableItemByKeyPath(&(resB->fResData), resB->fRes, inKey);
1821 UResourceDataEntry *dataEntry = resB->fData;
1824 const char* resPath = resB->fResPath;
1825 int32_t len = resB->fResPathLen;
1846 resB, 0, helper, status);
1847 /*helper = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, helper, status);*/
1861 /*const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);*/
1863 /* check if resB->fResPath gives the right name here */
1870 fillIn = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, fillIn, status);
1875 fillIn = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
2001 U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) {
2009 if(resB == NULL) {
2014 int32_t type = RES_GET_TYPE(resB->fRes);
2017 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
2020 if(resB->fHasFallback == TRUE) {
2021 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
2023 /* check if resB->fResPath gives the right name here */
2024 return init_resb_result(rd, res, key, -1, realData, resB, 0, fillIn, status);
2032 return init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
2038 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
2040 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
2042 return init_resb_result(rd, res, key, realData, resB, fillIn, status);
2054 U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) {
2062 if(resB == NULL) {
2067 int32_t type = RES_GET_TYPE(resB->fRes);
2071 res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
2075 if(resB->fHasFallback == TRUE) {
2076 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
2085 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
2103 return res_getString(&(resB->fResData), res, len);
2107 UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
2120 else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
2122 const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
2137 ures_getUTF8StringByKey(const UResourceBundle *resB,
2143 const UChar *s16 = ures_getStringByKey(resB, key, &length16, status);
2199 U_CFUNC const char* ures_getName(const UResourceBundle* resB) {
2200 if(resB == NULL) {
2204 return resB->fData->fName;
2208 U_CFUNC const char* ures_getPath(const UResourceBundle* resB) {
2209 if(resB == NULL) {
2213 return resB->fData->fPath;
2397 U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo) {
2398 if (!resB) return;
2400 u_versionFromString(versionInfo, ures_getVersionNumberInternal(resB));