LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
IDownload Class Referenceabstract

Common interface for all the downloaders. More...

#include "idownload.h"

Public Types

enum  Error {
  EUnknown,
  ENoError,
  ENotFound,
  EAccessDenied,
  ELocalError
}
 
typedef unsigned long int JobID_t
 

Public Member Functions

virtual qint64 GetDownloadSpeed () const =0
 Returns download speed. More...
 
virtual qint64 GetUploadSpeed () const =0
 Returns upload speed. More...
 
virtual void StartAll ()=0
 Starts all tasks. More...
 
virtual void StopAll ()=0
 Stops all tasks. More...
 
virtual EntityTestHandleResult CouldDownload (const LeechCraft::Entity &entity) const =0
 Returns whether plugin can handle given entity. More...
 
virtual int AddJob (LeechCraft::Entity entity)=0
 Adds the job with given parameters. More...
 
virtual void KillTask (int id)=0
 Kills the task with the given id. More...
 
virtual ~IDownload ()
 Virtual destructor. More...
 

Detailed Description

Common interface for all the downloaders.

Plugins which provide downloading capabilities and want to be visible by LeechCraft and other plugins as download providers should implement this interface.

Plugins implementing this interface are expected to have following signals:

  • jobFinished (int id) Indicates that a job with a given id has finished.
  • jobFinished (int id) Indicates that a job with a given id has been removed.
  • handleJobError (int id, IDownload::Error error) Indicates that an error occured while downloading a job with the given id.

In order to obtain IDs for the tasks plugins are expected to use ICoreProxy::GetID() in order to avoid name clashes.

See also
IJobHolder, IEntityHandler

Definition at line 62 of file idownload.h.

Member Typedef Documentation

◆ JobID_t

typedef unsigned long int IDownload::JobID_t

Definition at line 73 of file idownload.h.

Member Enumeration Documentation

◆ Error

Enumerator
EUnknown 
ENoError 
ENotFound 
EAccessDenied 
ELocalError 

Definition at line 65 of file idownload.h.

Constructor & Destructor Documentation

◆ ~IDownload()

virtual IDownload::~IDownload ( )
inlinevirtual

Virtual destructor.

Definition at line 152 of file idownload.h.

Member Function Documentation

◆ AddJob()

virtual int IDownload::AddJob ( LeechCraft::Entity  entity)
pure virtual

Adds the job with given parameters.

Adds the job to the downloader and returns the ID of the newly added job back to identify it.

Parameters
[in]entityA Entity structure.
Returns
ID of the job for the other plugins to use.
See also
LeechCraft::Entity

◆ CouldDownload()

virtual EntityTestHandleResult IDownload::CouldDownload ( const LeechCraft::Entity entity) const
pure virtual

Returns whether plugin can handle given entity.

This function is used to query every loaded plugin providing the IDownload interface whether it could handle the entity entered by user or generated automatically with given task parameters. Entity could be anything from file name to URL to all kinds of hashes like Magnet links.

Parameters
[in]entityA Entity structure.
Returns
The result of the test whether the entity can be handled.
See also
AddJob
LeechCraft::Entity

◆ GetDownloadSpeed()

virtual qint64 IDownload::GetDownloadSpeed ( ) const
pure virtual

Returns download speed.

Returns summed up download speed of the plugin. The value is primarily used in the interface as there are no ways of controlling of bandwidth's usage of a particular plugin.

Returns
Download speed in bytes.
See also
GetUploadSpeed

◆ GetUploadSpeed()

virtual qint64 IDownload::GetUploadSpeed ( ) const
pure virtual

Returns upload speed.

Returns summed up upload speed of the plugin. The value is primarily used in the interface as there are no ways of controlling of bandwidth's usage of a particular plugin.

Returns
Upload speed in bytes.
See also
GetDownloadSpeed

◆ KillTask()

virtual void IDownload::KillTask ( int  id)
pure virtual

Kills the task with the given id.

Kills the task with the id previously returned from AddJob. If there is no such task, the function shall leave the downloader in a good state. Ignoring will do.

Parameters
[in]idID of the task previously added with AddJob().

◆ StartAll()

virtual void IDownload::StartAll ( )
pure virtual

Starts all tasks.

This is called by LeechCraft when it wants all plugins to start all of its tasks.

◆ StopAll()

virtual void IDownload::StopAll ( )
pure virtual

Stops all tasks.

This is called by LeechCraft when it wants all plugins to stop all of its tasks.


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