]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-list.cc
warning: cast from type A to type B casts away qualifiers [-Wcast-qual]
[apt.git] / apt-private / private-list.cc
index 08851eb7e92978c00bc273e9eba9aa42b158c4bb..44a766c8412f3fd7156447e029a7cd3899fed9a6 100644 (file)
@@ -61,7 +61,7 @@ class PackageNameMatcher : public Matcher                             /*{{{*/
   public:
    PackageNameMatcher(const char **patterns)
    {
   public:
    PackageNameMatcher(const char **patterns)
    {
-      for(int i=0; patterns[i] != NULL; i++)
+      for(int i=0; patterns[i] != NULL; ++i)
       {
          std::string pattern = patterns[i];
 #ifdef PACKAGE_MATCHER_ABI_COMPAT
       {
          std::string pattern = patterns[i];
 #ifdef PACKAGE_MATCHER_ABI_COMPAT
@@ -69,7 +69,7 @@ class PackageNameMatcher : public Matcher                             /*{{{*/
             cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern);
 #else
          APT::CacheFilter::PackageMatcher *cachefilter = NULL;
             cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern);
 #else
          APT::CacheFilter::PackageMatcher *cachefilter = NULL;
-         if(_config->FindB("APT::Cmd::UseRegexp", false) == true)
+         if(_config->FindB("APT::Cmd::Use-Regexp", false) == true)
             cachefilter = new APT::CacheFilter::PackageNameMatchesRegEx(pattern);
          else
             cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern);
             cachefilter = new APT::CacheFilter::PackageNameMatchesRegEx(pattern);
          else
             cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern);
@@ -79,12 +79,12 @@ class PackageNameMatcher : public Matcher                           /*{{{*/
    }
    virtual ~PackageNameMatcher()
    {
    }
    virtual ~PackageNameMatcher()
    {
-      for(J=filters.begin(); J != filters.end(); J++)
+      for(J=filters.begin(); J != filters.end(); ++J)
          delete *J;
    }
    virtual bool operator () (const pkgCache::PkgIterator &P) 
    {
          delete *J;
    }
    virtual bool operator () (const pkgCache::PkgIterator &P) 
    {
-      for(J=filters.begin(); J != filters.end(); J++)
+      for(J=filters.begin(); J != filters.end(); ++J)
       {
          APT::CacheFilter::PackageMatcher *cachefilter = *J;
          if((*cachefilter)(P)) 
       {
          APT::CacheFilter::PackageMatcher *cachefilter = *J;
          if((*cachefilter)(P)) 
@@ -101,11 +101,15 @@ private:
                                                                        /*}}}*/
 void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,     /*{{{*/
                      pkgCache::PkgIterator P,    
                                                                        /*}}}*/
 void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,     /*{{{*/
                      pkgCache::PkgIterator P,    
-                     std::ostream &outs)
+                     std::ostream &outs,
+                     bool include_summary=true)
 {
    for (pkgCache::VerIterator Ver = P.VersionList();
 {
    for (pkgCache::VerIterator Ver = P.VersionList();
-        Ver.end() == false; Ver++) 
-      ListSingleVersion(CacheFile, records, Ver, outs);
+        Ver.end() == false; ++Ver)
+   {
+      ListSingleVersion(CacheFile, records, Ver, outs, include_summary);
+      outs << "\n";
+   }
 }
                                                                        /*}}}*/
 // list - list package based on criteria                               /*{{{*/
 }
                                                                        /*}}}*/
 // list - list package based on criteria                               /*{{{*/
@@ -136,18 +140,18 @@ bool List(CommandLine &Cmd)
 
    PackageNameMatcher matcher(patterns);
    LocalitySortedVersionSet bag;
 
    PackageNameMatcher matcher(patterns);
    LocalitySortedVersionSet bag;
-   OpTextProgress progress;
+   OpTextProgress progress(*_config);
    progress.OverallProgress(0,
                             Cache->Head().PackageCount, 
                             Cache->Head().PackageCount,
                             _("Listing"));
    GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress);
    progress.OverallProgress(0,
                             Cache->Head().PackageCount, 
                             Cache->Head().PackageCount,
                             _("Listing"));
    GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress);
-   for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); V++)
+   for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V)
    {
       std::stringstream outs;
    {
       std::stringstream outs;
-      if(_config->FindB("APT::Cmd::AllVersions", false) == true)
+      if(_config->FindB("APT::Cmd::All-Versions", false) == true)
       {
       {
-         ListAllVersions(CacheFile, records, V.ParentPkg(), outs);
+         ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary);
          output_map.insert(std::make_pair<std::string, std::string>(
             V.ParentPkg().Name(), outs.str()));
       } else {
          output_map.insert(std::make_pair<std::string, std::string>(
             V.ParentPkg().Name(), outs.str()));
       } else {
@@ -159,7 +163,7 @@ bool List(CommandLine &Cmd)
 
    // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status)
    // output the sorted map
 
    // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status)
    // output the sorted map
-   for (K = output_map.begin(); K != output_map.end(); K++)
+   for (K = output_map.begin(); K != output_map.end(); ++K)
       std::cout << (*K).second << std::endl;
 
 
       std::cout << (*K).second << std::endl;