/* * CommandLineWindow.cpp * * Created on: May 8, 2010 * Author: heber */ #include #include "UIElements/CommandLineWindow.hpp" #include "UIElements/CommandLineStatusIndicator.hpp" #include "Actions/ActionRegistry.hpp" #include "Actions/CmdAction/HelpAction.hpp" #include "Actions/ParserAction/LoadXyzAction.hpp" #include "Actions/ParserAction/SaveXyzAction.hpp" #include "CommandLineParser.hpp" #include using namespace std; // TODO: see what code can be moved to a base class for Graphic and CommandLine Windows CommandLineWindow::CommandLineWindow() { // create and register all command line callable actions populateParserActions(); // Add status indicators etc... statusIndicator = new CommandLineStatusIndicator(); } CommandLineWindow::~CommandLineWindow() { delete statusIndicator; } void CommandLineWindow::display() { // go through all possible actions for(std::map::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRunner != ActionRegistry::getInstance().getEndIter(); ActionRunner++) { // check whether action is present in command line if (CommandLineParser::getInstance().vm.count(ActionRunner->first)) { ActionRunner->second->call(); } } } void CommandLineWindow::populateParserActions() { new CommandLineHelpAction(); new ParserLoadXyzAction(); new ParserSaveXyzAction(); }