当前位置: 首页>>代码示例>>C++>>正文


C++ reason函数代码示例

本文整理汇总了C++中reason函数的典型用法代码示例。如果您正苦于以下问题:C++ reason函数的具体用法?C++ reason怎么用?C++ reason使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reason函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: showRelocatability

void showRelocatability() {
    int i;

#ifdef RUNTIME_RELOC_CHECKS
    goto_len = calculateRelocatability(handler_sizes);
#endif

    if(goto_len >= 0)
        printf("Dispatch sequence is relocatable\n");
    else
        printf("Dispatch sequence is not relocatable (%s)\n", reason(goto_len));

    for(i = 0; i < HANDLERS; i++) {
        int j;

        printf("Opcodes at depth %d: \n", i);

        for(j = 0; j < LABELS_SIZE; j++) {
            int size = handler_sizes[i][j];

            if(size >= 0)
                printf("%d : is relocatable\n", j);
            else
                printf("%d : is not relocatable (%s)\n", j, reason(size));
        }
    }
}
开发者ID:OPSF,项目名称:uClinux,代码行数:27,代码来源:inlining.c

示例2: reason

void DelayedTrick::onEffect(const CardEffectStruct &effect) const
{
    Room *room = effect.to->getRoom();

    CardMoveReason reason(CardMoveReason::S_REASON_USE, effect.to->objectName(), getSkillName(), QString());
    room->moveCardTo(this, NULL, Player::PlaceTable, reason, true);

    LogMessage log;
    log.from = effect.to;
    log.type = "#DelayedTrick";
    log.arg = effect.card->objectName();
    room->sendLog(log);

    JudgeStruct judge_struct = judge;
    judge_struct.who = effect.to;
    room->judge(judge_struct);

    if (judge_struct.isBad()) {
        takeEffect(effect.to);
        if (room->getCardOwner(getEffectiveId()) == NULL) {
            CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString());
            room->throwCard(this, reason, NULL);
        }
    } else if (movable) {
        onNullified(effect.to);
    } else {
        if (room->getCardOwner(getEffectiveId()) == NULL) {
            CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString());
            room->throwCard(this, reason, NULL);
        }
    }
}
开发者ID:DGAH,项目名称:QSanguosha-v2,代码行数:32,代码来源:standard.cpp

示例3: throw

/** \brief callback notified by host2ip_t when the result is known
 */
bool	ipcountry_t::neoip_host2ip_cb(void *cb_userptr, host2ip_vapi_t &cb_host2ip_vapi
						, const inet_err_t &inet_err
						, const std::vector<ip_addr_t> &result_arr)	throw()
{
	// display the result
	KLOG_DBG("enter host2ip returned err=" << inet_err << " with " << result_arr.size() << " ip_addr_t"
					<< " for hostname=" << host2ip->hostname());
	// if the host2ip failed to return an ip address, notify the caller
	if( inet_err.failed() || result_arr.empty() ){
		std::string	reason("unable to resolve the ip_addr_t " + ipaddr().to_string());
		return notify_callback(inet_err_t(inet_err_t::ERROR, reason), std::string());
	}
	
	// create an alias on the result_ipaddr
	const ip_addr_t	result_ipaddr	= result_arr[0]; 
	// log to debug
	KLOG_DBG("result=" << result_ipaddr);
	
	// convert the result_ipaddr into a country code
	const char * country_ptr	= ipaddr2countrycode(result_ipaddr);
	if( !country_ptr ){
		std::string	reason("Internal error. the return ip_addr_t is NOT a ISO3166 code. ip_addr=" + result_ipaddr.to_string());
		return notify_callback(inet_err_t(inet_err_t::ERROR, reason), std::string());
	}
	// notify the caller of the successfull result
	std::string	country_code	= country_ptr;
	return notify_callback(inet_err_t::OK, country_code);
}
开发者ID:jeromeetienne,项目名称:neoip,代码行数:30,代码来源:neoip_ipcountry.cpp

