本文整理汇总了C++中BRoster::GetRunningAppInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ BRoster::GetRunningAppInfo方法的具体用法?C++ BRoster::GetRunningAppInfo怎么用?C++ BRoster::GetRunningAppInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRoster
的用法示例。
在下文中一共展示了BRoster::GetRunningAppInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: entry
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
{
/* in case there isn't a BApplication yet, we'll construct a roster. */
BRoster roster;
app_info info;
status_t rc = roster.GetRunningAppInfo(getTeamID(), &info);
BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
BEntry entry(&(info.ref), true);
BPath path;
rc = entry.GetPath(&path); /* (path) now has binary's path. */
assert(rc == B_OK);
rc = path.GetParent(&path); /* chop filename, keep directory. */
assert(rc == B_OK);
const char *str = path.Path();
assert(str != NULL);
char *retval = (char *) allocator.Malloc(strlen(str) + 1);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
strcpy(retval, str);
return(retval);
} /* __PHYSFS_platformCalcBaseDir */
示例2: GetLocalSignature
//------------------------------------------------------------------------------
std::string TInstantiateObjectTester::GetLocalSignature()
{
BRoster Roster;
app_info ai;
team_id team;
// Get the team_id of this app
thread_id tid = find_thread(NULL);
thread_info ti;
status_t err = get_thread_info(tid, &ti);
if (err)
{
FORMAT_AND_THROW(" failed to get thread_info: ", err);
}
// Get the app_info via the team_id
team = ti.team;
team_info info;
err = get_team_info(team, &info);
if (err)
{
FORMAT_AND_THROW(" failed to get team_info: ", err);
}
team = info.team;
// It seems that this call to GetRunningAppInfo() is not working because we
// don't have an instance of BApplication somewhere -- the roster, therefore,
// doesn't know about us.
err = Roster.GetRunningAppInfo(team, &ai);
if (err)
{
FORMAT_AND_THROW(" failed to get app_info: ", err);
}
// Return the signature from the app_info
return ai.signature;
}