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


C++ ActionList类代码示例

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


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

示例1: addActions

void ZoomMenu::addActions(QMenu *m)
{
    const ActionList za = m_menuActions->actions();
    const ActionList::const_iterator cend = za.constEnd();
    for (ActionList::const_iterator it =  za.constBegin(); it != cend; ++it) {
        m->addAction(*it);
        if (zoomOf(*it)  == 100)
            m->addSeparator();
    }
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:10,代码来源:zoomwidget.cpp

示例2: setZoom

void ZoomMenu::setZoom(int percent)
{
    const ActionList za = m_menuActions->actions();
    const ActionList::const_iterator cend = za.constEnd();
    for (ActionList::const_iterator it =  za.constBegin(); it != cend; ++it)
        if (zoomOf(*it) == percent) {
            (*it)->setChecked(true);
            return;
        }
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例3: ByteActionListConverter

//Uses A* search to find optimal sequence of actions to go from current location to desired location
//Once sequence is found, the actions are executed.
//Returns:
//	ACT_GOING: still executing sequence of actions
//	ACT_SUCCESS: finished executing sequence of actions
//	ACT_ERROR: search provided no solution to the problem
//	other: Flags to indicate something went wrong
ActionResult Brain::GoToLocation(byte end_x, byte end_y, int desired_direction /*= -1*/)
{
	static bool is_searching = true;
	static ActionList action_list;
	//Perform the search and convert it to a usable list
	if(is_searching)
	{
		byte_action_list byte_actions = SearchAlgorithm::AStarGoAToB(end_x, end_y, robot_state_, board_state_, desired_direction);
		for(byte_action action : byte_actions)
		{
			SearchAlgorithm::PrintByteActionString(action);
		}
		action_list = ByteActionListConverter(byte_actions);
		is_searching = false;
		//If the action list is empty after search has been completed, no good!
		//This means our search found no solution; return error
		if(action_list.IsEmpty())
		{
			Serial.println(end_x);
			Serial.println(end_y);
			robot_state_.Print();
			board_state_.Print();
			is_searching = true; //reset search for next time
			return ACT_ERROR;
		}
	}

	//If the list is empty, we've completed our execution of the actions
	if(action_list.IsEmpty())
	{
		is_searching = true; //reset search for next time
		return ACT_SUCCESS;
	}

	//Get current action and execute it
	Action* curr_action = action_list.GetCurrentAction();
//	curr_action->Print();
	ActionResult result = curr_action->Run();

	//From the result of the action, return things to the calling function
	switch(result)
	{
	case ACT_GOING: //Continue on this action
		return ACT_GOING;
		break;
	case ACT_SUCCESS: //Good! Action completed, Move on to the next step
		action_list.MoveToNextAction();
		return ACT_GOING;
		break;
	default: //Error; return error flags and let calling function deal with it. Do not continue with these actions
		is_searching = true; //reset search for next time
		return result;
		break;
	}
}
开发者ID:BryceHennen,项目名称:IEEE-Robotics-2016,代码行数:62,代码来源:Brain.cpp

示例4: SYNTAX_ERROR

RobotInterface::ActionList RobotInterface::XMLReader::Private::readActionsTag(TiXmlElement *actionsElem)
{
    const std::string &valueStr = actionsElem->ValueStr();

    if (valueStr.compare("actions") != 0) {
        SYNTAX_ERROR(actionsElem->Row()) << "Expected \"actions\". Found" << valueStr;
    }

    std::string filename;
    if (actionsElem->QueryStringAttribute("file", &filename) == TIXML_SUCCESS) {
        // yDebug() << "Found actions file [" << filename << "]";
        filename=rf.findFileByName(filename);
        return readActionsFile(filename);
    }

    std::string robotName;
    if (actionsElem->QueryStringAttribute("robot", &robotName) != TIXML_SUCCESS) {
        SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"robot\" attribute";
    }

    if (robotName != robot.name()) {
        SYNTAX_WARNING(actionsElem->Row()) << "Trying to import a file for the wrong robot. Found" << robotName << "instead of" << robot.name();
    }

    unsigned int build;
#if TINYXML_UNSIGNED_INT_BUG
    if (actionsElem->QueryUnsignedAttribute("build", &build()) != TIXML_SUCCESS) {
        // No build attribute. Assuming build="0"
        SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
    }
#else
    int tmp;
    if (actionsElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
        // No build attribute. Assuming build="0"
        SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
        tmp = 0;
    }
    build = (unsigned)tmp;
#endif

    if (build != robot.build()) {
        SYNTAX_WARNING(actionsElem->Row()) << "Import a file for a different robot build. Found" << build << "instead of" << robot.build();
    }

    ActionList actions;
    for (TiXmlElement* childElem = actionsElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
        ActionList childActions = readActions(childElem);
        for (ActionList::const_iterator it = childActions.begin(); it != childActions.end(); ++it) {
            actions.push_back(*it);
        }
    }

    return actions;
}
开发者ID:warp1337,项目名称:icub-main,代码行数:54,代码来源:XMLReader.cpp

示例5: deleteActions

void ActionEditor::deleteActions(QDesignerFormWindowInterface *fw, const ActionList &actions)
{
    // We need a macro even in the case of single action because the commands might cause the
    // scheduling of other commands (signal slots connections)
    const QString description = actions.size() == 1 ?
        tr("Remove action '%1'").arg(actions.front()->objectName()) : tr("Remove actions");
    fw->beginCommand(description);
    foreach(QAction *action, actions) {
        RemoveActionCommand *cmd = new RemoveActionCommand(fw);
        cmd->init(action);
        fw->commandHistory()->push(cmd);
    }
开发者ID:hkahn,项目名称:qt5-qttools-nacl,代码行数:12,代码来源:actioneditor.cpp

示例6: log_debug

void SimpleController::flood(Channel *channel, const PacketIn *msg) {
  log_debug("flood");

  ActionList actions;
  actions.add(AT_OUTPUT{OFPP_FLOOD});

  PacketOutBuilder packetOut;
  packetOut.setBufferId(msg->bufferId());
  packetOut.setInPort(msg->inPort());
  packetOut.setActions(actions);
  packetOut.send(channel);
}
开发者ID:byllyfish,项目名称:libofp,代码行数:12,代码来源:simplecontroller.cpp

示例7: EntityList

//ActionCallback World::pushActionCallback(){
void World::pushActionCallback(){
	BoundingBox *box = character->getBoundingBox();		
	EntityList *elist = new EntityList();
	int nEntities = currScene->getEntitiesInBox(box, elist);	
	for(EntityList::iterator i=elist->begin(); i!=elist->end(); i++){
		ActionList actionList = (*i)->getActionList();
		for(ActionList::iterator j = actionList.begin(); j!=actionList.end(); j++){			
			if((*j)->type == ACTION_PUSH){				
				(*j)->react();				
			}
		}
	}			
}
开发者ID:brettatoms,项目名称:robopanic,代码行数:14,代码来源:World.cpp

示例8: GetActions

ActionList CorrectPlayer::GetActions(Hand hand, int dealer, Shoe& shoe, int betSize, bool allBusted, int numBusted)
{
	this->allBusted = allBusted;
	this->numBusted = numBusted;

	ActionList actions;
	actions.Add(Action(ActionType::Stand, Stand(hand, dealer, shoe)));
	actions.Add(Action(ActionType::Hit, Hit(hand, dealer, shoe)));
	actions.Add(Action(ActionType::Double, Double(hand, dealer, shoe, betSize)));
	actions.Add(Action(ActionType::Surrender, SurrenderEV()));

	return actions;
}
开发者ID:alexhanh,项目名称:Botting-Library,代码行数:13,代码来源:CorrectPlayer.cpp

示例9: RemoveCommandFromList

bool CKeyBindings::RemoveCommandFromList(ActionList& al, const std::string& command)
{
    bool success = false;
    ActionList::iterator it = al.begin();
    while (it != al.end()) {
        if (it->command == command) {
            it = al.erase(it);
            success = true;
        } else {
            ++it;
        }
    }
    return success;
}
开发者ID:spring,项目名称:spring,代码行数:14,代码来源:KeyBindings.cpp

示例10: actionList

ActionList ActionsWidget::actionList() const
{
    // return a copy of our action list
    ActionList list;
    foreach( ClipAction* action, m_actionList ) {
        if ( !action ) {
            qCDebug(KLIPPER_LOG) << "action is null";
            continue;
        }
        list.append( new ClipAction( *action ) );
    }

    return list;
}
开发者ID:KDE,项目名称:plasma-workspace,代码行数:14,代码来源:configdialog.cpp

示例11: RemoveCommandFromList

bool CKeyBindings::RemoveCommandFromList(ActionList& al, const string& command)
{
	bool success = false;
	for (int i = 0; i < (int)al.size(); ++i) {
		if (al[i].command == command) {
			success = true;
			for (int j = (i + 1); j < (int)al.size(); ++j) {
				al[j - 1] = al[j];
			}
			al.resize(al.size() - 1);
		}
	}
	return success;
}
开发者ID:Arkazon,项目名称:spring,代码行数:14,代码来源:KeyBindings.cpp

示例12: GetKeyContexts

/** \fn KeyBindings::GetKeyContexts(const QString &) const
 *  \brief Get the context names in which a key is bound.
 *  \return A list of context names in which a key is bound.
 */
QStringList KeyBindings::GetKeyContexts(const QString &key) const
{
    ActionList actions = m_actionSet.GetActions(key);
    QStringList contexts;

    for (int i = 0; i < actions.size(); i++)
    {
        QString context = actions[i].GetContext();
        if (!contexts.contains(context))
            contexts.push_back(context);
    }

    return contexts;
}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:18,代码来源:keybindings.cpp

示例13: contextMenuActions

bool ToolBarEventFilter::handleContextMenuEvent(QContextMenuEvent * event )
{
    event->accept();

    const QPoint globalPos = event->globalPos();
    const ActionList al = contextMenuActions(event->globalPos());

    QMenu menu(0);
    const ActionList::const_iterator acend = al.constEnd();
    for (ActionList::const_iterator it = al.constBegin(); it != acend; ++it)
        menu.addAction(*it);
    menu.exec(globalPos);
    return true;
}
开发者ID:dewhisna,项目名称:emscripten-qt,代码行数:14,代码来源:qdesigner_toolbar.cpp

示例14: PrintDeviceInfo

void PrintDeviceInfo(Device *dev, int indent)
{
	string indentStr;
	GetIndentString(indent, indentStr);
	const char *devName = dev->getFriendlyName();
	cout << indentStr << devName << endl;

	int i, n, j;
	ServiceList *serviceList = dev->getServiceList();
	int serviceCnt = serviceList->size();
	for (n=0; n<serviceCnt; n++) {
		Service *service = serviceList->getService(n);
		cout << indentStr << " service[" << n << "] = "<< service->getServiceType() << endl;
		ActionList *actionList = service->getActionList();
		int actionCnt = actionList->size();
		for (i=0; i<actionCnt; i++) {
			Action *action = actionList->getAction(i);
			cout << indentStr << "  action[" << i << "] = "<< action->getName() << endl;
			ArgumentList *argList = action->getArgumentList();
			int argCnt = argList->size();
			for (j=0; j<argCnt; j++) {
					Argument *arg = argList->getArgument(j);
					cout << indentStr << "    arg[" << j << "] = " << arg->getName() << "("  << arg->getDirection() << ")";
					StateVariable *stateVar = arg->getRelatedStateVariable();
					if (stateVar != NULL)
						cout << " - " << stateVar->getName();
					cout << endl;
			}
		}
		ServiceStateTable *stateTable = service->getServiceStateTable();
		int varCnt = stateTable->size();
		for (i=0; i<varCnt; i++) {
			StateVariable *stateVar = stateTable->getStateVariable(i);
			cout << indentStr << "  stateVar[" << i << "] = " << stateVar->getName() << endl;
			AllowedValueList *valueList = stateVar->getAllowedValueList();
			int valueListCnt = valueList->size();
			if (0 < valueListCnt) {
				for (j=0; j<valueListCnt; j++)
					cout << indentStr << "    AllowedValueList[" << j << "] = " << valueList->getAllowedValue(j) << endl;
			}
			AllowedValueRange *valueRange = stateVar->getAllowedValueRange();
			if (valueRange != NULL) {
					cout << indentStr << "    AllowedRange[minimum] = " << valueRange->getMinimum() << endl;
					cout << indentStr << "    AllowedRange[maximum] = " << valueRange->getMaximum() << endl;
					cout << indentStr << "    AllowedRange[step] = " << valueRange->getStep() << endl;
			}
		}
	}
}
开发者ID:Debanjan07,项目名称:CyberLink4CC,代码行数:49,代码来源:TestCtrlPoint.cpp

示例15: getRunningActionSet

    double NetworkConstantModel::next_occuring_event(double /*now*/)
    {
      NetworkConstantAction *action = nullptr;
      double min = -1.0;

      ActionList *actionSet = getRunningActionSet();
      for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
          ; it != itend ; ++it) {
        action = static_cast<NetworkConstantAction*>(&*it);
        if (action->latency_ > 0 && (min < 0 || action->latency_ < min))
          min = action->latency_;
      }

      return min;
    }
开发者ID:fabienchaix,项目名称:simgrid,代码行数:15,代码来源:network_constant.cpp


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