]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire.h
Source record file list parsing
[apt.git] / apt-pkg / acquire.h
index dc3896d3fc8b1656597b9b8850397bde59b75c43..156fc7aaec373779a799e610cf1750be69b8a0ca 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire.h,v 1.16 1998/12/04 21:16:49 jgg Exp $
+// $Id: acquire.h,v 1.20 1999/03/27 03:02:39 jgg Exp $
 /* ######################################################################
 
    Acquire - File Acquiration
@@ -98,13 +98,19 @@ class pkgAcquire
    Worker *WorkerStep(Worker *I);
    inline Item **ItemsBegin() {return Items.begin();};
    inline Item **ItemsEnd() {return Items.end();};
-
+   
+   // Iterate over queued Item URIs
+   class UriIterator;
+   UriIterator UriBegin();
+   UriIterator UriEnd();
+   
    // Cleans out the download dir
    bool Clean(string Dir);
 
    // Returns the size of the total download set
    unsigned long TotalNeeded();
    unsigned long FetchNeeded();
+   unsigned long PartialPresent();
    
    pkgAcquire(pkgAcquireStatus *Log = 0);
    ~pkgAcquire();
@@ -123,6 +129,7 @@ struct pkgAcquire::ItemDesc
 class pkgAcquire::Queue
 {
    friend pkgAcquire;
+   friend pkgAcquire::UriIterator;
    Queue *Next;
    
    protected:
@@ -149,6 +156,8 @@ class pkgAcquire::Queue
    QItem *Items;
    pkgAcquire::Worker *Workers;
    pkgAcquire *Owner;
+   signed long PipeDepth;
+   unsigned long MaxPipeDepth;
    
    public:
    
@@ -170,6 +179,40 @@ class pkgAcquire::Queue
    ~Queue();
 };
 
+class pkgAcquire::UriIterator
+{
+   pkgAcquire::Queue *CurQ;
+   pkgAcquire::Queue::QItem *CurItem;
+   
+   public:
+   
+   // Advance to the next item
+   inline void operator ++() {operator ++();};
+   void operator ++(int)
+   {
+      CurItem = CurItem->Next;
+      while (CurItem == 0 && CurQ != 0)
+      {
+        CurItem = CurQ->Items;
+        CurQ = CurQ->Next;
+      }
+   };
+   
+   // Accessors
+   inline pkgAcquire::ItemDesc const *operator ->() const {return CurItem;};
+   inline bool operator !=(UriIterator const &rhs) const {return rhs.CurQ != CurQ || rhs.CurItem != CurItem;};
+   inline bool operator ==(UriIterator const &rhs) const {return rhs.CurQ == CurQ && rhs.CurItem == CurItem;};
+   
+   UriIterator(pkgAcquire::Queue *Q) : CurQ(Q), CurItem(0)
+   {
+      while (CurItem == 0 && CurQ != 0)
+      {
+        CurItem = CurQ->Items;
+        CurQ = CurQ->Next;
+      }
+   }   
+};
+
 // Configuration information from each method
 struct pkgAcquire::MethodConfig
 {