]> git.saurik.com Git - apt.git/blobdiff - ftparchive/writer.h
0.6.30
[apt.git] / ftparchive / writer.h
index 854d3424bef0ef9c0728ae3c3ee8b69ca8753c28..ce4c947a916b7f50cb1bc44020eeb198cbe64de8 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: writer.h,v 1.4 2001/06/26 02:50:27 jgg Exp $
+// $Id: writer.h,v 1.4.2.2 2003/12/26 22:55:43 mdz Exp $
 /* ######################################################################
 
    Writer 
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <iostream>
 #include <vector>
+#include <map>
 
 #include "cachedb.h"
 #include "override.h"
 using std::string;
 using std::cout;
 using std::endl;
+using std::vector;
+using std::map;
     
 class FTWScanner
 {
    protected:
-
-   char *TmpExt;
-   const char *Ext[10];
+   vector<string> Patterns;
    const char *OriginalPath;
    char *RealPath;
    bool ErrorPrinted;
@@ -66,10 +67,12 @@ class FTWScanner
    virtual bool DoPackage(string FileName) = 0;
    bool RecursiveScan(string Dir);
    bool LoadFileList(string BaseDir,string File);
+   void ClearPatterns() { Patterns.clear(); };
+   void AddPattern(string Pattern) { Patterns.push_back(Pattern); };
    bool SetExts(string Vals);
       
    FTWScanner();
-   virtual ~FTWScanner() {delete [] RealPath; delete [] TmpExt;};
+   virtual ~FTWScanner() {delete [] RealPath;};
 };
 
 class PackagesWriter : public FTWScanner
@@ -148,5 +151,27 @@ class SourcesWriter : public FTWScanner
    virtual ~SourcesWriter() {free(Buffer);};
 };
 
+class ReleaseWriter : public FTWScanner
+{
+public:
+   ReleaseWriter(string DB);
+   virtual bool DoPackage(string FileName);
+   void Finish();
+
+   FILE *Output;
+   // General options
+   string PathPrefix;
+   string DirStrip;
+
+protected:
+   struct CheckSum
+   {
+      string MD5;
+      string SHA1;
+      // Limited by FileFd::Size()
+      unsigned long size;
+   };
+   map<string,struct CheckSum> CheckSums;
+};
 
 #endif