void Shortcuts_foreach(Shortcuts& shortcuts, CommandVisitor& visitor) { for(Shortcuts::iterator i = shortcuts.begin(); i != shortcuts.end(); ++i) { visitor.visit((*i).first.c_str(), (*i).second.first); } }
//----------------------------------------------------------------------------- /// Handles any internal commands that a CommandProcessor must respond to //----------------------------------------------------------------------------- void CommandProcessor::HandleInternalCommands() { if (m_commandTreeResponse.IsActive()) { #ifdef USE_C3_STREAMLOG StreamLog::Ref() << "\n CommandProcessor: HandleInternalCommands: Enter." << "--------------------------------------------" << "\n"; #endif string strTree; strTree += "<CommandTree>"; #ifdef USE_C3_STREAMLOG StreamLog::Ref() << "\n CommandProcessor: About to call GetCommandTree()." << "--------------------------------------------" << "\n"; #endif strTree += GetCommandTree(); #ifdef USE_C3_STREAMLOG StreamLog::Ref() << "\n CommandProcessor: Finished GetCommandTree()." << "--------------------------------------------" << "\n"; #endif strTree += "</CommandTree>"; #ifdef USE_C3_STREAMLOG StreamLog::Ref() << "\n CommandProcessor: About to send data back through command." << "--------------------------------------------" << "\n"; #endif m_commandTreeResponse.Send(strTree.c_str()); } if (m_xmlResponse.IsActive()) { m_xmlResponse.Send(GetEditableCommandValues().c_str()); } if (m_commandListResponse.IsActive()) { // Create a Visitor object CommandVisitor myVisitor; // Send the visitor off to fetch all of the available commands Accept(myVisitor); // Send the commands back to the client. m_commandListResponse.Send((char*)(myVisitor.GetCommandStrings()).asCharArray()); } }
void EngineFrontend<Engine>::start () { CommandVisitor<Engine> visitor (engine_, codec_); while (!stop_ && !visitor.stop()) { try { WhateverCommand cmd = codec_.readCommand (); //FIXME: without this like everything blocks // boost::apply_visitor (PrintCmd(), cmd); boost::apply_visitor (visitor, cmd); } catch (...) //FIXME { stop_ = true; } } }
pair<string, string> PlusCommand::accept(CommandVisitor& commandVisitor) { return commandVisitor.visit(*this); }
pair<string, string> GetAllFilesInDirectoryCommand::accept(CommandVisitor& cmdVisitor) { return cmdVisitor.visit(*this); }
pair<string, string> GetFileExtensionCommand::accept(CommandVisitor& cmdVisitor) { return cmdVisitor.visit(*this); }
pair<string, string> IdentifierToReturnValueCommand::accept(CommandVisitor& commandVisitor) { return commandVisitor.visit(*this); }
//-------------------------------------------------------------------------- /// Handle interaction with a CommandVisitor object. The Command visitor is /// recursing the command tree making copies of all the available commands. /// \param rVisitor Implements a handler for this CommandProcessor //-------------------------------------------------------------------------- void CommandProcessor::Accept(CommandVisitor& rVisitor) { rVisitor.VisitCommandProcessor(this); }
//-------------------------------------------------------------------------- /// Handle interaction with a CommandVisitor object. The Command visitor is /// recursing the command tree making copies of all the available commands. /// \param rVisitor Implements a handler for this CommandResponse //-------------------------------------------------------------------------- void CommandResponse::Accept(CommandVisitor& rVisitor) { rVisitor.VisitCommandResponse(this); }
pair<string, string> GetFromValueCommand::accept(CommandVisitor& commandVisitor) { return commandVisitor.visit(*this); }
pair<string, string> AddLengthToArrayCommand::accept(CommandVisitor& commandVisitor) { return commandVisitor.visit(*this); }
pair<string, string> RemoveDirectoryCommand::accept(CommandVisitor& cmdVisitor) { return cmdVisitor.visit(*this); }
pair<string, string> SmallerEqualsToCommand::accept(CommandVisitor& commandVisitor) { return commandVisitor.visit(*this); }
pair<string, string> CountCommand::accept(CommandVisitor& cmdVisitor) { return cmdVisitor.visit(*this); }
pair<string, string> AddItemToArrayAtCommand::accept(CommandVisitor& commandVisitor) { return commandVisitor.visit(*this); }