CacheSetHelper Class Reference

## Classes

struct | PkgModifier
class | Private

## Public Types

enum | PkgSelector { UNKNOWN , REGEX , TASK , FNMATCH , PACKAGENAME , STRING , PATTERN }
enum | VerSelector { RELEASE , VERSIONNUMBER , ALL , CANDANDINST , CANDIDATE , INSTALLED , CANDINST , INSTCAND , NEWEST }
| specifies which version(s) we want to refer to More...

## Public Member Functions

| CacheSetHelper (bool const ShowError=true, GlobalError::MsgType ErrorType=GlobalError::ERROR)
virtual bool | PackageFrom (enum PkgSelector const select, PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
virtual bool | PackageFromCommandLine (PackageContainerInterface *const pci, pkgCacheFile &Cache, const char **cmdline)
virtual bool | PackageFromModifierCommandLine (unsigned short &modID, PackageContainerInterface *const pci, pkgCacheFile &Cache, const char *cmdline, std::list< PkgModifier > const &mods)
virtual void | showPackageSelection (pkgCache::PkgIterator const &pkg, PkgSelector const select, std::string const &pattern)
| be notified about the package being selected via pattern
virtual void | canNotFindPackage (enum PkgSelector const select, PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
| be notified if a package can't be found via pattern
virtual void | showVersionSelection (pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern)
| be notified about the version being selected via pattern
virtual void | canNotFindVersion (enum VerSelector const select, VersionContainerInterface *const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
| be notified if a version can't be found for a package
virtual pkgCache::VerIterator | canNotGetVersion (enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
virtual pkgCache::PkgIterator | canNotFindPkgName (pkgCacheFile &Cache, std::string const &str)
bool | showErrors () const
bool | showErrors (bool const newValue)
GlobalError::MsgType | errorType () const
GlobalError::MsgType | errorType (GlobalError::MsgType const &newValue)
std::string | getLastVersionMatcher () const
void | setLastVersionMatcher (std::string const &matcher)

## Protected Member Functions

pkgCache::VerIterator | canNotGetInstCandVer (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
pkgCache::VerIterator | canNotGetCandInstVer (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
pkgCache::VerIterator | canNotGetVerFromRelease (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, std::string const &release)
pkgCache::VerIterator | canNotGetVerFromVersionNumber (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, std::string const &verstr)
bool | PackageFromTask (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
bool | PackageFromRegEx (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
bool | PackageFromFnmatch (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
bool | PackageFromPackageName (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
bool | PackageFromString (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
bool | PackageFromPattern (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)

## Protected Attributes

bool | ShowError
GlobalError::MsgType | ErrorType

## Detailed Description

Simple base class with a lot of virtual methods which can be overridden to alter the behavior or the output of the CacheSets.

This helper is passed around by the static methods in the CacheSets and used every time they hit an error condition or something could be printed out.

## Member Enumeration Documentation

## VerSelector

enum VerSelector

specifies which version(s) we want to refer to

Enumerator
RELEASE | by release string
VERSIONNUMBER | by version number string
ALL | All versions
CANDANDINST | Candidate and installed version
CANDIDATE | Candidate version
INSTALLED | Installed version
CANDINST | Candidate or if non installed version
INSTCAND | Installed or if non candidate version
NEWEST | Newest version

## Member Function Documentation

## canNotFindPackage()

void canNotFindPackage | ( | enum PkgSelector const | select,
|  | PackageContainerInterface *const | pci,
|  | pkgCacheFile & | Cache,
|  | std::string const & | pattern )

virtual

be notified if a package can't be found via pattern

Can be used to show a message as well as to try something else to make it match

Parameters

  select | is the method tried for selection
  pci | is the container the package should be inserted in
  Cache | is the package universe available
  pattern | is the string not matching anything

References canNotFindPackage().

Referenced by canNotFindPackage(), and PackageFromString().

## canNotFindVersion()

void canNotFindVersion | ( | enum VerSelector const | select,
|  | VersionContainerInterface *const | vci,
|  | pkgCacheFile & | Cache,
|  | pkgCache::PkgIterator const & | Pkg )

virtual

be notified if a version can't be found for a package

Main use is probably to show a message to the user what happened

Parameters

  select | is the method tried for selection
  vci | is the container the version should be inserted in
  Cache | is the package universe available
  Pkg | is the package we wanted a version from

References ALL, CANDANDINST, CANDIDATE, CANDINST, INSTALLED, INSTCAND, NEWEST, RELEASE, and VERSIONNUMBER.

## PackageFromString()

bool PackageFromString | ( | PackageContainerInterface *const | pci,
|  | pkgCacheFile & | Cache,
|  | std::string const & | pattern )

protected

Todo
  hm, hm, regexp/fnmatch incompatible?

References canNotFindPackage().

## showPackageSelection()

void showPackageSelection | ( | pkgCache::PkgIterator const & | pkg,
|  | PkgSelector const | select,
|  | std::string const & | pattern )

virtual

be notified about the package being selected via pattern

Main use is probably to show a message to the user what happened

Parameters

  pkg | is the package which was selected
  select | is the selection method which choose the package
  pattern | is the string used by the selection method to pick the package

## showVersionSelection()

void showVersionSelection | ( | pkgCache::PkgIterator const & | Pkg,
|  | pkgCache::VerIterator const & | Ver,
|  | enum VerSelector const | select,
|  | std::string const & | pattern )

virtual

be notified about the version being selected via pattern

Main use is probably to show a message to the user what happened Note that at the moment this method is only called for RELEASE and VERSION selections, not for the others.

Parameters

  Pkg | is the package which was selected for
  Ver | is the version selected
  select | is the selection method which choose the version
  pattern | is the string used by the selection method to pick the version

References ALL, CANDANDINST, CANDIDATE, CANDINST, INSTALLED, INSTCAND, NEWEST, RELEASE, and VERSIONNUMBER.

The documentation for this class was generated from the following files:

- apt-pkg/cacheset.h
- apt-pkg/cacheset.cc