]>
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
95 struct CacheDB::Stats
&Stats
;
98 inline bool ReadOverride(string File
) {return Over
.ReadOverride(File
);};
99 inline bool ReadExtraOverride(string File
)
100 {return Over
.ReadExtraOverride(File
);};
101 virtual bool DoPackage(string FileName
);
103 PackagesWriter(string DB
,string Overrides
,string ExtOverrides
=string(),
104 string Arch
=string());
105 virtual ~PackagesWriter() {};
108 class ContentsWriter
: public FTWScanner
118 struct CacheDB::Stats
&Stats
;
121 bool DoPackage(string FileName
,string Package
);
122 virtual bool DoPackage(string FileName
)
123 {return DoPackage(FileName
,string());};
124 bool ReadFromPkgs(string PkgFile
,string PkgCompress
);
126 void Finish() {Gen
.Print(Output
);};
127 inline bool ReadyDB(string DB
) {return Db
.ReadyDB(DB
);};
129 ContentsWriter(string DB
);
130 virtual ~ContentsWriter() {};
133 class SourcesWriter
: public FTWScanner
138 unsigned long BufSize
;
148 struct CacheDB::Stats Stats
;
150 virtual bool DoPackage(string FileName
);
152 SourcesWriter(string BOverrides
,string SOverrides
,
153 string ExtOverrides
=string());
154 virtual ~SourcesWriter() {free(Buffer
);};
157 class ReleaseWriter
: public FTWScanner
160 ReleaseWriter(string DB
);
161 virtual bool DoPackage(string FileName
);
175 // Limited by FileFd::Size()
179 map
<string
,struct CheckSum
> CheckSums
;