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


C++ Commands类代码示例

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


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

示例1: main

int main()
{

	size_t i = 0;
	while (cin.good()) {
		WorldStatusUpdate world;
		readProtoFromStream(world, cin);

		cerr << "Tick: " << i << endl;
		cerr << "Proto content with DebugString" << endl;
		cerr << world.DebugString() << endl;

		Commands commands;
		Commands::Command* command = commands.add_commands();
		command->set_commandtype(Commands::TRAIN);
		Commands::Train* train = command->mutable_traincommand();
		train->set_withwhat("Champion");
		train->set_what(Commands::WORKER);
		writeProtoOnStream(commands, cout);

		++i;
	}

	return 0;
}
开发者ID:makiverem,项目名称:EricssonStrategy,代码行数:25,代码来源:sample.cpp

示例2: _handle_options

static int
_handle_options(int argc, char **argv)
{
   int i;

   while(argc > 0)
     {
        const char *cmd = argv[0];

        for (i = 0; i < ARRAY_SIZE(commands); i++) {
           Commands *c = commands + i;
           if (strcmp(c->cmd, cmd))
             continue;

           if (c->fn)
             c->fn(argc, argv);
	}

        argv++;
        argc--;
     }



   return 0;
}
开发者ID:chep,项目名称:Enna-Media-Server,代码行数:26,代码来源:main.c

示例3: while

void CommandMgr::ClearCommands()
{
    while (!commandTable.empty())
    {
        Commands::iterator itr = commandTable.begin();
        delete itr->second;
        commandTable.erase(itr);
    }
}
开发者ID:DrEhsan,项目名称:Whiff,代码行数:9,代码来源:CommandMgr.cpp

示例4:

 ~Rule()
 {
     delete filter_;
     typedef Commands::const_iterator It;
     for (It i = cmds_->begin(); i != cmds_->end(); ++i) {
         delete *i;
     }
     delete cmds_;
 }
开发者ID:francoisferland,项目名称:HBBA,代码行数:9,代码来源:rules_ast.hpp

示例5: main

int main()
{
	
	Commands Input;
	Input.Input();
	
	ParseText();
	return 0;
}
开发者ID:Jyang772,项目名称:Linux-Fetch,代码行数:9,代码来源:string.cpp

示例6: match

void Cmd_struct::match() 
{	
	int choice = -1;
	// first four letters are commands
	string substring = this->command.substr(0,4);
	string file = "";
	Commands commands;
	// get the commands from textResources\\basicCommands.txt
	vector<string> command_codes = commands.getCodes();

	// Iterate over all basic commands
	for (int i = 0; i < command_codes.size(); i++)
	{
		if (substring == command_codes[i])
		{
			choice = i;
		}
	}
	if(choice == 3 || choice == 6)
	{
		// If we search there is a search query
		file = this->command.substr(5, this->command.length() - 5);
	}

	FunctionHandler fh;
	switch (choice)
	{
	case 0:
		this->test();
		break;
	case 1:
		this->shutdown();
		break;
	case 2:
		this->chrom();
		break;
	case 3:
		this->playMedia(file);
		break;
	case 4:
		fh.executeBatch("ccleaner.bat");
		break;
	case 5:
		fh.executeBatch("startuTorrent.bat");
		break;
	case 6:
		this->closeProgram(file);
		break;
	default:
		this->error();
		break;
	}
}
开发者ID:Hallborg,项目名称:Remote-PC-Control,代码行数:53,代码来源:command+structure.cpp

示例7: execute

	boost::any execute(const command& c) const
	{
		Commands::const_iterator it = commands.find(c.name);

		if (it != commands.end())
		{
			return (it->second.func)->execute(c);
		}
		else
		{
			return boost::any();//return std::string("unknown command");
		}
	}
开发者ID:rgde,项目名称:rgdengine,代码行数:13,代码来源:xml_utilities.cpp

