Added a couple of methods for app_info finding.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@460 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2002-07-26 20:00:15 +00:00
parent 2a2585c598
commit 679ac7ab0d
2 changed files with 42 additions and 0 deletions

View File

@ -98,6 +98,28 @@ AppInfoList::IndexOf(team_id team) const
return -1;
}
// IndexOf
int32
AppInfoList::IndexOf(const entry_ref *ref) const
{
for (int32 i = 0; RosterAppInfo *info = InfoAt(i); i++) {
if (info->ref == *ref)
return i;
}
return -1;
}
// IndexOfToken
int32
AppInfoList::IndexOfToken(uint32 token) const
{
for (int32 i = 0; RosterAppInfo *info = InfoAt(i); i++) {
if (info->token == token)
return i;
}
return -1;
}
// InfoAt
RosterAppInfo *
AppInfoList::InfoAt(int32 index) const
@ -119,6 +141,20 @@ AppInfoList::InfoFor(team_id team) const
return InfoAt(IndexOf(team));
}
// InfoFor
RosterAppInfo *
AppInfoList::InfoFor(const entry_ref *ref) const
{
return InfoAt(IndexOf(ref));
}
// InfoForToken
RosterAppInfo *
AppInfoList::InfoForToken(uint32 token) const
{
return InfoAt(IndexOfToken(token));
}
// CountInfos
int32
AppInfoList::CountInfos() const

View File

@ -30,6 +30,8 @@
#include <List.h>
#include <OS.h>
class entry_ref;
class RosterAppInfo;
class AppInfoList {
@ -45,10 +47,14 @@ public:
int32 IndexOf(RosterAppInfo *info) const;
int32 IndexOf(const char *signature) const;
int32 IndexOf(team_id team) const;
int32 IndexOf(const entry_ref *ref) const;
int32 IndexOfToken(uint32 token) const;
RosterAppInfo *InfoAt(int32 index) const;
RosterAppInfo *InfoFor(const char *signature) const;
RosterAppInfo *InfoFor(team_id team) const;
RosterAppInfo *InfoFor(const entry_ref *ref) const;
RosterAppInfo *InfoForToken(uint32 token) const;
int32 CountInfos() const;