* Added insert_preserve helper functions to torrent::Object.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1000 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-11-01 08:32:08 +00:00
parent ff2c25bdeb
commit c326c7f43a
11 changed files with 31 additions and 43 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ ExecFile::execute_object(const torrent::Object& rawArgs, int flags) {
if (args.empty())
throw torrent::input_error("Too few arguments.");
for (torrent::Object::list_type::const_iterator itr = args.begin(), last = args.end(); itr != last; itr++, argsCurrent++) {
for (torrent::Object::list_const_iterator itr = args.begin(), last = args.end(); itr != last; itr++, argsCurrent++) {
if (argsCurrent == argsBuffer + max_args - 1)
throw torrent::input_error("Too many arguments.");
+6 -6
View File
@@ -235,8 +235,8 @@ convert_list_to_string(const torrent::Object& src) {
}
std::string
convert_list_to_string(torrent::Object::list_type::const_iterator first,
torrent::Object::list_type::const_iterator last) {
convert_list_to_string(torrent::Object::list_const_iterator first,
torrent::Object::list_const_iterator last) {
std::string dest;
while (first != last) {
@@ -270,8 +270,8 @@ convert_list_to_string(torrent::Object::list_type::const_iterator first,
}
std::string
convert_list_to_command(torrent::Object::list_type::const_iterator first,
torrent::Object::list_type::const_iterator last) {
convert_list_to_command(torrent::Object::list_const_iterator first,
torrent::Object::list_const_iterator last) {
if (first == last)
throw torrent::input_error("Too few arguments.");
@@ -375,7 +375,7 @@ print_object(char* first, char* last, const torrent::Object* src, int flags) {
return std::max(first + snprintf(first, std::distance(first, last), "%lli", src->as_value()), last);
case torrent::Object::TYPE_LIST:
for (torrent::Object::list_type::const_iterator itr = src->as_list().begin(), itrEnd = src->as_list().end(); itr != itrEnd; itr++) {
for (torrent::Object::list_const_iterator itr = src->as_list().begin(), itrEnd = src->as_list().end(); itr != itrEnd; itr++) {
first = print_object(first, last, &*itr, flags);
// Don't expand tilde after the first element in the list.
@@ -412,7 +412,7 @@ print_object_std(std::string* dest, const torrent::Object* src, int flags) {
return;
}
case torrent::Object::TYPE_LIST:
for (torrent::Object::list_type::const_iterator itr = src->as_list().begin(), itrEnd = src->as_list().end(); itr != itrEnd; itr++) {
for (torrent::Object::list_const_iterator itr = src->as_list().begin(), itrEnd = src->as_list().end(); itr != itrEnd; itr++) {
print_object_std(dest, &*itr, flags);
// Don't expand tilde after the first element in the list.
+2 -2
View File
@@ -74,8 +74,8 @@ const char* parse_list(const char* first, const char* last, torrent::Object* des
const char* parse_whole_list(const char* first, const char* last, torrent::Object* dest);
std::string convert_list_to_string(const torrent::Object& src);
std::string convert_list_to_string(torrent::Object::list_type::const_iterator first, torrent::Object::list_type::const_iterator last);
std::string convert_list_to_command(torrent::Object::list_type::const_iterator first, torrent::Object::list_type::const_iterator last);
std::string convert_list_to_string(torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last);
std::string convert_list_to_command(torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last);
int64_t convert_to_value(const torrent::Object& src, int base = 0, int unit = 1);
bool convert_to_value_nothrow(const torrent::Object& src, int64_t* value, int base = 0, int unit = 1);
+1 -1
View File
@@ -86,7 +86,7 @@ parse_command_execute(target_type target, torrent::Object* object) {
if (object->is_list()) {
// For now, until we can flag the lists we want executed and those
// we can't, disable recursion completely.
for (torrent::Object::list_type::iterator itr = object->as_list().begin(), last = object->as_list().end(); itr != last; itr++) {
for (torrent::Object::list_iterator itr = object->as_list().begin(), last = object->as_list().end(); itr != last; itr++) {
if (itr->is_list())
continue;
+1 -1
View File
@@ -107,7 +107,7 @@ inline void call_command_d_set_string(const char* key, core::Download
inline void call_command_d_set_std_string(const std::string& key, core::Download* download, const std::string& arg) { commands.call_command_d(key.c_str(), download, torrent::Object(arg)); }
inline torrent::Object
call_command_d_range(const char* key, core::Download* download, torrent::Object::list_type::const_iterator first, torrent::Object::list_type::const_iterator last) {
call_command_d_range(const char* key, core::Download* download, torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last) {
// Change to using range ctor.
torrent::Object rawArgs(torrent::Object::TYPE_LIST);
torrent::Object::list_type& args = rawArgs.as_list();
+2 -2
View File
@@ -350,7 +350,7 @@ object_to_xmlrpc(xmlrpc_env* env, const torrent::Object& object) {
{
xmlrpc_value* result = xmlrpc_array_new(env);
for (torrent::Object::list_type::const_iterator itr = object.as_list().begin(), last = object.as_list().end(); itr != last; itr++)
for (torrent::Object::list_const_iterator itr = object.as_list().begin(), last = object.as_list().end(); itr != last; itr++)
xmlrpc_array_append_item(env, result, object_to_xmlrpc(env, *itr));
return result;
@@ -360,7 +360,7 @@ object_to_xmlrpc(xmlrpc_env* env, const torrent::Object& object) {
{
xmlrpc_value* result = xmlrpc_struct_new(env);
for (torrent::Object::map_type::const_iterator itr = object.as_map().begin(), last = object.as_map().end(); itr != last; itr++)
for (torrent::Object::map_const_iterator itr = object.as_map().begin(), last = object.as_map().end(); itr != last; itr++)
xmlrpc_struct_set_value(env, result, itr->first.c_str(), object_to_xmlrpc(env, itr->second));
return result;