adds extract string support for wscmd

This commit is contained in:
Peter Thorson
2012-06-07 06:07:42 -05:00
parent b58cf53353
commit 0b10e9c0a3
2 changed files with 11 additions and 1 deletions

View File

@@ -68,3 +68,11 @@ wscmd::cmd wscmd::parse(const std::string& m) {
return command;
}
bool wscmd::extract_string(wscmd::cmd command,const std::string& key,std::string& val) {
if (command.args[key] != "") {
val = command.args[key];
return true;
} else {
return false;
}
}

View File

@@ -60,7 +60,7 @@ namespace wscmd {
wscmd::cmd parse(const std::string& m);
template <typename T>
bool extract_number(wscmd::cmd command,std::string key,T& val) {
bool extract_number(wscmd::cmd command,const std::string& key,T& val) {
if (command.args[key] != "") {
std::istringstream buf(command.args[key]);
@@ -70,6 +70,8 @@ namespace wscmd {
}
return false;
}
bool extract_string(wscmd::cmd command,const std::string& key,std::string& val);
} // namespace wscmd
#endif // WSCMD_HPP