]> git.saurik.com Git - apt.git/blob - apt-inst/contrib/extracttar.h
27c453d0d5e003a6795345c7e1c580ee14317f93
[apt.git] / apt-inst / contrib / extracttar.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: extracttar.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
5
6 Extract a Tar - Tar Extractor
7
8 The tar extractor takes an ordinary gzip compressed tar stream from
9 the given file and explodes it, passing the individual items to the
10 given Directory Stream for processing.
11
12 ##################################################################### */
13 /*}}}*/
14 #ifndef PKGLIB_EXTRACTTAR_H
15 #define PKGLIB_EXTRACTTAR_H
16
17 #include <apt-pkg/fileutl.h>
18 #include <apt-pkg/dirstream.h>
19
20 #include <algorithm>
21
22 class ExtractTar
23 {
24 protected:
25
26 struct TarHeader;
27
28 // The varios types items can be
29 enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
30 SymbolicLink = '2',CharacterDevice = '3',
31 BlockDevice = '4',Directory = '5',FIFO = '6',
32 GNU_LongLink = 'K',GNU_LongName = 'L'};
33
34 FileFd &File;
35 unsigned long MaxInSize;
36 int GZPid;
37 FileFd InFd;
38 bool Eof;
39 std::string DecompressProg;
40
41 // Fork and reap gzip
42 bool StartGzip();
43 bool Done(bool Force);
44
45 public:
46
47 bool Go(pkgDirStream &Stream);
48
49 ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
50 virtual ~ExtractTar();
51 };
52
53 #endif