summaryrefslogtreecommitdiff
path: root/ftparchive/contents.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 /ftparchive/contents.h
parent00b47c98ca4a4349686a082eba6d77decbb03a4d (diff)
Join with aliencode
Author: jgg Date: 2001-02-20 07:03:16 GMT Join with aliencode
Diffstat (limited to 'ftparchive/contents.h')
-rw-r--r--ftparchive/contents.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/ftparchive/contents.h b/ftparchive/contents.h
new file mode 100644
index 000000000..d8457cd45
--- /dev/null
+++ b/ftparchive/contents.h
@@ -0,0 +1,89 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: contents.h,v 1.2 2001/02/20 07:03:18 jgg Exp $
+/* ######################################################################
+
+ contents - Contents of archive things.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef CONTENTS_H
+#define CONTENTS_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <apt-pkg/debfile.h>
+#include <apt-pkg/dirstream.h>
+
+class GenContents
+{
+ struct Node
+ {
+ // Binary Tree links
+ Node *BTreeLeft;
+ Node *BTreeRight;
+ Node *DirDown;
+ Node *Dups;
+ const char *Path;
+ const char *Package;
+
+ void *operator new(size_t Amount,GenContents *Owner);
+ void operator delete(void *) {};
+
+ Node() : BTreeLeft(0), BTreeRight(0), DirDown(0), Dups(0),
+ Path(0), Package(0) {};
+ };
+ friend struct Node;
+
+ struct BigBlock
+ {
+ void *Block;
+ BigBlock *Next;
+ };
+
+ Node Root;
+
+ // Big block allocation pools
+ BigBlock *BlockList;
+ char *StrPool;
+ unsigned long StrLeft;
+ Node *NodePool;
+ unsigned long NodeLeft;
+
+ Node *Grab(Node *Top,const char *Name,const char *Package);
+ void WriteSpace(FILE *Out,unsigned int Current,unsigned int Target);
+ void DoPrint(FILE *Out,Node *Top, char *Buf);
+
+ public:
+
+ char *Mystrdup(const char *From);
+ void Add(const char *Dir,const char *Package);
+ void Print(FILE *Out);
+
+ GenContents() : BlockList(0), StrPool(0), StrLeft(0),
+ NodePool(0), NodeLeft(0) {};
+ ~GenContents();
+};
+
+class ContentsExtract : public pkgDirStream
+{
+ public:
+
+ // The Data Block
+ char *Data;
+ unsigned long MaxSize;
+ unsigned long CurSize;
+ void AddData(const char *Text);
+
+ bool Read(debDebFile &Deb);
+
+ virtual bool DoItem(Item &Itm,int &Fd);
+ void Reset() {CurSize = 0;};
+ bool TakeContents(const void *Data,unsigned long Length);
+ void Add(GenContents &Contents,string Package);
+
+ ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {};
+ virtual ~ContentsExtract() {delete [] Data;};
+};
+
+#endif