]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcache.cc
Fixed default dirs
[apt.git] / apt-pkg / pkgcache.cc
index b8af6b5e43ace8317c84a3dec18fa4e4a63e96f8..13e33dc4ffc8f30ecacfa53c7614f37b23e30441 100644 (file)
@@ -1,11 +1,11 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.cc,v 1.6 1998/07/12 01:26:04 jgg Exp $
+// $Id: pkgcache.cc,v 1.11 1998/10/08 05:05:05 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
    
-   Please see doc/pkglib/cache.sgml for a more detailed description of 
+   Please see doc/apt-pkg/cache.sgml for a more detailed description of 
    this format. Also be sure to keep that file up-to-date!!
    
    This is the general utility functions for cache managment. They provide
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/pkgcache.h"
-#pragma implementation "pkglib/cacheiterators.h"
+#pragma implementation "apt-pkg/pkgcache.h"
+#pragma implementation "apt-pkg/cacheiterators.h"
 #endif 
-#include <pkglib/pkgcache.h>
-#include <pkglib/version.h>
-#include <pkglib/error.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/error.h>
 #include <system.h>
 
 #include <string>
@@ -59,6 +59,7 @@ pkgCache::Header::Header()
    VersionCount = 0;
    DependsCount = 0;
    PackageFileCount = 0;
+   MaxVerFileSize = 0;
    
    FileList = 0;
    StringList = 0;
@@ -203,13 +204,13 @@ void pkgCache::PkgIterator::operator ++(int)
 /* By this we mean if it is either cleanly installed or cleanly removed. */
 pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
 {
-   if (Pkg->CurrentState == State::UnPacked ||
-       Pkg->CurrentState == State::HalfConfigured)
+   if (Pkg->CurrentState == pkgCache::State::UnPacked ||
+       Pkg->CurrentState == pkgCache::State::HalfConfigured)
       return NeedsConfigure;
    
-   if (Pkg->CurrentState == State::UnInstalled ||
-       Pkg->CurrentState == State::HalfInstalled ||
-       Pkg->InstState != State::Ok)
+   if (Pkg->CurrentState == pkgCache::State::UnInstalled ||
+       Pkg->CurrentState == pkgCache::State::HalfInstalled ||
+       Pkg->InstState != pkgCache::State::Ok)
       return NeedsUnpack;
       
    return NeedsNothing;
@@ -221,8 +222,9 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
    conflicts. */
 bool pkgCache::DepIterator::IsCritical()
 {
-   if (Dep->Type == Dep::Conflicts || Dep->Type == Dep::Depends ||
-       Dep->Type == Dep::PreDepends)
+   if (Dep->Type == pkgCache::Dep::Conflicts || 
+       Dep->Type == pkgCache::Dep::Depends ||
+       Dep->Type == pkgCache::Dep::PreDepends)
       return true;
    return false;
 }
@@ -297,7 +299,8 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
         if (pkgCheckDep(TargetVer(),I.VerStr(),Dep->CompareOp) == false)
            continue;
 
-        if (Dep->Type == Dep::Conflicts && ParentPkg() == I.ParentPkg())
+        if (Dep->Type == pkgCache::Dep::Conflicts && 
+            ParentPkg() == I.ParentPkg())
            continue;
         
         Size++;
@@ -311,7 +314,8 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
         if (pkgCheckDep(TargetVer(),I.ProvideVersion(),Dep->CompareOp) == false)
            continue;
         
-        if (Dep->Type == Dep::Conflicts && ParentPkg() == I.OwnerPkg())
+        if (Dep->Type == pkgCache::Dep::Conflicts && 
+            ParentPkg() == I.OwnerPkg())
            continue;
         
         Size++;
@@ -335,6 +339,18 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
    return Res;
 }
                                                                        /*}}}*/
+// DepIterator::CompType - Return a string describing the compare type /*{{{*/
+// ---------------------------------------------------------------------
+/* This returns a string representation of the dependency compare 
+   type */
+const char *pkgCache::DepIterator::CompType()
+{
+   const char *Ops[] = {"","<=",">=","<",">","=","!="};
+   if ((Dep->CompareOp & 0xF) < sizeof(Ops))
+      return Ops[Dep->CompareOp & 0xF];
+   return "";   
+}
+                                                                       /*}}}*/
 // VerIterator::CompareVer - Fast version compare for same pkgs                /*{{{*/
 // ---------------------------------------------------------------------
 /* This just looks over the version list to see if B is listed before A. In
@@ -365,7 +381,7 @@ bool pkgCache::VerIterator::Downloadable() const
 {
    VerFileIterator Files = FileList();
    for (; Files.end() == false; Files++)
-      if ((Files.File()->Flags & Flag::NotSource) != Flag::NotSource)
+      if ((Files.File()->Flags & pkgCache::Flag::NotSource) != pkgCache::Flag::NotSource)
         return true;
    return false;
 }