summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/generic/apt/apt.cc32
-rw-r--r--src/generic/apt/apt.h10
2 files changed, 42 insertions, 0 deletions
diff --git a/src/generic/apt/apt.cc b/src/generic/apt/apt.cc
index 9036a443..6e63d8de 100644
--- a/src/generic/apt/apt.cc
+++ b/src/generic/apt/apt.cc
@@ -33,6 +33,7 @@
#include <generic/util/undo.h>
#include <generic/util/util.h>
+#include <vscreen/transcode.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
@@ -849,3 +850,34 @@ bool is_interesting_dep(const pkgCache::DepIterator &d,
abort();
}
}
+
+std::wstring get_short_description(const pkgCache::VerIterator &ver)
+{
+ if(ver.end() || ver.FileList().end() || apt_package_records == NULL)
+ return std::wstring();
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+
+ if(vf.end())
+ return std::wstring();
+ else
+ // Since Packages files don't have a bundled description and it
+ // just feels icky for the data in Packages to depend on the
+ // encoding, I just force a sane encoding on it here. Really,
+ // though, Packages files should have an encapsulated encoding
+ // somewhere.
+ return transcode(apt_package_records->Lookup(vf).ShortDesc(), "UTF-8");
+}
+
+std::wstring get_long_description(const pkgCache::VerIterator &ver)
+{
+ if(ver.end() || ver.FileList().end() || apt_package_records == NULL)
+ return std::wstring();
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+
+ if(vf.end())
+ return std::wstring();
+ else
+ return transcode(apt_package_records->Lookup(vf).LongDesc(), "UTF-8");
+}
diff --git a/src/generic/apt/apt.h b/src/generic/apt/apt.h
index 8b21921b..ac2d8c70 100644
--- a/src/generic/apt/apt.h
+++ b/src/generic/apt/apt.h
@@ -162,6 +162,16 @@ void surrounding_or(pkgCache::DepIterator dep,
pkgCache *cache = NULL);
+/** \return a short description string corresponding to the given
+ * version.
+ */
+std::wstring get_short_description(const pkgCache::VerIterator &ver);
+
+/** \return a long description string corresponding to the given
+ * version.
+ */
+std::wstring get_long_description(const pkgCache::VerIterator &ver);
+
/** \return true if pkg is suggested by another package which will be
* installed.
*/