diff --git a/src/servers/registrar/AppInfoList.cpp b/src/servers/registrar/AppInfoList.cpp index c3689bd15e..ca9895552d 100644 --- a/src/servers/registrar/AppInfoList.cpp +++ b/src/servers/registrar/AppInfoList.cpp @@ -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 diff --git a/src/servers/registrar/AppInfoList.h b/src/servers/registrar/AppInfoList.h index 90d53577f9..56dde2fa52 100644 --- a/src/servers/registrar/AppInfoList.h +++ b/src/servers/registrar/AppInfoList.h @@ -30,6 +30,8 @@ #include #include +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;