本文整理汇总了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;
}
}
示例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 );
}
示例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();
}
示例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;
}
示例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);
}
}
}
}
示例6: FindByID
CShopItemPtr CShop::FindStartingItemByID(const char *id)
{
return FindByID(_startingItems, id);
}
示例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);
示例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;
}