MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / generateAttributes

Method generateAttributes

tools/aapt/ResourceTable.cpp:3256–3297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3254}
3255
3256status_t ResourceTable::Entry::generateAttributes(ResourceTable* table,
3257 const String16& package)
3258{
3259 const String16 attr16("attr");
3260 const String16 id16("id");
3261 const size_t N = mBag.size();
3262 for (size_t i=0; i<N; i++) {
3263 const String16& key = mBag.keyAt(i);
3264 const Item& it = mBag.valueAt(i);
3265 if (it.isId) {
3266 if (!table->hasBagOrEntry(key, &id16, &package)) {
3267 String16 value("false");
3268 status_t err = table->addEntry(SourcePos(String8("<generated>"), 0), package,
3269 id16, key, value);
3270 if (err != NO_ERROR) {
3271 return err;
3272 }
3273 }
3274 } else if (!table->hasBagOrEntry(key, &attr16, &package)) {
3275
3276#if 1
3277// fprintf(stderr, "ERROR: Bag attribute '%s' has not been defined.\n",
3278// String8(key).string());
3279// const Item& item(mBag.valueAt(i));
3280// fprintf(stderr, "Referenced from file %s line %d\n",
3281// item.sourcePos.file.string(), item.sourcePos.line);
3282// return UNKNOWN_ERROR;
3283#else
3284 char numberStr[16];
3285 sprintf(numberStr, "%d", ResTable_map::TYPE_ANY);
3286 status_t err = table->addBag(SourcePos("<generated>", 0), package,
3287 attr16, key, String16(""),
3288 String16("^type"),
3289 String16(numberStr), NULL, NULL);
3290 if (err != NO_ERROR) {
3291 return err;
3292 }
3293#endif
3294 }
3295 }
3296 return NO_ERROR;
3297}
3298
3299status_t ResourceTable::Entry::assignResourceIds(ResourceTable* table,
3300 const String16& package)

Callers 1

assignResourceIdsMethod · 0.80

Calls 8

SourcePosClass · 0.85
hasBagOrEntryMethod · 0.80
addBagMethod · 0.80
String16Class · 0.70
sizeMethod · 0.65
keyAtMethod · 0.45
valueAtMethod · 0.45
addEntryMethod · 0.45

Tested by

no test coverage detected