]> git.saurik.com Git - apt.git/blob - apt-pkg/acquire-item.h
Fixed problem with not being able to open files
[apt.git] / apt-pkg / acquire-item.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: acquire-item.h,v 1.9 1998/11/13 07:08:50 jgg Exp $
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 #include <apt-pkg/pkgrecords.h>
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;
34 inline void QueueURI(ItemDesc &Item)
35 {Owner->Enqueue(Item);};
36
37 void Rename(string From,string To);
38
39 public:
40
41 // State of the item
42 enum {StatIdle, StatFetching, StatDone, StatError} Status;
43 string ErrorText;
44 unsigned long FileSize;
45 char *Mode;
46 unsigned long ID;
47 bool Complete;
48 bool Local;
49
50 // Number of queues we are inserted into
51 unsigned int QueueCounter;
52
53 // File to write the fetch into
54 string DestFile;
55
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
60 virtual string Custom600Headers() {return string();};
61
62 Item(pkgAcquire *Owner);
63 virtual ~Item();
64 };
65
66 // Item class for index files
67 class pkgAcqIndex : public pkgAcquire::Item
68 {
69 protected:
70
71 const pkgSourceList::Item *Location;
72 bool Decompression;
73 bool Erase;
74 pkgAcquire::ItemDesc Desc;
75
76 public:
77
78 virtual void Done(string Message,unsigned long Size,string Md5Hash);
79 virtual string Custom600Headers();
80
81 pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
82 };
83
84 // Item class for index files
85 class pkgAcqIndexRel : public pkgAcquire::Item
86 {
87 protected:
88
89 const pkgSourceList::Item *Location;
90 pkgAcquire::ItemDesc Desc;
91
92 public:
93
94 virtual void Done(string Message,unsigned long Size,string Md5Hash);
95 virtual string Custom600Headers();
96
97 pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
98 };
99
100 // Item class for archive files
101 class pkgAcqArchive : public pkgAcquire::Item
102 {
103 protected:
104
105 pkgCache::VerIterator Version;
106 pkgAcquire::ItemDesc Desc;
107 pkgSourceList *Sources;
108 pkgRecords *Recs;
109 string MD5;
110
111 public:
112
113 virtual void Done(string Message,unsigned long Size,string Md5Hash);
114
115 pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
116 pkgRecords *Recs,pkgCache::VerIterator const &Version);
117 };
118
119 #endif