summaryrefslogtreecommitdiffstats
path: root/src/Client/CommandParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client/CommandParser.cpp')
-rw-r--r--src/Client/CommandParser.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index a271860..9b5c6bf 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -63,7 +63,7 @@ const CommandParser::Command CommandParser::commands[] = {
};
-const CommandParser::Command* CommandParser::findCommand(const std::string& command) {
+const CommandParser::Command* CommandParser::findCommand(const Core::String& command) {
for(int i = 0; commands[i].commands[0] != 0; ++i) {
for(int j = 0; commands[i].commands[j] != 0; ++j) {
if(command == commands[i].commands[j]) {
@@ -75,7 +75,7 @@ const CommandParser::Command* CommandParser::findCommand(const std::string& comm
return 0;
}
-void CommandParser::printUsage(const std::string& command) {
+void CommandParser::printUsage(const Core::String& command) {
const CommandParser::Command *cmd = findCommand(command);
if(cmd)
@@ -83,14 +83,14 @@ void CommandParser::printUsage(const std::string& command) {
}
-std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std::vector<std::string> &args, bool mustBeActive) {
- const std::map<std::string, Common::HostInfo>& hosts = application->getInformationManager()->getDaemons();
- std::map<std::string, Common::HostInfo> ret;
+std::map<Core::String, Common::HostInfo> CommandParser::parseHostList(const std::vector<Core::String> &args, bool mustBeActive) {
+ const std::map<Core::String, Common::HostInfo>& hosts = application->getInformationManager()->getDaemons();
+ std::map<Core::String, Common::HostInfo> ret;
- for(std::vector<std::string>::const_iterator arg = args.begin(); arg != args.end(); ++arg) {
+ for(std::vector<Core::String>::const_iterator arg = args.begin(); arg != args.end(); ++arg) {
if(*arg == "*") {
if(mustBeActive) {
- for(std::map<std::string, Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host) {
+ for(std::map<Core::String, Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host) {
if(host->second.getState() != Common::HostInfo::INACTIVE)
ret.insert(*host);
}
@@ -103,7 +103,7 @@ std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std::
}
}
else {
- std::map<std::string, Common::HostInfo>::const_iterator host = hosts.find(*arg);
+ std::map<Core::String, Common::HostInfo>::const_iterator host = hosts.find(*arg);
if(host == hosts.end())
std::cerr << "Host '" << *arg << "' doesn't exist." << std::endl;
@@ -117,7 +117,7 @@ std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std::
return ret;
}
-void CommandParser::helpCommand(const std::vector<std::string> &args) {
+void CommandParser::helpCommand(const std::vector<Core::String> &args) {
if(args.size() == 1) {
std::cout << "Available commands:" << std::endl << std::endl;
@@ -146,8 +146,8 @@ void CommandParser::helpCommand(const std::vector<std::string> &args) {
}
}
-void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
- const std::map<std::string, Common::HostInfo>& hosts = application->getInformationManager()->getDaemons();
+void CommandParser::listHostsCommand(const std::vector<Core::String> &args) {
+ const std::map<Core::String, Common::HostInfo>& hosts = application->getInformationManager()->getDaemons();
if(args.size() == 1) {
if(hosts.empty()) {
@@ -157,7 +157,7 @@ void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
bool output = false;
- for(std::map<std::string, Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host) {
+ for(std::map<Core::String, Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host) {
if(host->second.getState() == Common::HostInfo::INACTIVE)
continue;
@@ -186,7 +186,7 @@ void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
std::cout << "Host list:" << std::endl;
- for(std::map<std::string, Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host) {
+ for(std::map<Core::String, Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host) {
std::cout << " " << host->first << " (" << (host->second.getState() == Common::HostInfo::RUNNING ? "running" : "inactive") << ")" << std::endl;
}
@@ -198,7 +198,7 @@ void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
}
}
-void CommandParser::exitCommand(const std::vector<std::string> &/*args*/) {
+void CommandParser::exitCommand(const std::vector<Core::String> &/*args*/) {
boost::shared_ptr<Common::Requests::DisconnectRequest> request(new Common::Requests::DisconnectRequest(application));
application->getRequestManager()->sendRequest(connection, request);
@@ -212,26 +212,26 @@ void CommandParser::exitCommand(const std::vector<std::string> &/*args*/) {
disconnect = true;
}
-bool CommandParser::parse(const std::string &cmd) {
- std::vector<Core::UnicodeString> splitCmd;
+bool CommandParser::parse(const Core::String &cmd) {
+ std::vector<Core::String> splitCmd;
- Core::Tokenizer::tokenize(cmd.c_str(), splitCmd);
+ Core::Tokenizer::tokenize(cmd, splitCmd);
if(splitCmd.empty())
return true;
- const Command* command = findCommand(splitCmd[0].extract());
+ const Command* command = findCommand(splitCmd[0]);
if(command) {
- std::vector<std::string> strings;
+ std::vector<Core::String> strings;
- for(std::vector<Core::UnicodeString>::iterator it = splitCmd.begin(); it != splitCmd.end(); ++it)
- strings.push_back(it->extract());
+ for(std::vector<Core::String>::iterator it = splitCmd.begin(); it != splitCmd.end(); ++it)
+ strings.push_back(*it);
command->function(this, strings);
}
else {
- std::cerr << "Unknown command '" << splitCmd[0].extract() << "'." << std::endl;
+ std::cerr << "Unknown command '" << splitCmd[0] << "'." << std::endl;
}
return true;