int32 ResourcesContainer::IndexOf(type_code type, int32 id) const { int32 index = -1; int32 count = CountResources(); for (int32 i = 0; index == -1 && i < count; i++) { ResourceItem *item = ResourceAt(i); if (item->Type() == type && item->ID() == id) index = i; } return index; }
// Gets information about a resource identified by byType and andName. bool BResources::GetResourceInfo(type_code byType, const char* andName, int32* idFound, size_t* lengthFound) { ResourceItem* item = NULL; if (InitCheck() == B_OK) item = fContainer->ResourceAt(fContainer->IndexOf(byType, andName)); if (item) { if (idFound) *idFound = item->ID(); if (lengthFound) *lengthFound = item->DataSize(); } return item; }
// Gets information about a resource identified by byPointer. bool BResources::GetResourceInfo(const void* byPointer, type_code* typeFound, int32* idFound, size_t* lengthFound, const char** nameFound) { ResourceItem* item = NULL; if (InitCheck() == B_OK) item = fContainer->ResourceAt(fContainer->IndexOf(byPointer)); if (item) { if (typeFound) *typeFound = item->Type(); if (idFound) *idFound = item->ID(); if (nameFound) *nameFound = item->Name(); if (lengthFound) *lengthFound = item->DataSize(); } return item; }