* More commands moved to the new system.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@897 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-05-01 19:00:17 +00:00
parent 2ede6f03ab
commit a864d5938d
9 changed files with 187 additions and 48 deletions
+26
View File
@@ -36,6 +36,8 @@
#include "config.h"
#include "utils/parse.h"
#include "command_slot.h"
namespace utils {
@@ -87,6 +89,30 @@ CommandSlot::call_list(Variable* rawVariable, const torrent::Object& rawArgs) {
}
}
const torrent::Object
CommandSlot::call_value_base(Variable* rawVariable, const torrent::Object& rawArgs, int base, int unit) {
CommandSlot* command = static_cast<CommandSlot*>(rawVariable);
const torrent::Object& arg = to_single_argument(rawArgs);
switch (arg.type()) {
case torrent::Object::TYPE_VALUE:
return command->m_slot(arg);
case torrent::Object::TYPE_STRING:
{
torrent::Object argValue(torrent::Object::TYPE_VALUE);
if (!utils::parse_whole_value_nothrow(arg.as_string().c_str(), &argValue.as_value(), base, unit))
throw torrent::input_error("Not a value.");
return command->m_slot(argValue);
}
default:
throw torrent::input_error("Not a value.");
}
}
const torrent::Object
CommandSlot::call_string(Variable* rawVariable, const torrent::Object& rawArgs) {
CommandSlot* command = static_cast<CommandSlot*>(rawVariable);