Replace old command call functions with the new one taking torrent::Objects.

This commit is contained in:
rakshasa
2012-05-04 22:33:26 +09:00
parent fb75510c0f
commit d2d09d97f8
4 changed files with 31 additions and 122 deletions
+6 -11
View File
@@ -124,33 +124,28 @@ call_command_d_range(const char* key, core::Download* download, torrent::Object:
return commands.call_command_d(key, download, rawArgs);
}
void call_object(const torrent::Object& command, target_type target = make_target());
torrent::Object call_object(const torrent::Object& command, target_type target = make_target());
inline void
inline torrent::Object
call_object_nothrow(const torrent::Object& command, target_type target = make_target()) {
try { call_object(command, target); } catch (torrent::input_error& e) {}
try { return call_object(command, target); } catch (torrent::input_error& e) { return torrent::Object(); }
}
inline void
inline torrent::Object
call_object_d_nothrow(const torrent::Object& command, core::Download* download) {
try { call_object(command, make_target(download)); } catch (torrent::input_error& e) {}
try { return call_object(command, make_target(download)); } catch (torrent::input_error& e) { return torrent::Object(); }
}
//
//
//
// Temp until it can be moved somewhere better...
const torrent::Object
command_function_call(const torrent::raw_string& cmd, target_type target, const torrent::Object& args);
const torrent::Object
command_function_call_object(const torrent::Object& cmd, target_type target, const torrent::Object& args);
const torrent::Object
command_function_multi_call(const torrent::Object::map_type& cmd, target_type target, const torrent::Object& args);
inline const torrent::Object
command_function_call_str(const std::string& cmd, target_type target, const torrent::Object& args) {
return command_function_call(torrent::raw_string::from_string(cmd), target, args);
return command_function_call_object(torrent::Object(cmd), target, args);
}
}