summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pkg_columnizer.cc14
-rw-r--r--src/pkg_columnizer.h9
-rw-r--r--src/pkg_ver_item.cc38
-rw-r--r--src/pkg_ver_item.h26
4 files changed, 58 insertions, 29 deletions
diff --git a/src/pkg_columnizer.cc b/src/pkg_columnizer.cc
index 852b0e54..cdb143c9 100644
--- a/src/pkg_columnizer.cc
+++ b/src/pkg_columnizer.cc
@@ -110,6 +110,14 @@ const char *pkg_item::pkg_columnizer::column_names[pkg_columnizer::numtypes]=
column_disposition pkg_item::pkg_columnizer::setup_column(int type)
{
+ return setup_column(pkg, visible_ver, basex, type);
+}
+
+column_disposition pkg_item::pkg_columnizer::setup_column(const pkgCache::PkgIterator &pkg,
+ const pkgCache::VerIterator &visible_ver,
+ int basex,
+ int type)
+{
switch(type)
{
case name:
@@ -323,9 +331,9 @@ column_disposition pkg_item::pkg_columnizer::setup_column(int type)
break;
case priority:
if(!visible_ver.end() &&
- visible_ver.PriorityType() &&
- visible_ver.PriorityType()[0])
- return column_disposition(visible_ver.PriorityType(), 0);
+ const_cast<pkgCache::VerIterator &>(visible_ver).PriorityType() &&
+ const_cast<pkgCache::VerIterator &>(visible_ver).PriorityType()[0])
+ return column_disposition(const_cast<pkgCache::VerIterator &>(visible_ver).PriorityType(), 0);
else
return column_disposition(_("Unknown"), 0);
diff --git a/src/pkg_columnizer.h b/src/pkg_columnizer.h
index 6cb46bcf..72ec94c6 100644
--- a/src/pkg_columnizer.h
+++ b/src/pkg_columnizer.h
@@ -1,6 +1,6 @@
// pkg_columnizer.h -*-c++-*-
//
-// Copyright 1999-2002, 2004-2005 Daniel Burrows
+// Copyright 1999-2002, 2004-2005, 2007 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -40,10 +40,15 @@ class pkg_item::pkg_columnizer:public column_generator
// Set up the translated format widths.
static void init_formatting();
protected:
- virtual column_disposition setup_column(int type);
const pkgCache::PkgIterator &get_pkg() {return pkg;}
const pkgCache::VerIterator &get_visible_ver() {return visible_ver;}
public:
+ static column_disposition setup_column(const pkgCache::PkgIterator &pkg,
+ const pkgCache::VerIterator &ver,
+ int basex,
+ int type);
+ virtual column_disposition setup_column(int type);
+
static const column_definition_list &get_columns()
{
setup_columns();
diff --git a/src/pkg_ver_item.cc b/src/pkg_ver_item.cc
index 45a5e8f9..1f0cdb5a 100644
--- a/src/pkg_ver_item.cc
+++ b/src/pkg_ver_item.cc
@@ -1,6 +1,6 @@
// pkg_ver_item.cc
//
-// Copyright 1999-2005 Daniel Burrows
+// Copyright 1999-2005, 2007 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -50,28 +50,16 @@
using namespace std;
-class pkg_ver_columnizer:public pkg_item::pkg_columnizer
-{
- bool show_pkg_name;
-
-protected:
- column_disposition setup_column(int type);
-public:
- pkg_ver_columnizer(const pkgCache::VerIterator &_ver,
- bool _show_pkg_name,
- const column_definition_list &_columns,
- int _basex):
- pkg_item::pkg_columnizer(_ver.ParentPkg(), _ver, _columns, _basex),
- show_pkg_name(_show_pkg_name)
- {
- }
-};
-
column_disposition pkg_ver_columnizer::setup_column(int type)
{
- pkgCache::VerIterator ver=get_visible_ver();
- int basex=get_basex();
+ return setup_column(get_visible_ver(), show_pkg_name, get_basex(), type);
+}
+column_disposition pkg_ver_columnizer::setup_column(const pkgCache::VerIterator &ver,
+ bool show_pkg_name,
+ int basex,
+ int type)
+{
switch(type)
{
case name:
@@ -339,8 +327,9 @@ column_disposition pkg_ver_columnizer::setup_column(int type)
if(ver.end())
return column_disposition("", 0);
- if(ver.PriorityType() && ver.PriorityType()[0])
- return column_disposition(ver.PriorityType(), 0);
+ if(const_cast<pkgCache::VerIterator &>(ver).PriorityType() &&
+ const_cast<pkgCache::VerIterator &>(ver).PriorityType()[0])
+ return column_disposition(const_cast<pkgCache::VerIterator &>(ver).PriorityType(), 0);
else
return column_disposition(_("Unknown"), 0);
case shortpriority:
@@ -418,7 +407,10 @@ column_disposition pkg_ver_columnizer::setup_column(int type)
return column_disposition("U", 0);
}
default:
- return pkg_columnizer::setup_column(type);
+ return pkg_columnizer::setup_column(ver.ParentPkg(),
+ ver,
+ basex,
+ type);
}
}
diff --git a/src/pkg_ver_item.h b/src/pkg_ver_item.h
index 2b84f2a7..fe33560f 100644
--- a/src/pkg_ver_item.h
+++ b/src/pkg_ver_item.h
@@ -1,6 +1,6 @@
// pkg_ver_item.h (This is -*-c++-*-)
//
-// Copyright 1999-2002, 2004-2005 Daniel Burrows
+// Copyright 1999-2002, 2004-2005, 2007 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@
#include "apt_info_tree.h"
+#include "pkg_columnizer.h"
#include "pkg_node.h"
#include "pkg_grouppolicy.h"
#include "pkg_item_with_subtree.h"
@@ -36,6 +37,29 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/pkgsystem.h>
+
+class pkg_ver_columnizer:public pkg_item::pkg_columnizer
+{
+ bool show_pkg_name;
+
+public:
+ static column_disposition setup_column(const pkgCache::VerIterator &ver,
+ bool show_pkg_name,
+ int basex,
+ int type);
+ column_disposition setup_column(int type);
+
+
+ pkg_ver_columnizer(const pkgCache::VerIterator &_ver,
+ bool _show_pkg_name,
+ const column_definition_list &_columns,
+ int _basex):
+ pkg_item::pkg_columnizer(_ver.ParentPkg(), _ver, _columns, _basex),
+ show_pkg_name(_show_pkg_name)
+ {
+ }
+};
+
class pkg_ver_item:public pkg_tree_node
{
pkgCache::VerIterator version;