]>
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 ##################################################################### */
25 #include "apt-ftparchive.h"
36 vector
<string
> Patterns
;
37 const char *OriginalPath
;
41 // Stuff for the delinker
44 static FTWScanner
*Owner
;
45 static int ScannerFTW(const char *File
,const struct stat
*sb
,int Flag
);
46 static int ScannerFile(const char *File
, bool ReadLink
);
48 bool Delink(string
&FileName
,const char *OriginalPath
,
49 unsigned long &Bytes
,off_t FileSize
);
51 inline void NewLine(unsigned Priority
)
53 if (ErrorPrinted
== false && Quiet
<= Priority
)
62 unsigned long DeLinkLimit
;
63 string InternalPrefix
;
65 virtual bool DoPackage(string FileName
) = 0;
66 bool RecursiveScan(string Dir
);
67 bool LoadFileList(string BaseDir
,string File
);
68 void ClearPatterns() { Patterns
.clear(); };
69 void AddPattern(string Pattern
) { Patterns
.push_back(Pattern
); };
70 bool SetExts(string Vals
);
73 virtual ~FTWScanner() {delete [] RealPath
;};
76 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
);
174 // Limited by FileFd::Size()
178 map
<string
,struct CheckSum
> CheckSums
;