summaryrefslogtreecommitdiff
path: root/apt-inst/contrib/arfile.h
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:56:32 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:56:32 +0000
commitb2e465d6d32d2dc884f58b94acb7e35f671a87fe (patch)
tree5928383b9bde7b0ba9812e6526ad746466e558f7 /apt-inst/contrib/arfile.h
parent00b47c98ca4a4349686a082eba6d77decbb03a4d (diff)
Join with aliencode
Author: jgg Date: 2001-02-20 07:03:16 GMT Join with aliencode
Diffstat (limited to 'apt-inst/contrib/arfile.h')
-rw-r--r--apt-inst/contrib/arfile.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/apt-inst/contrib/arfile.h b/apt-inst/contrib/arfile.h
new file mode 100644
index 000000000..6c54d3e6b
--- /dev/null
+++ b/apt-inst/contrib/arfile.h
@@ -0,0 +1,68 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: arfile.h,v 1.2 2001/02/20 07:03:16 jgg Exp $
+/* ######################################################################
+
+ AR File - Handle an 'AR' archive
+
+ This is a reader for the usual 4.4 BSD AR format. It allows raw
+ stream access to a single member at a time. Basically all this class
+ provides is header parsing and verification. It is up to the client
+ to correctly make use of the stream start/stop points.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_ARFILE_H
+#define PKGLIB_ARFILE_H
+
+#ifdef __GNUG__
+#pragma interface "apt-pkg/arfile.h"
+#endif
+
+#include <string>
+#include <apt-pkg/fileutl.h>
+
+class ARArchive
+{
+ struct MemberHeader;
+ public:
+ struct Member;
+
+ protected:
+
+ // Linked list of members
+ Member *List;
+
+ bool LoadHeaders();
+
+ public:
+
+ // The stream file
+ FileFd &File;
+
+ // Locate a member by name
+ const Member *FindMember(const char *Name) const;
+
+ ARArchive(FileFd &File);
+ ~ARArchive();
+};
+
+// A member of the archive
+struct ARArchive::Member
+{
+ // Fields from the header
+ string Name;
+ unsigned long MTime;
+ unsigned long UID;
+ unsigned long GID;
+ unsigned long Mode;
+ unsigned long Size;
+
+ // Location of the data.
+ unsigned long Start;
+ Member *Next;
+
+ Member() : Start(0), Next(0) {};
+};
+
+#endif