acquire-item.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: acquire-item.h,v 1.5 1998/11/05 07:21:36 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. void Rename(string From,string To);
  28. public:
  29. // State of the item
  30. enum {StatIdle, StatFetching, StatDone, StatError} Status;
  31. string ErrorText;
  32. // Number of queues we are inserted into
  33. unsigned int QueueCounter;
  34. // File to write the fetch into
  35. string DestFile;
  36. virtual void Failed(string Message);
  37. virtual void Done(string Message,unsigned long Size,string Md5Hash);
  38. virtual string Custom600Headers() {return string();};
  39. Item(pkgAcquire *Owner);
  40. virtual ~Item();
  41. };
  42. // Item class for index files
  43. class pkgAcqIndex : public pkgAcquire::Item
  44. {
  45. protected:
  46. const pkgSourceList::Item *Location;
  47. bool Decompression;
  48. bool Erase;
  49. public:
  50. virtual void Done(string Message,unsigned long Size,string Md5Hash);
  51. virtual string Custom600Headers();
  52. pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
  53. };
  54. // Item class for index files
  55. class pkgAcqIndexRel : public pkgAcquire::Item
  56. {
  57. protected:
  58. const pkgSourceList::Item *Location;
  59. public:
  60. virtual void Done(string Message,unsigned long Size,string Md5Hash);
  61. virtual string Custom600Headers();
  62. pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
  63. };
  64. #endif