]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | #ifdef __GNUG__ | |
19 | #pragma interface "apt-pkg/arfile.h" | |
20 | #endif | |
21 | ||
22 | #include <string> | |
23 | #include <apt-pkg/fileutl.h> | |
24 | ||
25 | class ARArchive | |
26 | { | |
27 | struct MemberHeader; | |
28 | public: | |
29 | struct Member; | |
30 | ||
31 | protected: | |
32 | ||
33 | // Linked list of members | |
34 | Member *List; | |
35 | ||
36 | bool LoadHeaders(); | |
37 | ||
38 | public: | |
39 | ||
40 | // The stream file | |
41 | FileFd &File; | |
42 | ||
43 | // Locate a member by name | |
44 | const Member *FindMember(const char *Name) const; | |
45 | ||
46 | ARArchive(FileFd &File); | |
47 | ~ARArchive(); | |
48 | }; | |
49 | ||
50 | // A member of the archive | |
51 | struct ARArchive::Member | |
52 | { | |
53 | // Fields from the header | |
54 | string Name; | |
55 | unsigned long MTime; | |
56 | unsigned long UID; | |
57 | unsigned long GID; | |
58 | unsigned long Mode; | |
59 | unsigned long Size; | |
60 | ||
61 | // Location of the data. | |
62 | unsigned long Start; | |
63 | Member *Next; | |
64 | ||
65 | Member() : Start(0), Next(0) {}; | |
66 | }; | |
67 | ||
68 | #endif |