mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-11 16:49:22 +00:00
Removed algorithms from path_input.cc.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@358 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -13,4 +13,12 @@ allowed since the tracker set a min interval.
|
|||||||
|
|
||||||
Make accumulate return the value, no refs please...
|
Make accumulate return the value, no refs please...
|
||||||
|
|
||||||
!!! Clean up logs at regular intervals.
|
> - listing the total upload / download bandwidth at the bottom of the
|
||||||
|
> screen;
|
||||||
|
|
||||||
|
> - seeing the number of seeds / leechers of a torrent on the main
|
||||||
|
> screen (and the level of distribution between leechers);
|
||||||
|
|
||||||
|
> - being able to delete not just the torrent file, but the files it
|
||||||
|
> created from rtorrent. Like when you start a torrent, but it is too
|
||||||
|
> slow or broken or for various reasons you don't want to download it.
|
||||||
|
|||||||
+1
-40
@@ -23,51 +23,12 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <rak/algorithm.h>
|
||||||
|
|
||||||
#include "path_input.h"
|
#include "path_input.h"
|
||||||
|
|
||||||
namespace input {
|
namespace input {
|
||||||
|
|
||||||
struct
|
|
||||||
string_starts_with : public std::binary_function<std::string, std::string, bool> {
|
|
||||||
bool operator () (const std::string& complete, const std::string& base) const {
|
|
||||||
return !complete.compare(0, base.size(), base);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename _InputIter>
|
|
||||||
typename std::iterator_traits<_InputIter>::difference_type
|
|
||||||
count_base(_InputIter __first1, _InputIter __last1,
|
|
||||||
_InputIter __first2, _InputIter __last2) {
|
|
||||||
|
|
||||||
typename std::iterator_traits<_InputIter>::difference_type __n = 0;
|
|
||||||
|
|
||||||
for ( ;__first1 != __last1 && __first2 != __last2; ++__first1, ++__first2, ++__n)
|
|
||||||
if (*__first1 != *__first2)
|
|
||||||
return __n;
|
|
||||||
|
|
||||||
return __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename _InputIter>
|
|
||||||
std::string
|
|
||||||
make_base(_InputIter __first, _InputIter __last) {
|
|
||||||
if (__first == __last)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
std::string __base = *__first++;
|
|
||||||
|
|
||||||
for ( ;__first != __last; ++__first) {
|
|
||||||
std::string::size_type __pos = count_base(__base.begin(), __base.end(),
|
|
||||||
__first->begin(), __first->end());
|
|
||||||
|
|
||||||
if (__pos < __base.size())
|
|
||||||
__base.resize(__pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __base;
|
|
||||||
}
|
|
||||||
|
|
||||||
PathInput::PathInput() {
|
PathInput::PathInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user