mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 21:52:30 +00:00
* 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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user