From e1d8490f0654a3da0b900407d80d91d8d0da68c8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 27 Sep 2009 01:55:44 +0200 Subject: Use libicu to support unicode properly; migrated ConfigManager to UnicodeString --- src/Client/CommandParser.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/Client') diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 3f1850c..a271860 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -213,19 +213,26 @@ void CommandParser::exitCommand(const std::vector &/*args*/) { } bool CommandParser::parse(const std::string &cmd) { - std::vector splitCmd; + std::vector splitCmd; - Core::Tokenizer::tokenize(cmd, splitCmd); + Core::Tokenizer::tokenize(cmd.c_str(), splitCmd); if(splitCmd.empty()) return true; - const Command* command = findCommand(splitCmd[0]); + const Command* command = findCommand(splitCmd[0].extract()); - if(command) - command->function(this, splitCmd); - else - std::cerr << "Unknown command '" << splitCmd[0] << "'." << std::endl; + if(command) { + std::vector strings; + + for(std::vector::iterator it = splitCmd.begin(); it != splitCmd.end(); ++it) + strings.push_back(it->extract()); + + command->function(this, strings); + } + else { + std::cerr << "Unknown command '" << splitCmd[0].extract() << "'." << std::endl; + } return true; } -- cgit v1.2.3