]> git.saurik.com Git - apt.git/blame - apt-pkg/acquire-item.h
More or less working acquire system
[apt.git] / apt-pkg / acquire-item.h
CommitLineData
0118833a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
8267fe24 3// $Id: acquire-item.h,v 1.6 1998/11/09 01:09:21 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
28class 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
AL
43 unsigned long FileSize;
44 bool Complete;
c88edf1d 45
0a8a80e5 46 // Number of queues we are inserted into
0118833a 47 unsigned int QueueCounter;
0118833a 48
0a8a80e5
AL
49 // File to write the fetch into
50 string DestFile;
0118833a 51
c88edf1d
AL
52 virtual void Failed(string Message);
53 virtual void Done(string Message,unsigned long Size,string Md5Hash);
8267fe24 54 virtual void Start(string Message,unsigned long Size);
c88edf1d 55
0a8a80e5
AL
56 virtual string Custom600Headers() {return string();};
57
0118833a
AL
58 Item(pkgAcquire *Owner);
59 virtual ~Item();
60};
61
62// Item class for index files
63class pkgAcqIndex : public pkgAcquire::Item
64{
65 protected:
66
67 const pkgSourceList::Item *Location;
8b89e57f 68 bool Decompression;
bfd22fc0 69 bool Erase;
8267fe24 70 pkgAcquire::ItemDesc Desc;
0118833a
AL
71
72 public:
73
8b89e57f 74 virtual void Done(string Message,unsigned long Size,string Md5Hash);
0a8a80e5 75 virtual string Custom600Headers();
0118833a
AL
76
77 pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
78};
79
80// Item class for index files
81class pkgAcqIndexRel : public pkgAcquire::Item
82{
83 protected:
84
85 const pkgSourceList::Item *Location;
8267fe24 86 pkgAcquire::ItemDesc Desc;
0118833a
AL
87
88 public:
89
8b89e57f 90 virtual void Done(string Message,unsigned long Size,string Md5Hash);
0a8a80e5
AL
91 virtual string Custom600Headers();
92
0118833a
AL
93 pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
94};
95
0118833a 96#endif