merge with my debian-sid branch
[ntk/apt.git] / apt-inst / contrib / extracttar.h
CommitLineData
b2e465d6
AL
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
b2e465d6 17#include <apt-pkg/fileutl.h>
b2e465d6 18
472ff00e
DK
19#include <string>
20
21class pkgDirStream;
42ab8223 22
b2e465d6
AL
23class ExtractTar
24{
25 protected:
26
27 struct TarHeader;
28
29 // The varios types items can be
30 enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
31 SymbolicLink = '2',CharacterDevice = '3',
32 BlockDevice = '4',Directory = '5',FIFO = '6',
33 GNU_LongLink = 'K',GNU_LongName = 'L'};
34
35 FileFd &File;
36 unsigned long MaxInSize;
37 int GZPid;
38 FileFd InFd;
39 bool Eof;
8f3ba4e8 40 std::string DecompressProg;
b2e465d6
AL
41
42 // Fork and reap gzip
43 bool StartGzip();
44 bool Done(bool Force);
45
46 public:
47
48 bool Go(pkgDirStream &Stream);
49
8f3ba4e8 50 ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
b2e465d6
AL
51 virtual ~ExtractTar();
52};
53
54#endif