// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.h,v 1.19 2002/07/08 03:13:30 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
#include <vector>
#include <string>
+#include <map>
class FileFd;
class pkgSourceList;
class OpProgress;
class pkgIndexFile;
-class pkgCacheGenerator /*{{{*/
+class APT_HIDDEN pkgCacheGenerator /*{{{*/
{
private:
-
- pkgCache::StringItem *UniqHash[26];
APT_HIDDEN map_stringitem_t WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); };
APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String);
APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String, const unsigned long &Len);
APT_HIDDEN map_pointer_t AllocateInMap(const unsigned long &size);
+ std::map<std::string,map_stringitem_t> strMixed;
+ std::map<std::string,map_stringitem_t> strSections;
+ std::map<std::string,map_stringitem_t> strPkgNames;
+ std::map<std::string,map_stringitem_t> strVersions;
+
public:
class ListParser;
DynamicMMap ⤅
pkgCache Cache;
OpProgress *Progress;
-
+
+ std::string RlsFileName;
+ pkgCache::ReleaseFile *CurrentRlsFile;
std::string PkgFileName;
pkgCache::PackageFile *CurrentFile;
public:
- map_stringitem_t WriteUniqString(const char *S,unsigned int const Size);
- inline map_stringitem_t WriteUniqString(const std::string &S) {return WriteUniqString(S.c_str(),S.length());};
+ enum StringType { MIXED, PKGNAME, VERSIONNUMBER, SECTION };
+ map_stringitem_t StoreString(StringType const type, const char * S, unsigned int const Size);
+ inline map_stringitem_t StoreString(enum StringType const type, const std::string &S) {return StoreString(type, S.c_str(),S.length());};
void DropProgress() {Progress = 0;};
- bool SelectFile(const std::string &File,const std::string &Site,pkgIndexFile const &Index,
- unsigned long Flags = 0);
+ bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, unsigned long Flags = 0);
+ bool SelectReleaseFile(const std::string &File, const std::string &Site, unsigned long Flags = 0);
bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
inline pkgCache &GetCache() {return Cache;};
inline pkgCache::PkgFileIterator GetCurFile()
{return pkgCache::PkgFileIterator(Cache,CurrentFile);};
+ inline pkgCache::RlsFileIterator GetCurRlsFile()
+ {return pkgCache::RlsFileIterator(Cache,CurrentRlsFile);};
bool HasFileDeps() {return FoundFileDeps;};
bool MergeFileProvides(ListParser &List);
bool FinishCache(OpProgress *Progress) APT_DEPRECATED APT_CONST;
- static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
+ APT_PUBLIC static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
MMap **OutMap = 0,bool AllowMem = false);
- static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap);
- static DynamicMMap* CreateDynamicMMap(FileFd *CacheF, unsigned long Flags = 0);
+ APT_PUBLIC static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap);
+ APT_PUBLIC static DynamicMMap* CreateDynamicMMap(FileFd *CacheF, unsigned long Flags = 0);
void ReMap(void const * const oldMap, void const * const newMap);
pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
- ~pkgCacheGenerator();
+ virtual ~pkgCacheGenerator();
private:
+ void *d;
APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName);
APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
};
/*}}}*/
// This is the abstract package list parser class. /*{{{*/
-class pkgCacheGenerator::ListParser
+class APT_HIDDEN pkgCacheGenerator::ListParser
{
pkgCacheGenerator *Owner;
friend class pkgCacheGenerator;
// Flag file dependencies
bool FoundFileDeps;
-
+
+ void *d;
+
protected:
- inline map_stringitem_t WriteUniqString(std::string S) {return Owner->WriteUniqString(S);};
- inline map_stringitem_t WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
+ inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, std::string const &S) {return Owner->StoreString(type, S);};
+ inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, const char *S,unsigned int Size) {return Owner->StoreString(type, S, Size);};
+
inline map_stringitem_t WriteString(const std::string &S) {return Owner->WriteStringInMap(S);};
inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);};
bool NewDepends(pkgCache::VerIterator &Ver,const std::string &Package, const std::string &Arch,
* \param Hash of the currently parsed version
* \param Ver to compare with
*/
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
- virtual
-#endif
- APT_PURE bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver);
+ virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver);
virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
pkgCache::VerIterator &Ver) = 0;
virtual map_filesize_t Offset() = 0;
virtual bool CollectFileProvides(pkgCache &/*Cache*/,
pkgCache::VerIterator &/*Ver*/) {return true;};
- ListParser() : FoundFileDeps(false) {};
- virtual ~ListParser() {};
+ ListParser();
+ virtual ~ListParser();
};
/*}}}*/