本文整理汇总了C++中FindByID函数的典型用法代码示例。如果您正苦于以下问题:C++ FindByID函数的具体用法?C++ FindByID怎么用?C++ FindByID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindByID函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AllocID
afs_int32
AllocID(struct ubik_trans *at, afs_int32 flag, afs_int32 *aid)
{
/* allocs an id from the proper area of address space, based on flag */
afs_int32 code = 1;
afs_int32 i = 0;
int maxcount = 50; /* to prevent infinite loops */
if (flag & PRGRP) {
*aid = ntohl(cheader.maxGroup);
/* Check for PRBADID to avoid wrap-around. */
while (code && i < maxcount && *aid != PRBADID) {
--(*aid);
code = FindByID(at, *aid);
i++;
}
if (code)
return PRNOIDS;
cheader.maxGroup = htonl(*aid);
code =
pr_Write(at, 0, 16, (char *)&cheader.maxGroup,
sizeof(cheader.maxGroup));
if (code)
return PRDBFAIL;
return PRSUCCESS;
} else if (flag & PRFOREIGN) {
*aid = ntohl(cheader.maxForeign);
while (code && i < maxcount) {
++(*aid);
code = FindByID(at, *aid);
i++;
}
if (code)
return PRNOIDS;
cheader.maxForeign = htonl(*aid);
code =
pr_Write(at, 0, 24, (char *)&cheader.maxForeign,
sizeof(cheader.maxForeign));
if (code)
return PRDBFAIL;
return PRSUCCESS;
} else {
*aid = ntohl(cheader.maxID);
while (code && i < maxcount && *aid != 0x7fffffff) {
++(*aid);
code = FindByID(at, *aid);
i++;
}
if (code)
return PRNOIDS;
cheader.maxID = htonl(*aid);
code =
pr_Write(at, 0, 20, (char *)&cheader.maxID,
sizeof(cheader.maxID));
if (code)
return PRDBFAIL;
return PRSUCCESS;
}
}
开发者ID:adeason,项目名称:openafs,代码行数:59,代码来源:utils.c
示例2: FindByID
CShopItemPtr CShop::FindShopItemDefByClassName( const idStr &className ) {
CShopItemPtr found = FindByID( _itemDefs, className );
if( found != NULL ) {
return found;
}
// Check if we should run another search
if( idStr::Cmpn( className.c_str(), "atdm:", 5 ) == 0 ) {
return CShopItemPtr(); // atdm is already prepended, return empty
}
// Try again with "atdm:" prepended
return FindByID( _itemDefs, "atdm:" + className );
}
开发者ID:revelator,项目名称:The-Darkmod-Experimental,代码行数:12,代码来源:Shop.cpp
示例3: DYNAMIC_DOWNCAST
void CMyRibbonBar::testUpdate()
{
CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, FindByID(WM_CHART_FORMAT_SEL_COMBO));
if (pFormatSelCombo == NULL)
{
return;
}
pFormatSelCombo->SelectItem(2);
return;
int i=pFormatSelCombo->GetCurSel();
}
开发者ID:geforce42376,项目名称:easyprofiler,代码行数:11,代码来源:MyRibbonBar.cpp
示例4: FindByID
VTextureWeightmapChannelResource *VTextureWeightmapChannelResourceCollection::CreateDetailTexture(const VTextureWeightmapChannelResource::DetailTextureProperties_t &props)
{
VTextureWeightmapChannelResource *pFound = FindByID(props.m_iTextureID);
if (pFound)
{
if (pFound->m_Properties==props)
return pFound;
// update properties in existing channel:
pFound->m_Properties = props;
return pFound;
}
// create a new one
VTextureWeightmapChannelResource *pNew = new VTextureWeightmapChannelResource(props);
pNew->m_iSortingKey = Count(); // do not re-enum all others
Add(pNew);
return pNew;
}
开发者ID:Alagong,项目名称:projectanarchy,代码行数:20,代码来源:TextureWeightmapChannel.cpp
示例5: SendEmoteMessage
void ZSList::SOPZoneBootup(const char* adminname, uint32 ZoneServerID, const char* zonename, bool iMakeStatic) {
ZoneServer* zs = 0;
ZoneServer* zs2 = 0;
uint32 zoneid;
if (!(zoneid = database.GetZoneID(zonename)))
SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' not found in 'zone' table. Typo protection=ON.", zonename);
else {
if (ZoneServerID != 0)
zs = FindByID(ZoneServerID);
else
SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: ServerID must be specified");
if (zs == 0)
SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zoneserver not found");
else {
zs2 = FindByName(zonename);
if (zs2 != 0)
SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' already being hosted by ZoneServer #%i", zonename, zs2->GetID());
else {
zs->TriggerBootup(zoneid, 0, adminname, iMakeStatic);
}
}
}
}
开发者ID:Corysia,项目名称:Server,代码行数:24,代码来源:zonelist.cpp
示例6: FindByID
CShopItemPtr CShop::FindStartingItemByID(const char *id)
{
return FindByID(_startingItems, id);
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:4,代码来源:Shop.cpp
示例7: CommandProc
//.........这里部分代码省略.........
Initdb();
initialize_PT_error_table();
if (wflag) {
struct usr_list *u;
int seenGroup = 0, id = 0, flags = 0;
while (fgets(buffer, sizeof(buffer), dfp)) {
int oid, cid, quota, uid;
char name[PR_MAXNAMELEN], mem[PR_MAXNAMELEN];
if (isspace(*buffer)) {
code = sscanf(buffer, "%s %d", mem, &uid);
if (code != 2) {
fprintf(stderr,
"Insuffient data provided for group membership\n");
exit(1);
}
if (!seenGroup) {
fprintf(stderr,
"Group member %s listed outside of group\n",
mem);
exit(1);
}
for (u = usr_head; u; u = u->next)
if (u->uid && u->uid == uid)
break;
if (u) {
/* Add user - deferred because it is probably foreign */
u->uid = 0;
if (FindByID(0, uid))
code = PRIDEXIST;
else {
if (!code
&& (flags & (PRGRP | PRQUOTA)) ==
(PRGRP | PRQUOTA)) {
gentry.ngroups++;
code = pr_WriteEntry(0, 0, gpos, &gentry);
if (code)
fprintf(stderr,
"Error setting group count on %s: %s\n",
name, afs_error_message(code));
}
code = CreateEntry(0, u->name, &uid, 1 /*idflag */ ,
1 /*gflag */ ,
SYSADMINID /*oid */ ,
SYSADMINID /*cid */ );
}
if (code)
fprintf(stderr, "Error while creating %s: %s\n",
u->name, afs_error_message(code));
continue;
}
/* Add user to group */
if (id == ANYUSERID || id == AUTHUSERID || uid == ANONYMOUSID) {
code = PRPERM;
} else if ((upos = FindByID(0, uid))
&& (gpos = FindByID(0, id))) {
code = pr_ReadEntry(0, 0, upos, &uentry);
if (!code)
code = pr_ReadEntry(0, 0, gpos, &gentry);
if (!code)
code = AddToEntry(0, &gentry, gpos, uid);
开发者ID:bagdxk,项目名称:openafs,代码行数:67,代码来源:pt_util.c
示例8: FindByID
//! \brief Model にメッセージがあればこれで。解析は Model の仕事
//! \param[in] ID_ Model の ID。
// 管理する時点で必要になりそうなものは各自継承先で
// ID をメンバとして保存しておくこと。
//! \param[in] message_ 伝えるメッセージ。解析は Model の仕事。
//! \retval true メッセージを正常に伝えた
//! \retval false ID_ が見つからなかった
bool ControlerInterface::sendMessageToModel(unsigned int ID_, std::string message_) {
bool result = true;
ModelerInterfaceContainer::iterator model = std::find_if(this->modelContainer.begin(), this->modelContainer.end(), FindByID(ID_));
if (model != this->modelContainer.end()) {
result = false;
} else {
(*model)->setMessage(message_);
}
return result;
}
开发者ID:gamepattisiere,项目名称:laboratory,代码行数:18,代码来源:Controler.cpp
注:本文中的FindByID函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论