當前位置: 首頁>>代碼示例>>C++>>正文


C++ FindByID函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。