示例8: generateCommands

 Shrinkable<Commands<Cmd>> generateCommands(const Random &random,
                                               int size) const {
   return shrinkable::map(generateSequence(random, size),
                          [](const CommandSequence &sequence) {
                            Commands<Cmd> cmds;
                            const auto &entries = sequence.entries;
                            cmds.reserve(entries.size());
                            std::transform(begin(entries),
                                           end(entries),
                                           std::back_inserter(cmds),
                                           [](const CommandEntry &entry) {
                                             return entry.shrinkable.value();
                                           });
                            return cmds;
                          });
 }
开发者ID:pereckerdal,项目名称:rapidcheck,代码行数:16,代码来源:Commands.hpp

示例9: main

int main(int argc, char *argv[])
{
    MythFileRecorderCommandLineParser cmdline;

    if (!cmdline.Parse(argc, argv))
    {
        cmdline.PrintHelp();
        return GENERIC_EXIT_INVALID_CMDLINE;
    }

    if (cmdline.toBool("showhelp"))
    {
        cmdline.PrintHelp();
        return GENERIC_EXIT_OK;
    }

    if (cmdline.toBool("showversion"))
    {
        cmdline.PrintVersion();
        return GENERIC_EXIT_OK;
    }

    bool loopinput = !cmdline.toBool("noloop");
    int  data_rate = cmdline.toInt("data_rate");

    QCoreApplication a(argc, argv);
    QCoreApplication::setApplicationName("mythfilerecorder");

    int retval;
    if ((retval = cmdline.ConfigureLogging()) != GENERIC_EXIT_OK)
        return retval;

    QString filename = "";
    if (!cmdline.toString("infile").isEmpty())
        filename = cmdline.toString("infile");
    else if (cmdline.GetArgs().size() >= 1)
        filename = cmdline.GetArgs()[0];

    Commands recorder;
    recorder.Run(filename, data_rate, loopinput);

    return GENERIC_EXIT_OK;
}
开发者ID:shaun2029,项目名称:mythtv,代码行数:43,代码来源:mythfilerecorder.cpp

示例10: LBClear

void VDDialogEditAccelerators::RefilterCommands(const char *pattern) {
	mFilteredCommands.clear();

	LBClear(IDC_AVAILCOMMANDS);

	Commands::const_iterator it(mAllCommands.begin()), itEnd(mAllCommands.end());
	for(; it != itEnd; ++it) {
		const VDAccelToCommandEntry& ent = **it;

		if (VDFileWildMatch(pattern, ent.mpName)) {
			const VDStringW s(VDTextAToW(ent.mpName));

			mFilteredCommands.push_back(&ent);
			LBAddString(IDC_AVAILCOMMANDS, s.c_str());
		}
	}

	LBSetSelectedIndex(IDC_AVAILCOMMANDS, 0);
}
开发者ID:KGE-INC,项目名称:VirtualDub,代码行数:19,代码来源:AccelEditDialog.cpp

示例11: prepareCommands

Commands prepareCommands() {
    Commands commands;
    commands.push_back(Command {"set-led-state", "Set led state", {"on", "off"}});
    commands.push_back(Command {"get-led-state", "Get led state", {}});
    commands.push_back(Command {"set-led-color", "Set led color (red, green or blue)", {"red", "green", "blue"}});
    commands.push_back(Command {"get-led-color", "Get led color", {}});
    commands.push_back(Command {"set-led-rate", "Set led rate (0..5 Hz)", {"0", "1", "2", "3", "4", "5"}});
    commands.push_back(Command {"get-led-rate", "Get led rate", {}});

    return commands;
}
开发者ID:movb,项目名称:testapp,代码行数:11,代码来源:client.cpp

示例12: cmdGetItem

    /** The command handler functions. */
    bool cmdGetItem( Command& command )
    {
        const QueueGetItemPacket* packet = command.get< QueueGetItemPacket >();
        Commands commands;
        queue.tryPop( packet->itemsRequested, commands );

        for( CommandsCIter i = commands.begin(); i != commands.end(); ++i )
        {
            Command* item = *i;
            ObjectPacket* reply = item->getModifiable< ObjectPacket >();
            reply->instanceID = packet->slaveInstanceID;
            command.getNode()->send( *reply );
            item->release();
        }

        if( packet->itemsRequested > commands.size( ))
        {
            QueueEmptyPacket reply( packet );
            command.getNode()->send( reply );
        }
        return true;
    }
