| 3334 | } |
| 3335 | |
| 3336 | status_t ResourceTable::Entry::prepareFlatten(StringPool* strings, ResourceTable* table, |
| 3337 | const String8* configTypeName, const ConfigDescription* config) |
| 3338 | { |
| 3339 | if (mType == TYPE_ITEM) { |
| 3340 | Item& it = mItem; |
| 3341 | AccessorCookie ac(it.sourcePos, String8(mName), String8(it.value)); |
| 3342 | if (!table->stringToValue(&it.parsedValue, strings, |
| 3343 | it.value, false, true, 0, |
| 3344 | &it.style, NULL, &ac, mItemFormat, |
| 3345 | configTypeName, config)) { |
| 3346 | return UNKNOWN_ERROR; |
| 3347 | } |
| 3348 | } else if (mType == TYPE_BAG) { |
| 3349 | const size_t N = mBag.size(); |
| 3350 | for (size_t i=0; i<N; i++) { |
| 3351 | const String16& key = mBag.keyAt(i); |
| 3352 | Item& it = mBag.editValueAt(i); |
| 3353 | AccessorCookie ac(it.sourcePos, String8(key), String8(it.value)); |
| 3354 | if (!table->stringToValue(&it.parsedValue, strings, |
| 3355 | it.value, false, true, it.bagKeyId, |
| 3356 | &it.style, NULL, &ac, it.format, |
| 3357 | configTypeName, config)) { |
| 3358 | return UNKNOWN_ERROR; |
| 3359 | } |
| 3360 | } |
| 3361 | } else { |
| 3362 | mPos.error("Error: entry %s is not a single item or a bag.\n", |
| 3363 | String8(mName).string()); |
| 3364 | return UNKNOWN_ERROR; |
| 3365 | } |
| 3366 | return NO_ERROR; |
| 3367 | } |
| 3368 | |
| 3369 | status_t ResourceTable::Entry::remapStringValue(StringPool* strings) |
| 3370 | { |