#include <vector>
#include <string>
-using std::vector;
-using std::string;
-
-
+#include <stddef.h>
#include <sys/time.h>
+#include <sys/select.h>
+
+#ifndef APT_10_CLEANER_HEADERS
#include <unistd.h>
+#endif
+
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+using std::string;
+#endif
class pkgAcquireStatus;
friend class Item;
friend class Queue;
- typedef vector<Item *>::iterator ItemIterator;
- typedef vector<Item *>::const_iterator ItemCIterator;
+ typedef std::vector<Item *>::iterator ItemIterator;
+ typedef std::vector<Item *>::const_iterator ItemCIterator;
protected:
* This is built monotonically as items are created and only
* emptied when the download shuts down.
*/
- vector<Item *> Items;
+ std::vector<Item *> Items;
/** \brief The head of the list of active queues.
*
* \return the string-name of the queue in which a fetch request
* for the given URI should be placed.
*/
- string QueueName(string URI,MethodConfig const *&Config);
+ std::string QueueName(std::string URI,MethodConfig const *&Config);
/** \brief Build up the set of file descriptors upon which select() should
* block.
*
* \return the method whose name is Access, or \b NULL if no such method exists.
*/
- MethodConfig *GetConfig(string Access);
+ MethodConfig *GetConfig(std::string Access);
/** \brief Provides information on how a download terminated. */
enum RunResult {
*/
void Shutdown();
- /** \brief Get the first #Worker object.
+ /** \brief Get the first Worker object.
*
* \return the first active worker in this download process.
*/
inline Worker *WorkersBegin() {return Workers;};
- /** \brief Advance to the next #Worker object.
+ /** \brief Advance to the next Worker object.
*
* \return the worker immediately following I, or \b NULL if none
* exists.
*/
- Worker *WorkerStep(Worker *I);
+ Worker *WorkerStep(Worker *I) APT_PURE;
/** \brief Get the head of the list of items. */
inline ItemIterator ItemsBegin() {return Items.begin();};
*
* \return \b true if the directory exists and is readable.
*/
- bool Clean(string Dir);
+ bool Clean(std::string Dir);
/** \return the total size in bytes of all the items included in
* this download.
* only one Acquire class is in action at the time or an empty string
* if no lock file should be used.
*/
- bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
+ bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
/** \brief Construct a new pkgAcquire. */
- pkgAcquire(pkgAcquireStatus *Log) __deprecated;
+ pkgAcquire(pkgAcquireStatus *Log) APT_DEPRECATED;
pkgAcquire();
/** \brief Destroy this pkgAcquire object.
struct pkgAcquire::ItemDesc : public WeakPointable
{
/** \brief The URI from which to download this item. */
- string URI;
+ std::string URI;
/** brief A description of this item. */
- string Description;
+ std::string Description;
/** brief A shorter description of this item. */
- string ShortDesc;
+ std::string ShortDesc;
/** brief The underlying item which is to be downloaded. */
Item *Owner;
};
};
/** \brief The name of this queue. */
- string Name;
+ std::string Name;
/** \brief The head of the list of items contained in this queue.
*
* \return the first item in the queue whose URI is #URI and that
* is being downloaded by #Owner.
*/
- QItem *FindItem(string URI,pkgAcquire::Worker *Owner);
+ QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner) APT_PURE;
/** Presumably this should start downloading an item?
*
* \param Name The name of the new queue.
* \param Owner The download process that owns the new queue.
*/
- Queue(string Name,pkgAcquire *Owner);
+ Queue(std::string Name,pkgAcquire *Owner);
/** Shut down all the worker processes associated with this queue
* and empty the queue.
MethodConfig *Next;
/** \brief The name of this acquire method (e.g., http). */
- string Access;
+ std::string Access;
/** \brief The implementation version of this acquire method. */
- string Version;
+ std::string Version;
/** \brief If \b true, only one download queue should be created for this
* method.
/** \brief The number of items that have been successfully downloaded. */
unsigned long CurrentItems;
+ /** \brief The estimated percentage of the download (0-100)
+ */
+ double Percent;
+
public:
/** \brief If \b true, the download scheduler should call Pulse()
* \todo This is a horrible blocking monster; it should be CPSed
* with prejudice.
*/
- virtual bool MediaChange(string Media,string Drive) = 0;
+ virtual bool MediaChange(std::string Media,std::string Drive) = 0;
/** \brief Invoked when an item is confirmed to be up-to-date.