mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 19:52:31 +00:00
* Make VariableMap handle both global and core::Download
variables. Variable now has functions for both void and core::Download*, where the core::Download* is discarded if necessary. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@847 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -43,6 +43,10 @@
|
||||
#include <iosfwd>
|
||||
#include <torrent/object.h>
|
||||
|
||||
namespace core {
|
||||
class Download;
|
||||
}
|
||||
|
||||
namespace torrent {
|
||||
class Object;
|
||||
}
|
||||
@@ -78,15 +82,25 @@ public:
|
||||
|
||||
void insert(key_type key, Variable* v);
|
||||
|
||||
// Consider taking char* start and finish instead of std::string to
|
||||
// avoid copying. Or make a view class.
|
||||
// Consider uninlining the helper functions.
|
||||
|
||||
const mapped_type& get(key_type key) const;
|
||||
const std::string& get_string(key_type key) const { return get(key).as_string(); }
|
||||
mapped_value_type get_value(key_type key) const { return get(key).as_value(); }
|
||||
const mapped_type& get_d(core::Download* download, key_type key) const;
|
||||
|
||||
const std::string& get_string(key_type key) const { return get(key).as_string(); }
|
||||
const std::string& get_d_string(core::Download* download, key_type key) const { return get_d(download, key).as_string(); }
|
||||
|
||||
mapped_value_type get_value(key_type key) const { return get(key).as_value(); }
|
||||
mapped_value_type get_d_value(core::Download* download, key_type key) const { return get_d(download, key).as_value(); }
|
||||
|
||||
void set(key_type key, const mapped_type& arg);
|
||||
void set_string(key_type key, const std::string& arg) { set(key, mapped_type(arg)); }
|
||||
void set_value(key_type key, mapped_value_type arg) { set(key, mapped_type(arg)); }
|
||||
void set_d(core::Download* download, key_type key, const mapped_type& arg);
|
||||
|
||||
void set_string(key_type key, const std::string& arg) { set(key, mapped_type(arg)); }
|
||||
void set_d_string(core::Download* download, key_type key, const std::string& arg) { set_d(download, key, mapped_type(arg)); }
|
||||
|
||||
void set_value(key_type key, mapped_value_type arg) { set(key, mapped_type(arg)); }
|
||||
void set_d_value(core::Download* download, key_type key, mapped_value_type arg) { set_d(download, key, mapped_type(arg)); }
|
||||
|
||||
void set_std_string(const std::string& key, const std::string& arg) { set(key.c_str(), mapped_type(arg)); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user