acquire-item.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: acquire-item.h,v 1.3 1998/10/24 04:57:57 jgg Exp $
  4. /* ######################################################################
  5. Acquire Item - Item to acquire
  6. When an item is instantiated it will add it self to the local list in
  7. the Owner Acquire class. Derived classes will then call QueueURI to
  8. register all the URI's they wish to fetch for at the initial moment.
  9. Two item classes are provided to provide functionality for downloading
  10. of Index files and downloading of Packages.
  11. ##################################################################### */
  12. /*}}}*/
  13. #ifndef PKGLIB_ACQUIRE_ITEM_H
  14. #define PKGLIB_ACQUIRE_ITEM_H
  15. #include <apt-pkg/acquire.h>
  16. #include <apt-pkg/sourcelist.h>
  17. #ifdef __GNUG__
  18. #pragma interface "apt-pkg/acquire-item.h"
  19. #endif
  20. // Item to acquire
  21. class pkgAcquire::Item
  22. {
  23. protected:
  24. pkgAcquire *Owner;
  25. inline void QueueURI(string URI,string Description)
  26. {Owner->Enqueue(this,URI,Description);};
  27. public:
  28. // State of the item
  29. enum {StatIdle, StatFetching, StatDone, StatError} Status;
  30. string ErrorText;
  31. // Number of queues we are inserted into
  32. unsigned int QueueCounter;
  33. // File to write the fetch into
  34. string DestFile;
  35. virtual void Failed(string Message);
  36. virtual void Done(string Message,unsigned long Size,string Md5Hash);
  37. virtual string Custom600Headers() {return string();};
  38. Item(pkgAcquire *Owner);
  39. virtual ~Item();
  40. };
  41. // Item class for index files
  42. class pkgAcqIndex : public pkgAcquire::Item
  43. {
  44. protected:
  45. const pkgSourceList::Item *Location;
  46. public:
  47. virtual string Custom600Headers();
  48. pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
  49. };
  50. // Item class for index files
  51. class pkgAcqIndexRel : public pkgAcquire::Item
  52. {
  53. protected:
  54. const pkgSourceList::Item *Location;
  55. public:
  56. virtual void Done(string Message,unsigned long Size,string Md5Hash);
  57. virtual string Custom600Headers();
  58. pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
  59. };
  60. #endif