// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.h,v 1.29.2.1 2003/12/24 23:09:17 mdz Exp $
/* ######################################################################
Acquire - File Acquiration
- This module contians the Acquire system. It is responsible for bringing
+ This module contains the Acquire system. It is responsible for bringing
files into the local pathname space. It deals with URIs for files and
URI handlers responsible for downloading or finding the URIs.
/** \brief FD of the Lock file we acquire in Setup (if any) */
int LockFD;
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
public:
*
* \param WSet The set of file descriptors that are ready for
* output.
+ *
+ * \return false if there is an error condition on one of the fds
*/
- virtual void RunFds(fd_set *RSet,fd_set *WSet);
+ bool RunFdsSane(fd_set *RSet,fd_set *WSet);
+
+ // just here for compatbility, needs to be removed on the next
+ // ABI/API break. RunFdsSane() is what should be used as it
+ // returns if there is an error condition on one of the fds
+ virtual void RunFds(fd_set *RSet,fd_set *WSet);
/** \brief Check for idle queues with ready-to-fetch items.
*
/** \brief Get the head of the list of items. */
inline ItemIterator ItemsBegin() {return Items.begin();};
+ inline ItemCIterator ItemsBegin() const {return Items.begin();};
/** \brief Get the end iterator of the list of items. */
inline ItemIterator ItemsEnd() {return Items.end();};
+ inline ItemCIterator ItemsEnd() const {return Items.end();};
// Iterate over queued Item URIs
class UriIterator;
* if no lock file should be used. If set also all needed directories
* will be created.
*/
- APT_DEPRECATED bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
+ APT_DEPRECATED_MSG("Use constructors, .SetLog and .GetLock as needed") bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
bool GetLock(std::string const &Lock);
/** \brief Construct a new pkgAcquire. */
- pkgAcquire(pkgAcquireStatus *Log);
+ explicit pkgAcquire(pkgAcquireStatus *Log);
pkgAcquire();
/** \brief Destroy this pkgAcquire object.
friend class pkgAcquire::Worker;
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
/** \brief The next queue in the pkgAcquire object's list of queues. */
Queue *Next;
protected:
/** \brief A single item placed in this queue. */
- struct QItem : public WeakPointable
+ struct QItem : public ItemDesc
{
/** \brief The next item in the queue. */
QItem *Next;
/** \brief The worker associated with this item, if any. */
pkgAcquire::Worker *Worker;
- /** \brief The URI from which to download this item. */
- std::string URI;
- /** \brief A description of this item. */
- std::string Description;
- /** \brief A shorter description of this item. */
- std::string ShortDesc;
/** \brief The underlying items interested in the download */
std::vector<Item*> Owners;
- // both, backward compatibility and easy access as syncing is interal
- Item * Owner;
typedef std::vector<Item*>::const_iterator owner_iterator;
* \param Name The name of the new queue.
* \param Owner The download process that owns the new queue.
*/
- Queue(std::string Name,pkgAcquire *Owner);
+ Queue(std::string const &Name,pkgAcquire * const Owner);
/** Shut down all the worker processes associated with this queue
* and empty the queue.
class pkgAcquire::UriIterator
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
/** The next queue to iterate over. */
pkgAcquire::Queue *CurQ;
*
* \param Q The queue over which this UriIterator should iterate.
*/
- UriIterator(pkgAcquire::Queue *Q) : d(NULL), CurQ(Q), CurItem(0)
- {
- while (CurItem == 0 && CurQ != 0)
- {
- CurItem = CurQ->Items;
- CurQ = CurQ->Next;
- }
- }
+ explicit UriIterator(pkgAcquire::Queue *Q);
virtual ~UriIterator();
};
/*}}}*/
struct pkgAcquire::MethodConfig
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
/** \brief The next link on the acquire method list.
*
class pkgAcquireStatus
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
protected: