dirstream.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. unsigned long Mode;
  34. unsigned long UID;
  35. unsigned long GID;
  36. unsigned long long Size;
  37. unsigned long MTime;
  38. unsigned long Major;
  39. unsigned long Minor;
  40. };
  41. virtual bool DoItem(Item &Itm,int &Fd);
  42. virtual bool Fail(Item &Itm,int Fd);
  43. virtual bool FinishedFile(Item &Itm,int Fd);
  44. virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/,
  45. unsigned long long /*Size*/,unsigned long long /*Pos*/) {return true;};
  46. virtual ~pkgDirStream() {};
  47. };
  48. #endif