X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/a359eb714e150b2b59856d0056b9880aaaedd128..9c0c758e9af50f624414decbaae43c04e8d8e3f9:/Server/src/command.cpp?ds=sidebyside diff --git a/Server/src/command.cpp b/Server/src/command.cpp index 5087d9e..5aa4700 100644 --- a/Server/src/command.cpp +++ b/Server/src/command.cpp @@ -28,6 +28,7 @@ #include "plaqui/server/command.h" #include "plaqui/server/string.h" #include +//#include #ifdef DEBUG # include #endif // DEBUG @@ -40,13 +41,15 @@ namespace Server { Command::~Command(void) { #ifdef DEBUG - cerr << __FILE__ << ": destructor." << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": destructor." << endl; #endif // DEBUG } Command::Command(const string& _target, const string& _command) { #ifdef DEBUG - cerr << __FILE__ << ": target = " << target << " | " + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": target = " << target << " | " << "command = " << command << endl; #endif // DEBUG set_target(_target); @@ -62,7 +65,8 @@ void Command::build(void) { } } #ifdef DEBUG - cerr << __FILE__ << ": build() = " << uri << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": build() = " << uri << endl; #endif // DEBUG } @@ -100,16 +104,19 @@ void Command::add_arg(const std::string& arg) { void Command::add_arg(const unsigned& arg) { #ifdef DEBUG - cerr << __FILE__ << ": add_arg(arg = " << arg << ") = " + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": add_arg(arg = " << arg << ") = " << String().from(arg) << endl; #endif // DEBUG args.push_back(String().from(arg)); build(); } -istream& operator>>(istream& is, Command& command) { +istream& operator>>(istream& is, Command& command) + throw(HTTPError, sockerr, ios::failure) { #ifdef DEBUG - cerr << __FILE__ << ": operator>>()" << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": operator>>()" << endl; #endif // DEBUG // Obtengo datos del Request HTTP. is >> static_cast(command); @@ -133,9 +140,10 @@ istream& operator>>(istream& is, Command& command) { return is; } -ostream& operator<<(ostream& os, const Command& command) { +ostream& operator<<(ostream& os, const Command& command) throw (sockerr) { #ifdef DEBUG - cerr << __FILE__ << ": operator<<()" << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": operator<<()" << endl; #endif // DEBUG // Manda el request HTTP con la URI que representa el comando. os << static_cast(command);