LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
IDownload Class Referenceabstract

Common interface for all the downloaders. More...

#include "idownload.h"

Classes

struct  Error
 
struct  Success
 

Public Types

using Result = LC::Util::Either< Error, Success >
 

Public Member Functions

virtual qint64 GetDownloadSpeed () const =0
 Returns download speed. More...
 
virtual qint64 GetUploadSpeed () const =0
 Returns upload speed. More...
 
virtual EntityTestHandleResult CouldDownload (const LC::Entity &entity) const =0
 Returns whether plugin can handle given entity. More...
 
virtual QFuture< ResultAddJob (LC::Entity entity)=0
 Adds the job with given parameters. 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 42 of file idownload.h.

Member Typedef Documentation

◆ Result

Definition at line 74 of file idownload.h.

Constructor & Destructor Documentation

◆ ~IDownload()

virtual IDownload::~IDownload ( )
inlinevirtual

Virtual destructor.

Definition at line 130 of file idownload.h.

Member Function Documentation

◆ AddJob()

virtual QFuture<Result> IDownload::AddJob ( LC::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
LC::Entity

◆ CouldDownload()

virtual EntityTestHandleResult IDownload::CouldDownload ( const LC::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
LC::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

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