X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/ffe5447aa2d71b5296cbdd36c48d5f9d59e249af..f5a1e732bf3907cabd004932aba3256b31d9d282:/Server/src/command.cpp diff --git a/Server/src/command.cpp b/Server/src/command.cpp index 084cf79..08a73c9 100644 --- a/Server/src/command.cpp +++ b/Server/src/command.cpp @@ -44,12 +44,13 @@ Command::~Command(void) { #endif // DEBUG } -Command::Command(const string& target, const string& command): - target(target), command(command) { +Command::Command(const string& _target, const string& _command) { #ifdef DEBUG cerr << __FILE__ << ": target = " << target << " | " << "command = " << command << endl; #endif // DEBUG + set_target(_target); + set_command(_command); } void Command::build(void) { @@ -64,7 +65,7 @@ void Command::set_target(const std::string& _target) { build(); } -const std::string& Command::get_target(void) { +const std::string& Command::get_target(void) const { return target; } @@ -73,7 +74,7 @@ void Command::set_command(const std::string& _command) { build(); } -const std::string& Command::get_command(void) { +const std::string& Command::get_command(void) const { return command; } @@ -82,7 +83,7 @@ void Command::set_args(const Command::Arguments& _args) { build(); } -const Command::Arguments& Command::get_args(void) { +const Command::Arguments& Command::get_args(void) const { return args; } @@ -108,8 +109,8 @@ istream& operator>>(istream& is, Command& command) { } else { command.target = ""; } - if (command.args.size() > 1) { - command.command = command.args[1]; + if (command.args.size() > 0) { + command.command = command.args[0]; command.args.erase(command.args.begin()); } else { command.command = "";