dirstream.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: dirstream.h,v 1.2 2001/02/20 07:03:16 jgg Exp $
  4. /* ######################################################################
  5. Directory Stream
  6. When unpacking the contents of the archive are passed into a directory
  7. stream class for analysis and processing. The class controls all aspects
  8. of actually writing the directory stream from disk. The low level
  9. archive handlers are only responsible for decoding the archive format
  10. and sending events (via method calls) to the specified directory
  11. stream.
  12. When unpacking a real file the archive handler is passed back a file
  13. handle to write the data to, this is to support strange
  14. archives+unpacking methods. If that fd is -1 then the file data is
  15. simply ignored.
  16. The provided defaults do the 'Right Thing' for a normal unpacking
  17. process (ie 'tar')
  18. ##################################################################### */
  19. /*}}}*/
  20. #ifndef PKGLIB_DIRSTREAM_H
  21. #define PKGLIB_DIRSTREAM_H
  22. #include <apt-pkg/macros.h>
  23. class pkgDirStream
  24. {
  25. public:
  26. // All possible information about a component
  27. struct Item
  28. {
  29. enum Type_t {File, HardLink, SymbolicLink, CharDevice, BlockDevice,
  30. Directory, FIFO} Type;
  31. char *Name;
  32. char *LinkTarget;
  33. #if APT_PKG_ABI >= 413
  34. unsigned long long Size;
  35. #endif
  36. unsigned long Mode;
  37. unsigned long UID;
  38. unsigned long GID;
  39. #if APT_PKG_ABI < 413
  40. unsigned long Size;
  41. #endif
  42. unsigned long MTime;
  43. unsigned long Major;
  44. unsigned long Minor;
  45. };
  46. virtual bool DoItem(Item &Itm,int &Fd);
  47. virtual bool Fail(Item &Itm,int Fd);
  48. virtual bool FinishedFile(Item &Itm,int Fd);
  49. #if APT_PKG_ABI >= 413
  50. virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/,
  51. unsigned long long /*Size*/,unsigned long long /*Pos*/) {return true;};
  52. #else
  53. virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/,
  54. unsigned long /*Size*/,unsigned long /*Pos*/) {return true;};
  55. #endif
  56. virtual ~pkgDirStream() {};
  57. };
  58. #endif