Seperated out my template algorithms and stuff.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@334 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-03-08 18:25:34 +00:00
parent f379abb200
commit a4dbdffcb8
16 changed files with 40 additions and 38 deletions
+6 -6
View File
@@ -3,7 +3,7 @@
#include <stdexcept>
#include <algorithm>
#include "utils/functional.h"
#include "rak/functional.h"
#include "canvas.h"
#include "manager.h"
@@ -26,8 +26,8 @@ Manager::adjust_layout() {
int countDynamic = 0;
int staticHeight = 0;
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), utils::accumulate(staticHeight, std::mem_fun(&Window::get_min_height))));
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), utils::accumulate(countDynamic, std::mem_fun(&Window::is_dynamic))));
std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), rak::accumulate(staticHeight, std::mem_fun(&Window::get_min_height))));
std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), rak::accumulate(countDynamic, std::mem_fun(&Window::is_dynamic))));
int dynamic = std::max(0, Canvas::get_screen_height() - staticHeight);
int height = 0, h;
@@ -56,9 +56,9 @@ void
Manager::do_update() {
Canvas::refresh_std();
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), utils::if_then(std::mem_fun(&Window::is_dirty),
std::mem_fun(&Window::redraw))));
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), rak::if_then(std::mem_fun(&Window::is_dirty),
std::mem_fun(&Window::redraw))));
std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
Canvas::do_update();
}
+5 -5
View File
@@ -1,7 +1,7 @@
#include "config.h"
#include "core/download.h"
#include "utils/algorithm.h"
#include "rak/algorithm.h"
#include "canvas.h"
#include "utils.h"
@@ -26,10 +26,10 @@ WindowDownloadList::redraw() {
typedef std::pair<DList::iterator, DList::iterator> Range;
Range range = utils::advance_bidirectional(m_list->begin(),
*m_focus != m_list->end() ? *m_focus : m_list->begin(),
m_list->end(),
m_canvas->get_height() / 3);
Range range = rak::advance_bidirectional(m_list->begin(),
*m_focus != m_list->end() ? *m_focus : m_list->begin(),
m_list->end(),
m_canvas->get_height() / 3);
// Make sure we properly fill out the last lines so it looks like
// there are more torrents, yet don't hide it if we got the last one
+5 -3
View File
@@ -3,7 +3,7 @@
#include <stdexcept>
#include "core/download.h"
#include "utils/algorithm.h"
#include "rak/algorithm.h"
#include "window_file_list.h"
@@ -37,8 +37,10 @@ WindowFileList::redraw() {
typedef std::pair<unsigned int, unsigned int> Range;
Range range = utils::advance_bidirectional<unsigned int>(0, *m_focus, m_download->get_download().get_entry_size(),
m_canvas->get_height());
Range range = rak::advance_bidirectional<unsigned int>(0,
*m_focus,
m_download->get_download().get_entry_size(),
m_canvas->get_height());
while (range.first != range.second) {
torrent::Entry e = m_download->get_download().get_entry(range.first);
+2 -2
View File
@@ -6,7 +6,7 @@
#include "core/http_queue.h"
#include "canvas.h"
#include "utils/functional.h"
#include "rak/functional.h"
#include "window_http_queue.h"
namespace display {
@@ -105,7 +105,7 @@ WindowHttpQueue::receive_insert(core::CurlGet* h) {
void
WindowHttpQueue::receive_erase(core::CurlGet* h) {
Container::iterator itr = std::find_if(m_container.begin(), m_container.end(),
utils::equal(h, std::mem_fun_ref(&Node::get_http)));
rak::equal(h, std::mem_fun_ref(&Node::get_http)));
if (itr == m_container.end())
throw std::logic_error("WindowHttpQueue::receive_erase(...) tried to remove an object we don't have");
+5 -5
View File
@@ -3,7 +3,7 @@
#include <stdexcept>
#include "core/download.h"
#include "utils/algorithm.h"
#include "rak/algorithm.h"
#include "canvas.h"
#include "window_peer_list.h"
@@ -42,10 +42,10 @@ WindowPeerList::redraw() {
typedef std::pair<PList::iterator, PList::iterator> Range;
Range range = utils::advance_bidirectional(m_list->begin(),
*m_focus != m_list->end() ? *m_focus : m_list->begin(),
m_list->end(),
m_canvas->get_height() - y);
Range range = rak::advance_bidirectional(m_list->begin(),
*m_focus != m_list->end() ? *m_focus : m_list->begin(),
m_list->end(),
m_canvas->get_height() - y);
if (m_download->get_download().get_chunks_total() <= 0)
throw std::logic_error("WindowPeerList::redraw() m_slotChunksTotal() returned invalid value");