]>
Commit | Line | Data |
---|---|---|
0118833a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
30e1eab5 | 3 | // $Id: acquire-item.h,v 1.10 1998/11/22 03:20:31 jgg Exp $ |
0118833a AL |
4 | /* ###################################################################### |
5 | ||
6 | Acquire Item - Item to acquire | |
7 | ||
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. | |
11 | ||
12 | Two item classes are provided to provide functionality for downloading | |
13 | of Index files and downloading of Packages. | |
14 | ||
15 | ##################################################################### */ | |
16 | /*}}}*/ | |
17 | #ifndef PKGLIB_ACQUIRE_ITEM_H | |
18 | #define PKGLIB_ACQUIRE_ITEM_H | |
19 | ||
20 | #include <apt-pkg/acquire.h> | |
21 | #include <apt-pkg/sourcelist.h> | |
03e39e59 | 22 | #include <apt-pkg/pkgrecords.h> |
0118833a AL |
23 | |
24 | #ifdef __GNUG__ | |
25 | #pragma interface "apt-pkg/acquire-item.h" | |
26 | #endif | |
27 | ||
28 | // Item to acquire | |
29 | class pkgAcquire::Item | |
30 | { | |
31 | protected: | |
32 | ||
33 | pkgAcquire *Owner; | |
8267fe24 AL |
34 | inline void QueueURI(ItemDesc &Item) |
35 | {Owner->Enqueue(Item);}; | |
0118833a | 36 | |
8b89e57f AL |
37 | void Rename(string From,string To); |
38 | ||
0118833a AL |
39 | public: |
40 | ||
c88edf1d AL |
41 | // State of the item |
42 | enum {StatIdle, StatFetching, StatDone, StatError} Status; | |
43 | string ErrorText; | |
8267fe24 | 44 | unsigned long FileSize; |
b98f2859 AL |
45 | char *Mode; |
46 | unsigned long ID; | |
8267fe24 | 47 | bool Complete; |
a6568219 | 48 | bool Local; |
30e1eab5 | 49 | |
0a8a80e5 | 50 | // Number of queues we are inserted into |
0118833a | 51 | unsigned int QueueCounter; |
0118833a | 52 | |
0a8a80e5 AL |
53 | // File to write the fetch into |
54 | string DestFile; | |
0118833a | 55 | |
c88edf1d AL |
56 | virtual void Failed(string Message); |
57 | virtual void Done(string Message,unsigned long Size,string Md5Hash); | |
8267fe24 | 58 | virtual void Start(string Message,unsigned long Size); |
30e1eab5 AL |
59 | virtual string Describe() = 0; |
60 | ||
0a8a80e5 AL |
61 | virtual string Custom600Headers() {return string();}; |
62 | ||
0118833a AL |
63 | Item(pkgAcquire *Owner); |
64 | virtual ~Item(); | |
65 | }; | |
66 | ||
67 | // Item class for index files | |
68 | class pkgAcqIndex : public pkgAcquire::Item | |
69 | { | |
70 | protected: | |
71 | ||
72 | const pkgSourceList::Item *Location; | |
8b89e57f | 73 | bool Decompression; |
bfd22fc0 | 74 | bool Erase; |
8267fe24 | 75 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
76 | |
77 | public: | |
78 | ||
8b89e57f | 79 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 80 | virtual string Custom600Headers(); |
30e1eab5 | 81 | virtual string Describe(); |
0118833a AL |
82 | |
83 | pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location); | |
84 | }; | |
85 | ||
86 | // Item class for index files | |
87 | class pkgAcqIndexRel : public pkgAcquire::Item | |
88 | { | |
89 | protected: | |
90 | ||
91 | const pkgSourceList::Item *Location; | |
8267fe24 | 92 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
93 | |
94 | public: | |
95 | ||
8b89e57f | 96 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 97 | virtual string Custom600Headers(); |
30e1eab5 | 98 | virtual string Describe(); |
0a8a80e5 | 99 | |
0118833a AL |
100 | pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location); |
101 | }; | |
102 | ||
03e39e59 AL |
103 | // Item class for archive files |
104 | class pkgAcqArchive : public pkgAcquire::Item | |
105 | { | |
106 | protected: | |
107 | ||
108 | pkgCache::VerIterator Version; | |
109 | pkgAcquire::ItemDesc Desc; | |
110 | pkgSourceList *Sources; | |
111 | pkgRecords *Recs; | |
112 | string MD5; | |
30e1eab5 | 113 | string &StoreFilename; |
03e39e59 AL |
114 | |
115 | public: | |
116 | ||
117 | virtual void Done(string Message,unsigned long Size,string Md5Hash); | |
30e1eab5 | 118 | virtual string Describe(); |
03e39e59 AL |
119 | |
120 | pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, | |
30e1eab5 AL |
121 | pkgRecords *Recs,pkgCache::VerIterator const &Version, |
122 | string &StoreFilename); | |
03e39e59 AL |
123 | }; |
124 | ||
0118833a | 125 | #endif |