diff --git a/.clang-format b/.clang-format index 7b6699da..2f0b1678 100644 --- a/.clang-format +++ b/.clang-format @@ -9,7 +9,7 @@ BinPackArguments: false BinPackParameters: false BreakConstructorInitializers: AfterColon BreakStringLiterals: false -ColumnLimit: 130 +ColumnLimit: 0 ContinuationIndentWidth: 2 IndentCaseLabels: false IndentWidth: 2 diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index 35effab2..475516e3 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -46,17 +46,18 @@ #include "rpc/parse.h" #include "rpc/parse_options.h" -static std::vector> object_storage_flags = {{"multi", rpc::object_storage::flag_multi_type}, - {"simple", rpc::object_storage::flag_function_type}, - {"value", rpc::object_storage::flag_value_type}, - {"bool", rpc::object_storage::flag_bool_type}, - {"string", rpc::object_storage::flag_string_type}, - {"list", rpc::object_storage::flag_list_type}, +static std::vector> object_storage_flags = { + {"multi", rpc::object_storage::flag_multi_type}, + {"simple", rpc::object_storage::flag_function_type}, + {"value", rpc::object_storage::flag_value_type}, + {"bool", rpc::object_storage::flag_bool_type}, + {"string", rpc::object_storage::flag_string_type}, + {"list", rpc::object_storage::flag_list_type}, - {"static", rpc::object_storage::flag_static}, - {"private", rpc::object_storage::flag_private}, - {"const", rpc::object_storage::flag_constant}, - {"rlookup", rpc::object_storage::flag_rlookup}}; + {"static", rpc::object_storage::flag_static}, + {"private", rpc::object_storage::flag_private}, + {"const", rpc::object_storage::flag_constant}, + {"rlookup", rpc::object_storage::flag_rlookup}}; static int object_storage_parse_flag(const std::string& flag) { @@ -82,9 +83,7 @@ system_method_generate_command(torrent::Object::list_const_iterator first, torre } void -system_method_generate_command2(torrent::Object* object, - torrent::Object::list_const_iterator first, - torrent::Object::list_const_iterator last) { +system_method_generate_command2(torrent::Object* object, torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last) { if (first == last) { // TODO: Use empty object. *object = ""; @@ -196,8 +195,7 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) { rpc::commands.insert_slot>::type>( create_new_key(rawKey), - std::bind( - &rpc::object_storage::call_function_str, control->object_storage(), rawKey, std::placeholders::_1, std::placeholders::_2), + std::bind(&rpc::object_storage::call_function_str, control->object_storage(), rawKey, std::placeholders::_1, std::placeholders::_2), &rpc::command_base_call, cmd_flags, NULL, @@ -312,11 +310,14 @@ system_method_insert(const torrent::Object::list_type& args) { torrent::Object::list_type new_args; new_args.push_back(rawKey); - if ((new_flags & rpc::object_storage::flag_function_type) || (new_flags & rpc::object_storage::flag_multi_type)) { + if ((new_flags & rpc::object_storage::flag_function_type) || + (new_flags & rpc::object_storage::flag_multi_type)) { new_args.push_back(system_method_generate_command(++itrArgs, args.end())); - } else if ((new_flags & rpc::object_storage::flag_value_type) || (new_flags & rpc::object_storage::flag_bool_type) || - (new_flags & rpc::object_storage::flag_string_type) || (new_flags & rpc::object_storage::flag_list_type)) { + } else if ((new_flags & rpc::object_storage::flag_value_type) || + (new_flags & rpc::object_storage::flag_bool_type) || + (new_flags & rpc::object_storage::flag_string_type) || + (new_flags & rpc::object_storage::flag_list_type)) { if (++itrArgs != args.end()) new_args.insert(new_args.end(), itrArgs, args.end()); @@ -355,10 +356,7 @@ system_method_redirect(const torrent::Object::list_type& args) { std::string new_key = torrent::object_create_string(args.front()); std::string dest_key = torrent::object_create_string(args.back()); - rpc::commands.create_redirect(create_new_key(new_key), - create_new_key(dest_key), - rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_delete_key | - rpc::CommandMap::flag_modifiable); + rpc::commands.create_redirect(create_new_key(new_key), create_new_key(dest_key), rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_delete_key | rpc::CommandMap::flag_modifiable); return torrent::Object(); } @@ -435,7 +433,8 @@ cmd_catch(rpc::target_type target, const torrent::Object& args) { } } -#define CMD2_METHOD_INSERT(key, flags) CMD2_ANY_LIST(key, std::bind(&system_method_insert_object, std::placeholders::_2, flags)); +#define CMD2_METHOD_INSERT(key, flags) \ + CMD2_ANY_LIST(key, std::bind(&system_method_insert_object, std::placeholders::_2, flags)); void initialize_command_dynamic() { diff --git a/src/core/view.cc b/src/core/view.cc index ad77ad03..d3aeb4ad 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -55,7 +55,8 @@ namespace core { // Also add focus thingie here? struct view_downloads_compare : std::binary_function { - view_downloads_compare(const torrent::Object& cmd) : m_command(cmd) {} + view_downloads_compare(const torrent::Object& cmd) : + m_command(cmd) {} bool operator()(Download* d1, Download* d2) const { try { @@ -75,8 +76,7 @@ struct view_downloads_compare : std::binary_function // return rpc::commands.call_command(tmp_command.as_dict_key().c_str(), tmp_command.as_dict_obj(), // rpc::make_target_pair(d1, d2)).as_value(); - return rpc::commands.call_command(m_command.as_dict_key().c_str(), m_command.as_dict_obj(), rpc::make_target_pair(d1, d2)) - .as_value(); + return rpc::commands.call_command(m_command.as_dict_key().c_str(), m_command.as_dict_obj(), rpc::make_target_pair(d1, d2)).as_value(); } catch (torrent::input_error& e) { control->core()->push_log(e.what()); @@ -89,9 +89,12 @@ struct view_downloads_compare : std::binary_function }; struct view_downloads_filter : std::unary_function { - view_downloads_filter(const torrent::Object& cmd, const torrent::Object& cmd2) : m_command(cmd), m_command2(cmd2) {} + view_downloads_filter(const torrent::Object& cmd, const torrent::Object& cmd2) : + m_command(cmd), m_command2(cmd2) {} - bool operator()(Download* d1) const { return this->evalCmd(m_command, d1) && this->evalCmd(m_command2, d1); } + bool operator()(Download* d1) const { + return this->evalCmd(m_command, d1) && this->evalCmd(m_command2, d1); + } bool evalCmd(const torrent::Object& cmd, Download* d1) const { if (cmd.is_empty()) @@ -269,9 +272,8 @@ View::filter() { return; // Parition the list in two steps so we know which elements changed. - iterator splitVisible = std::stable_partition(begin_visible(), end_visible(), view_downloads_filter(m_filter, m_temp_filter)); - iterator splitFiltered = - std::stable_partition(begin_filtered(), end_filtered(), view_downloads_filter(m_filter, m_temp_filter)); + iterator splitVisible = std::stable_partition(begin_visible(), end_visible(), view_downloads_filter(m_filter, m_temp_filter)); + iterator splitFiltered = std::stable_partition(begin_filtered(), end_filtered(), view_downloads_filter(m_filter, m_temp_filter)); base_type changed(splitVisible, splitFiltered); iterator splitChanged = changed.begin() + std::distance(splitVisible, end_visible());