* Cleaned up commands.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1068 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-09-24 15:26:15 +00:00
parent 879a019757
commit 6385b995f3
17 changed files with 231 additions and 165 deletions
+17 -1
View File
@@ -52,6 +52,20 @@ namespace torrent {
namespace rpc {
template <typename Target>
struct target_wrapper {
typedef Target target_type;
typedef Target cleaned_type;
};
template <>
struct target_wrapper<void> {
struct no_type {};
typedef void target_type;
typedef no_type* cleaned_type;
};
// Since c++0x isn't out yet...
template <typename T1, typename T2, typename T3>
struct rt_triple : private std::pair<T1, T2> {
@@ -95,6 +109,7 @@ public:
typedef torrent::Object::key_type key_type;
typedef const torrent::Object (*generic_slot) (Command*, const torrent::Object&);
typedef const torrent::Object (*cleaned_slot) (Command*, target_wrapper<void>::cleaned_type, const torrent::Object&);
typedef const torrent::Object (*any_slot) (Command*, target_type, const torrent::Object&);
typedef const torrent::Object (*download_slot) (Command*, core::Download*, const torrent::Object&);
typedef const torrent::Object (*file_slot) (Command*, torrent::File*, const torrent::Object&);
@@ -127,7 +142,8 @@ struct target_type_id {
// Nothing here, so we cause an error.
};
template <> struct target_type_id<Command::generic_slot> { static const int value = Command::target_generic; };
//template <> struct target_type_id<Command::generic_slot> { static const int value = Command::target_generic; };
template <> struct target_type_id<Command::cleaned_slot> { static const int value = Command::target_generic; };
template <> struct target_type_id<Command::any_slot> { static const int value = Command::target_any; };
template <> struct target_type_id<Command::download_slot> { static const int value = Command::target_download; };
template <> struct target_type_id<Command::peer_slot> { static const int value = Command::target_peer; };