File: dirstream.h

package info (click to toggle)
apt 1.0.9.8.4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 15,080 kB
  • ctags: 5,307
  • sloc: cpp: 50,972; sh: 12,111; xml: 4,130; makefile: 855; perl: 209; python: 28
file content (58 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- mode: cpp; mode: fold -*-
// Description								/*{{{*/
// $Id: dirstream.h,v 1.2 2001/02/20 07:03:16 jgg Exp $
/* ######################################################################

   Directory Stream 

   When unpacking the contents of the archive are passed into a directory
   stream class for analysis and processing. The class controls all aspects
   of actually writing the directory stream from disk. The low level
   archive handlers are only responsible for decoding the archive format
   and sending events (via method calls) to the specified directory
   stream.
   
   When unpacking a real file the archive handler is passed back a file 
   handle to write the data to, this is to support strange 
   archives+unpacking methods. If that fd is -1 then the file data is 
   simply ignored.
   
   The provided defaults do the 'Right Thing' for a normal unpacking
   process (ie 'tar')
   
   ##################################################################### */
									/*}}}*/
#ifndef PKGLIB_DIRSTREAM_H
#define PKGLIB_DIRSTREAM_H


class pkgDirStream
{ 
   public:

   // All possible information about a component
   struct Item
   {
      enum Type_t {File, HardLink, SymbolicLink, CharDevice, BlockDevice,
	           Directory, FIFO} Type;
      char *Name;
      char *LinkTarget;
      unsigned long Mode;
      unsigned long UID;
      unsigned long GID;
      unsigned long Size;
      unsigned long MTime;
      unsigned long Major;
      unsigned long Minor;
   };
   
   virtual bool DoItem(Item &Itm,int &Fd);
   virtual bool Fail(Item &Itm,int Fd);
   virtual bool FinishedFile(Item &Itm,int Fd);
   virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/,
			unsigned long /*Size*/,unsigned long /*Pos*/) {return true;};
      
   virtual ~pkgDirStream() {};   
};

#endif