]> git.saurik.com Git - apt.git/blame - apt-inst/contrib/arfile.h
* apt-pkg/acquire-item.cc:
[apt.git] / apt-inst / contrib / arfile.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: arfile.h,v 1.2 2001/02/20 07:03:16 jgg Exp $
4/* ######################################################################
5
6 AR File - Handle an 'AR' archive
7
8 This is a reader for the usual 4.4 BSD AR format. It allows raw
9 stream access to a single member at a time. Basically all this class
10 provides is header parsing and verification. It is up to the client
11 to correctly make use of the stream start/stop points.
12
13 ##################################################################### */
14 /*}}}*/
15#ifndef PKGLIB_ARFILE_H
16#define PKGLIB_ARFILE_H
17
b2e465d6
AL
18
19#include <string>
20#include <apt-pkg/fileutl.h>
21
22class ARArchive
23{
24 struct MemberHeader;
25 public:
26 struct Member;
27
28 protected:
29
30 // Linked list of members
31 Member *List;
32
33 bool LoadHeaders();
34
35 public:
36
37 // The stream file
38 FileFd &File;
39
40 // Locate a member by name
41 const Member *FindMember(const char *Name) const;
42
43 ARArchive(FileFd &File);
44 ~ARArchive();
45};
46
47// A member of the archive
48struct ARArchive::Member
49{
50 // Fields from the header
51 string Name;
52 unsigned long MTime;
53 unsigned long UID;
54 unsigned long GID;
55 unsigned long Mode;
56 unsigned long Size;
57
58 // Location of the data.
59 unsigned long Start;
60 Member *Next;
61
62 Member() : Start(0), Next(0) {};
63};
64
65#endif