开发者ID:aoighost,项目名称:Equalizer,代码行数:23,代码来源:queueMaster.cpp

示例13: getAction

pair<int,int> getAction(const Commands& commands) {
    while ( true ) {
        displayMenu(commands);
        int choice = getNumber(0,commands.size());
        int subChoice = 0;
        if (choice == 0) return make_pair(-1,0);
        if (!commands[choice-1].params.empty()) {
            displaySubMenu(commands[choice-1].params);
            subChoice = getNumber(0,commands[choice-1].params.size());
            if (subChoice == 0)
                continue;
        }
        return make_pair(choice-1, subChoice-1);
    }
}
开发者ID:movb,项目名称:testapp,代码行数:15,代码来源:client.cpp

示例14: split

void ScreenOptionsMaster::Init()
{
	vector<RString> asLineNames;
	split( LINE_NAMES, ",", asLineNames );
	if( asLineNames.empty() )
	{
		LuaHelpers::ReportScriptErrorFmt("\"%s:LineNames\" is empty.", m_sName.c_str());
	}

	if( FORCE_ALL_PLAYERS )
	{
		FOREACH_PlayerNumber( pn )
			GAMESTATE->JoinPlayer( pn );
	}

	if( NAVIGATION_MODE == "toggle" )
		SetNavigation( PREFSMAN->m_iArcadeOptionsNavigation? NAV_TOGGLE_THREE_KEY:NAV_TOGGLE_FIVE_KEY );
	else if( NAVIGATION_MODE == "menu" )
		SetNavigation( NAV_THREE_KEY_MENU );

	SetInputMode( StringToInputMode(INPUT_MODE) );

	// Call this after enabling players, if any.
	ScreenOptions::Init();

	vector<OptionRowHandler*> OptionRowHandlers;
	for( unsigned i = 0; i < asLineNames.size(); ++i )
	{
		RString sLineName = asLineNames[i];
		RString sRowCommands = LINE(sLineName);
		
		Commands cmds;
		ParseCommands( sRowCommands, cmds, false );

		OptionRowHandler *pHand = OptionRowHandlerUtil::Make( cmds );
		if( pHand == NULL )
		{
			LuaHelpers::ReportScriptErrorFmt("Invalid OptionRowHandler \"%s\" in \"%s:Line:%s\".", cmds.GetOriginalCommandString().c_str(), m_sName.c_str(), sLineName.c_str());
		}
		else
		{
			OptionRowHandlers.push_back( pHand );
		}
	}
	InitMenu( OptionRowHandlers );
}
开发者ID:AratnitY,项目名称:stepmania,代码行数:46,代码来源:ScreenOptionsMaster.cpp

示例15: OnItemSelectionChanged

void VDDialogEditAccelerators::OnItemSelectionChanged(VDUIProxyListView *source, int index) {
	if (index < 0 || mbBlockCommandUpdate)
		return;

	const BoundCommand& bcmd = *mBoundCommands[index];

	if (mpHotKeyControl)
		mpHotKeyControl->SetAccelerator(bcmd.mAccel);

	uint32 n = mFilteredCommands.size();
	int cmdSelIndex = -1;

	for(uint32 i=0; i<n; ++i) {
		const VDAccelToCommandEntry& cent = *mFilteredCommands[i];

		if (!_stricmp(cent.mpName, bcmd.mpCommand)) {
			cmdSelIndex = i;
			break;
		}
	}

	LBSetSelectedIndex(IDC_AVAILCOMMANDS, cmdSelIndex);
}
开发者ID:KGE-INC,项目名称:VirtualDub,代码行数:23,代码来源:AccelEditDialog.cpp


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