jigdo API

Download::Output Class Reference

A derived class of Output must be supplied by the user of Download, to take care of the downloaded data and to output progress reports. More...

#include <download.hh>

Inheritance diagram for Download::Output:

Job::SingleUrl Job::MakeImageDl::JigdoDownload

List of all members.


Public Member Functions

virtual ~Output ()
 The Download object does *not* delete its Output.
virtual void download_dataSize (uint64 n)=0
 Called as soon as the size of the downloaded data is known.
virtual void download_data (const byte *data, unsigned size, uint64 currentSize)=0
 Called during download whenever data arrives, with the data that just arrived.
virtual void download_succeeded ()=0
 Called when download is complete.
virtual void download_failed (string *message)=0
 Short progress message ("Timeout", "404 not found") which means that the download has failed.
virtual void download_message (string *message)=0
 Short progress message ("Looking up host", "Connecting" etc).

Detailed Description

A derived class of Output must be supplied by the user of Download, to take care of the downloaded data and to output progress reports.


Constructor & Destructor Documentation

virtual Download::Output::~Output (  )  [inline, virtual]

The Download object does *not* delete its Output.


Member Function Documentation

virtual void Download::Output::download_dataSize ( uint64  n  )  [pure virtual]

Called as soon as the size of the downloaded data is known.

May not be called at all if the size is unknown. May be called before the first download_data() or sometime afterwards. Problem with libwww: Returns size as long int - 2 GB size limit!

virtual void Download::Output::download_data ( const byte *  data,
unsigned  size,
uint64  currentSize 
) [pure virtual]

Called during download whenever data arrives, with the data that just arrived.

You can write the data to a file, copy it away etc. currentSize is the offset into the downloaded data (including the "size" new bytes) - useful for "x% done" messages.

virtual void Download::Output::download_succeeded (  )  [pure virtual]

Called when download is complete.

If this is called, you may want to check whether dataSize() was ever called, and if it was, check whether currentSize == dataSize. If this is not the case (i.e. less data was received than the amount promised by the server), consider resume()ing the download.

virtual void Download::Output::download_failed ( string *  message  )  [pure virtual]

Short progress message ("Timeout", "404 not found") which means that the download has failed.

From now on, Download::failed() will be true. Message is always valid UTF-8

virtual void Download::Output::download_message ( string *  message  )  [pure virtual]

Short progress message ("Looking up host", "Connecting" etc).

As a special case, an empty string indicates that the download proper has begun. Message is always valid UTF-8


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

Generated on Tue Sep 23 14:27:42 2008 for jigdo by  doxygen 1.5.6