]>
Commit | Line | Data |
---|---|---|
0118833a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
b98f2859 | 3 | // $Id: acquire-item.h,v 1.7 1998/11/11 06:54:14 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> | |
22 | ||
23 | #ifdef __GNUG__ | |
24 | #pragma interface "apt-pkg/acquire-item.h" | |
25 | #endif | |
26 | ||
27 | // Item to acquire | |
28 | class pkgAcquire::Item | |
29 | { | |
30 | protected: | |
31 | ||
32 | pkgAcquire *Owner; | |
8267fe24 AL |
33 | inline void QueueURI(ItemDesc &Item) |
34 | {Owner->Enqueue(Item);}; | |
0118833a | 35 | |
8b89e57f AL |
36 | void Rename(string From,string To); |
37 | ||
0118833a AL |
38 | public: |
39 | ||
c88edf1d AL |
40 | // State of the item |
41 | enum {StatIdle, StatFetching, StatDone, StatError} Status; | |
42 | string ErrorText; | |
8267fe24 | 43 | unsigned long FileSize; |
b98f2859 AL |
44 | char *Mode; |
45 | unsigned long ID; | |
8267fe24 | 46 | bool Complete; |
c88edf1d | 47 | |
0a8a80e5 | 48 | // Number of queues we are inserted into |
0118833a | 49 | unsigned int QueueCounter; |
0118833a | 50 | |
0a8a80e5 AL |
51 | // File to write the fetch into |
52 | string DestFile; | |
0118833a | 53 | |
c88edf1d AL |
54 | virtual void Failed(string Message); |
55 | virtual void Done(string Message,unsigned long Size,string Md5Hash); | |
8267fe24 | 56 | virtual void Start(string Message,unsigned long Size); |
c88edf1d | 57 | |
0a8a80e5 AL |
58 | virtual string Custom600Headers() {return string();}; |
59 | ||
0118833a AL |
60 | Item(pkgAcquire *Owner); |
61 | virtual ~Item(); | |
62 | }; | |
63 | ||
64 | // Item class for index files | |
65 | class pkgAcqIndex : public pkgAcquire::Item | |
66 | { | |
67 | protected: | |
68 | ||
69 | const pkgSourceList::Item *Location; | |
8b89e57f | 70 | bool Decompression; |
bfd22fc0 | 71 | bool Erase; |
8267fe24 | 72 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
73 | |
74 | public: | |
75 | ||
8b89e57f | 76 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 77 | virtual string Custom600Headers(); |
0118833a AL |
78 | |
79 | pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location); | |
80 | }; | |
81 | ||
82 | // Item class for index files | |
83 | class pkgAcqIndexRel : public pkgAcquire::Item | |
84 | { | |
85 | protected: | |
86 | ||
87 | const pkgSourceList::Item *Location; | |
8267fe24 | 88 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
89 | |
90 | public: | |
91 | ||
8b89e57f | 92 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 AL |
93 | virtual string Custom600Headers(); |
94 | ||
0118833a AL |
95 | pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location); |
96 | }; | |
97 | ||
0118833a | 98 | #endif |