]>
git.saurik.com Git - apt.git/blob - apt-pkg/acquire-item.h
4a2a4e38559148fbe7efe43ae70d3b4b9679ae37
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: acquire-item.h,v 1.11 1998/12/11 06:01:25 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 A Archive class is provided for downloading .deb files. It does Md5
16 checking and source location.
18 ##################################################################### */
20 #ifndef PKGLIB_ACQUIRE_ITEM_H
21 #define PKGLIB_ACQUIRE_ITEM_H
23 #include <apt-pkg/acquire.h>
24 #include <apt-pkg/sourcelist.h>
25 #include <apt-pkg/pkgrecords.h>
28 #pragma interface "apt-pkg/acquire-item.h"
32 class pkgAcquire::Item
37 inline void QueueURI(ItemDesc
&Item
)
38 {Owner
->Enqueue(Item
);};
40 void Rename(string From
,string To
);
45 enum {StatIdle
, StatFetching
, StatDone
, StatError
} Status
;
47 unsigned long FileSize
;
53 // Number of queues we are inserted into
54 unsigned int QueueCounter
;
56 // File to write the fetch into
59 virtual void Failed(string Message
);
60 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
61 virtual void Start(string Message
,unsigned long Size
);
62 virtual string
Describe() = 0;
64 virtual string
Custom600Headers() {return string();};
66 Item(pkgAcquire
*Owner
);
70 // Item class for index files
71 class pkgAcqIndex
: public pkgAcquire::Item
75 const pkgSourceList::Item
*Location
;
78 pkgAcquire::ItemDesc Desc
;
82 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
83 virtual string
Custom600Headers();
84 virtual string
Describe();
86 pkgAcqIndex(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
);
89 // Item class for index files
90 class pkgAcqIndexRel
: public pkgAcquire::Item
94 const pkgSourceList::Item
*Location
;
95 pkgAcquire::ItemDesc Desc
;
99 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
100 virtual string
Custom600Headers();
101 virtual string
Describe();
103 pkgAcqIndexRel(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
);
106 // Item class for archive files
107 class pkgAcqArchive
: public pkgAcquire::Item
111 pkgCache::VerIterator Version
;
112 pkgAcquire::ItemDesc Desc
;
113 pkgSourceList
*Sources
;
116 string
&StoreFilename
;
117 pkgCache::VerFileIterator Vf
;
123 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
124 virtual string
Describe();
126 pkgAcqArchive(pkgAcquire
*Owner
,pkgSourceList
*Sources
,
127 pkgRecords
*Recs
,pkgCache::VerIterator
const &Version
,
128 string
&StoreFilename
);