示例4: on_lag_member_del

 // Handler called when a physical interface is no longer active in a LAG.
 void on_lag_member_del(eos::intf_id_t lag, eos::intf_id_t member) {
    // Custom application code to react to a physical interface
    // leaving a LAG for any reason. For example, to get the reason:
    auto stat = eth_lag_intf_mgr_->eth_lag_intf_membership_status(member);
    std::string reason(stat.reason());  // e.g., 'not link up'
    t.trace8("ApplicationAgent on_lag_member_del: %s deleted from %s",
              member.to_string().c_str(), lag.to_string().c_str());
 }
开发者ID:aristanetworks,项目名称:EosSdk,代码行数:9,代码来源:EthLagIntfExample.cpp

示例5: next

void DelayedTrick::onNullified(ServerPlayer *target) const
{
    Room *room = target->getRoom();
    RoomThread *thread = room->getThread();

    if (movable) {
        QList<ServerPlayer *> players = room->getOtherPlayers(target);
        players << target;
        ServerPlayer *next = NULL; //next meaning this next one
        bool next2next = false; //it's meaning another next(a second next) is necessary
        foreach (ServerPlayer *player, players) {
            if (player->containsTrick(objectName()))
                continue;

            const ProhibitSkill *skill = room->isProhibited(target, player, this);
            if (skill) {
                LogMessage log;
                log.type = "#SkillAvoid";
                log.from = player;
                log.arg = skill->objectName();
                log.arg2 = objectName();
                room->sendLog(log);

                room->broadcastSkillInvoke(skill->objectName());
                continue;
            }

            next = player;
            CardMoveReason reason(CardMoveReason::S_REASON_TRANSFER, target->objectName(), QString(), getSkillName(), QString());
            room->moveCardTo(this, target, player, Player::PlaceDelayedTrick, reason, true);
            if (target == player)
                break;

            CardUseStruct use;
            use.from = NULL;
            use.to << player;
            use.card = this;
            QVariant data = QVariant::fromValue(use);
            thread->trigger(TargetConfirming, room, data);
            CardUseStruct new_use = data.value<CardUseStruct>();
            if (new_use.to.isEmpty()) {
                next2next = true;
                break;
            }

            thread->trigger(TargetConfirmed, room, data);
            break;
        }
        //case:stop.
        if (!next) {
            CardMoveReason reason(CardMoveReason::S_REASON_TRANSFER, target->objectName(), QString(), getSkillName(), QString());
            room->moveCardTo(this, target, target, Player::PlaceDelayedTrick, reason, true);
        }
        //case: next2next
        if (next && next2next)
            onNullified(next);
    } else {
开发者ID:lwtmusou,项目名称:touhoukill,代码行数:57,代码来源:standard.cpp

示例6: while

bool SyncObject::lockConditional(SyncType type, const char* from)
{
	if (waitingThreads)
		return false;

	if (type == SYNC_SHARED)
	{
		while (true)
		{
			const AtomicCounter::counter_type oldState = lockState;
			if (oldState < 0)
				break;

			const AtomicCounter::counter_type newState = oldState + 1;
			if (lockState.compareExchange(oldState, newState))
			{
				WaitForFlushCache();
#ifdef DEV_BUILD
				MutexLockGuard g(mutex, FB_FUNCTION);
#endif
				reason(from);
				return true;
			}
		}
	}
	else
	{
		ThreadSync* thread = ThreadSync::findThread();
		fb_assert(thread);

		if (thread == exclusiveThread)
		{
			++monitorCount;
			reason(from);
			return true;
		}

		while (waiters == 0)
		{
			const AtomicCounter::counter_type oldState = lockState;
			if (oldState != 0)
				break;

			if (lockState.compareExchange(oldState, -1))
			{
				WaitForFlushCache();
				exclusiveThread = thread;
				reason(from);
				return true;
			}
		}

	}

	return false;
}
开发者ID:Jactry,项目名称:firebird-git-svn,代码行数:56,代码来源:SyncObject.cpp

示例7: reason

void DelayedTrick::onEffect(const CardEffectStruct &effect) const
{
    Room *room = effect.to->getRoom();

    CardMoveReason reason(CardMoveReason::S_REASON_USE, effect.to->objectName(), getSkillName(), QString());
    room->moveCardTo(this, NULL, Player::PlaceTable, reason, true);

    LogMessage log;
    log.from = effect.to;
    log.type = "#DelayedTrick";
    log.arg = effect.card->objectName();
    room->sendLog(log);

    JudgeStruct judge_struct = judge;
    judge_struct.who = effect.to;
    room->judge(judge_struct);

    if (judge_struct.negative == judge_struct.isBad()) {
        if (effect.to->isAlive())
            takeEffect(effect.to);
        if (room->getCardOwner(getEffectiveId()) == NULL) {
            CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString());
            room->throwCard(this, reason, NULL);
        }
    } else if (movable) {
        onNullified(effect.to);
    } else if (returnable && effect.to->isAlive()) {
        if (room->getCardOwner(getEffectiveId()) == NULL) {
            if (isVirtualCard()) {
                Card *delayTrick = Sanguosha->cloneCard(objectName());
                WrappedCard *vs_card = Sanguosha->getWrappedCard(getEffectiveId());
                vs_card->setSkillName(getSkillName());
                vs_card->takeOver(delayTrick);
                room->broadcastUpdateCard(room->getAlivePlayers(), vs_card->getId(), vs_card);
            }
           
            CardsMoveStruct move;
            move.card_ids << getEffectiveId();
            move.to = effect.to;
            move.to_place = Player::PlaceDelayedTrick;
            room->moveCardsAtomic(move, true);
        }
    }
    else {
        if (room->getCardOwner(getEffectiveId()) == NULL) {
            CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, QString());
            room->throwCard(this, reason, NULL);
        }
    }
}
开发者ID:lwtmusou,项目名称:touhoukill,代码行数:50,代码来源:standard.cpp

