mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-10 04:02:30 +00:00
* Bumped to 0.11.5/0.7.5.
* Added "call.set_upload_rate", "call.get_upload_rate" and "call.get_directory" XMLRPC calls. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@888 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -66,13 +66,13 @@ public:
|
||||
static const char* string_to_value_unit(const char* pos, value_type* value, int base, int unit);
|
||||
static bool string_to_value_unit_nothrow(const char* pos, value_type* value, int base, int unit);
|
||||
|
||||
protected:
|
||||
Variable(const Variable&);
|
||||
void operator = (const Variable&);
|
||||
|
||||
// Temporary hack, until torrent::Object is extended to allow
|
||||
// references so we can return a copy, not a const reference.
|
||||
static const torrent::Object m_emptyObject;
|
||||
|
||||
protected:
|
||||
Variable(const Variable&);
|
||||
void operator = (const Variable&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -172,15 +172,22 @@ VariableValueSlot::get() {
|
||||
}
|
||||
|
||||
void
|
||||
VariableValueSlot::set(const torrent::Object& arg) {
|
||||
VariableValueSlot::set(const torrent::Object& rawArg) {
|
||||
if (!m_slotSet.is_valid())
|
||||
return;
|
||||
|
||||
const torrent::Object* arg;
|
||||
|
||||
if (rawArg.type() == torrent::Object::TYPE_LIST && rawArg.as_list().size() == 1)
|
||||
arg = &rawArg.as_list().front();
|
||||
else
|
||||
arg = &rawArg;
|
||||
|
||||
value_type value;
|
||||
|
||||
switch (arg.type()) {
|
||||
switch (arg->type()) {
|
||||
case torrent::Object::TYPE_STRING:
|
||||
string_to_value_unit(arg.as_string().c_str(), &value, m_base, m_unit);
|
||||
string_to_value_unit(arg->as_string().c_str(), &value, m_base, m_unit);
|
||||
|
||||
// Check if we hit the end of the input.
|
||||
|
||||
@@ -188,7 +195,7 @@ VariableValueSlot::set(const torrent::Object& arg) {
|
||||
break;
|
||||
|
||||
case torrent::Object::TYPE_VALUE:
|
||||
m_slotSet(arg.as_value());
|
||||
m_slotSet(arg->as_value());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -236,4 +236,16 @@ VariableMap::process_file(key_type path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const VariableMap::mapped_type&
|
||||
VariableMap::call_command_get(key_type key, const mapped_type& arg) {
|
||||
return get(key);
|
||||
}
|
||||
|
||||
const VariableMap::mapped_type&
|
||||
VariableMap::call_command_set(key_type key, const mapped_type& arg) {
|
||||
set(key, arg);
|
||||
|
||||
return Variable::m_emptyObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@ public:
|
||||
void process_stream(std::istream* str);
|
||||
bool process_file(key_type path);
|
||||
|
||||
// The new API, which is atm just a wrapper over the old and
|
||||
// requires seperate calls to get and set. These will be merged.
|
||||
const mapped_type& call_command_get(key_type key, const mapped_type& arg);
|
||||
const mapped_type& call_command_set(key_type key, const mapped_type& arg);
|
||||
|
||||
private:
|
||||
VariableMap(const VariableMap&);
|
||||
void operator = (const VariableMap&);
|
||||
|
||||
Reference in New Issue
Block a user