本文整理汇总了C++中reason函数的典型用法代码示例。如果您正苦于以下问题:C++ reason函数的具体用法?C++ reason怎么用?C++ reason使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reason函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: outmessage
std::string PhoenixViewerLink::processRequestForInfo(LLUUID requester, std::string message, std::string name, LLUUID sessionid)
{
std::string detectstring = "/reqsysinfo";
if(!message.find(detectstring)==0)
{
//llinfos << "sysinfo was not found in this message, it was at " << message.find("/sysinfo") << " pos." << llendl;
return message;
}
if(!(is_support(requester)||is_developer(requester)))
{
return message;
}
std::string my_name;
gAgent.buildFullname(my_name);
//llinfos << "sysinfo was found in this message, it was at " << message.find("/sysinfo") << " pos." << llendl;
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("PhoenixReqInfo",args,LLSD(), callbackPhoenixReqInfo);
return outmessage;
}
开发者ID:N3X15,项目名称:Luna-Viewer,代码行数:34,代码来源:a_phoenixviewerlink.cpp
示例17: onPhaseChange
virtual bool onPhaseChange(ServerPlayer *player) const{
if(player->getPhase() == Player::Start){
Room *room = player->getRoom();
player->setMark("juao", 0);
ServerPlayer *xuyou = room->findPlayerBySkillName(objectName());
foreach (int card_id, player->getPile("hautain")){
if(!xuyou)
{
CardMoveReason reason(CardMoveReason::S_REASON_REMOVE_FROM_PILE, QString(), "hautain", QString());
room->throwCard(Sanguosha->getCard(card_id), reason, NULL);
}
else
room->obtainCard(player, card_id);
}
if(!xuyou)
return false;
LogMessage log;
log.type = "#JuaoObtain";
log.from = player;
log.arg = objectName();
log.to << xuyou;
room->sendLog(log);
player->skip(Player::Draw);
}
开发者ID:43501474,项目名称:QSanguosha,代码行数:26,代码来源:wisdompackage.cpp
示例18: TEST_F
TEST_F(CacheReaderTest, RefreshErrorsIfCacheIsEmpty) {
auto catalogClient = Grid::get(operationContext())->catalogClient(operationContext());
KeysCollectionCacheReader reader("test", catalogClient);
auto status = reader.refresh(operationContext()).getStatus();
ASSERT_EQ(ErrorCodes::KeyNotFound, status.code());
ASSERT_FALSE(status.reason().empty());
}
开发者ID:bjori,项目名称:mongo,代码行数:7,代码来源:keys_collection_cache_reader_test.cpp
示例19: qrand
void HuangtianCard::use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const
{
ServerPlayer *zhangjiao = targets.first();
if (zhangjiao->hasLordSkill("huangtian")) {
room->setPlayerFlag(zhangjiao, "HuangtianInvoked");
if (!zhangjiao->isLord() && zhangjiao->hasSkill("weidi"))
room->broadcastSkillInvoke("weidi");
else {
int index = qrand() % 2 + 1;
if (Player::isNostalGeneral(zhangjiao, "zhangjiao"))
index += 2;
room->broadcastSkillInvoke("huangtian", index);
}
room->notifySkillInvoked(zhangjiao, "huangtian");
CardMoveReason reason(CardMoveReason::S_REASON_GIVE, source->objectName(), zhangjiao->objectName(), "huangtian", QString());
room->obtainCard(zhangjiao, this, reason);
QList<ServerPlayer *> zhangjiaos;
QList<ServerPlayer *> players = room->getOtherPlayers(source);
foreach (ServerPlayer *p, players) {
if (p->hasLordSkill("huangtian") && !p->hasFlag("HuangtianInvoked"))
zhangjiaos << p;
}
if (zhangjiaos.isEmpty())
room->setPlayerFlag(source, "ForbidHuangtian");
}
开发者ID:ZeroYearning,项目名称:QSanguosha-v2,代码行数:27,代码来源:wind.cpp
示例20: reason
/***********************************************************************
* called when initiated connection process yields a result
***********************************************************************/
void GameClient::ZCom_cbConnectResult( ZCom_ConnID _id, eZCom_ConnectResult _result, ZCom_BitStream &_reply )
{
m_zoi_id = _id;
m_id = _reply.getInt(32);
std::string reason(_reply.getStringStatic());
std::stringstream strs;
strs<<"Game Client: The connection process for: "<<m_zoi_id<<" returned with resultcode "<<_result<<", the reply was "<<reason;
LogHandler::getInstance()->LogToFile(strs.str(), 2);
if ( _result != eZCom_ConnAccepted )
{
m_connected = false;
if(reason == "")
reason = "Server not reachable";
InternalWorkpile::getInstance()->AddEvent(new GameErrorMessageEvent("Problem connecting to game server " + m_servername + " - " + reason));
}
else
{
m_connected = true;
ZCom_requestDownstreamLimit(m_zoi_id, m_downpacketpersecond, m_downbyteperpacket);
#ifndef _ZOID_USED_NEW_VERSION_
ZCom_requestZoidMode( m_zoi_id, 1 );
#else
ZCom_changeObjectChannelSubscription( m_zoi_id, 1, eZCom_Subscribe );
#endif
}
}
开发者ID:leloulight,项目名称:lbanet,代码行数:33,代码来源:gameclient.cpp
注:本文中的reason函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论