]>
git.saurik.com Git - apt.git/blob - apt-pkg/acquire-item.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: acquire-item.h,v 1.10 1998/11/22 03:20:31 jgg Exp $
4 /* ######################################################################
6 Acquire Item - Item to acquire
8 When an item is instantiated it will add it self to the local list in
9 the Owner Acquire class. Derived classes will then call QueueURI to
10 register all the URI's they wish to fetch for at the initial moment.
12 Two item classes are provided to provide functionality for downloading
13 of Index files and downloading of Packages.
15 ##################################################################### */
17 #ifndef PKGLIB_ACQUIRE_ITEM_H
18 #define PKGLIB_ACQUIRE_ITEM_H
20 #include <apt-pkg/acquire.h>
21 #include <apt-pkg/sourcelist.h>
22 #include <apt-pkg/pkgrecords.h>
25 #pragma interface "apt-pkg/acquire-item.h"
29 class pkgAcquire::Item
34 inline void QueueURI(ItemDesc
&Item
)
35 {Owner
->Enqueue(Item
);};
37 void Rename(string From
,string To
);
42 enum {StatIdle
, StatFetching
, StatDone
, StatError
} Status
;
44 unsigned long FileSize
;
50 // Number of queues we are inserted into
51 unsigned int QueueCounter
;
53 // File to write the fetch into
56 virtual void Failed(string Message
);
57 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
58 virtual void Start(string Message
,unsigned long Size
);
59 virtual string
Describe() = 0;
61 virtual string
Custom600Headers() {return string();};
63 Item(pkgAcquire
*Owner
);
67 // Item class for index files
68 class pkgAcqIndex
: public pkgAcquire::Item
72 const pkgSourceList::Item
*Location
;
75 pkgAcquire::ItemDesc Desc
;
79 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
80 virtual string
Custom600Headers();
81 virtual string
Describe();
83 pkgAcqIndex(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
);
86 // Item class for index files
87 class pkgAcqIndexRel
: public pkgAcquire::Item
91 const pkgSourceList::Item
*Location
;
92 pkgAcquire::ItemDesc Desc
;
96 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
97 virtual string
Custom600Headers();
98 virtual string
Describe();
100 pkgAcqIndexRel(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
);
103 // Item class for archive files
104 class pkgAcqArchive
: public pkgAcquire::Item
108 pkgCache::VerIterator Version
;
109 pkgAcquire::ItemDesc Desc
;
110 pkgSourceList
*Sources
;
113 string
&StoreFilename
;
117 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
118 virtual string
Describe();
120 pkgAcqArchive(pkgAcquire
*Owner
,pkgSourceList
*Sources
,
121 pkgRecords
*Recs
,pkgCache::VerIterator
const &Version
,
122 string
&StoreFilename
);