|
|
@ -55,12 +55,13 @@ void RPCExecutor::start() |
|
|
|
void RPCExecutor::request(const QString &command) |
|
|
|
void RPCExecutor::request(const QString &command) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Parse shell-like command line into separate arguments
|
|
|
|
// Parse shell-like command line into separate arguments
|
|
|
|
|
|
|
|
std::string strMethod; |
|
|
|
|
|
|
|
std::vector<std::string> strParams; |
|
|
|
|
|
|
|
try { |
|
|
|
boost::escaped_list_separator<char> els('\\',' ','\"'); |
|
|
|
boost::escaped_list_separator<char> els('\\',' ','\"'); |
|
|
|
std::string strCommand = command.toStdString(); |
|
|
|
std::string strCommand = command.toStdString(); |
|
|
|
boost::tokenizer<boost::escaped_list_separator<char> > tok(strCommand, els); |
|
|
|
boost::tokenizer<boost::escaped_list_separator<char> > tok(strCommand, els); |
|
|
|
|
|
|
|
|
|
|
|
std::string strMethod; |
|
|
|
|
|
|
|
std::vector<std::string> strParams; |
|
|
|
|
|
|
|
int n = 0; |
|
|
|
int n = 0; |
|
|
|
for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg,++n) |
|
|
|
for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg,++n) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -69,6 +70,12 @@ void RPCExecutor::request(const QString &command) |
|
|
|
else |
|
|
|
else |
|
|
|
strParams.push_back(*beg); |
|
|
|
strParams.push_back(*beg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch(boost::escaped_list_error &e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
emit reply(RPCConsole::CMD_ERROR, QString("Parse error")); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
std::string strPrint; |
|
|
|
std::string strPrint; |
|
|
|