DownloadList Class Reference

DownloadList is a container for Download objects, wrapping around PartData objects. More...

#include <downloadlist.h>

List of all members.


Public Member Functions

Iter begin ()
Iter end ()
Downloadfind (const Hash< ED2KHash > &hash) const
 Find a specific download, searching with hash.
bool valid (Download *ptr) const
 Check the validity of a Download pointer.
DownloadgetNextForUdpQuery ()
 Selects next download for sending ServerUDP query to.

Static Public Member Functions

static DownloadListinstance ()

Public Attributes

boost::signal< void(Download &)> onRemoved
 Emitted when a download is removed.
boost::signal< void(Download &)> onAdded
 Emitted when a download is added.

Private Member Functions

 DownloadList ()
 DownloadList (const DownloadList &)
 ~DownloadList ()
DownloadListoperator= (const DownloadList &)
void init ()
 Initialize this class.
void exit ()
 Exit this class.
void onPDEvent (PartData *pd, int evt)
void onSFEvent (SharedFile *sf, int evt)
void tryAddFile (SharedFile *sf)
 Try to add a SharedFile to the list.

Private Attributes

boost::scoped_ptr< Detail::MIDownloadListm_list
 List implementation.

Friends

class ED2K

Classes

class  Iter
 Iterator for the underlying implementation. More...

Detailed Description

DownloadList is a container for Download objects, wrapping around PartData objects.

The purpose is to provide a simpler and faster interface than FilesList, and to provide some ed2k-specific features that FilesList cannot offer.

Two public signals declared in this class indicate when new downloads are added or removed. Iterating on the list can be done using nested type Iter, and begin() / end() functions.

Definition at line 134 of file downloadlist.h.


Constructor & Destructor Documentation

DownloadList::DownloadList  )  [private]
 

Definition at line 171 of file downloadlist.cpp.

References m_list.

DownloadList::DownloadList const DownloadList  )  [private]
 

DownloadList::~DownloadList  )  [private]
 

Definition at line 172 of file downloadlist.cpp.

References s_downloadList.


Member Function Documentation

DownloadList::Iter DownloadList::begin  ) 
 

Returns:
Iterator to the beginning of the list

Definition at line 173 of file downloadlist.cpp.

References m_list.

Referenced by init(), and ServerList::reqSources().

DownloadList::Iter DownloadList::end  ) 
 

Returns:
Returns iterator to one-past-end of the list

Definition at line 177 of file downloadlist.cpp.

References m_list.

Referenced by init(), and ServerList::reqSources().

DownloadList & DownloadList::instance  )  [static]
 

Returns:
Reference to the only instance of this Singleton class

Definition at line 182 of file downloadlist.cpp.

References s_downloadList.

Referenced by ClientList::addSource(), ServerList::init(), ED2K::onExit(), ED2K::onInit(), Client::onPacket(), ServerList::reqSources(), and ServerList::udpGetSources().

Download * DownloadList::find const Hash< ED2KHash > &  hash  )  const
 

Find a specific download, searching with hash.

Parameters:
hash Hash to be searched for
Returns:
Pointer to the file, or 0 if not found

Definition at line 272 of file downloadlist.cpp.

References m_list.

Referenced by ClientList::addSource(), ServerList::load(), and Client::onPacket().

bool DownloadList::valid Download ptr  )  const
 

Check the validity of a Download pointer.

Parameters:
ptr Pointer to check validity
Returns:
True if the pointer is valid; false otherwise

Definition at line 277 of file downloadlist.cpp.

References m_list.

Download * DownloadList::getNextForUdpQuery  ) 
 

Selects next download for sending ServerUDP query to.

Returns:
Download to be queried, or 0 if something goes wrong

Definition at line 258 of file downloadlist.cpp.

References m_list.

Referenced by ServerList::udpGetSources().

DownloadList& DownloadList::operator= const DownloadList  )  [private]
 

void DownloadList::init  )  [private]
 

Initialize this class.

Definition at line 189 of file downloadlist.cpp.

References begin(), end(), m_list, onPDEvent(), onSFEvent(), TRACE_SRCEXCH, and tryAddFile().

Referenced by ED2K::onInit().

void DownloadList::exit  )  [private]
 

Exit this class.

Definition at line 207 of file downloadlist.cpp.

References m_list.

Referenced by ED2K::onExit().

void DownloadList::onPDEvent PartData *  pd,
int  evt
[private]
 

Definition at line 238 of file downloadlist.cpp.

References m_list, and onRemoved.

Referenced by init().

void DownloadList::onSFEvent SharedFile *  sf,
int  evt
[private]
 

Definition at line 252 of file downloadlist.cpp.

References tryAddFile().

Referenced by init().

void DownloadList::tryAddFile SharedFile *  sf  )  [private]
 

Try to add a SharedFile to the list.

The file needs to have ed2k- compatible hashes, must be <4gb in size and must be partial to be added to the list. If addition succeeds, onAdded() signal is emitted.

Parameters:
file SharedFile to be added

Definition at line 213 of file downloadlist.cpp.

References m_list, and onAdded.

Referenced by init(), and onSFEvent().


Friends And Related Function Documentation

friend class ED2K [friend]
 

Definition at line 202 of file downloadlist.h.


Member Data Documentation

boost::signal<void (Download&)> DownloadList::onRemoved
 

Emitted when a download is removed.

Definition at line 193 of file downloadlist.h.

Referenced by onPDEvent().

boost::signal<void (Download&)> DownloadList::onAdded
 

Emitted when a download is added.

Definition at line 195 of file downloadlist.h.

Referenced by ServerList::init(), and tryAddFile().

boost::scoped_ptr<Detail::MIDownloadList> DownloadList::m_list [private]
 

List implementation.

Definition at line 219 of file downloadlist.h.

Referenced by begin(), DownloadList(), end(), exit(), find(), getNextForUdpQuery(), init(), onPDEvent(), tryAddFile(), and valid().


The documentation for this class was generated from the following files: