apt: apt-pkg/contrib/arfile.h Source File

apt 3.2.0 commandline package manager

arfile.h
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 AR File - Handle an 'AR' archive
6
7 This is a reader for the usual 4.4 BSD AR format. It allows raw
8 stream access to a single member at a time. Basically all this class
9 provides is header parsing and verification. It is up to the client
10 to correctly make use of the stream start/stop points.
11
12 ##################################################################### */
13 /*}}}*/
14#ifndef PKGLIB_ARFILE_H
15#define PKGLIB_ARFILE_H
16
17#include <apt-pkg/macros.h>
18#include <string>
19
20class FileFd;
21
22 class APT_PUBLIC 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 inline Member *Members() { return List; }
43
44 APT_PUBLIC explicit ARArchive(FileFd &File);
45 APT_PUBLIC ~ARArchive();
46};
47
48// A member of the archive
49 struct ARArchive::Member
50{
51 // Fields from the header
52 std::string Name;
53 unsigned long MTime;
54 unsigned long UID;
55 unsigned long GID;
56 unsigned long Mode;
57 unsigned long long Size;
58
59 // Location of the data.
60 unsigned long long Start;
61 Member *Next;
62
63 Member() : Start(0), Next(0) {};
64};
65
66#endif
FileFd
Definition fileutl.h:43
ARArchive::MemberHeader
Definition arfile.cc:31
ARArchive::Member
Definition arfile.h:50