Half done the http queue.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@264 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-02-09 23:36:27 +00:00
parent f7144a333f
commit deb1244d8c
11 changed files with 207 additions and 125 deletions
+4 -19
View File
@@ -2,7 +2,8 @@
#include <stdexcept>
#include <algorithm>
#include <functional>
#include "functional.h"
#include "canvas.h"
#include "manager.h"
@@ -10,22 +11,6 @@
namespace display {
template <typename Type, typename Ftor>
struct _accumulate {
_accumulate(Type& t, Ftor f) : m_t(t), m_f(f) {}
template <typename Arg>
void operator () (Arg& a) { m_t += m_f(a); }
Type& m_t;
Ftor m_f;
};
template <typename Type, typename Ftor>
_accumulate<Type, Ftor> accumulate(Type& t, Ftor f) {
return _accumulate<Type, Ftor>(t, f);
}
Manager::iterator
Manager::erase(Window* w) {
iterator itr = std::find(begin(), end(), w);
@@ -41,8 +26,8 @@ Manager::adjust_layout() {
int countDynamic = 0;
int staticHeight = 0;
std::for_each(begin(), end(), accumulate(staticHeight, std::mem_fun(&Window::get_min_height)));
std::for_each(begin(), end(), accumulate(countDynamic, std::mem_fun(&Window::is_dynamic)));
std::for_each(begin(), end(), func::accumulate(staticHeight, std::mem_fun(&Window::get_min_height)));
std::for_each(begin(), end(), func::accumulate(countDynamic, std::mem_fun(&Window::is_dynamic)));
int dynamic = std::max(0, Canvas::get_screen_height() - staticHeight);
int height = 0, h;