コード例 #1
0
ファイル: ResourcesContainer.cpp プロジェクト: mariuz/haiku
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;
}
コード例 #2
0
ファイル: Resources.cpp プロジェクト: yunxiaoxiao110/haiku
// 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;
}
コード例 #3
0
ファイル: Resources.cpp プロジェクト: yunxiaoxiao110/haiku
// 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;
}