From 6ad9158c4f1e1adf1fbb80b205523aa1bc5fe4b7 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 1 Jul 2003 09:04:52 +0000 Subject: not using showCommands --- src/CommandParser.cc | 26 ++++++++------------------ src/CommandParser.hh | 6 ++---- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/CommandParser.cc b/src/CommandParser.cc index 1355cf9..aebb99a 100644 --- a/src/CommandParser.cc +++ b/src/CommandParser.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: CommandParser.cc,v 1.2 2003/07/01 01:49:09 rathnor Exp $ +// $Id: CommandParser.cc,v 1.3 2003/07/01 09:04:52 fluxgen Exp $ #include "CommandParser.hh" @@ -28,8 +28,8 @@ #include #include -#include using namespace std; + namespace { string::size_type removeFirstWhitespace(std::string &str) { @@ -60,7 +60,7 @@ CommandParser &CommandParser::instance() { } FbTk::Command *CommandParser::parseLine(const std::string &line) { - + // parse arguments and command string command = line; string arguments; @@ -70,7 +70,7 @@ FbTk::Command *CommandParser::parseLine(const std::string &line) { // ok we have arguments, parsing them here arguments = command.substr(second_pos); removeFirstWhitespace(arguments); - command.erase(second_pos); // remove argument from command + command.erase(second_pos); // remove argument from command } // now we have parsed command and arguments @@ -82,23 +82,12 @@ FbTk::Command *CommandParser::parseLine(const std::string &line) { command = FbTk::StringUtil::toLower(command); // we didn't find any matching command in default commands, - // so we search in the command creators modules for a matching command string + // so we search in the command creators modules for a + // matching command string return toCommand(command, arguments); } -ostream &operator << (ostream &the_stream, const CommandParser::CommandFactoryMap::value_type &value) { - the_stream<(the_stream, "\n")); -} - FbTk::Command *CommandParser::toCommand(const std::string &command_str, const std::string &arguments) { if (m_commandfactorys[command_str] != 0) return m_commandfactorys[command_str]->stringToCommand(command_str, arguments); @@ -115,7 +104,8 @@ void CommandParser::associateCommand(const std::string &command, CommandFactory } void CommandParser::removeAssociation(CommandFactory &factory) { - std::vector commands; // commands that are associated with the factory + // commands that are associated with the factory + std::vector commands; // find associations CommandFactoryMap::iterator factory_it = m_commandfactorys.begin(); const CommandFactoryMap::iterator factory_it_end = m_commandfactorys.end(); diff --git a/src/CommandParser.hh b/src/CommandParser.hh index 1a58c35..7872ef2 100644 --- a/src/CommandParser.hh +++ b/src/CommandParser.hh @@ -20,14 +20,13 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: CommandParser.hh,v 1.1 2003/06/30 14:44:43 fluxgen Exp $ +// $Id: CommandParser.hh,v 1.2 2003/07/01 09:01:20 fluxgen Exp $ #ifndef COMMANDPARSER_HH #define COMMANDPARSER_HH #include #include -#include #include "RefCount.hh" @@ -54,8 +53,7 @@ public: /// @return parses and returns a command matching the line FbTk::Command *parseLine(const std::string &line); - /// lists all commands to an ostream - void showCommands(std::ostream &the_stream) const; + /// @return instance of command parser static CommandParser &instance(); private: -- cgit v0.11.2