X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/281daf46d178d4fb6f43e8b13b9b51736db84d74..e75f306ea9596c82e3b0c188e9b5203fc9d619da:/apt-pkg/orderlist.h?ds=inline diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index 7a33b97cc..d13301bcf 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -1,19 +1,18 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: orderlist.h,v 1.3 1999/07/03 03:10:35 jgg Exp $ +// $Id: orderlist.h,v 1.9 2001/02/20 07:03:17 jgg Exp $ /* ###################################################################### Order List - Represents and Manipulates an ordered list of packages. A list of packages can be ordered by a number of conflicting criteria each given a specific priority. Each package also has a set of flags - indicating some usefull things about it that are derived in the + indicating some useful things about it that are derived in the course of sorting. The pkgPackageManager class uses this class for all of it's installation ordering needs. ##################################################################### */ /*}}}*/ -// Header section: pkglib #ifndef PKGLIB_ORDERLIST_H #define PKGLIB_ORDERLIST_H @@ -24,19 +23,11 @@ #include class pkgDepCache; -class pkgOrderList +class pkgOrderList : protected pkgCache::Namespace { protected: - pkgDepCache &Cache; - - // Bring some usefull types into the local scope - typedef pkgCache::PkgIterator PkgIterator; - typedef pkgCache::VerIterator VerIterator; - typedef pkgCache::DepIterator DepIterator; - typedef pkgCache::PrvIterator PrvIterator; - typedef pkgCache::Package Package; - typedef pkgCache::Version Version; + pkgDepCache &Cache; typedef bool (pkgOrderList::*DepFunc)(DepIterator D); // These are the currently selected ordering functions @@ -48,18 +39,20 @@ class pkgOrderList // State Package **End; Package **List; + Package **AfterEnd; string *FileList; DepIterator Loops[20]; int LoopCount; int Depth; - unsigned char *Flags; + unsigned short *Flags; + bool Debug; // Main visit function bool VisitNode(PkgIterator Pkg); bool VisitDeps(DepFunc F,PkgIterator Pkg); bool VisitRDeps(DepFunc F,PkgIterator Pkg); bool VisitRProvides(DepFunc F,VerIterator Ver); - bool VisitProvides(DepIterator Pkg); + bool VisitProvides(DepIterator Pkg,bool Critical); // Dependency checking functions. bool DepUnPackCrit(DepIterator D); @@ -88,8 +81,9 @@ class pkgOrderList enum Flags {Added = (1 << 0), AddPending = (1 << 1), Immediate = (1 << 2), Loop = (1 << 3), UnPacked = (1 << 4), Configured = (1 << 5), - Removed = (1 << 6), + Removed = (1 << 6), // Early Remove InList = (1 << 7), + After = (1 << 8), States = (UnPacked | Configured | Removed)}; // Flag manipulators @@ -98,9 +92,11 @@ class pkgOrderList void Flag(PkgIterator Pkg,unsigned long State, unsigned long F) {Flags[Pkg->ID] = (Flags[Pkg->ID] & (~F)) | State;}; inline void Flag(PkgIterator Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; inline void Flag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; - inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & States) == 0;}; + inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;}; + bool IsMissing(PkgIterator Pkg); void WipeFlags(unsigned long F); - + void SetFileList(string *FileList) {this->FileList = FileList;}; + // Accessors inline iterator begin() {return List;}; inline iterator end() {return End;}; @@ -117,7 +113,7 @@ class pkgOrderList int Score(PkgIterator Pkg); - pkgOrderList(pkgDepCache &Cache); + pkgOrderList(pkgDepCache *Cache); ~pkgOrderList(); };