void BackgroundEngine::roleRandom() { for(int i=0;i<playerSum;i++){ playerList[i]=setRole(roles[i],this,queue[i].digitValue(),queue[i+playerSum].digitValue()); coder.roleNotice(queue[i].digitValue(),roles[i]); } seatPostarrange(); gameStart(); }
void BackgroundEngine::role3Pick1Reply(int id,int roleID) { for(int i=0;i<playerSum;i++) if(queue[i].digitValue()==id){ playerList[i]=setRole(roleID,this,id,queue[i+playerSum].digitValue()); coder.roleNotice(id,roleID); break; } }
bool MonsterTwoSprite::init() { if (!NPCSprite::init()) return false; setRole(Monster_2); return true; }
bool MonsterOneSprite::init() { if (!NPCSprite::init()) return false; setRole(Monster_1); return true; }
/// Set role Datum wciSession_setRole(PG_FUNCTION_ARGS) { if (PG_ARGISNULL(0)) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("Role cannot be NULL"))); text * role = PG_GETARG_TEXT_P(0); std::string sRole = getString(role); static const boost::regex matchRole("[a-zA-Z_][a-zA-Z_0-9]*"); if (!boost::regex_match(sRole, matchRole)) { std::ostringstream msg; msg << "Invalid role name: " << sRole; std::string sMsg = msg.str(); ereport(ERROR, (errcode(ERRCODE_INVALID_ROLE_SPECIFICATION), errmsg("%s", sMsg.c_str()))); } setRole(sRole.c_str()); PG_RETURN_VOID(); }
void Transaction::setProperty(int property, QDBusVariant value) { if (isForeignUser()) { sendErrorReply(QDBusError::AccessDenied); return; } switch (property) { case QApt::TransactionIdProperty: case QApt::UserIdProperty: // Read-only sendErrorReply(QDBusError::Failed); break; case QApt::RoleProperty: setRole((QApt::TransactionProperty)value.variant().toInt()); break; case QApt::StatusProperty: setStatus((QApt::TransactionStatus)value.variant().toInt()); break; case QApt::LocaleProperty: setLocale(value.variant().toString()); break; case QApt::ProxyProperty: setProxy(value.variant().toString()); break; case QApt::DebconfPipeProperty: setDebconfPipe(value.variant().toString()); break; case QApt::PackagesProperty: setPackages(value.variant().toMap()); break; case QApt::FrontendCapsProperty: setFrontendCaps(value.variant().toInt()); break; default: sendErrorReply(QDBusError::InvalidArgs); break; } }
RoleComboBoxItem::RoleComboBoxItem(const QString &role, int number, QSize size) :m_role(role), m_number(number), m_size(size) { setRole(role); this->setFlag(QGraphicsItem::ItemIgnoresParentOpacity); }
void JabberContact::deserializeLine(const QString& key, const QString& value) { QString val = value; if(val.startsWith('\"') && val.endsWith('\"')) val = val.mid(1, val.length() - 2); if(key == "ID") { setId(val); } else if(key == "Node") { setNode(val); } else if(key == "Resource") { setResource(val); } else if(key == "Name") { setName(val); } else if(key == "FirstName") { setFirstName(val); } else if(key == "Nick") { setNick(val); } else if(key == "Desc") { setDesc(val); } else if(key == "BirthDay") { setBirthday(val); } else if(key == "Url") { setUrl(val); } else if(key == "OrgName") { setOrgName(val); } else if(key == "OrgUnit") { setOrgUnit(val); } else if(key == "Title") { setTitle(val); } else if(key == "Role") { setRole(val); } else if(key == "Street") { setStreet(val); } else if(key == "ExtAddr") { setExtAddr(val); } else if(key == "City") { setCity(val); } else if(key == "Region") { setRegion(val); } else if(key == "PCode") { setPCode(val); } else if(key == "Country") { setCountry(val); } else if(key == "EMail") { setEmail(val); } else if(key == "Phone") { setPhone(val); } else if(key == "StatusTime") { setStatusTime(val.toUInt()); } else if(key == "OnlineTime") { setOnlineTime(val.toUInt()); } else if(key == "Subscribe") { setSubscribe(val.toUInt()); } else if(key == "Group") { setGroup(val); } else if(key == "PhotoWidth") { setPhotoWidth(val.toUInt()); } else if(key == "PhotoHeight") { setPhotoHeight(val.toUInt()); } else if(key == "LogoWidth") { setLogoWidth(val.toUInt()); } else if(key == "LogoHeight") { setLogoHeight(val.toUInt()); } else if(key == "AutoReply") { setAutoReply(val); } }
status_t Harness::testStateTransitions( const char *componentName, const char *componentRole) { if (strncmp(componentName, "OMX.", 4)) { // Non-OMX components, i.e. software decoders won't execute this // test. return OK; } sp<MemoryDealer> dealer = new MemoryDealer(16 * 1024 * 1024, "OMXHarness"); IOMX::node_id node; status_t err = mOMX->allocateNode(componentName, this, &node); EXPECT_SUCCESS(err, "allocateNode"); NodeReaper reaper(this, node); err = setRole(node, componentRole); EXPECT_SUCCESS(err, "setRole"); // Initiate transition Loaded->Idle err = mOMX->sendCommand(node, OMX_CommandStateSet, OMX_StateIdle); EXPECT_SUCCESS(err, "sendCommand(go-to-Idle)"); omx_message msg; err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); // Make sure node doesn't just transition to idle before we are done // allocating all input and output buffers. EXPECT(err == TIMED_OUT, "Component must not transition from loaded to idle before " "all input and output buffers are allocated."); // Now allocate buffers. Vector<Buffer> inputBuffers; err = allocatePortBuffers(dealer, node, 0, &inputBuffers); EXPECT_SUCCESS(err, "allocatePortBuffers(input)"); err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); CHECK_EQ(err, TIMED_OUT); Vector<Buffer> outputBuffers; err = allocatePortBuffers(dealer, node, 1, &outputBuffers); EXPECT_SUCCESS(err, "allocatePortBuffers(output)"); err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); EXPECT(err == OK && msg.type == omx_message::EVENT && msg.u.event_data.event == OMX_EventCmdComplete && msg.u.event_data.data1 == OMX_CommandStateSet && msg.u.event_data.data2 == OMX_StateIdle, "Component did not properly transition to idle state " "after all input and output buffers were allocated."); // Initiate transition Idle->Executing err = mOMX->sendCommand(node, OMX_CommandStateSet, OMX_StateExecuting); EXPECT_SUCCESS(err, "sendCommand(go-to-Executing)"); err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); EXPECT(err == OK && msg.type == omx_message::EVENT && msg.u.event_data.event == OMX_EventCmdComplete && msg.u.event_data.data1 == OMX_CommandStateSet && msg.u.event_data.data2 == OMX_StateExecuting, "Component did not properly transition from idle to " "executing state."); for (size_t i = 0; i < outputBuffers.size(); ++i) { err = mOMX->fillBuffer(node, outputBuffers[i].mID); EXPECT_SUCCESS(err, "fillBuffer"); outputBuffers.editItemAt(i).mFlags |= kBufferBusy; } err = mOMX->sendCommand(node, OMX_CommandFlush, 1); EXPECT_SUCCESS(err, "sendCommand(flush-output-port)"); err = dequeueMessageForNodeIgnoringBuffers( node, &inputBuffers, &outputBuffers, &msg, DEFAULT_TIMEOUT); EXPECT(err == OK && msg.type == omx_message::EVENT && msg.u.event_data.event == OMX_EventCmdComplete && msg.u.event_data.data1 == OMX_CommandFlush && msg.u.event_data.data2 == 1, "Component did not properly acknowledge flushing the output port."); for (size_t i = 0; i < outputBuffers.size(); ++i) { EXPECT((outputBuffers[i].mFlags & kBufferBusy) == 0, "Not all output buffers have been returned to us by the time " "we received the flush-complete notification."); } for (size_t i = 0; i < outputBuffers.size(); ++i) { err = mOMX->fillBuffer(node, outputBuffers[i].mID); EXPECT_SUCCESS(err, "fillBuffer"); outputBuffers.editItemAt(i).mFlags |= kBufferBusy; } // Initiate transition Executing->Idle err = mOMX->sendCommand(node, OMX_CommandStateSet, OMX_StateIdle); EXPECT_SUCCESS(err, "sendCommand(go-to-Idle)"); err = dequeueMessageForNodeIgnoringBuffers( node, &inputBuffers, &outputBuffers, &msg, DEFAULT_TIMEOUT); EXPECT(err == OK && msg.type == omx_message::EVENT && msg.u.event_data.event == OMX_EventCmdComplete && msg.u.event_data.data1 == OMX_CommandStateSet && msg.u.event_data.data2 == OMX_StateIdle, "Component did not properly transition to from executing to " "idle state."); for (size_t i = 0; i < inputBuffers.size(); ++i) { EXPECT((inputBuffers[i].mFlags & kBufferBusy) == 0, "Not all input buffers have been returned to us by the " "time we received the transition-to-idle complete " "notification."); } for (size_t i = 0; i < outputBuffers.size(); ++i) { EXPECT((outputBuffers[i].mFlags & kBufferBusy) == 0, "Not all output buffers have been returned to us by the " "time we received the transition-to-idle complete " "notification."); } // Initiate transition Idle->Loaded err = mOMX->sendCommand(node, OMX_CommandStateSet, OMX_StateLoaded); EXPECT_SUCCESS(err, "sendCommand(go-to-Loaded)"); // Make sure node doesn't just transition to loaded before we are done // freeing all input and output buffers. err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); CHECK_EQ(err, TIMED_OUT); for (size_t i = 0; i < inputBuffers.size(); ++i) { err = mOMX->freeBuffer(node, 0, inputBuffers[i].mID); EXPECT_SUCCESS(err, "freeBuffer"); } err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); CHECK_EQ(err, TIMED_OUT); for (size_t i = 0; i < outputBuffers.size(); ++i) { err = mOMX->freeBuffer(node, 1, outputBuffers[i].mID); EXPECT_SUCCESS(err, "freeBuffer"); } err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); EXPECT(err == OK && msg.type == omx_message::EVENT && msg.u.event_data.event == OMX_EventCmdComplete && msg.u.event_data.data1 == OMX_CommandStateSet && msg.u.event_data.data2 == OMX_StateLoaded, "Component did not properly transition to from idle to " "loaded state after freeing all input and output buffers."); err = mOMX->freeNode(node); EXPECT_SUCCESS(err, "freeNode"); reaper.disarm(); node = 0; return OK; }
void PlasmaShellSurfaceInterface::Private::setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role) { auto s = cast<Private>(resource); Q_ASSERT(client == *s->client); s->setRole(role); }