示例8: outmessage

std::string FSData::processRequestForInfo(LLUUID requester, std::string message, std::string name, LLUUID sessionid)
{
	std::string detectstring = "/reqsysinfo";
	if(!message.find(detectstring) == 0)
	{
		return message;
	}

	if(!(is_support(requester)||is_developer(requester)))
	{
		return message;
	}

	std::string outmessage("I am requesting information about your system setup.");
	std::string reason("");
	if(message.length() > detectstring.length())
	{
		reason = std::string(message.substr(detectstring.length()));
		//there is more to it!
		outmessage = std::string("I am requesting information about your system setup for this reason : " + reason);
		reason = "The reason provided was : " + reason;
	}
	
	LLSD args;
	args["REASON"] = reason;
	args["NAME"] = name;
	args["FROMUUID"] = requester;
	args["SESSIONID"] = sessionid;
	LLNotifications::instance().add("FireStormReqInfo", args, LLSD(), callbackReqInfo);

	return outmessage;
}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:32,代码来源:fsdata.cpp

示例9: foreach

void DelayedTrick::onNullified(ServerPlayer *target) const{
    Room *room = target->getRoom();
    if(movable){
        QList<ServerPlayer *> players = room->getOtherPlayers(target);
        players << target;

        foreach(ServerPlayer *player, players){
            if(player->containsTrick(objectName()))
                continue;

            const ProhibitSkill *skill = room->isProhibited(target, player, this);
            if(skill){
                LogMessage log;
                log.type = "#SkillAvoid";
                log.from = player;
                log.arg = skill->objectName();
                log.arg2 = objectName();
                room->sendLog(log);

                room->broadcastSkillInvoke(skill->objectName());
                continue;
            }

            CardMoveReason reason(CardMoveReason::S_REASON_TRANSFER, target->objectName(), QString(), this->getSkillName(), QString());
            room->moveCardTo(this, target, player, Player::PlaceDelayedTrick, reason, true);
            break;
        }
    }
    else{
开发者ID:gutenye,项目名称:QSanguosha,代码行数:29,代码来源:standard.cpp

示例10: trigger

    bool trigger(TriggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
    {
        DamageStruct damage = data.value<DamageStruct>();

        if (damage.card && damage.card->isKindOf("Slash")
            && damage.by_user && !damage.chain && !damage.transfer && !damage.to->isAllNude()
            && player->askForSkillInvoke(this, data)) {
            room->broadcastSkillInvoke(objectName(), 1);
            LogMessage log;
            log.type = "#Yishi";
            log.from = player;
            log.arg = objectName();
            log.to << damage.to;
            room->sendLog(log);
            int card_id = room->askForCardChosen(player, damage.to, "hej", objectName());
            if (room->getCardPlace(card_id) == Player::PlaceDelayedTrick)
                room->broadcastSkillInvoke(objectName(), 2);
            else if (room->getCardPlace(card_id) == Player::PlaceEquip)
                room->broadcastSkillInvoke(objectName(), 3);
            else
                room->broadcastSkillInvoke(objectName(), 4);
            CardMoveReason reason(CardMoveReason::S_REASON_EXTRACTION, player->objectName());
            room->obtainCard(player, Sanguosha->getCard(card_id), reason, room->getCardPlace(card_id) != Player::PlaceHand);
            return true;
        }
        return false;
    }
开发者ID:SwordElucidator,项目名称:QSanguosha-v2-AnimeMod,代码行数:27,代码来源:ling.cpp

示例11: TEST_F

TEST_F(SyncTailTest, MultiApplyReturnsBadValueOnNullOperationContext) {
    auto writerPool = SyncTail::makeWriterPool();
    auto op = makeCreateCollectionOplogEntry({Timestamp(Seconds(1), 0), 1LL});
    auto status = multiApply(nullptr, writerPool.get(), {op}, noopApplyOperationFn).getStatus();
    ASSERT_EQUALS(ErrorCodes::BadValue, status);
    ASSERT_STRING_CONTAINS(status.reason(), "invalid operation context");
}
开发者ID:DreamerKing,项目名称:mongo,代码行数:7,代码来源:sync_tail_test.cpp

示例12: toString

void DelayedTrick::onUse(Room *room, const CardUseStruct &card_use) const
{
    CardUseStruct use = card_use;
    WrappedCard *wrapped = Sanguosha->getWrappedCard(this->getEffectiveId());
    use.card = wrapped;

    QVariant data = QVariant::fromValue(use);
    RoomThread *thread = room->getThread();
    thread->trigger(PreCardUsed, room, use.from, data);
    use = data.value<CardUseStruct>();

    LogMessage log;
    log.from = use.from;
    log.to = use.to;
    log.type = "#UseCard";
    log.card_str = toString();
    room->sendLog(log);

    CardMoveReason reason(CardMoveReason::S_REASON_USE, use.from->objectName(), use.to.first()->objectName(), this->getSkillName(), QString());
    room->moveCardTo(this, use.to.first(), Player::PlaceDelayedTrick, reason, true);

    thread->trigger(CardUsed, room, use.from, data);
    use = data.value<CardUseStruct>();
    thread->trigger(CardFinished, room, use.from, data);
}
开发者ID:DGAH,项目名称:QSanguosha-v2,代码行数:25,代码来源:standard.cpp

示例13: onPhaseChange

    virtual bool onPhaseChange(ServerPlayer *wangyi) const{
        if(!wangyi->isWounded())
            return false;
        if(wangyi->getPhase() == Player::Start || wangyi->getPhase() == Player::Finish){
            if(!wangyi->askForSkillInvoke(objectName()))
                return false;
            Room *room = wangyi->getRoom();
            room->broadcastSkillInvoke(objectName(), 1);
            JudgeStruct judge;
            judge.pattern = QRegExp("(.*):(club|spade):(.*)");
            judge.good = true;
            judge.reason = objectName();
            judge.who = wangyi;

            room->judge(judge);

            if(judge.isGood()){
                int x = wangyi->getLostHp();
                wangyi->drawCards(x); //It should be preview, not draw
                ServerPlayer *target = room->askForPlayerChosen(wangyi, room->getAllPlayers(), objectName());

                if (target == wangyi)
                    room->broadcastSkillInvoke(objectName(), 2);
                else if (target->getGeneralName().contains("machao"))
                    room->broadcastSkillInvoke(objectName(), 4);
                else
                    room->broadcastSkillInvoke(objectName(), 3);

                QList<const Card *> miji_cards = wangyi->getHandcards().mid(wangyi->getHandcardNum() - x);
                foreach(const Card *card, miji_cards){
                    CardMoveReason reason(CardMoveReason::S_REASON_GIVE, wangyi->objectName());
                    reason.m_playerId == target->objectName();
                    room->obtainCard(target, card, reason, false);
                }
            }
开发者ID:dixieboy,项目名称:QSanguosha,代码行数:35,代码来源:yjcm2012-package.cpp

示例14: Disasoc

BOOLEAN Disasoc(Signal_t *signal)
{
	FrmDesc_t *pfrmDesc;
	Frame_t *rdu;
	MacAddr_t Sta;
	ReasonCode Rsn;
	U8 vapId = 0;
	
	ZDEBUG("Disasoc");
	pfrmDesc	= signal->frmInfo.frmDesc;
	rdu = pfrmDesc->mpdu;
	memcpy((U8 *)&Sta, (U8 *)(addr2(rdu)), 6);
	Rsn = (ReasonCode)(reason(rdu));

	if(memcmp(addr1(rdu), (U8*)&mBssId, 6)){ //Not for this BSSID
		freeFdesc(pfrmDesc);
		return TRUE;
	}

	UpdateStaStatus(&Sta, STATION_STATE_DIS_ASOC, vapId);
	freeFdesc(pfrmDesc);
	
	//here to handle disassoc ind.
	pdot11Obj->StatusNotify(STA_DISASSOCIATED, (U8 *)&Sta);
	return TRUE;
}
开发者ID:archith,项目名称:camera_project,代码行数:26,代码来源:zdasocsvc.c

示例15: trigger

    virtual bool trigger(TriggerEvent, Room* room, ServerPlayer *player, QVariant &data) const{
        if(player->isNude())
            return false;
        QList<ServerPlayer *> caopis = room->findPlayersBySkillName(objectName());
        foreach(ServerPlayer *caopi, caopis){
            if(caopi->isAlive() && room->askForSkillInvoke(caopi, objectName(), data)){
                if(player->isCaoCao()){
                    room->broadcastSkillInvoke(objectName(), 3);
                }else if(player->isMale())
                    room->broadcastSkillInvoke(objectName(), 1);
                else
                    room->broadcastSkillInvoke(objectName(), 2);

                caopi->obtainCard(player->getWeapon());
                caopi->obtainCard(player->getArmor());
                caopi->obtainCard(player->getDefensiveHorse());
                caopi->obtainCard(player->getOffensiveHorse());

                DummyCard *all_cards = player->wholeHandCards();
                if(all_cards){
                    CardMoveReason reason(CardMoveReason::S_REASON_RECYCLE, caopi->objectName());
                    room->obtainCard(caopi, all_cards, reason, false);
                    delete all_cards;
                }
                break;
            }
        }
        return false;
    }
开发者ID:dixieboy,项目名称:QSanguosha,代码行数:29,代码来源:thicket.cpp


注:本文中的reason函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。