mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 21:22:31 +00:00
* Added VariableBool.
* Added views for downloads, that can be sorted. * Added options "view_add", "view_sort" and "view_new". git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@671 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -42,9 +42,6 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
VariableAny::~VariableAny() {
|
||||
}
|
||||
|
||||
const torrent::Object&
|
||||
VariableAny::get() {
|
||||
return m_variable;
|
||||
@@ -55,14 +52,6 @@ VariableAny::set(const torrent::Object& arg) {
|
||||
m_variable = arg;
|
||||
}
|
||||
|
||||
VariableValue::~VariableValue() {
|
||||
}
|
||||
|
||||
const torrent::Object&
|
||||
VariableValue::get() {
|
||||
return m_variable;
|
||||
}
|
||||
|
||||
void
|
||||
VariableValue::set(const torrent::Object& arg) {
|
||||
uint64_t value;
|
||||
@@ -93,40 +82,31 @@ VariableValue::set(const torrent::Object& arg) {
|
||||
}
|
||||
}
|
||||
|
||||
VariableBool::~VariableBool() {
|
||||
}
|
||||
|
||||
const torrent::Object&
|
||||
VariableBool::get() {
|
||||
return m_variable;
|
||||
}
|
||||
|
||||
void
|
||||
VariableBool::set(const torrent::Object& arg) {
|
||||
if (arg.is_value()) {
|
||||
switch (arg.type()) {
|
||||
case torrent::Object::TYPE_VALUE:
|
||||
m_variable = arg.as_value() ? (int64_t)1 : (int64_t)0;
|
||||
break;
|
||||
|
||||
} else if (arg.is_string()) {
|
||||
|
||||
if (arg.as_string() == "yes" ||
|
||||
arg.as_string() == "true")
|
||||
case torrent::Object::TYPE_STRING:
|
||||
// Move the checks into some is_true, is_false think in Variable.
|
||||
if (arg.as_string() == "yes" || arg.as_string() == "true")
|
||||
m_variable = (int64_t)1;
|
||||
|
||||
else if (arg.as_string() == "no" ||
|
||||
arg.as_string() == "false")
|
||||
else if (arg.as_string() == "no" || arg.as_string() == "false")
|
||||
m_variable = (int64_t)0;
|
||||
|
||||
else
|
||||
throw torrent::input_error("String does not parse as a boolean.");
|
||||
|
||||
} else {
|
||||
break;
|
||||
|
||||
default:
|
||||
throw torrent::input_error("Input is not a boolean.");
|
||||
}
|
||||
}
|
||||
|
||||
VariableObject::~VariableObject() {
|
||||
}
|
||||
|
||||
const torrent::Object&
|
||||
VariableObject::get() {
|
||||
if (m_root.empty())
|
||||
|
||||
Reference in New Issue
Block a user