* Moved hash and torrent size checking to initialize so it will be

caught when loading a torrent.

* Added VariableMap to core::Download and started moving various
settings.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@624 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-01-19 17:13:25 +00:00
parent e8cd37ea3a
commit 52636178d1
14 changed files with 242 additions and 114 deletions
+15 -3
View File
@@ -48,6 +48,7 @@ class Variable;
class VariableMap : public std::map<std::string, Variable*> {
public:
typedef std::map<std::string, Variable*> base_type;
typedef torrent::Bencode mapped_type;
using base_type::iterator;
using base_type::value_type;
@@ -59,10 +60,11 @@ public:
// Consider taking char* start and finish instead of std::string to
// avoid copying. Or make a view class.
const torrent::Bencode& get(const std::string& key);
const mapped_type& get(const std::string& key);
std::string get_string(const std::string& key);
void set(const std::string& key, const torrent::Bencode& arg);
void set_string(const std::string& key, const std::string& arg) { set(key, torrent::Bencode(arg)); }
void set(const std::string& key, const mapped_type& arg);
void set_string(const std::string& key, const std::string& arg) { set(key, mapped_type(arg)); }
// Temporary.
void process_command(const std::string& command);
@@ -72,6 +74,16 @@ private:
void operator = (const VariableMap&);
};
inline std::string
VariableMap::get_string(const std::string& key) {
const mapped_type& v = get(key);
if (v.get_type() == mapped_type::TYPE_NONE)
return std::string();
else
return v.as_string();
}
}
#endif