mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 03:32:29 +00:00
* Use user-modifiable commands instead of slots for the 'on_*' events.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1070 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+24
-1
@@ -62,7 +62,7 @@ struct command_map_data_type {
|
||||
|
||||
int target() const { return m_target; }
|
||||
|
||||
Command* m_variable;
|
||||
Command* m_variable;
|
||||
|
||||
union {
|
||||
Command::cleaned_slot m_genericSlot;
|
||||
@@ -124,6 +124,9 @@ public:
|
||||
void insert(key_type key, const command_map_data_type src);
|
||||
void erase(iterator itr);
|
||||
|
||||
const mapped_type call(key_type key, target_type target, const mapped_type& args = mapped_type()) { return call_command(key, args, target); }
|
||||
const mapped_type call_catch(key_type key, target_type target, const mapped_type& args = mapped_type(), const char* err = "Command failed: ");
|
||||
|
||||
const mapped_type call_command (key_type key, const mapped_type& arg, target_type target = target_type((int)Command::target_generic, NULL));
|
||||
const mapped_type call_command (const_iterator itr, const mapped_type& arg, target_type target = target_type((int)Command::target_generic, NULL));
|
||||
|
||||
@@ -151,6 +154,26 @@ inline target_type make_target_pair(T target1, T target2) {
|
||||
return target_type((int)target_type_id<T, T>::value, target1, target2);
|
||||
}
|
||||
|
||||
// TODO: Helper-functions that really should be in the
|
||||
// torrent/object.h header.
|
||||
|
||||
inline torrent::Object
|
||||
create_object_list(const torrent::Object& o1, const torrent::Object& o2) {
|
||||
torrent::Object tmp = torrent::Object::create_list();
|
||||
tmp.as_list().push_back(o1);
|
||||
tmp.as_list().push_back(o2);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
inline torrent::Object
|
||||
create_object_list(const torrent::Object& o1, const torrent::Object& o2, const torrent::Object& o3) {
|
||||
torrent::Object tmp = torrent::Object::create_list();
|
||||
tmp.as_list().push_back(o1);
|
||||
tmp.as_list().push_back(o2);
|
||||
tmp.as_list().push_back(o3);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user