]>
git.saurik.com Git - apt.git/blob - ftparchive/writer.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: writer.h,v 1.4.2.2 2003/12/26 22:55:43 mdz Exp $
4 /* ######################################################################
8 The file writer classes. These write various types of output, sources,
11 ##################################################################### */
17 #pragma interface "writer.h"
28 #include "apt-ftparchive.h"
39 vector
<string
> Patterns
;
40 const char *OriginalPath
;
44 // Stuff for the delinker
47 static FTWScanner
*Owner
;
48 static int Scanner(const char *File
,const struct stat
*sb
,int Flag
);
50 bool Delink(string
&FileName
,const char *OriginalPath
,
51 unsigned long &Bytes
,struct stat
&St
);
53 inline void NewLine(unsigned Priority
)
55 if (ErrorPrinted
== false && Quiet
<= Priority
)
64 unsigned long DeLinkLimit
;
65 string InternalPrefix
;
67 virtual bool DoPackage(string FileName
) = 0;
68 bool RecursiveScan(string Dir
);
69 bool LoadFileList(string BaseDir
,string File
);
70 void ClearPatterns() { Patterns
.clear(); };
71 void AddPattern(string Pattern
) { Patterns
.push_back(Pattern
); };
72 bool SetExts(string Vals
);
75 virtual ~FTWScanner() {delete [] RealPath
;};
78 class PackagesWriter
: public FTWScanner
94 struct CacheDB::Stats
&Stats
;
97 inline bool ReadOverride(string File
) {return Over
.ReadOverride(File
);};
98 inline bool ReadExtraOverride(string File
)
99 {return Over
.ReadExtraOverride(File
);};
100 virtual bool DoPackage(string FileName
);
102 PackagesWriter(string DB
,string Overrides
,string ExtOverrides
=string(),
103 string Arch
=string());
104 virtual ~PackagesWriter() {};
107 class ContentsWriter
: public FTWScanner
117 struct CacheDB::Stats
&Stats
;
120 bool DoPackage(string FileName
,string Package
);
121 virtual bool DoPackage(string FileName
)
122 {return DoPackage(FileName
,string());};
123 bool ReadFromPkgs(string PkgFile
,string PkgCompress
);
125 void Finish() {Gen
.Print(Output
);};
126 inline bool ReadyDB(string DB
) {return Db
.ReadyDB(DB
);};
128 ContentsWriter(string DB
);
129 virtual ~ContentsWriter() {};
132 class SourcesWriter
: public FTWScanner
137 unsigned long BufSize
;
147 struct CacheDB::Stats Stats
;
149 virtual bool DoPackage(string FileName
);
151 SourcesWriter(string BOverrides
,string SOverrides
,
152 string ExtOverrides
=string());
153 virtual ~SourcesWriter() {free(Buffer
);};
156 class ReleaseWriter
: public FTWScanner
159 ReleaseWriter(string DB
);
160 virtual bool DoPackage(string FileName
);
173 // Limited by FileFd::Size()
177 map
<string
,struct CheckSum
> CheckSums
;