Example #1
0
void CommandProcesser::ProcessCommand(const wxString& command, bool inStartup)
{
	wxCmdLineParser parser(command);

	// Add our options.
	CommandMap::iterator it, itEnd = mCommandMap.end();
	for(it = mCommandMap.begin(); it != itEnd; ++it)
	{
		const CommandPtr& command = it->second;
		command->PrepareParser(parser);
	}

	// Wrap this in NULL log output so no information is leaked.
	{
		wxLogNull log;
		parser.Parse(false);
	}

	wxString data;

	// Iterate through the commands, looking for any that were parsed.
	for(it = mCommandMap.begin(); it != itEnd; ++it)
	{
		const wxString& key = it->first;
		if(true == parser.Found(key, &data))
		{
			GameEngine::get().ExecuteCommand(parser, it->second, inStartup);
		}
	}
}